nomoreide 0.1.76 → 0.1.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,219 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/window-DlR023_X.js","assets/core-DhEqZVGG.js","assets/event-BK_86lmQ.js"])))=>i.map(i=>d[i]);
2
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))i(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&i(c)}).observe(document,{childList:!0,subtree:!0});function s(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(a){if(a.ep)return;a.ep=!0;const l=s(a);fetch(a.href,l)}})();function nR(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var cg={exports:{}},Cc={};var Nw;function iR(){if(Nw)return Cc;Nw=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(i,a,l){var c=null;if(l!==void 0&&(c=""+l),a.key!==void 0&&(c=""+a.key),"key"in a){l={};for(var h in a)h!=="key"&&(l[h]=a[h])}else l=a;return a=l.ref,{$$typeof:e,type:i,key:c,ref:a!==void 0?a:null,props:l}}return Cc.Fragment=t,Cc.jsx=s,Cc.jsxs=s,Cc}var Cw;function rR(){return Cw||(Cw=1,cg.exports=iR()),cg.exports}var n=rR(),ug={exports:{}},ct={};var Ew;function aR(){if(Ew)return ct;Ew=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),c=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.iterator;function v(U){return U===null||typeof U!="object"?null:(U=b&&U[b]||U["@@iterator"],typeof U=="function"?U:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,N={};function E(U,F,re){this.props=U,this.context=F,this.refs=N,this.updater=re||w}E.prototype.isReactComponent={},E.prototype.setState=function(U,F){if(typeof U!="object"&&typeof U!="function"&&U!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,U,F,"setState")},E.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function T(){}T.prototype=E.prototype;function A(U,F,re){this.props=U,this.context=F,this.refs=N,this.updater=re||w}var C=A.prototype=new T;C.constructor=A,k(C,E.prototype),C.isPureReactComponent=!0;var R=Array.isArray;function L(){}var H={H:null,A:null,T:null,S:null},B=Object.prototype.hasOwnProperty;function P(U,F,re){var fe=re.ref;return{$$typeof:e,type:U,key:F,ref:fe!==void 0?fe:null,props:re}}function D(U,F){return P(U.type,F,U.props)}function G(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function $(U){var F={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(re){return F[re]})}var O=/\/+/g;function V(U,F){return typeof U=="object"&&U!==null&&U.key!=null?$(""+U.key):F.toString(36)}function K(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(L,L):(U.status="pending",U.then(function(F){U.status==="pending"&&(U.status="fulfilled",U.value=F)},function(F){U.status==="pending"&&(U.status="rejected",U.reason=F)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function I(U,F,re,fe,se){var te=typeof U;(te==="undefined"||te==="boolean")&&(U=null);var ye=!1;if(U===null)ye=!0;else switch(te){case"bigint":case"string":case"number":ye=!0;break;case"object":switch(U.$$typeof){case e:case t:ye=!0;break;case p:return ye=U._init,I(ye(U._payload),F,re,fe,se)}}if(ye)return se=se(U),ye=fe===""?"."+V(U,0):fe,R(se)?(re="",ye!=null&&(re=ye.replace(O,"$&/")+"/"),I(se,F,re,"",function(Ye){return Ye})):se!=null&&(G(se)&&(se=D(se,re+(se.key==null||U&&U.key===se.key?"":(""+se.key).replace(O,"$&/")+"/")+ye)),F.push(se)),1;ye=0;var Ee=fe===""?".":fe+":";if(R(U))for(var De=0;De<U.length;De++)fe=U[De],te=Ee+V(fe,De),ye+=I(fe,F,re,te,se);else if(De=v(U),typeof De=="function")for(U=De.call(U),De=0;!(fe=U.next()).done;)fe=fe.value,te=Ee+V(fe,De++),ye+=I(fe,F,re,te,se);else if(te==="object"){if(typeof U.then=="function")return I(K(U),F,re,fe,se);throw F=String(U),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.")}return ye}function Y(U,F,re){if(U==null)return U;var fe=[],se=0;return I(U,fe,"","",function(te){return F.call(re,te,se++)}),fe}function W(U){if(U._status===-1){var F=U._result;F=F(),F.then(function(re){(U._status===0||U._status===-1)&&(U._status=1,U._result=re)},function(re){(U._status===0||U._status===-1)&&(U._status=2,U._result=re)}),U._status===-1&&(U._status=0,U._result=F)}if(U._status===1)return U._result.default;throw U._result}var le=typeof reportError=="function"?reportError:function(U){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var F=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof U=="object"&&U!==null&&typeof U.message=="string"?String(U.message):String(U),error:U});if(!window.dispatchEvent(F))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",U);return}console.error(U)},J={map:Y,forEach:function(U,F,re){Y(U,function(){F.apply(this,arguments)},re)},count:function(U){var F=0;return Y(U,function(){F++}),F},toArray:function(U){return Y(U,function(F){return F})||[]},only:function(U){if(!G(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return ct.Activity=g,ct.Children=J,ct.Component=E,ct.Fragment=s,ct.Profiler=a,ct.PureComponent=A,ct.StrictMode=i,ct.Suspense=f,ct.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=H,ct.__COMPILER_RUNTIME={__proto__:null,c:function(U){return H.H.useMemoCache(U)}},ct.cache=function(U){return function(){return U.apply(null,arguments)}},ct.cacheSignal=function(){return null},ct.cloneElement=function(U,F,re){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var fe=k({},U.props),se=U.key;if(F!=null)for(te in F.key!==void 0&&(se=""+F.key),F)!B.call(F,te)||te==="key"||te==="__self"||te==="__source"||te==="ref"&&F.ref===void 0||(fe[te]=F[te]);var te=arguments.length-2;if(te===1)fe.children=re;else if(1<te){for(var ye=Array(te),Ee=0;Ee<te;Ee++)ye[Ee]=arguments[Ee+2];fe.children=ye}return P(U.type,se,fe)},ct.createContext=function(U){return U={$$typeof:c,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:l,_context:U},U},ct.createElement=function(U,F,re){var fe,se={},te=null;if(F!=null)for(fe in F.key!==void 0&&(te=""+F.key),F)B.call(F,fe)&&fe!=="key"&&fe!=="__self"&&fe!=="__source"&&(se[fe]=F[fe]);var ye=arguments.length-2;if(ye===1)se.children=re;else if(1<ye){for(var Ee=Array(ye),De=0;De<ye;De++)Ee[De]=arguments[De+2];se.children=Ee}if(U&&U.defaultProps)for(fe in ye=U.defaultProps,ye)se[fe]===void 0&&(se[fe]=ye[fe]);return P(U,te,se)},ct.createRef=function(){return{current:null}},ct.forwardRef=function(U){return{$$typeof:h,render:U}},ct.isValidElement=G,ct.lazy=function(U){return{$$typeof:p,_payload:{_status:-1,_result:U},_init:W}},ct.memo=function(U,F){return{$$typeof:d,type:U,compare:F===void 0?null:F}},ct.startTransition=function(U){var F=H.T,re={};H.T=re;try{var fe=U(),se=H.S;se!==null&&se(re,fe),typeof fe=="object"&&fe!==null&&typeof fe.then=="function"&&fe.then(L,le)}catch(te){le(te)}finally{F!==null&&re.types!==null&&(F.types=re.types),H.T=F}},ct.unstable_useCacheRefresh=function(){return H.H.useCacheRefresh()},ct.use=function(U){return H.H.use(U)},ct.useActionState=function(U,F,re){return H.H.useActionState(U,F,re)},ct.useCallback=function(U,F){return H.H.useCallback(U,F)},ct.useContext=function(U){return H.H.useContext(U)},ct.useDebugValue=function(){},ct.useDeferredValue=function(U,F){return H.H.useDeferredValue(U,F)},ct.useEffect=function(U,F){return H.H.useEffect(U,F)},ct.useEffectEvent=function(U){return H.H.useEffectEvent(U)},ct.useId=function(){return H.H.useId()},ct.useImperativeHandle=function(U,F,re){return H.H.useImperativeHandle(U,F,re)},ct.useInsertionEffect=function(U,F){return H.H.useInsertionEffect(U,F)},ct.useLayoutEffect=function(U,F){return H.H.useLayoutEffect(U,F)},ct.useMemo=function(U,F){return H.H.useMemo(U,F)},ct.useOptimistic=function(U,F){return H.H.useOptimistic(U,F)},ct.useReducer=function(U,F,re){return H.H.useReducer(U,F,re)},ct.useRef=function(U){return H.H.useRef(U)},ct.useState=function(U){return H.H.useState(U)},ct.useSyncExternalStore=function(U,F,re){return H.H.useSyncExternalStore(U,F,re)},ct.useTransition=function(){return H.H.useTransition()},ct.version="19.2.6",ct}var jw;function N0(){return jw||(jw=1,ug.exports=aR()),ug.exports}var y=N0(),dg={exports:{}},Ec={},hg={exports:{}},fg={};var Aw;function oR(){return Aw||(Aw=1,(function(e){function t(I,Y){var W=I.length;I.push(Y);e:for(;0<W;){var le=W-1>>>1,J=I[le];if(0<a(J,Y))I[le]=Y,I[W]=J,W=le;else break e}}function s(I){return I.length===0?null:I[0]}function i(I){if(I.length===0)return null;var Y=I[0],W=I.pop();if(W!==Y){I[0]=W;e:for(var le=0,J=I.length,U=J>>>1;le<U;){var F=2*(le+1)-1,re=I[F],fe=F+1,se=I[fe];if(0>a(re,W))fe<J&&0>a(se,re)?(I[le]=se,I[fe]=W,le=fe):(I[le]=re,I[F]=W,le=F);else if(fe<J&&0>a(se,W))I[le]=se,I[fe]=W,le=fe;else break e}}return Y}function a(I,Y){var W=I.sortIndex-Y.sortIndex;return W!==0?W:I.id-Y.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var c=Date,h=c.now();e.unstable_now=function(){return c.now()-h}}var f=[],d=[],p=1,g=null,b=3,v=!1,w=!1,k=!1,N=!1,E=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function C(I){for(var Y=s(d);Y!==null;){if(Y.callback===null)i(d);else if(Y.startTime<=I)i(d),Y.sortIndex=Y.expirationTime,t(f,Y);else break;Y=s(d)}}function R(I){if(k=!1,C(I),!w)if(s(f)!==null)w=!0,L||(L=!0,$());else{var Y=s(d);Y!==null&&K(R,Y.startTime-I)}}var L=!1,H=-1,B=5,P=-1;function D(){return N?!0:!(e.unstable_now()-P<B)}function G(){if(N=!1,L){var I=e.unstable_now();P=I;var Y=!0;try{e:{w=!1,k&&(k=!1,T(H),H=-1),v=!0;var W=b;try{t:{for(C(I),g=s(f);g!==null&&!(g.expirationTime>I&&D());){var le=g.callback;if(typeof le=="function"){g.callback=null,b=g.priorityLevel;var J=le(g.expirationTime<=I);if(I=e.unstable_now(),typeof J=="function"){g.callback=J,C(I),Y=!0;break t}g===s(f)&&i(f),C(I)}else i(f);g=s(f)}if(g!==null)Y=!0;else{var U=s(d);U!==null&&K(R,U.startTime-I),Y=!1}}break e}finally{g=null,b=W,v=!1}Y=void 0}}finally{Y?$():L=!1}}}var $;if(typeof A=="function")$=function(){A(G)};else if(typeof MessageChannel<"u"){var O=new MessageChannel,V=O.port2;O.port1.onmessage=G,$=function(){V.postMessage(null)}}else $=function(){E(G,0)};function K(I,Y){H=E(function(){I(e.unstable_now())},Y)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(I){I.callback=null},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):B=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(I){switch(b){case 1:case 2:case 3:var Y=3;break;default:Y=b}var W=b;b=Y;try{return I()}finally{b=W}},e.unstable_requestPaint=function(){N=!0},e.unstable_runWithPriority=function(I,Y){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var W=b;b=I;try{return Y()}finally{b=W}},e.unstable_scheduleCallback=function(I,Y,W){var le=e.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?le+W:le):W=le,I){case 1:var J=-1;break;case 2:J=250;break;case 5:J=1073741823;break;case 4:J=1e4;break;default:J=5e3}return J=W+J,I={id:p++,callback:Y,priorityLevel:I,startTime:W,expirationTime:J,sortIndex:-1},W>le?(I.sortIndex=W,t(d,I),s(f)===null&&I===s(d)&&(k?(T(H),H=-1):k=!0,K(R,W-le))):(I.sortIndex=J,t(f,I),w||v||(w=!0,L||(L=!0,$()))),I},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(I){var Y=b;return function(){var W=b;b=Y;try{return I.apply(this,arguments)}finally{b=W}}}})(fg)),fg}var Tw;function lR(){return Tw||(Tw=1,hg.exports=oR()),hg.exports}var mg={exports:{}},an={};var Rw;function cR(){if(Rw)return an;Rw=1;var e=N0();function t(f){var d="https://react.dev/errors/"+f;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)d+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+f+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var i={d:{f:s,r:function(){throw Error(t(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},a=Symbol.for("react.portal");function l(f,d,p){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:g==null?null:""+g,children:f,containerInfo:d,implementation:p}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(f,d){if(f==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return an.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,an.createPortal=function(f,d){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(t(299));return l(f,d,null,p)},an.flushSync=function(f){var d=c.T,p=i.p;try{if(c.T=null,i.p=2,f)return f()}finally{c.T=d,i.p=p,i.d.f()}},an.preconnect=function(f,d){typeof f=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,i.d.C(f,d))},an.prefetchDNS=function(f){typeof f=="string"&&i.d.D(f)},an.preinit=function(f,d){if(typeof f=="string"&&d&&typeof d.as=="string"){var p=d.as,g=h(p,d.crossOrigin),b=typeof d.integrity=="string"?d.integrity:void 0,v=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?i.d.S(f,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:v}):p==="script"&&i.d.X(f,{crossOrigin:g,integrity:b,fetchPriority:v,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},an.preinitModule=function(f,d){if(typeof f=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var p=h(d.as,d.crossOrigin);i.d.M(f,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&i.d.M(f)},an.preload=function(f,d){if(typeof f=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,g=h(p,d.crossOrigin);i.d.L(f,p,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},an.preloadModule=function(f,d){if(typeof f=="string")if(d){var p=h(d.as,d.crossOrigin);i.d.m(f,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else i.d.m(f)},an.requestFormReset=function(f){i.d.r(f)},an.unstable_batchedUpdates=function(f,d){return f(d)},an.useFormState=function(f,d,p){return c.H.useFormState(f,d,p)},an.useFormStatus=function(){return c.H.useHostTransitionStatus()},an.version="19.2.6",an}var Mw;function AC(){if(Mw)return mg.exports;Mw=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(),mg.exports=cR(),mg.exports}var Dw;function uR(){if(Dw)return Ec;Dw=1;var e=lR(),t=N0(),s=AC();function i(r){var o="https://react.dev/errors/"+r;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)o+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+r+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function l(r){var o=r,u=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,(o.flags&4098)!==0&&(u=o.return),r=o.return;while(r)}return o.tag===3?u:null}function c(r){if(r.tag===13){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function h(r){if(r.tag===31){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function f(r){if(l(r)!==r)throw Error(i(188))}function d(r){var o=r.alternate;if(!o){if(o=l(r),o===null)throw Error(i(188));return o!==r?null:r}for(var u=r,m=o;;){var x=u.return;if(x===null)break;var _=x.alternate;if(_===null){if(m=x.return,m!==null){u=m;continue}break}if(x.child===_.child){for(_=x.child;_;){if(_===u)return f(x),r;if(_===m)return f(x),o;_=_.sibling}throw Error(i(188))}if(u.return!==m.return)u=x,m=_;else{for(var j=!1,z=x.child;z;){if(z===u){j=!0,u=x,m=_;break}if(z===m){j=!0,m=x,u=_;break}z=z.sibling}if(!j){for(z=_.child;z;){if(z===u){j=!0,u=_,m=x;break}if(z===m){j=!0,m=_,u=x;break}z=z.sibling}if(!j)throw Error(i(189))}}if(u.alternate!==m)throw Error(i(190))}if(u.tag!==3)throw Error(i(188));return u.stateNode.current===u?r:o}function p(r){var o=r.tag;if(o===5||o===26||o===27||o===6)return r;for(r=r.child;r!==null;){if(o=p(r),o!==null)return o;r=r.sibling}return null}var g=Object.assign,b=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),A=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),P=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),G=Symbol.iterator;function $(r){return r===null||typeof r!="object"?null:(r=G&&r[G]||r["@@iterator"],typeof r=="function"?r:null)}var O=Symbol.for("react.client.reference");function V(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===O?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case k:return"Fragment";case E:return"Profiler";case N:return"StrictMode";case R:return"Suspense";case L:return"SuspenseList";case P:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case w:return"Portal";case A:return r.displayName||"Context";case T:return(r._context.displayName||"Context")+".Consumer";case C:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case H:return o=r.displayName||null,o!==null?o:V(r.type)||"Memo";case B:o=r._payload,r=r._init;try{return V(r(o))}catch{}}return null}var K=Array.isArray,I=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},le=[],J=-1;function U(r){return{current:r}}function F(r){0>J||(r.current=le[J],le[J]=null,J--)}function re(r,o){J++,le[J]=r.current,r.current=o}var fe=U(null),se=U(null),te=U(null),ye=U(null);function Ee(r,o){switch(re(te,o),re(se,r),re(fe,null),o.nodeType){case 9:case 11:r=(r=o.documentElement)&&(r=r.namespaceURI)?K_(r):0;break;default:if(r=o.tagName,o=o.namespaceURI)o=K_(o),r=Y_(o,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}F(fe),re(fe,r)}function De(){F(fe),F(se),F(te)}function Ye(r){r.memoizedState!==null&&re(ye,r);var o=fe.current,u=Y_(o,r.type);o!==u&&(re(se,r),re(fe,u))}function we(r){se.current===r&&(F(fe),F(se)),ye.current===r&&(F(ye),wc._currentValue=W)}var He,$e;function St(r){if(He===void 0)try{throw Error()}catch(u){var o=u.stack.trim().match(/\n( *(at )?)/);He=o&&o[1]||"",$e=-1<u.stack.indexOf(`
3
+ at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
4
+ `+He+r+$e}var Gt=!1;function At(r,o){if(!r||Gt)return"";Gt=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var m={DetermineComponentFrameRoot:function(){try{if(o){var Ce=function(){throw Error()};if(Object.defineProperty(Ce.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ce,[])}catch(pe){var he=pe}Reflect.construct(r,[],Ce)}else{try{Ce.call()}catch(pe){he=pe}r.call(Ce.prototype)}}else{try{throw Error()}catch(pe){he=pe}(Ce=r())&&typeof Ce.catch=="function"&&Ce.catch(function(){})}}catch(pe){if(pe&&he&&typeof pe.stack=="string")return[pe.stack,he.stack]}return[null,null]}};m.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var x=Object.getOwnPropertyDescriptor(m.DetermineComponentFrameRoot,"name");x&&x.configurable&&Object.defineProperty(m.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var _=m.DetermineComponentFrameRoot(),j=_[0],z=_[1];if(j&&z){var X=j.split(`
5
+ `),de=z.split(`
6
+ `);for(x=m=0;m<X.length&&!X[m].includes("DetermineComponentFrameRoot");)m++;for(;x<de.length&&!de[x].includes("DetermineComponentFrameRoot");)x++;if(m===X.length||x===de.length)for(m=X.length-1,x=de.length-1;1<=m&&0<=x&&X[m]!==de[x];)x--;for(;1<=m&&0<=x;m--,x--)if(X[m]!==de[x]){if(m!==1||x!==1)do if(m--,x--,0>x||X[m]!==de[x]){var ve=`
7
+ `+X[m].replace(" at new "," at ");return r.displayName&&ve.includes("<anonymous>")&&(ve=ve.replace("<anonymous>",r.displayName)),ve}while(1<=m&&0<=x);break}}}finally{Gt=!1,Error.prepareStackTrace=u}return(u=r?r.displayName||r.name:"")?St(u):""}function Ln(r,o){switch(r.tag){case 26:case 27:case 5:return St(r.type);case 16:return St("Lazy");case 13:return r.child!==o&&o!==null?St("Suspense Fallback"):St("Suspense");case 19:return St("SuspenseList");case 0:case 15:return At(r.type,!1);case 11:return At(r.type.render,!1);case 1:return At(r.type,!0);case 31:return St("Activity");default:return""}}function _n(r){try{var o="",u=null;do o+=Ln(r,u),u=r,r=r.return;while(r);return o}catch(m){return`
8
+ Error generating stack: `+m.message+`
9
+ `+m.stack}}var ms=Object.prototype.hasOwnProperty,Hs=e.unstable_scheduleCallback,un=e.unstable_cancelCallback,ei=e.unstable_shouldYield,On=e.unstable_requestPaint,Lt=e.unstable_now,ps=e.unstable_getCurrentPriorityLevel,is=e.unstable_ImmediatePriority,et=e.unstable_UserBlockingPriority,tt=e.unstable_NormalPriority,Ct=e.unstable_LowPriority,S=e.unstable_IdlePriority,ee=e.log,ge=e.unstable_setDisableYieldValue,_e=null,oe=null;function Re(r){if(typeof ee=="function"&&ge(r),oe&&typeof oe.setStrictMode=="function")try{oe.setStrictMode(_e,r)}catch{}}var M=Math.clz32?Math.clz32:Se,ce=Math.log,Me=Math.LN2;function Se(r){return r>>>=0,r===0?32:31-(ce(r)/Me|0)|0}var me=256,Ae=262144,Ne=4194304;function Be(r){var o=r&42;if(o!==0)return o;switch(r&-r){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function q(r,o,u){var m=r.pendingLanes;if(m===0)return 0;var x=0,_=r.suspendedLanes,j=r.pingedLanes;r=r.warmLanes;var z=m&134217727;return z!==0?(m=z&~_,m!==0?x=Be(m):(j&=z,j!==0?x=Be(j):u||(u=z&~r,u!==0&&(x=Be(u))))):(z=m&~_,z!==0?x=Be(z):j!==0?x=Be(j):u||(u=m&~r,u!==0&&(x=Be(u)))),x===0?0:o!==0&&o!==x&&(o&_)===0&&(_=x&-x,u=o&-o,_>=u||_===32&&(u&4194048)!==0)?o:x}function ne(r,o){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&o)===0}function xe(r,o){switch(r){case 1:case 2:case 4:case 8:case 64:return o+250;case 16:case 32: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 o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Pe(){var r=Ne;return Ne<<=1,(Ne&62914560)===0&&(Ne=4194304),r}function at(r){for(var o=[],u=0;31>u;u++)o.push(r);return o}function Mt(r,o){r.pendingLanes|=o,o!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function qe(r,o,u,m,x,_){var j=r.pendingLanes;r.pendingLanes=u,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=u,r.entangledLanes&=u,r.errorRecoveryDisabledLanes&=u,r.shellSuspendCounter=0;var z=r.entanglements,X=r.expirationTimes,de=r.hiddenUpdates;for(u=j&~u;0<u;){var ve=31-M(u),Ce=1<<ve;z[ve]=0,X[ve]=-1;var he=de[ve];if(he!==null)for(de[ve]=null,ve=0;ve<he.length;ve++){var pe=he[ve];pe!==null&&(pe.lane&=-536870913)}u&=~Ce}m!==0&&Ue(r,m,0),_!==0&&x===0&&r.tag!==0&&(r.suspendedLanes|=_&~(j&~o))}function Ue(r,o,u){r.pendingLanes|=o,r.suspendedLanes&=~o;var m=31-M(o);r.entangledLanes|=o,r.entanglements[m]=r.entanglements[m]|1073741824|u&261930}function ot(r,o){var u=r.entangledLanes|=o;for(r=r.entanglements;u;){var m=31-M(u),x=1<<m;x&o|r[m]&o&&(r[m]|=o),u&=~x}}function gs(r,o){var u=o&-o;return u=(u&42)!==0?1:ts(u),(u&(r.suspendedLanes|o))!==0?0:u}function ts(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=16;break;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:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function ir(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function So(){var r=Y.p;return r!==0?r:(r=window.event,r===void 0?32:xw(r.type))}function ko(r,o){var u=Y.p;try{return Y.p=r,o()}finally{Y.p=u}}var zi=Math.random().toString(36).slice(2),bs="__reactFiber$"+zi,nn="__reactProps$"+zi,Br="__reactContainer$"+zi,Dl="__reactEvents$"+zi,Bu="__reactListeners$"+zi,No="__reactHandles$"+zi,Pu="__reactResources$"+zi,Aa="__reactMarker$"+zi;function Ll(r){delete r[bs],delete r[nn],delete r[Dl],delete r[Bu],delete r[No]}function dn(r){var o=r[bs];if(o)return o;for(var u=r.parentNode;u;){if(o=u[Br]||u[bs]){if(u=o.alternate,o.child!==null||u!==null&&u.child!==null)for(r=sw(r);r!==null;){if(u=r[bs])return u;r=sw(r)}return o}r=u,u=r.parentNode}return null}function rr(r){if(r=r[bs]||r[Br]){var o=r.tag;if(o===5||o===6||o===13||o===31||o===26||o===27||o===3)return r}return null}function Pr(r){var o=r.tag;if(o===5||o===26||o===27||o===6)return r.stateNode;throw Error(i(33))}function Ir(r){var o=r[Pu];return o||(o=r[Pu]={hoistableStyles:new Map,hoistableScripts:new Map}),o}function Ss(r){r[Aa]=!0}var Iu=new Set,Ta={};function ar(r,o){Le(r,o),Le(r+"Capture",o)}function Le(r,o){for(Ta[r]=o,r=0;r<o.length;r++)Iu.add(o[r])}var st=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),bt={},Ot={};function xs(r){return ms.call(Ot,r)?!0:ms.call(bt,r)?!1:st.test(r)?Ot[r]=!0:(bt[r]=!0,!1)}function rn(r,o,u){if(xs(o))if(u===null)r.removeAttribute(o);else{switch(typeof u){case"undefined":case"function":case"symbol":r.removeAttribute(o);return;case"boolean":var m=o.toLowerCase().slice(0,5);if(m!=="data-"&&m!=="aria-"){r.removeAttribute(o);return}}r.setAttribute(o,""+u)}}function zn(r,o,u){if(u===null)r.removeAttribute(o);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(o);return}r.setAttribute(o,""+u)}}function wn(r,o,u,m){if(m===null)r.removeAttribute(u);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(u);return}r.setAttributeNS(o,u,""+m)}}function Kt(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Bn(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function $u(r,o,u){var m=Object.getOwnPropertyDescriptor(r.constructor.prototype,o);if(!r.hasOwnProperty(o)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var x=m.get,_=m.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return x.call(this)},set:function(j){u=""+j,_.call(this,j)}}),Object.defineProperty(r,o,{enumerable:m.enumerable}),{getValue:function(){return u},setValue:function(j){u=""+j},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function Co(r){if(!r._valueTracker){var o=Bn(r)?"checked":"value";r._valueTracker=$u(r,o,""+r[o])}}function Ol(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var u=o.getValue(),m="";return r&&(m=Bn(r)?r.checked?"true":"false":r.value),r=m,r!==u?(o.setValue(r),!0):!1}function Eo(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var lm=/[\n"\\]/g;function Sn(r){return r.replace(lm,function(o){return"\\"+o.charCodeAt(0).toString(16)+" "})}function zl(r,o,u,m,x,_,j,z){r.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?r.type=j:r.removeAttribute("type"),o!=null?j==="number"?(o===0&&r.value===""||r.value!=o)&&(r.value=""+Kt(o)):r.value!==""+Kt(o)&&(r.value=""+Kt(o)):j!=="submit"&&j!=="reset"||r.removeAttribute("value"),o!=null?jo(r,j,Kt(o)):u!=null?jo(r,j,Kt(u)):m!=null&&r.removeAttribute("value"),x==null&&_!=null&&(r.defaultChecked=!!_),x!=null&&(r.checked=x&&typeof x!="function"&&typeof x!="symbol"),z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"?r.name=""+Kt(z):r.removeAttribute("name")}function Ra(r,o,u,m,x,_,j,z){if(_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(r.type=_),o!=null||u!=null){if(!(_!=="submit"&&_!=="reset"||o!=null)){Co(r);return}u=u!=null?""+Kt(u):"",o=o!=null?""+Kt(o):u,z||o===r.value||(r.value=o),r.defaultValue=o}m=m??x,m=typeof m!="function"&&typeof m!="symbol"&&!!m,r.checked=z?r.checked:!!m,r.defaultChecked=!!m,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(r.name=j),Co(r)}function jo(r,o,u){o==="number"&&Eo(r.ownerDocument)===r||r.defaultValue===""+u||(r.defaultValue=""+u)}function Ys(r,o,u,m){if(r=r.options,o){o={};for(var x=0;x<u.length;x++)o["$"+u[x]]=!0;for(u=0;u<r.length;u++)x=o.hasOwnProperty("$"+r[u].value),r[u].selected!==x&&(r[u].selected=x),x&&m&&(r[u].defaultSelected=!0)}else{for(u=""+Kt(u),o=null,x=0;x<r.length;x++){if(r[x].value===u){r[x].selected=!0,m&&(r[x].defaultSelected=!0);return}o!==null||r[x].disabled||(o=r[x])}o!==null&&(o.selected=!0)}}function Hu(r,o,u){if(o!=null&&(o=""+Kt(o),o!==r.value&&(r.value=o),u==null)){r.defaultValue!==o&&(r.defaultValue=o);return}r.defaultValue=u!=null?""+Kt(u):""}function Ao(r,o,u,m){if(o==null){if(m!=null){if(u!=null)throw Error(i(92));if(K(m)){if(1<m.length)throw Error(i(93));m=m[0]}u=m}u==null&&(u=""),o=u}u=Kt(o),r.defaultValue=u,m=r.textContent,m===u&&m!==""&&m!==null&&(r.value=m),Co(r)}function rt(r,o){if(o){var u=r.firstChild;if(u&&u===r.lastChild&&u.nodeType===3){u.nodeValue=o;return}}r.textContent=o}var Uu=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function ks(r,o,u){var m=o.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?m?r.setProperty(o,""):o==="float"?r.cssFloat="":r[o]="":m?r.setProperty(o,u):typeof u!="number"||u===0||Uu.has(o)?o==="float"?r.cssFloat=u:r[o]=(""+u).trim():r[o]=u+"px"}function zt(r,o,u){if(o!=null&&typeof o!="object")throw Error(i(62));if(r=r.style,u!=null){for(var m in u)!u.hasOwnProperty(m)||o!=null&&o.hasOwnProperty(m)||(m.indexOf("--")===0?r.setProperty(m,""):m==="float"?r.cssFloat="":r[m]="");for(var x in o)m=o[x],o.hasOwnProperty(x)&&u[x]!==m&&ks(r,x,m)}else for(var _ in o)o.hasOwnProperty(_)&&ks(r,_,o[_])}function $r(r){if(r.indexOf("-")===-1)return!1;switch(r){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 or=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["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"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["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"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["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"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Bl=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Hr(r){return Bl.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function Ie(){}var Ze=null;function ut(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var yt=null,rs=null;function ti(r){var o=rr(r);if(o&&(r=o.stateNode)){var u=r[nn]||null;e:switch(r=o.stateNode,o.type){case"input":if(zl(r,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),o=u.name,u.type==="radio"&&o!=null){for(u=r;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+Sn(""+o)+'"][type="radio"]'),o=0;o<u.length;o++){var m=u[o];if(m!==r&&m.form===r.form){var x=m[nn]||null;if(!x)throw Error(i(90));zl(m,x.value,x.defaultValue,x.defaultValue,x.checked,x.defaultChecked,x.type,x.name)}}for(o=0;o<u.length;o++)m=u[o],m.form===r.form&&Ol(m)}break e;case"textarea":Hu(r,u.value,u.defaultValue);break e;case"select":o=u.value,o!=null&&Ys(r,!!u.multiple,o,!1)}}}var Pl=!1;function Fu(r,o,u){if(Pl)return r(o,u);Pl=!0;try{var m=r(o);return m}finally{if(Pl=!1,(yt!==null||rs!==null)&&(Td(),yt&&(o=yt,r=rs,rs=yt=null,ti(o),r)))for(o=0;o<r.length;o++)ti(r[o])}}function Il(r,o){var u=r.stateNode;if(u===null)return null;var m=u[nn]||null;if(m===null)return null;u=m[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(r=r.type,m=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!m;break e;default:r=!1}if(r)return null;if(u&&typeof u!="function")throw Error(i(231,o,typeof u));return u}var lr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),cm=!1;if(lr)try{var $l={};Object.defineProperty($l,"passive",{get:function(){cm=!0}}),window.addEventListener("test",$l,$l),window.removeEventListener("test",$l,$l)}catch{cm=!1}var Ur=null,um=null,qu=null;function Yv(){if(qu)return qu;var r,o=um,u=o.length,m,x="value"in Ur?Ur.value:Ur.textContent,_=x.length;for(r=0;r<u&&o[r]===x[r];r++);var j=u-r;for(m=1;m<=j&&o[u-m]===x[_-m];m++);return qu=x.slice(r,1<m?1-m:void 0)}function Gu(r){var o=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&o===13&&(r=13)):r=o,r===10&&(r=13),32<=r||r===13?r:0}function Vu(){return!0}function Xv(){return!1}function kn(r){function o(u,m,x,_,j){this._reactName=u,this._targetInst=x,this.type=m,this.nativeEvent=_,this.target=j,this.currentTarget=null;for(var z in r)r.hasOwnProperty(z)&&(u=r[z],this[z]=u?u(_):_[z]);return this.isDefaultPrevented=(_.defaultPrevented!=null?_.defaultPrevented:_.returnValue===!1)?Vu:Xv,this.isPropagationStopped=Xv,this}return g(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=Vu)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=Vu)},persist:function(){},isPersistent:Vu}),o}var Ma={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Wu=kn(Ma),Hl=g({},Ma,{view:0,detail:0}),tA=kn(Hl),dm,hm,Ul,Ku=g({},Hl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:mm,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Ul&&(Ul&&r.type==="mousemove"?(dm=r.screenX-Ul.screenX,hm=r.screenY-Ul.screenY):hm=dm=0,Ul=r),dm)},movementY:function(r){return"movementY"in r?r.movementY:hm}}),Zv=kn(Ku),sA=g({},Ku,{dataTransfer:0}),nA=kn(sA),iA=g({},Hl,{relatedTarget:0}),fm=kn(iA),rA=g({},Ma,{animationName:0,elapsedTime:0,pseudoElement:0}),aA=kn(rA),oA=g({},Ma,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),lA=kn(oA),cA=g({},Ma,{data:0}),Qv=kn(cA),uA={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},dA={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"},hA={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function fA(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=hA[r])?!!o[r]:!1}function mm(){return fA}var mA=g({},Hl,{key:function(r){if(r.key){var o=uA[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=Gu(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?dA[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:mm,charCode:function(r){return r.type==="keypress"?Gu(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Gu(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),pA=kn(mA),gA=g({},Ku,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Jv=kn(gA),bA=g({},Hl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:mm}),xA=kn(bA),vA=g({},Ma,{propertyName:0,elapsedTime:0,pseudoElement:0}),yA=kn(vA),_A=g({},Ku,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),wA=kn(_A),SA=g({},Ma,{newState:0,oldState:0}),kA=kn(SA),NA=[9,13,27,32],pm=lr&&"CompositionEvent"in window,Fl=null;lr&&"documentMode"in document&&(Fl=document.documentMode);var CA=lr&&"TextEvent"in window&&!Fl,e1=lr&&(!pm||Fl&&8<Fl&&11>=Fl),t1=" ",s1=!1;function n1(r,o){switch(r){case"keyup":return NA.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function i1(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var To=!1;function EA(r,o){switch(r){case"compositionend":return i1(o);case"keypress":return o.which!==32?null:(s1=!0,t1);case"textInput":return r=o.data,r===t1&&s1?null:r;default:return null}}function jA(r,o){if(To)return r==="compositionend"||!pm&&n1(r,o)?(r=Yv(),qu=um=Ur=null,To=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return e1&&o.locale!=="ko"?null:o.data;default:return null}}var AA={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 r1(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!AA[r.type]:o==="textarea"}function a1(r,o,u,m){yt?rs?rs.push(m):rs=[m]:yt=m,o=Bd(o,"onChange"),0<o.length&&(u=new Wu("onChange","change",null,u,m),r.push({event:u,listeners:o}))}var ql=null,Gl=null;function TA(r){U_(r,0)}function Yu(r){var o=Pr(r);if(Ol(o))return r}function o1(r,o){if(r==="change")return o}var l1=!1;if(lr){var gm;if(lr){var bm="oninput"in document;if(!bm){var c1=document.createElement("div");c1.setAttribute("oninput","return;"),bm=typeof c1.oninput=="function"}gm=bm}else gm=!1;l1=gm&&(!document.documentMode||9<document.documentMode)}function u1(){ql&&(ql.detachEvent("onpropertychange",d1),Gl=ql=null)}function d1(r){if(r.propertyName==="value"&&Yu(Gl)){var o=[];a1(o,Gl,r,ut(r)),Fu(TA,o)}}function RA(r,o,u){r==="focusin"?(u1(),ql=o,Gl=u,ql.attachEvent("onpropertychange",d1)):r==="focusout"&&u1()}function MA(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Yu(Gl)}function DA(r,o){if(r==="click")return Yu(o)}function LA(r,o){if(r==="input"||r==="change")return Yu(o)}function OA(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var Pn=typeof Object.is=="function"?Object.is:OA;function Vl(r,o){if(Pn(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var u=Object.keys(r),m=Object.keys(o);if(u.length!==m.length)return!1;for(m=0;m<u.length;m++){var x=u[m];if(!ms.call(o,x)||!Pn(r[x],o[x]))return!1}return!0}function h1(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function f1(r,o){var u=h1(r);r=0;for(var m;u;){if(u.nodeType===3){if(m=r+u.textContent.length,r<=o&&m>=o)return{node:u,offset:o-r};r=m}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=h1(u)}}function m1(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?m1(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function p1(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var o=Eo(r.document);o instanceof r.HTMLIFrameElement;){try{var u=typeof o.contentWindow.location.href=="string"}catch{u=!1}if(u)r=o.contentWindow;else break;o=Eo(r.document)}return o}function xm(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o&&(o==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||o==="textarea"||r.contentEditable==="true")}var zA=lr&&"documentMode"in document&&11>=document.documentMode,Ro=null,vm=null,Wl=null,ym=!1;function g1(r,o,u){var m=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;ym||Ro==null||Ro!==Eo(m)||(m=Ro,"selectionStart"in m&&xm(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Wl&&Vl(Wl,m)||(Wl=m,m=Bd(vm,"onSelect"),0<m.length&&(o=new Wu("onSelect","select",null,o,u),r.push({event:o,listeners:m}),o.target=Ro)))}function Da(r,o){var u={};return u[r.toLowerCase()]=o.toLowerCase(),u["Webkit"+r]="webkit"+o,u["Moz"+r]="moz"+o,u}var Mo={animationend:Da("Animation","AnimationEnd"),animationiteration:Da("Animation","AnimationIteration"),animationstart:Da("Animation","AnimationStart"),transitionrun:Da("Transition","TransitionRun"),transitionstart:Da("Transition","TransitionStart"),transitioncancel:Da("Transition","TransitionCancel"),transitionend:Da("Transition","TransitionEnd")},_m={},b1={};lr&&(b1=document.createElement("div").style,"AnimationEvent"in window||(delete Mo.animationend.animation,delete Mo.animationiteration.animation,delete Mo.animationstart.animation),"TransitionEvent"in window||delete Mo.transitionend.transition);function La(r){if(_m[r])return _m[r];if(!Mo[r])return r;var o=Mo[r],u;for(u in o)if(o.hasOwnProperty(u)&&u in b1)return _m[r]=o[u];return r}var x1=La("animationend"),v1=La("animationiteration"),y1=La("animationstart"),BA=La("transitionrun"),PA=La("transitionstart"),IA=La("transitioncancel"),_1=La("transitionend"),w1=new Map,wm="abort auxClick beforeToggle 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(" ");wm.push("scrollEnd");function ki(r,o){w1.set(r,o),ar(o,[r])}var Xu=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var o=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(o))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},si=[],Do=0,Sm=0;function Zu(){for(var r=Do,o=Sm=Do=0;o<r;){var u=si[o];si[o++]=null;var m=si[o];si[o++]=null;var x=si[o];si[o++]=null;var _=si[o];if(si[o++]=null,m!==null&&x!==null){var j=m.pending;j===null?x.next=x:(x.next=j.next,j.next=x),m.pending=x}_!==0&&S1(u,x,_)}}function Qu(r,o,u,m){si[Do++]=r,si[Do++]=o,si[Do++]=u,si[Do++]=m,Sm|=m,r.lanes|=m,r=r.alternate,r!==null&&(r.lanes|=m)}function km(r,o,u,m){return Qu(r,o,u,m),Ju(r)}function Oa(r,o){return Qu(r,null,null,o),Ju(r)}function S1(r,o,u){r.lanes|=u;var m=r.alternate;m!==null&&(m.lanes|=u);for(var x=!1,_=r.return;_!==null;)_.childLanes|=u,m=_.alternate,m!==null&&(m.childLanes|=u),_.tag===22&&(r=_.stateNode,r===null||r._visibility&1||(x=!0)),r=_,_=_.return;return r.tag===3?(_=r.stateNode,x&&o!==null&&(x=31-M(u),r=_.hiddenUpdates,m=r[x],m===null?r[x]=[o]:m.push(o),o.lane=u|536870912),_):null}function Ju(r){if(50<pc)throw pc=0,Dp=null,Error(i(185));for(var o=r.return;o!==null;)r=o,o=r.return;return r.tag===3?r.stateNode:null}var Lo={};function $A(r,o,u,m){this.tag=r,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function In(r,o,u,m){return new $A(r,o,u,m)}function Nm(r){return r=r.prototype,!(!r||!r.isReactComponent)}function cr(r,o){var u=r.alternate;return u===null?(u=In(r.tag,o,r.key,r.mode),u.elementType=r.elementType,u.type=r.type,u.stateNode=r.stateNode,u.alternate=r,r.alternate=u):(u.pendingProps=o,u.type=r.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=r.flags&65011712,u.childLanes=r.childLanes,u.lanes=r.lanes,u.child=r.child,u.memoizedProps=r.memoizedProps,u.memoizedState=r.memoizedState,u.updateQueue=r.updateQueue,o=r.dependencies,u.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},u.sibling=r.sibling,u.index=r.index,u.ref=r.ref,u.refCleanup=r.refCleanup,u}function k1(r,o){r.flags&=65011714;var u=r.alternate;return u===null?(r.childLanes=0,r.lanes=o,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=u.childLanes,r.lanes=u.lanes,r.child=u.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=u.memoizedProps,r.memoizedState=u.memoizedState,r.updateQueue=u.updateQueue,r.type=u.type,o=u.dependencies,r.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),r}function ed(r,o,u,m,x,_){var j=0;if(m=r,typeof r=="function")Nm(r)&&(j=1);else if(typeof r=="string")j=GT(r,u,fe.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case P:return r=In(31,u,o,x),r.elementType=P,r.lanes=_,r;case k:return za(u.children,x,_,o);case N:j=8,x|=24;break;case E:return r=In(12,u,o,x|2),r.elementType=E,r.lanes=_,r;case R:return r=In(13,u,o,x),r.elementType=R,r.lanes=_,r;case L:return r=In(19,u,o,x),r.elementType=L,r.lanes=_,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case A:j=10;break e;case T:j=9;break e;case C:j=11;break e;case H:j=14;break e;case B:j=16,m=null;break e}j=29,u=Error(i(130,r===null?"null":typeof r,"")),m=null}return o=In(j,u,o,x),o.elementType=r,o.type=m,o.lanes=_,o}function za(r,o,u,m){return r=In(7,r,m,o),r.lanes=u,r}function Cm(r,o,u){return r=In(6,r,null,o),r.lanes=u,r}function N1(r){var o=In(18,null,null,0);return o.stateNode=r,o}function Em(r,o,u){return o=In(4,r.children!==null?r.children:[],r.key,o),o.lanes=u,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}var C1=new WeakMap;function ni(r,o){if(typeof r=="object"&&r!==null){var u=C1.get(r);return u!==void 0?u:(o={value:r,source:o,stack:_n(o)},C1.set(r,o),o)}return{value:r,source:o,stack:_n(o)}}var Oo=[],zo=0,td=null,Kl=0,ii=[],ri=0,Fr=null,Bi=1,Pi="";function ur(r,o){Oo[zo++]=Kl,Oo[zo++]=td,td=r,Kl=o}function E1(r,o,u){ii[ri++]=Bi,ii[ri++]=Pi,ii[ri++]=Fr,Fr=r;var m=Bi;r=Pi;var x=32-M(m)-1;m&=~(1<<x),u+=1;var _=32-M(o)+x;if(30<_){var j=x-x%5;_=(m&(1<<j)-1).toString(32),m>>=j,x-=j,Bi=1<<32-M(o)+x|u<<x|m,Pi=_+r}else Bi=1<<_|u<<x|m,Pi=r}function jm(r){r.return!==null&&(ur(r,1),E1(r,1,0))}function Am(r){for(;r===td;)td=Oo[--zo],Oo[zo]=null,Kl=Oo[--zo],Oo[zo]=null;for(;r===Fr;)Fr=ii[--ri],ii[ri]=null,Pi=ii[--ri],ii[ri]=null,Bi=ii[--ri],ii[ri]=null}function j1(r,o){ii[ri++]=Bi,ii[ri++]=Pi,ii[ri++]=Fr,Bi=o.id,Pi=o.overflow,Fr=r}var Xs=null,Xt=null,kt=!1,qr=null,ai=!1,Tm=Error(i(519));function Gr(r){var o=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Yl(ni(o,r)),Tm}function A1(r){var o=r.stateNode,u=r.type,m=r.memoizedProps;switch(o[bs]=r,o[nn]=m,u){case"dialog":vt("cancel",o),vt("close",o);break;case"iframe":case"object":case"embed":vt("load",o);break;case"video":case"audio":for(u=0;u<bc.length;u++)vt(bc[u],o);break;case"source":vt("error",o);break;case"img":case"image":case"link":vt("error",o),vt("load",o);break;case"details":vt("toggle",o);break;case"input":vt("invalid",o),Ra(o,m.value,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name,!0);break;case"select":vt("invalid",o);break;case"textarea":vt("invalid",o),Ao(o,m.value,m.defaultValue,m.children)}u=m.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||o.textContent===""+u||m.suppressHydrationWarning===!0||V_(o.textContent,u)?(m.popover!=null&&(vt("beforetoggle",o),vt("toggle",o)),m.onScroll!=null&&vt("scroll",o),m.onScrollEnd!=null&&vt("scrollend",o),m.onClick!=null&&(o.onclick=Ie),o=!0):o=!1,o||Gr(r,!0)}function T1(r){for(Xs=r.return;Xs;)switch(Xs.tag){case 5:case 31:case 13:ai=!1;return;case 27:case 3:ai=!0;return;default:Xs=Xs.return}}function Bo(r){if(r!==Xs)return!1;if(!kt)return T1(r),kt=!0,!1;var o=r.tag,u;if((u=o!==3&&o!==27)&&((u=o===5)&&(u=r.type,u=!(u!=="form"&&u!=="button")||Kp(r.type,r.memoizedProps)),u=!u),u&&Xt&&Gr(r),T1(r),o===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));Xt=tw(r)}else if(o===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));Xt=tw(r)}else o===27?(o=Xt,ra(r.type)?(r=Jp,Jp=null,Xt=r):Xt=o):Xt=Xs?li(r.stateNode.nextSibling):null;return!0}function Ba(){Xt=Xs=null,kt=!1}function Rm(){var r=qr;return r!==null&&(jn===null?jn=r:jn.push.apply(jn,r),qr=null),r}function Yl(r){qr===null?qr=[r]:qr.push(r)}var Mm=U(null),Pa=null,dr=null;function Vr(r,o,u){re(Mm,o._currentValue),o._currentValue=u}function hr(r){r._currentValue=Mm.current,F(Mm)}function Dm(r,o,u){for(;r!==null;){var m=r.alternate;if((r.childLanes&o)!==o?(r.childLanes|=o,m!==null&&(m.childLanes|=o)):m!==null&&(m.childLanes&o)!==o&&(m.childLanes|=o),r===u)break;r=r.return}}function Lm(r,o,u,m){var x=r.child;for(x!==null&&(x.return=r);x!==null;){var _=x.dependencies;if(_!==null){var j=x.child;_=_.firstContext;e:for(;_!==null;){var z=_;_=x;for(var X=0;X<o.length;X++)if(z.context===o[X]){_.lanes|=u,z=_.alternate,z!==null&&(z.lanes|=u),Dm(_.return,u,r),m||(j=null);break e}_=z.next}}else if(x.tag===18){if(j=x.return,j===null)throw Error(i(341));j.lanes|=u,_=j.alternate,_!==null&&(_.lanes|=u),Dm(j,u,r),j=null}else j=x.child;if(j!==null)j.return=x;else for(j=x;j!==null;){if(j===r){j=null;break}if(x=j.sibling,x!==null){x.return=j.return,j=x;break}j=j.return}x=j}}function Po(r,o,u,m){r=null;for(var x=o,_=!1;x!==null;){if(!_){if((x.flags&524288)!==0)_=!0;else if((x.flags&262144)!==0)break}if(x.tag===10){var j=x.alternate;if(j===null)throw Error(i(387));if(j=j.memoizedProps,j!==null){var z=x.type;Pn(x.pendingProps.value,j.value)||(r!==null?r.push(z):r=[z])}}else if(x===ye.current){if(j=x.alternate,j===null)throw Error(i(387));j.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(r!==null?r.push(wc):r=[wc])}x=x.return}r!==null&&Lm(o,r,u,m),o.flags|=262144}function sd(r){for(r=r.firstContext;r!==null;){if(!Pn(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Ia(r){Pa=r,dr=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Zs(r){return R1(Pa,r)}function nd(r,o){return Pa===null&&Ia(r),R1(r,o)}function R1(r,o){var u=o._currentValue;if(o={context:o,memoizedValue:u,next:null},dr===null){if(r===null)throw Error(i(308));dr=o,r.dependencies={lanes:0,firstContext:o},r.flags|=524288}else dr=dr.next=o;return u}var HA=typeof AbortController<"u"?AbortController:function(){var r=[],o=this.signal={aborted:!1,addEventListener:function(u,m){r.push(m)}};this.abort=function(){o.aborted=!0,r.forEach(function(u){return u()})}},UA=e.unstable_scheduleCallback,FA=e.unstable_NormalPriority,Ns={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Om(){return{controller:new HA,data:new Map,refCount:0}}function Xl(r){r.refCount--,r.refCount===0&&UA(FA,function(){r.controller.abort()})}var Zl=null,zm=0,Io=0,$o=null;function qA(r,o){if(Zl===null){var u=Zl=[];zm=0,Io=Ip(),$o={status:"pending",value:void 0,then:function(m){u.push(m)}}}return zm++,o.then(M1,M1),o}function M1(){if(--zm===0&&Zl!==null){$o!==null&&($o.status="fulfilled");var r=Zl;Zl=null,Io=0,$o=null;for(var o=0;o<r.length;o++)(0,r[o])()}}function GA(r,o){var u=[],m={status:"pending",value:null,reason:null,then:function(x){u.push(x)}};return r.then(function(){m.status="fulfilled",m.value=o;for(var x=0;x<u.length;x++)(0,u[x])(o)},function(x){for(m.status="rejected",m.reason=x,x=0;x<u.length;x++)(0,u[x])(void 0)}),m}var D1=I.S;I.S=function(r,o){g_=Lt(),typeof o=="object"&&o!==null&&typeof o.then=="function"&&qA(r,o),D1!==null&&D1(r,o)};var $a=U(null);function Bm(){var r=$a.current;return r!==null?r:Vt.pooledCache}function id(r,o){o===null?re($a,$a.current):re($a,o.pool)}function L1(){var r=Bm();return r===null?null:{parent:Ns._currentValue,pool:r}}var Ho=Error(i(460)),Pm=Error(i(474)),rd=Error(i(542)),ad={then:function(){}};function O1(r){return r=r.status,r==="fulfilled"||r==="rejected"}function z1(r,o,u){switch(u=r[u],u===void 0?r.push(o):u!==o&&(o.then(Ie,Ie),o=u),o.status){case"fulfilled":return o.value;case"rejected":throw r=o.reason,P1(r),r;default:if(typeof o.status=="string")o.then(Ie,Ie);else{if(r=Vt,r!==null&&100<r.shellSuspendCounter)throw Error(i(482));r=o,r.status="pending",r.then(function(m){if(o.status==="pending"){var x=o;x.status="fulfilled",x.value=m}},function(m){if(o.status==="pending"){var x=o;x.status="rejected",x.reason=m}})}switch(o.status){case"fulfilled":return o.value;case"rejected":throw r=o.reason,P1(r),r}throw Ua=o,Ho}}function Ha(r){try{var o=r._init;return o(r._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(Ua=u,Ho):u}}var Ua=null;function B1(){if(Ua===null)throw Error(i(459));var r=Ua;return Ua=null,r}function P1(r){if(r===Ho||r===rd)throw Error(i(483))}var Uo=null,Ql=0;function od(r){var o=Ql;return Ql+=1,Uo===null&&(Uo=[]),z1(Uo,r,o)}function Jl(r,o){o=o.props.ref,r.ref=o!==void 0?o:null}function ld(r,o){throw o.$$typeof===b?Error(i(525)):(r=Object.prototype.toString.call(o),Error(i(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r)))}function I1(r){function o(ie,Q){if(r){var ue=ie.deletions;ue===null?(ie.deletions=[Q],ie.flags|=16):ue.push(Q)}}function u(ie,Q){if(!r)return null;for(;Q!==null;)o(ie,Q),Q=Q.sibling;return null}function m(ie){for(var Q=new Map;ie!==null;)ie.key!==null?Q.set(ie.key,ie):Q.set(ie.index,ie),ie=ie.sibling;return Q}function x(ie,Q){return ie=cr(ie,Q),ie.index=0,ie.sibling=null,ie}function _(ie,Q,ue){return ie.index=ue,r?(ue=ie.alternate,ue!==null?(ue=ue.index,ue<Q?(ie.flags|=67108866,Q):ue):(ie.flags|=67108866,Q)):(ie.flags|=1048576,Q)}function j(ie){return r&&ie.alternate===null&&(ie.flags|=67108866),ie}function z(ie,Q,ue,ke){return Q===null||Q.tag!==6?(Q=Cm(ue,ie.mode,ke),Q.return=ie,Q):(Q=x(Q,ue),Q.return=ie,Q)}function X(ie,Q,ue,ke){var nt=ue.type;return nt===k?ve(ie,Q,ue.props.children,ke,ue.key):Q!==null&&(Q.elementType===nt||typeof nt=="object"&&nt!==null&&nt.$$typeof===B&&Ha(nt)===Q.type)?(Q=x(Q,ue.props),Jl(Q,ue),Q.return=ie,Q):(Q=ed(ue.type,ue.key,ue.props,null,ie.mode,ke),Jl(Q,ue),Q.return=ie,Q)}function de(ie,Q,ue,ke){return Q===null||Q.tag!==4||Q.stateNode.containerInfo!==ue.containerInfo||Q.stateNode.implementation!==ue.implementation?(Q=Em(ue,ie.mode,ke),Q.return=ie,Q):(Q=x(Q,ue.children||[]),Q.return=ie,Q)}function ve(ie,Q,ue,ke,nt){return Q===null||Q.tag!==7?(Q=za(ue,ie.mode,ke,nt),Q.return=ie,Q):(Q=x(Q,ue),Q.return=ie,Q)}function Ce(ie,Q,ue){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Q=Cm(""+Q,ie.mode,ue),Q.return=ie,Q;if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case v:return ue=ed(Q.type,Q.key,Q.props,null,ie.mode,ue),Jl(ue,Q),ue.return=ie,ue;case w:return Q=Em(Q,ie.mode,ue),Q.return=ie,Q;case B:return Q=Ha(Q),Ce(ie,Q,ue)}if(K(Q)||$(Q))return Q=za(Q,ie.mode,ue,null),Q.return=ie,Q;if(typeof Q.then=="function")return Ce(ie,od(Q),ue);if(Q.$$typeof===A)return Ce(ie,nd(ie,Q),ue);ld(ie,Q)}return null}function he(ie,Q,ue,ke){var nt=Q!==null?Q.key:null;if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return nt!==null?null:z(ie,Q,""+ue,ke);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case v:return ue.key===nt?X(ie,Q,ue,ke):null;case w:return ue.key===nt?de(ie,Q,ue,ke):null;case B:return ue=Ha(ue),he(ie,Q,ue,ke)}if(K(ue)||$(ue))return nt!==null?null:ve(ie,Q,ue,ke,null);if(typeof ue.then=="function")return he(ie,Q,od(ue),ke);if(ue.$$typeof===A)return he(ie,Q,nd(ie,ue),ke);ld(ie,ue)}return null}function pe(ie,Q,ue,ke,nt){if(typeof ke=="string"&&ke!==""||typeof ke=="number"||typeof ke=="bigint")return ie=ie.get(ue)||null,z(Q,ie,""+ke,nt);if(typeof ke=="object"&&ke!==null){switch(ke.$$typeof){case v:return ie=ie.get(ke.key===null?ue:ke.key)||null,X(Q,ie,ke,nt);case w:return ie=ie.get(ke.key===null?ue:ke.key)||null,de(Q,ie,ke,nt);case B:return ke=Ha(ke),pe(ie,Q,ue,ke,nt)}if(K(ke)||$(ke))return ie=ie.get(ue)||null,ve(Q,ie,ke,nt,null);if(typeof ke.then=="function")return pe(ie,Q,ue,od(ke),nt);if(ke.$$typeof===A)return pe(ie,Q,ue,nd(Q,ke),nt);ld(Q,ke)}return null}function Ke(ie,Q,ue,ke){for(var nt=null,Et=null,Qe=Q,ht=Q=0,wt=null;Qe!==null&&ht<ue.length;ht++){Qe.index>ht?(wt=Qe,Qe=null):wt=Qe.sibling;var jt=he(ie,Qe,ue[ht],ke);if(jt===null){Qe===null&&(Qe=wt);break}r&&Qe&&jt.alternate===null&&o(ie,Qe),Q=_(jt,Q,ht),Et===null?nt=jt:Et.sibling=jt,Et=jt,Qe=wt}if(ht===ue.length)return u(ie,Qe),kt&&ur(ie,ht),nt;if(Qe===null){for(;ht<ue.length;ht++)Qe=Ce(ie,ue[ht],ke),Qe!==null&&(Q=_(Qe,Q,ht),Et===null?nt=Qe:Et.sibling=Qe,Et=Qe);return kt&&ur(ie,ht),nt}for(Qe=m(Qe);ht<ue.length;ht++)wt=pe(Qe,ie,ht,ue[ht],ke),wt!==null&&(r&&wt.alternate!==null&&Qe.delete(wt.key===null?ht:wt.key),Q=_(wt,Q,ht),Et===null?nt=wt:Et.sibling=wt,Et=wt);return r&&Qe.forEach(function(ua){return o(ie,ua)}),kt&&ur(ie,ht),nt}function it(ie,Q,ue,ke){if(ue==null)throw Error(i(151));for(var nt=null,Et=null,Qe=Q,ht=Q=0,wt=null,jt=ue.next();Qe!==null&&!jt.done;ht++,jt=ue.next()){Qe.index>ht?(wt=Qe,Qe=null):wt=Qe.sibling;var ua=he(ie,Qe,jt.value,ke);if(ua===null){Qe===null&&(Qe=wt);break}r&&Qe&&ua.alternate===null&&o(ie,Qe),Q=_(ua,Q,ht),Et===null?nt=ua:Et.sibling=ua,Et=ua,Qe=wt}if(jt.done)return u(ie,Qe),kt&&ur(ie,ht),nt;if(Qe===null){for(;!jt.done;ht++,jt=ue.next())jt=Ce(ie,jt.value,ke),jt!==null&&(Q=_(jt,Q,ht),Et===null?nt=jt:Et.sibling=jt,Et=jt);return kt&&ur(ie,ht),nt}for(Qe=m(Qe);!jt.done;ht++,jt=ue.next())jt=pe(Qe,ie,ht,jt.value,ke),jt!==null&&(r&&jt.alternate!==null&&Qe.delete(jt.key===null?ht:jt.key),Q=_(jt,Q,ht),Et===null?nt=jt:Et.sibling=jt,Et=jt);return r&&Qe.forEach(function(sR){return o(ie,sR)}),kt&&ur(ie,ht),nt}function Ut(ie,Q,ue,ke){if(typeof ue=="object"&&ue!==null&&ue.type===k&&ue.key===null&&(ue=ue.props.children),typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case v:e:{for(var nt=ue.key;Q!==null;){if(Q.key===nt){if(nt=ue.type,nt===k){if(Q.tag===7){u(ie,Q.sibling),ke=x(Q,ue.props.children),ke.return=ie,ie=ke;break e}}else if(Q.elementType===nt||typeof nt=="object"&&nt!==null&&nt.$$typeof===B&&Ha(nt)===Q.type){u(ie,Q.sibling),ke=x(Q,ue.props),Jl(ke,ue),ke.return=ie,ie=ke;break e}u(ie,Q);break}else o(ie,Q);Q=Q.sibling}ue.type===k?(ke=za(ue.props.children,ie.mode,ke,ue.key),ke.return=ie,ie=ke):(ke=ed(ue.type,ue.key,ue.props,null,ie.mode,ke),Jl(ke,ue),ke.return=ie,ie=ke)}return j(ie);case w:e:{for(nt=ue.key;Q!==null;){if(Q.key===nt)if(Q.tag===4&&Q.stateNode.containerInfo===ue.containerInfo&&Q.stateNode.implementation===ue.implementation){u(ie,Q.sibling),ke=x(Q,ue.children||[]),ke.return=ie,ie=ke;break e}else{u(ie,Q);break}else o(ie,Q);Q=Q.sibling}ke=Em(ue,ie.mode,ke),ke.return=ie,ie=ke}return j(ie);case B:return ue=Ha(ue),Ut(ie,Q,ue,ke)}if(K(ue))return Ke(ie,Q,ue,ke);if($(ue)){if(nt=$(ue),typeof nt!="function")throw Error(i(150));return ue=nt.call(ue),it(ie,Q,ue,ke)}if(typeof ue.then=="function")return Ut(ie,Q,od(ue),ke);if(ue.$$typeof===A)return Ut(ie,Q,nd(ie,ue),ke);ld(ie,ue)}return typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint"?(ue=""+ue,Q!==null&&Q.tag===6?(u(ie,Q.sibling),ke=x(Q,ue),ke.return=ie,ie=ke):(u(ie,Q),ke=Cm(ue,ie.mode,ke),ke.return=ie,ie=ke),j(ie)):u(ie,Q)}return function(ie,Q,ue,ke){try{Ql=0;var nt=Ut(ie,Q,ue,ke);return Uo=null,nt}catch(Qe){if(Qe===Ho||Qe===rd)throw Qe;var Et=In(29,Qe,null,ie.mode);return Et.lanes=ke,Et.return=ie,Et}}}var Fa=I1(!0),$1=I1(!1),Wr=!1;function Im(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function $m(r,o){r=r.updateQueue,o.updateQueue===r&&(o.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function Kr(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Yr(r,o,u){var m=r.updateQueue;if(m===null)return null;if(m=m.shared,(Tt&2)!==0){var x=m.pending;return x===null?o.next=o:(o.next=x.next,x.next=o),m.pending=o,o=Ju(r),S1(r,null,u),o}return Qu(r,m,o,u),Ju(r)}function ec(r,o,u){if(o=o.updateQueue,o!==null&&(o=o.shared,(u&4194048)!==0)){var m=o.lanes;m&=r.pendingLanes,u|=m,o.lanes=u,ot(r,u)}}function Hm(r,o){var u=r.updateQueue,m=r.alternate;if(m!==null&&(m=m.updateQueue,u===m)){var x=null,_=null;if(u=u.firstBaseUpdate,u!==null){do{var j={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};_===null?x=_=j:_=_.next=j,u=u.next}while(u!==null);_===null?x=_=o:_=_.next=o}else x=_=o;u={baseState:m.baseState,firstBaseUpdate:x,lastBaseUpdate:_,shared:m.shared,callbacks:m.callbacks},r.updateQueue=u;return}r=u.lastBaseUpdate,r===null?u.firstBaseUpdate=o:r.next=o,u.lastBaseUpdate=o}var Um=!1;function tc(){if(Um){var r=$o;if(r!==null)throw r}}function sc(r,o,u,m){Um=!1;var x=r.updateQueue;Wr=!1;var _=x.firstBaseUpdate,j=x.lastBaseUpdate,z=x.shared.pending;if(z!==null){x.shared.pending=null;var X=z,de=X.next;X.next=null,j===null?_=de:j.next=de,j=X;var ve=r.alternate;ve!==null&&(ve=ve.updateQueue,z=ve.lastBaseUpdate,z!==j&&(z===null?ve.firstBaseUpdate=de:z.next=de,ve.lastBaseUpdate=X))}if(_!==null){var Ce=x.baseState;j=0,ve=de=X=null,z=_;do{var he=z.lane&-536870913,pe=he!==z.lane;if(pe?(_t&he)===he:(m&he)===he){he!==0&&he===Io&&(Um=!0),ve!==null&&(ve=ve.next={lane:0,tag:z.tag,payload:z.payload,callback:null,next:null});e:{var Ke=r,it=z;he=o;var Ut=u;switch(it.tag){case 1:if(Ke=it.payload,typeof Ke=="function"){Ce=Ke.call(Ut,Ce,he);break e}Ce=Ke;break e;case 3:Ke.flags=Ke.flags&-65537|128;case 0:if(Ke=it.payload,he=typeof Ke=="function"?Ke.call(Ut,Ce,he):Ke,he==null)break e;Ce=g({},Ce,he);break e;case 2:Wr=!0}}he=z.callback,he!==null&&(r.flags|=64,pe&&(r.flags|=8192),pe=x.callbacks,pe===null?x.callbacks=[he]:pe.push(he))}else pe={lane:he,tag:z.tag,payload:z.payload,callback:z.callback,next:null},ve===null?(de=ve=pe,X=Ce):ve=ve.next=pe,j|=he;if(z=z.next,z===null){if(z=x.shared.pending,z===null)break;pe=z,z=pe.next,pe.next=null,x.lastBaseUpdate=pe,x.shared.pending=null}}while(!0);ve===null&&(X=Ce),x.baseState=X,x.firstBaseUpdate=de,x.lastBaseUpdate=ve,_===null&&(x.shared.lanes=0),ea|=j,r.lanes=j,r.memoizedState=Ce}}function H1(r,o){if(typeof r!="function")throw Error(i(191,r));r.call(o)}function U1(r,o){var u=r.callbacks;if(u!==null)for(r.callbacks=null,r=0;r<u.length;r++)H1(u[r],o)}var Fo=U(null),cd=U(0);function F1(r,o){r=_r,re(cd,r),re(Fo,o),_r=r|o.baseLanes}function Fm(){re(cd,_r),re(Fo,Fo.current)}function qm(){_r=cd.current,F(Fo),F(cd)}var $n=U(null),oi=null;function Xr(r){var o=r.alternate;re(vs,vs.current&1),re($n,r),oi===null&&(o===null||Fo.current!==null||o.memoizedState!==null)&&(oi=r)}function Gm(r){re(vs,vs.current),re($n,r),oi===null&&(oi=r)}function q1(r){r.tag===22?(re(vs,vs.current),re($n,r),oi===null&&(oi=r)):Zr()}function Zr(){re(vs,vs.current),re($n,$n.current)}function Hn(r){F($n),oi===r&&(oi=null),F(vs)}var vs=U(0);function ud(r){for(var o=r;o!==null;){if(o.tag===13){var u=o.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||Zp(u)||Qp(u)))return o}else if(o.tag===19&&(o.memoizedProps.revealOrder==="forwards"||o.memoizedProps.revealOrder==="backwards"||o.memoizedProps.revealOrder==="unstable_legacy-backwards"||o.memoizedProps.revealOrder==="together")){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var fr=0,dt=null,$t=null,Cs=null,dd=!1,qo=!1,qa=!1,hd=0,nc=0,Go=null,VA=0;function ls(){throw Error(i(321))}function Vm(r,o){if(o===null)return!1;for(var u=0;u<o.length&&u<r.length;u++)if(!Pn(r[u],o[u]))return!1;return!0}function Wm(r,o,u,m,x,_){return fr=_,dt=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,I.H=r===null||r.memoizedState===null?Ey:lp,qa=!1,_=u(m,x),qa=!1,qo&&(_=V1(o,u,m,x)),G1(r),_}function G1(r){I.H=ac;var o=$t!==null&&$t.next!==null;if(fr=0,Cs=$t=dt=null,dd=!1,nc=0,Go=null,o)throw Error(i(300));r===null||Es||(r=r.dependencies,r!==null&&sd(r)&&(Es=!0))}function V1(r,o,u,m){dt=r;var x=0;do{if(qo&&(Go=null),nc=0,qo=!1,25<=x)throw Error(i(301));if(x+=1,Cs=$t=null,r.updateQueue!=null){var _=r.updateQueue;_.lastEffect=null,_.events=null,_.stores=null,_.memoCache!=null&&(_.memoCache.index=0)}I.H=jy,_=o(u,m)}while(qo);return _}function WA(){var r=I.H,o=r.useState()[0];return o=typeof o.then=="function"?ic(o):o,r=r.useState()[0],($t!==null?$t.memoizedState:null)!==r&&(dt.flags|=1024),o}function Km(){var r=hd!==0;return hd=0,r}function Ym(r,o,u){o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~u}function Xm(r){if(dd){for(r=r.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}dd=!1}fr=0,Cs=$t=dt=null,qo=!1,nc=hd=0,Go=null}function hn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Cs===null?dt.memoizedState=Cs=r:Cs=Cs.next=r,Cs}function ys(){if($t===null){var r=dt.alternate;r=r!==null?r.memoizedState:null}else r=$t.next;var o=Cs===null?dt.memoizedState:Cs.next;if(o!==null)Cs=o,$t=r;else{if(r===null)throw dt.alternate===null?Error(i(467)):Error(i(310));$t=r,r={memoizedState:$t.memoizedState,baseState:$t.baseState,baseQueue:$t.baseQueue,queue:$t.queue,next:null},Cs===null?dt.memoizedState=Cs=r:Cs=Cs.next=r}return Cs}function fd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ic(r){var o=nc;return nc+=1,Go===null&&(Go=[]),r=z1(Go,r,o),o=dt,(Cs===null?o.memoizedState:Cs.next)===null&&(o=o.alternate,I.H=o===null||o.memoizedState===null?Ey:lp),r}function md(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return ic(r);if(r.$$typeof===A)return Zs(r)}throw Error(i(438,String(r)))}function Zm(r){var o=null,u=dt.updateQueue;if(u!==null&&(o=u.memoCache),o==null){var m=dt.alternate;m!==null&&(m=m.updateQueue,m!==null&&(m=m.memoCache,m!=null&&(o={data:m.data.map(function(x){return x.slice()}),index:0})))}if(o==null&&(o={data:[],index:0}),u===null&&(u=fd(),dt.updateQueue=u),u.memoCache=o,u=o.data[o.index],u===void 0)for(u=o.data[o.index]=Array(r),m=0;m<r;m++)u[m]=D;return o.index++,u}function mr(r,o){return typeof o=="function"?o(r):o}function pd(r){var o=ys();return Qm(o,$t,r)}function Qm(r,o,u){var m=r.queue;if(m===null)throw Error(i(311));m.lastRenderedReducer=u;var x=r.baseQueue,_=m.pending;if(_!==null){if(x!==null){var j=x.next;x.next=_.next,_.next=j}o.baseQueue=x=_,m.pending=null}if(_=r.baseState,x===null)r.memoizedState=_;else{o=x.next;var z=j=null,X=null,de=o,ve=!1;do{var Ce=de.lane&-536870913;if(Ce!==de.lane?(_t&Ce)===Ce:(fr&Ce)===Ce){var he=de.revertLane;if(he===0)X!==null&&(X=X.next={lane:0,revertLane:0,gesture:null,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null}),Ce===Io&&(ve=!0);else if((fr&he)===he){de=de.next,he===Io&&(ve=!0);continue}else Ce={lane:0,revertLane:de.revertLane,gesture:null,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null},X===null?(z=X=Ce,j=_):X=X.next=Ce,dt.lanes|=he,ea|=he;Ce=de.action,qa&&u(_,Ce),_=de.hasEagerState?de.eagerState:u(_,Ce)}else he={lane:Ce,revertLane:de.revertLane,gesture:de.gesture,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null},X===null?(z=X=he,j=_):X=X.next=he,dt.lanes|=Ce,ea|=Ce;de=de.next}while(de!==null&&de!==o);if(X===null?j=_:X.next=z,!Pn(_,r.memoizedState)&&(Es=!0,ve&&(u=$o,u!==null)))throw u;r.memoizedState=_,r.baseState=j,r.baseQueue=X,m.lastRenderedState=_}return x===null&&(m.lanes=0),[r.memoizedState,m.dispatch]}function Jm(r){var o=ys(),u=o.queue;if(u===null)throw Error(i(311));u.lastRenderedReducer=r;var m=u.dispatch,x=u.pending,_=o.memoizedState;if(x!==null){u.pending=null;var j=x=x.next;do _=r(_,j.action),j=j.next;while(j!==x);Pn(_,o.memoizedState)||(Es=!0),o.memoizedState=_,o.baseQueue===null&&(o.baseState=_),u.lastRenderedState=_}return[_,m]}function W1(r,o,u){var m=dt,x=ys(),_=kt;if(_){if(u===void 0)throw Error(i(407));u=u()}else u=o();var j=!Pn(($t||x).memoizedState,u);if(j&&(x.memoizedState=u,Es=!0),x=x.queue,sp(X1.bind(null,m,x,r),[r]),x.getSnapshot!==o||j||Cs!==null&&Cs.memoizedState.tag&1){if(m.flags|=2048,Vo(9,{destroy:void 0},Y1.bind(null,m,x,u,o),null),Vt===null)throw Error(i(349));_||(fr&127)!==0||K1(m,o,u)}return u}function K1(r,o,u){r.flags|=16384,r={getSnapshot:o,value:u},o=dt.updateQueue,o===null?(o=fd(),dt.updateQueue=o,o.stores=[r]):(u=o.stores,u===null?o.stores=[r]:u.push(r))}function Y1(r,o,u,m){o.value=u,o.getSnapshot=m,Z1(o)&&Q1(r)}function X1(r,o,u){return u(function(){Z1(o)&&Q1(r)})}function Z1(r){var o=r.getSnapshot;r=r.value;try{var u=o();return!Pn(r,u)}catch{return!0}}function Q1(r){var o=Oa(r,2);o!==null&&An(o,r,2)}function ep(r){var o=hn();if(typeof r=="function"){var u=r;if(r=u(),qa){Re(!0);try{u()}finally{Re(!1)}}}return o.memoizedState=o.baseState=r,o.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:mr,lastRenderedState:r},o}function J1(r,o,u,m){return r.baseState=u,Qm(r,$t,typeof m=="function"?m:mr)}function KA(r,o,u,m,x){if(xd(r))throw Error(i(485));if(r=o.action,r!==null){var _={payload:x,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(j){_.listeners.push(j)}};I.T!==null?u(!0):_.isTransition=!1,m(_),u=o.pending,u===null?(_.next=o.pending=_,ey(o,_)):(_.next=u.next,o.pending=u.next=_)}}function ey(r,o){var u=o.action,m=o.payload,x=r.state;if(o.isTransition){var _=I.T,j={};I.T=j;try{var z=u(x,m),X=I.S;X!==null&&X(j,z),ty(r,o,z)}catch(de){tp(r,o,de)}finally{_!==null&&j.types!==null&&(_.types=j.types),I.T=_}}else try{_=u(x,m),ty(r,o,_)}catch(de){tp(r,o,de)}}function ty(r,o,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(m){sy(r,o,m)},function(m){return tp(r,o,m)}):sy(r,o,u)}function sy(r,o,u){o.status="fulfilled",o.value=u,ny(o),r.state=u,o=r.pending,o!==null&&(u=o.next,u===o?r.pending=null:(u=u.next,o.next=u,ey(r,u)))}function tp(r,o,u){var m=r.pending;if(r.pending=null,m!==null){m=m.next;do o.status="rejected",o.reason=u,ny(o),o=o.next;while(o!==m)}r.action=null}function ny(r){r=r.listeners;for(var o=0;o<r.length;o++)(0,r[o])()}function iy(r,o){return o}function ry(r,o){if(kt){var u=Vt.formState;if(u!==null){e:{var m=dt;if(kt){if(Xt){t:{for(var x=Xt,_=ai;x.nodeType!==8;){if(!_){x=null;break t}if(x=li(x.nextSibling),x===null){x=null;break t}}_=x.data,x=_==="F!"||_==="F"?x:null}if(x){Xt=li(x.nextSibling),m=x.data==="F!";break e}}Gr(m)}m=!1}m&&(o=u[0])}}return u=hn(),u.memoizedState=u.baseState=o,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:iy,lastRenderedState:o},u.queue=m,u=ky.bind(null,dt,m),m.dispatch=u,m=ep(!1),_=op.bind(null,dt,!1,m.queue),m=hn(),x={state:o,dispatch:null,action:r,pending:null},m.queue=x,u=KA.bind(null,dt,x,_,u),x.dispatch=u,m.memoizedState=r,[o,u,!1]}function ay(r){var o=ys();return oy(o,$t,r)}function oy(r,o,u){if(o=Qm(r,o,iy)[0],r=pd(mr)[0],typeof o=="object"&&o!==null&&typeof o.then=="function")try{var m=ic(o)}catch(j){throw j===Ho?rd:j}else m=o;o=ys();var x=o.queue,_=x.dispatch;return u!==o.memoizedState&&(dt.flags|=2048,Vo(9,{destroy:void 0},YA.bind(null,x,u),null)),[m,_,r]}function YA(r,o){r.action=o}function ly(r){var o=ys(),u=$t;if(u!==null)return oy(o,u,r);ys(),o=o.memoizedState,u=ys();var m=u.queue.dispatch;return u.memoizedState=r,[o,m,!1]}function Vo(r,o,u,m){return r={tag:r,create:u,deps:m,inst:o,next:null},o=dt.updateQueue,o===null&&(o=fd(),dt.updateQueue=o),u=o.lastEffect,u===null?o.lastEffect=r.next=r:(m=u.next,u.next=r,r.next=m,o.lastEffect=r),r}function cy(){return ys().memoizedState}function gd(r,o,u,m){var x=hn();dt.flags|=r,x.memoizedState=Vo(1|o,{destroy:void 0},u,m===void 0?null:m)}function bd(r,o,u,m){var x=ys();m=m===void 0?null:m;var _=x.memoizedState.inst;$t!==null&&m!==null&&Vm(m,$t.memoizedState.deps)?x.memoizedState=Vo(o,_,u,m):(dt.flags|=r,x.memoizedState=Vo(1|o,_,u,m))}function uy(r,o){gd(8390656,8,r,o)}function sp(r,o){bd(2048,8,r,o)}function XA(r){dt.flags|=4;var o=dt.updateQueue;if(o===null)o=fd(),dt.updateQueue=o,o.events=[r];else{var u=o.events;u===null?o.events=[r]:u.push(r)}}function dy(r){var o=ys().memoizedState;return XA({ref:o,nextImpl:r}),function(){if((Tt&2)!==0)throw Error(i(440));return o.impl.apply(void 0,arguments)}}function hy(r,o){return bd(4,2,r,o)}function fy(r,o){return bd(4,4,r,o)}function my(r,o){if(typeof o=="function"){r=r();var u=o(r);return function(){typeof u=="function"?u():o(null)}}if(o!=null)return r=r(),o.current=r,function(){o.current=null}}function py(r,o,u){u=u!=null?u.concat([r]):null,bd(4,4,my.bind(null,o,r),u)}function np(){}function gy(r,o){var u=ys();o=o===void 0?null:o;var m=u.memoizedState;return o!==null&&Vm(o,m[1])?m[0]:(u.memoizedState=[r,o],r)}function by(r,o){var u=ys();o=o===void 0?null:o;var m=u.memoizedState;if(o!==null&&Vm(o,m[1]))return m[0];if(m=r(),qa){Re(!0);try{r()}finally{Re(!1)}}return u.memoizedState=[m,o],m}function ip(r,o,u){return u===void 0||(fr&1073741824)!==0&&(_t&261930)===0?r.memoizedState=o:(r.memoizedState=u,r=x_(),dt.lanes|=r,ea|=r,u)}function xy(r,o,u,m){return Pn(u,o)?u:Fo.current!==null?(r=ip(r,u,m),Pn(r,o)||(Es=!0),r):(fr&42)===0||(fr&1073741824)!==0&&(_t&261930)===0?(Es=!0,r.memoizedState=u):(r=x_(),dt.lanes|=r,ea|=r,o)}function vy(r,o,u,m,x){var _=Y.p;Y.p=_!==0&&8>_?_:8;var j=I.T,z={};I.T=z,op(r,!1,o,u);try{var X=x(),de=I.S;if(de!==null&&de(z,X),X!==null&&typeof X=="object"&&typeof X.then=="function"){var ve=GA(X,m);rc(r,o,ve,qn(r))}else rc(r,o,m,qn(r))}catch(Ce){rc(r,o,{then:function(){},status:"rejected",reason:Ce},qn())}finally{Y.p=_,j!==null&&z.types!==null&&(j.types=z.types),I.T=j}}function ZA(){}function rp(r,o,u,m){if(r.tag!==5)throw Error(i(476));var x=yy(r).queue;vy(r,x,o,W,u===null?ZA:function(){return _y(r),u(m)})}function yy(r){var o=r.memoizedState;if(o!==null)return o;o={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mr,lastRenderedState:W},next:null};var u={};return o.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mr,lastRenderedState:u},next:null},r.memoizedState=o,r=r.alternate,r!==null&&(r.memoizedState=o),o}function _y(r){var o=yy(r);o.next===null&&(o=r.alternate.memoizedState),rc(r,o.next.queue,{},qn())}function ap(){return Zs(wc)}function wy(){return ys().memoizedState}function Sy(){return ys().memoizedState}function QA(r){for(var o=r.return;o!==null;){switch(o.tag){case 24:case 3:var u=qn();r=Kr(u);var m=Yr(o,r,u);m!==null&&(An(m,o,u),ec(m,o,u)),o={cache:Om()},r.payload=o;return}o=o.return}}function JA(r,o,u){var m=qn();u={lane:m,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},xd(r)?Ny(o,u):(u=km(r,o,u,m),u!==null&&(An(u,r,m),Cy(u,o,m)))}function ky(r,o,u){var m=qn();rc(r,o,u,m)}function rc(r,o,u,m){var x={lane:m,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(xd(r))Ny(o,x);else{var _=r.alternate;if(r.lanes===0&&(_===null||_.lanes===0)&&(_=o.lastRenderedReducer,_!==null))try{var j=o.lastRenderedState,z=_(j,u);if(x.hasEagerState=!0,x.eagerState=z,Pn(z,j))return Qu(r,o,x,0),Vt===null&&Zu(),!1}catch{}if(u=km(r,o,x,m),u!==null)return An(u,r,m),Cy(u,o,m),!0}return!1}function op(r,o,u,m){if(m={lane:2,revertLane:Ip(),gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},xd(r)){if(o)throw Error(i(479))}else o=km(r,u,m,2),o!==null&&An(o,r,2)}function xd(r){var o=r.alternate;return r===dt||o!==null&&o===dt}function Ny(r,o){qo=dd=!0;var u=r.pending;u===null?o.next=o:(o.next=u.next,u.next=o),r.pending=o}function Cy(r,o,u){if((u&4194048)!==0){var m=o.lanes;m&=r.pendingLanes,u|=m,o.lanes=u,ot(r,u)}}var ac={readContext:Zs,use:md,useCallback:ls,useContext:ls,useEffect:ls,useImperativeHandle:ls,useLayoutEffect:ls,useInsertionEffect:ls,useMemo:ls,useReducer:ls,useRef:ls,useState:ls,useDebugValue:ls,useDeferredValue:ls,useTransition:ls,useSyncExternalStore:ls,useId:ls,useHostTransitionStatus:ls,useFormState:ls,useActionState:ls,useOptimistic:ls,useMemoCache:ls,useCacheRefresh:ls};ac.useEffectEvent=ls;var Ey={readContext:Zs,use:md,useCallback:function(r,o){return hn().memoizedState=[r,o===void 0?null:o],r},useContext:Zs,useEffect:uy,useImperativeHandle:function(r,o,u){u=u!=null?u.concat([r]):null,gd(4194308,4,my.bind(null,o,r),u)},useLayoutEffect:function(r,o){return gd(4194308,4,r,o)},useInsertionEffect:function(r,o){gd(4,2,r,o)},useMemo:function(r,o){var u=hn();o=o===void 0?null:o;var m=r();if(qa){Re(!0);try{r()}finally{Re(!1)}}return u.memoizedState=[m,o],m},useReducer:function(r,o,u){var m=hn();if(u!==void 0){var x=u(o);if(qa){Re(!0);try{u(o)}finally{Re(!1)}}}else x=o;return m.memoizedState=m.baseState=x,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:x},m.queue=r,r=r.dispatch=JA.bind(null,dt,r),[m.memoizedState,r]},useRef:function(r){var o=hn();return r={current:r},o.memoizedState=r},useState:function(r){r=ep(r);var o=r.queue,u=ky.bind(null,dt,o);return o.dispatch=u,[r.memoizedState,u]},useDebugValue:np,useDeferredValue:function(r,o){var u=hn();return ip(u,r,o)},useTransition:function(){var r=ep(!1);return r=vy.bind(null,dt,r.queue,!0,!1),hn().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,o,u){var m=dt,x=hn();if(kt){if(u===void 0)throw Error(i(407));u=u()}else{if(u=o(),Vt===null)throw Error(i(349));(_t&127)!==0||K1(m,o,u)}x.memoizedState=u;var _={value:u,getSnapshot:o};return x.queue=_,uy(X1.bind(null,m,_,r),[r]),m.flags|=2048,Vo(9,{destroy:void 0},Y1.bind(null,m,_,u,o),null),u},useId:function(){var r=hn(),o=Vt.identifierPrefix;if(kt){var u=Pi,m=Bi;u=(m&~(1<<32-M(m)-1)).toString(32)+u,o="_"+o+"R_"+u,u=hd++,0<u&&(o+="H"+u.toString(32)),o+="_"}else u=VA++,o="_"+o+"r_"+u.toString(32)+"_";return r.memoizedState=o},useHostTransitionStatus:ap,useFormState:ry,useActionState:ry,useOptimistic:function(r){var o=hn();o.memoizedState=o.baseState=r;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return o.queue=u,o=op.bind(null,dt,!0,u),u.dispatch=o,[r,o]},useMemoCache:Zm,useCacheRefresh:function(){return hn().memoizedState=QA.bind(null,dt)},useEffectEvent:function(r){var o=hn(),u={impl:r};return o.memoizedState=u,function(){if((Tt&2)!==0)throw Error(i(440));return u.impl.apply(void 0,arguments)}}},lp={readContext:Zs,use:md,useCallback:gy,useContext:Zs,useEffect:sp,useImperativeHandle:py,useInsertionEffect:hy,useLayoutEffect:fy,useMemo:by,useReducer:pd,useRef:cy,useState:function(){return pd(mr)},useDebugValue:np,useDeferredValue:function(r,o){var u=ys();return xy(u,$t.memoizedState,r,o)},useTransition:function(){var r=pd(mr)[0],o=ys().memoizedState;return[typeof r=="boolean"?r:ic(r),o]},useSyncExternalStore:W1,useId:wy,useHostTransitionStatus:ap,useFormState:ay,useActionState:ay,useOptimistic:function(r,o){var u=ys();return J1(u,$t,r,o)},useMemoCache:Zm,useCacheRefresh:Sy};lp.useEffectEvent=dy;var jy={readContext:Zs,use:md,useCallback:gy,useContext:Zs,useEffect:sp,useImperativeHandle:py,useInsertionEffect:hy,useLayoutEffect:fy,useMemo:by,useReducer:Jm,useRef:cy,useState:function(){return Jm(mr)},useDebugValue:np,useDeferredValue:function(r,o){var u=ys();return $t===null?ip(u,r,o):xy(u,$t.memoizedState,r,o)},useTransition:function(){var r=Jm(mr)[0],o=ys().memoizedState;return[typeof r=="boolean"?r:ic(r),o]},useSyncExternalStore:W1,useId:wy,useHostTransitionStatus:ap,useFormState:ly,useActionState:ly,useOptimistic:function(r,o){var u=ys();return $t!==null?J1(u,$t,r,o):(u.baseState=r,[r,u.queue.dispatch])},useMemoCache:Zm,useCacheRefresh:Sy};jy.useEffectEvent=dy;function cp(r,o,u,m){o=r.memoizedState,u=u(m,o),u=u==null?o:g({},o,u),r.memoizedState=u,r.lanes===0&&(r.updateQueue.baseState=u)}var up={enqueueSetState:function(r,o,u){r=r._reactInternals;var m=qn(),x=Kr(m);x.payload=o,u!=null&&(x.callback=u),o=Yr(r,x,m),o!==null&&(An(o,r,m),ec(o,r,m))},enqueueReplaceState:function(r,o,u){r=r._reactInternals;var m=qn(),x=Kr(m);x.tag=1,x.payload=o,u!=null&&(x.callback=u),o=Yr(r,x,m),o!==null&&(An(o,r,m),ec(o,r,m))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var u=qn(),m=Kr(u);m.tag=2,o!=null&&(m.callback=o),o=Yr(r,m,u),o!==null&&(An(o,r,u),ec(o,r,u))}};function Ay(r,o,u,m,x,_,j){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(m,_,j):o.prototype&&o.prototype.isPureReactComponent?!Vl(u,m)||!Vl(x,_):!0}function Ty(r,o,u,m){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(u,m),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(u,m),o.state!==r&&up.enqueueReplaceState(o,o.state,null)}function Ga(r,o){var u=o;if("ref"in o){u={};for(var m in o)m!=="ref"&&(u[m]=o[m])}if(r=r.defaultProps){u===o&&(u=g({},u));for(var x in r)u[x]===void 0&&(u[x]=r[x])}return u}function Ry(r){Xu(r)}function My(r){console.error(r)}function Dy(r){Xu(r)}function vd(r,o){try{var u=r.onUncaughtError;u(o.value,{componentStack:o.stack})}catch(m){setTimeout(function(){throw m})}}function Ly(r,o,u){try{var m=r.onCaughtError;m(u.value,{componentStack:u.stack,errorBoundary:o.tag===1?o.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function dp(r,o,u){return u=Kr(u),u.tag=3,u.payload={element:null},u.callback=function(){vd(r,o)},u}function Oy(r){return r=Kr(r),r.tag=3,r}function zy(r,o,u,m){var x=u.type.getDerivedStateFromError;if(typeof x=="function"){var _=m.value;r.payload=function(){return x(_)},r.callback=function(){Ly(o,u,m)}}var j=u.stateNode;j!==null&&typeof j.componentDidCatch=="function"&&(r.callback=function(){Ly(o,u,m),typeof x!="function"&&(ta===null?ta=new Set([this]):ta.add(this));var z=m.stack;this.componentDidCatch(m.value,{componentStack:z!==null?z:""})})}function eT(r,o,u,m,x){if(u.flags|=32768,m!==null&&typeof m=="object"&&typeof m.then=="function"){if(o=u.alternate,o!==null&&Po(o,u,x,!0),u=$n.current,u!==null){switch(u.tag){case 31:case 13:return oi===null?Rd():u.alternate===null&&cs===0&&(cs=3),u.flags&=-257,u.flags|=65536,u.lanes=x,m===ad?u.flags|=16384:(o=u.updateQueue,o===null?u.updateQueue=new Set([m]):o.add(m),zp(r,m,x)),!1;case 22:return u.flags|=65536,m===ad?u.flags|=16384:(o=u.updateQueue,o===null?(o={transitions:null,markerInstances:null,retryQueue:new Set([m])},u.updateQueue=o):(u=o.retryQueue,u===null?o.retryQueue=new Set([m]):u.add(m)),zp(r,m,x)),!1}throw Error(i(435,u.tag))}return zp(r,m,x),Rd(),!1}if(kt)return o=$n.current,o!==null?((o.flags&65536)===0&&(o.flags|=256),o.flags|=65536,o.lanes=x,m!==Tm&&(r=Error(i(422),{cause:m}),Yl(ni(r,u)))):(m!==Tm&&(o=Error(i(423),{cause:m}),Yl(ni(o,u))),r=r.current.alternate,r.flags|=65536,x&=-x,r.lanes|=x,m=ni(m,u),x=dp(r.stateNode,m,x),Hm(r,x),cs!==4&&(cs=2)),!1;var _=Error(i(520),{cause:m});if(_=ni(_,u),mc===null?mc=[_]:mc.push(_),cs!==4&&(cs=2),o===null)return!0;m=ni(m,u),u=o;do{switch(u.tag){case 3:return u.flags|=65536,r=x&-x,u.lanes|=r,r=dp(u.stateNode,m,r),Hm(u,r),!1;case 1:if(o=u.type,_=u.stateNode,(u.flags&128)===0&&(typeof o.getDerivedStateFromError=="function"||_!==null&&typeof _.componentDidCatch=="function"&&(ta===null||!ta.has(_))))return u.flags|=65536,x&=-x,u.lanes|=x,x=Oy(x),zy(x,r,u,m),Hm(u,x),!1}u=u.return}while(u!==null);return!1}var hp=Error(i(461)),Es=!1;function Qs(r,o,u,m){o.child=r===null?$1(o,null,u,m):Fa(o,r.child,u,m)}function By(r,o,u,m,x){u=u.render;var _=o.ref;if("ref"in m){var j={};for(var z in m)z!=="ref"&&(j[z]=m[z])}else j=m;return Ia(o),m=Wm(r,o,u,j,_,x),z=Km(),r!==null&&!Es?(Ym(r,o,x),pr(r,o,x)):(kt&&z&&jm(o),o.flags|=1,Qs(r,o,m,x),o.child)}function Py(r,o,u,m,x){if(r===null){var _=u.type;return typeof _=="function"&&!Nm(_)&&_.defaultProps===void 0&&u.compare===null?(o.tag=15,o.type=_,Iy(r,o,_,m,x)):(r=ed(u.type,null,m,o,o.mode,x),r.ref=o.ref,r.return=o,o.child=r)}if(_=r.child,!yp(r,x)){var j=_.memoizedProps;if(u=u.compare,u=u!==null?u:Vl,u(j,m)&&r.ref===o.ref)return pr(r,o,x)}return o.flags|=1,r=cr(_,m),r.ref=o.ref,r.return=o,o.child=r}function Iy(r,o,u,m,x){if(r!==null){var _=r.memoizedProps;if(Vl(_,m)&&r.ref===o.ref)if(Es=!1,o.pendingProps=m=_,yp(r,x))(r.flags&131072)!==0&&(Es=!0);else return o.lanes=r.lanes,pr(r,o,x)}return fp(r,o,u,m,x)}function $y(r,o,u,m){var x=m.children,_=r!==null?r.memoizedState:null;if(r===null&&o.stateNode===null&&(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),m.mode==="hidden"){if((o.flags&128)!==0){if(_=_!==null?_.baseLanes|u:u,r!==null){for(m=o.child=r.child,x=0;m!==null;)x=x|m.lanes|m.childLanes,m=m.sibling;m=x&~_}else m=0,o.child=null;return Hy(r,o,_,u,m)}if((u&536870912)!==0)o.memoizedState={baseLanes:0,cachePool:null},r!==null&&id(o,_!==null?_.cachePool:null),_!==null?F1(o,_):Fm(),q1(o);else return m=o.lanes=536870912,Hy(r,o,_!==null?_.baseLanes|u:u,u,m)}else _!==null?(id(o,_.cachePool),F1(o,_),Zr(),o.memoizedState=null):(r!==null&&id(o,null),Fm(),Zr());return Qs(r,o,x,u),o.child}function oc(r,o){return r!==null&&r.tag===22||o.stateNode!==null||(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.sibling}function Hy(r,o,u,m,x){var _=Bm();return _=_===null?null:{parent:Ns._currentValue,pool:_},o.memoizedState={baseLanes:u,cachePool:_},r!==null&&id(o,null),Fm(),q1(o),r!==null&&Po(r,o,m,!0),o.childLanes=x,null}function yd(r,o){return o=wd({mode:o.mode,children:o.children},r.mode),o.ref=r.ref,r.child=o,o.return=r,o}function Uy(r,o,u){return Fa(o,r.child,null,u),r=yd(o,o.pendingProps),r.flags|=2,Hn(o),o.memoizedState=null,r}function tT(r,o,u){var m=o.pendingProps,x=(o.flags&128)!==0;if(o.flags&=-129,r===null){if(kt){if(m.mode==="hidden")return r=yd(o,m),o.lanes=536870912,oc(null,r);if(Gm(o),(r=Xt)?(r=ew(r,ai),r=r!==null&&r.data==="&"?r:null,r!==null&&(o.memoizedState={dehydrated:r,treeContext:Fr!==null?{id:Bi,overflow:Pi}:null,retryLane:536870912,hydrationErrors:null},u=N1(r),u.return=o,o.child=u,Xs=o,Xt=null)):r=null,r===null)throw Gr(o);return o.lanes=536870912,null}return yd(o,m)}var _=r.memoizedState;if(_!==null){var j=_.dehydrated;if(Gm(o),x)if(o.flags&256)o.flags&=-257,o=Uy(r,o,u);else if(o.memoizedState!==null)o.child=r.child,o.flags|=128,o=null;else throw Error(i(558));else if(Es||Po(r,o,u,!1),x=(u&r.childLanes)!==0,Es||x){if(m=Vt,m!==null&&(j=gs(m,u),j!==0&&j!==_.retryLane))throw _.retryLane=j,Oa(r,j),An(m,r,j),hp;Rd(),o=Uy(r,o,u)}else r=_.treeContext,Xt=li(j.nextSibling),Xs=o,kt=!0,qr=null,ai=!1,r!==null&&j1(o,r),o=yd(o,m),o.flags|=4096;return o}return r=cr(r.child,{mode:m.mode,children:m.children}),r.ref=o.ref,o.child=r,r.return=o,r}function _d(r,o){var u=o.ref;if(u===null)r!==null&&r.ref!==null&&(o.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(i(284));(r===null||r.ref!==u)&&(o.flags|=4194816)}}function fp(r,o,u,m,x){return Ia(o),u=Wm(r,o,u,m,void 0,x),m=Km(),r!==null&&!Es?(Ym(r,o,x),pr(r,o,x)):(kt&&m&&jm(o),o.flags|=1,Qs(r,o,u,x),o.child)}function Fy(r,o,u,m,x,_){return Ia(o),o.updateQueue=null,u=V1(o,m,u,x),G1(r),m=Km(),r!==null&&!Es?(Ym(r,o,_),pr(r,o,_)):(kt&&m&&jm(o),o.flags|=1,Qs(r,o,u,_),o.child)}function qy(r,o,u,m,x){if(Ia(o),o.stateNode===null){var _=Lo,j=u.contextType;typeof j=="object"&&j!==null&&(_=Zs(j)),_=new u(m,_),o.memoizedState=_.state!==null&&_.state!==void 0?_.state:null,_.updater=up,o.stateNode=_,_._reactInternals=o,_=o.stateNode,_.props=m,_.state=o.memoizedState,_.refs={},Im(o),j=u.contextType,_.context=typeof j=="object"&&j!==null?Zs(j):Lo,_.state=o.memoizedState,j=u.getDerivedStateFromProps,typeof j=="function"&&(cp(o,u,j,m),_.state=o.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof _.getSnapshotBeforeUpdate=="function"||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(j=_.state,typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount(),j!==_.state&&up.enqueueReplaceState(_,_.state,null),sc(o,m,_,x),tc(),_.state=o.memoizedState),typeof _.componentDidMount=="function"&&(o.flags|=4194308),m=!0}else if(r===null){_=o.stateNode;var z=o.memoizedProps,X=Ga(u,z);_.props=X;var de=_.context,ve=u.contextType;j=Lo,typeof ve=="object"&&ve!==null&&(j=Zs(ve));var Ce=u.getDerivedStateFromProps;ve=typeof Ce=="function"||typeof _.getSnapshotBeforeUpdate=="function",z=o.pendingProps!==z,ve||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(z||de!==j)&&Ty(o,_,m,j),Wr=!1;var he=o.memoizedState;_.state=he,sc(o,m,_,x),tc(),de=o.memoizedState,z||he!==de||Wr?(typeof Ce=="function"&&(cp(o,u,Ce,m),de=o.memoizedState),(X=Wr||Ay(o,u,X,m,he,de,j))?(ve||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount()),typeof _.componentDidMount=="function"&&(o.flags|=4194308)):(typeof _.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=m,o.memoizedState=de),_.props=m,_.state=de,_.context=j,m=X):(typeof _.componentDidMount=="function"&&(o.flags|=4194308),m=!1)}else{_=o.stateNode,$m(r,o),j=o.memoizedProps,ve=Ga(u,j),_.props=ve,Ce=o.pendingProps,he=_.context,de=u.contextType,X=Lo,typeof de=="object"&&de!==null&&(X=Zs(de)),z=u.getDerivedStateFromProps,(de=typeof z=="function"||typeof _.getSnapshotBeforeUpdate=="function")||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(j!==Ce||he!==X)&&Ty(o,_,m,X),Wr=!1,he=o.memoizedState,_.state=he,sc(o,m,_,x),tc();var pe=o.memoizedState;j!==Ce||he!==pe||Wr||r!==null&&r.dependencies!==null&&sd(r.dependencies)?(typeof z=="function"&&(cp(o,u,z,m),pe=o.memoizedState),(ve=Wr||Ay(o,u,ve,m,he,pe,X)||r!==null&&r.dependencies!==null&&sd(r.dependencies))?(de||typeof _.UNSAFE_componentWillUpdate!="function"&&typeof _.componentWillUpdate!="function"||(typeof _.componentWillUpdate=="function"&&_.componentWillUpdate(m,pe,X),typeof _.UNSAFE_componentWillUpdate=="function"&&_.UNSAFE_componentWillUpdate(m,pe,X)),typeof _.componentDidUpdate=="function"&&(o.flags|=4),typeof _.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof _.componentDidUpdate!="function"||j===r.memoizedProps&&he===r.memoizedState||(o.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||j===r.memoizedProps&&he===r.memoizedState||(o.flags|=1024),o.memoizedProps=m,o.memoizedState=pe),_.props=m,_.state=pe,_.context=X,m=ve):(typeof _.componentDidUpdate!="function"||j===r.memoizedProps&&he===r.memoizedState||(o.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||j===r.memoizedProps&&he===r.memoizedState||(o.flags|=1024),m=!1)}return _=m,_d(r,o),m=(o.flags&128)!==0,_||m?(_=o.stateNode,u=m&&typeof u.getDerivedStateFromError!="function"?null:_.render(),o.flags|=1,r!==null&&m?(o.child=Fa(o,r.child,null,x),o.child=Fa(o,null,u,x)):Qs(r,o,u,x),o.memoizedState=_.state,r=o.child):r=pr(r,o,x),r}function Gy(r,o,u,m){return Ba(),o.flags|=256,Qs(r,o,u,m),o.child}var mp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function pp(r){return{baseLanes:r,cachePool:L1()}}function gp(r,o,u){return r=r!==null?r.childLanes&~u:0,o&&(r|=Fn),r}function Vy(r,o,u){var m=o.pendingProps,x=!1,_=(o.flags&128)!==0,j;if((j=_)||(j=r!==null&&r.memoizedState===null?!1:(vs.current&2)!==0),j&&(x=!0,o.flags&=-129),j=(o.flags&32)!==0,o.flags&=-33,r===null){if(kt){if(x?Xr(o):Zr(),(r=Xt)?(r=ew(r,ai),r=r!==null&&r.data!=="&"?r:null,r!==null&&(o.memoizedState={dehydrated:r,treeContext:Fr!==null?{id:Bi,overflow:Pi}:null,retryLane:536870912,hydrationErrors:null},u=N1(r),u.return=o,o.child=u,Xs=o,Xt=null)):r=null,r===null)throw Gr(o);return Qp(r)?o.lanes=32:o.lanes=536870912,null}var z=m.children;return m=m.fallback,x?(Zr(),x=o.mode,z=wd({mode:"hidden",children:z},x),m=za(m,x,u,null),z.return=o,m.return=o,z.sibling=m,o.child=z,m=o.child,m.memoizedState=pp(u),m.childLanes=gp(r,j,u),o.memoizedState=mp,oc(null,m)):(Xr(o),bp(o,z))}var X=r.memoizedState;if(X!==null&&(z=X.dehydrated,z!==null)){if(_)o.flags&256?(Xr(o),o.flags&=-257,o=xp(r,o,u)):o.memoizedState!==null?(Zr(),o.child=r.child,o.flags|=128,o=null):(Zr(),z=m.fallback,x=o.mode,m=wd({mode:"visible",children:m.children},x),z=za(z,x,u,null),z.flags|=2,m.return=o,z.return=o,m.sibling=z,o.child=m,Fa(o,r.child,null,u),m=o.child,m.memoizedState=pp(u),m.childLanes=gp(r,j,u),o.memoizedState=mp,o=oc(null,m));else if(Xr(o),Qp(z)){if(j=z.nextSibling&&z.nextSibling.dataset,j)var de=j.dgst;j=de,m=Error(i(419)),m.stack="",m.digest=j,Yl({value:m,source:null,stack:null}),o=xp(r,o,u)}else if(Es||Po(r,o,u,!1),j=(u&r.childLanes)!==0,Es||j){if(j=Vt,j!==null&&(m=gs(j,u),m!==0&&m!==X.retryLane))throw X.retryLane=m,Oa(r,m),An(j,r,m),hp;Zp(z)||Rd(),o=xp(r,o,u)}else Zp(z)?(o.flags|=192,o.child=r.child,o=null):(r=X.treeContext,Xt=li(z.nextSibling),Xs=o,kt=!0,qr=null,ai=!1,r!==null&&j1(o,r),o=bp(o,m.children),o.flags|=4096);return o}return x?(Zr(),z=m.fallback,x=o.mode,X=r.child,de=X.sibling,m=cr(X,{mode:"hidden",children:m.children}),m.subtreeFlags=X.subtreeFlags&65011712,de!==null?z=cr(de,z):(z=za(z,x,u,null),z.flags|=2),z.return=o,m.return=o,m.sibling=z,o.child=m,oc(null,m),m=o.child,z=r.child.memoizedState,z===null?z=pp(u):(x=z.cachePool,x!==null?(X=Ns._currentValue,x=x.parent!==X?{parent:X,pool:X}:x):x=L1(),z={baseLanes:z.baseLanes|u,cachePool:x}),m.memoizedState=z,m.childLanes=gp(r,j,u),o.memoizedState=mp,oc(r.child,m)):(Xr(o),u=r.child,r=u.sibling,u=cr(u,{mode:"visible",children:m.children}),u.return=o,u.sibling=null,r!==null&&(j=o.deletions,j===null?(o.deletions=[r],o.flags|=16):j.push(r)),o.child=u,o.memoizedState=null,u)}function bp(r,o){return o=wd({mode:"visible",children:o},r.mode),o.return=r,r.child=o}function wd(r,o){return r=In(22,r,null,o),r.lanes=0,r}function xp(r,o,u){return Fa(o,r.child,null,u),r=bp(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function Wy(r,o,u){r.lanes|=o;var m=r.alternate;m!==null&&(m.lanes|=o),Dm(r.return,o,u)}function vp(r,o,u,m,x,_){var j=r.memoizedState;j===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:m,tail:u,tailMode:x,treeForkCount:_}:(j.isBackwards=o,j.rendering=null,j.renderingStartTime=0,j.last=m,j.tail=u,j.tailMode=x,j.treeForkCount=_)}function Ky(r,o,u){var m=o.pendingProps,x=m.revealOrder,_=m.tail;m=m.children;var j=vs.current,z=(j&2)!==0;if(z?(j=j&1|2,o.flags|=128):j&=1,re(vs,j),Qs(r,o,m,u),m=kt?Kl:0,!z&&r!==null&&(r.flags&128)!==0)e:for(r=o.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Wy(r,u,o);else if(r.tag===19)Wy(r,u,o);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break e;for(;r.sibling===null;){if(r.return===null||r.return===o)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(x){case"forwards":for(u=o.child,x=null;u!==null;)r=u.alternate,r!==null&&ud(r)===null&&(x=u),u=u.sibling;u=x,u===null?(x=o.child,o.child=null):(x=u.sibling,u.sibling=null),vp(o,!1,x,u,_,m);break;case"backwards":case"unstable_legacy-backwards":for(u=null,x=o.child,o.child=null;x!==null;){if(r=x.alternate,r!==null&&ud(r)===null){o.child=x;break}r=x.sibling,x.sibling=u,u=x,x=r}vp(o,!0,u,null,_,m);break;case"together":vp(o,!1,null,null,void 0,m);break;default:o.memoizedState=null}return o.child}function pr(r,o,u){if(r!==null&&(o.dependencies=r.dependencies),ea|=o.lanes,(u&o.childLanes)===0)if(r!==null){if(Po(r,o,u,!1),(u&o.childLanes)===0)return null}else return null;if(r!==null&&o.child!==r.child)throw Error(i(153));if(o.child!==null){for(r=o.child,u=cr(r,r.pendingProps),o.child=u,u.return=o;r.sibling!==null;)r=r.sibling,u=u.sibling=cr(r,r.pendingProps),u.return=o;u.sibling=null}return o.child}function yp(r,o){return(r.lanes&o)!==0?!0:(r=r.dependencies,!!(r!==null&&sd(r)))}function sT(r,o,u){switch(o.tag){case 3:Ee(o,o.stateNode.containerInfo),Vr(o,Ns,r.memoizedState.cache),Ba();break;case 27:case 5:Ye(o);break;case 4:Ee(o,o.stateNode.containerInfo);break;case 10:Vr(o,o.type,o.memoizedProps.value);break;case 31:if(o.memoizedState!==null)return o.flags|=128,Gm(o),null;break;case 13:var m=o.memoizedState;if(m!==null)return m.dehydrated!==null?(Xr(o),o.flags|=128,null):(u&o.child.childLanes)!==0?Vy(r,o,u):(Xr(o),r=pr(r,o,u),r!==null?r.sibling:null);Xr(o);break;case 19:var x=(r.flags&128)!==0;if(m=(u&o.childLanes)!==0,m||(Po(r,o,u,!1),m=(u&o.childLanes)!==0),x){if(m)return Ky(r,o,u);o.flags|=128}if(x=o.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),re(vs,vs.current),m)break;return null;case 22:return o.lanes=0,$y(r,o,u,o.pendingProps);case 24:Vr(o,Ns,r.memoizedState.cache)}return pr(r,o,u)}function Yy(r,o,u){if(r!==null)if(r.memoizedProps!==o.pendingProps)Es=!0;else{if(!yp(r,u)&&(o.flags&128)===0)return Es=!1,sT(r,o,u);Es=(r.flags&131072)!==0}else Es=!1,kt&&(o.flags&1048576)!==0&&E1(o,Kl,o.index);switch(o.lanes=0,o.tag){case 16:e:{var m=o.pendingProps;if(r=Ha(o.elementType),o.type=r,typeof r=="function")Nm(r)?(m=Ga(r,m),o.tag=1,o=qy(null,o,r,m,u)):(o.tag=0,o=fp(null,o,r,m,u));else{if(r!=null){var x=r.$$typeof;if(x===C){o.tag=11,o=By(null,o,r,m,u);break e}else if(x===H){o.tag=14,o=Py(null,o,r,m,u);break e}}throw o=V(r)||r,Error(i(306,o,""))}}return o;case 0:return fp(r,o,o.type,o.pendingProps,u);case 1:return m=o.type,x=Ga(m,o.pendingProps),qy(r,o,m,x,u);case 3:e:{if(Ee(o,o.stateNode.containerInfo),r===null)throw Error(i(387));m=o.pendingProps;var _=o.memoizedState;x=_.element,$m(r,o),sc(o,m,null,u);var j=o.memoizedState;if(m=j.cache,Vr(o,Ns,m),m!==_.cache&&Lm(o,[Ns],u,!0),tc(),m=j.element,_.isDehydrated)if(_={element:m,isDehydrated:!1,cache:j.cache},o.updateQueue.baseState=_,o.memoizedState=_,o.flags&256){o=Gy(r,o,m,u);break e}else if(m!==x){x=ni(Error(i(424)),o),Yl(x),o=Gy(r,o,m,u);break e}else for(r=o.stateNode.containerInfo,r.nodeType===9?r=r.body:r=r.nodeName==="HTML"?r.ownerDocument.body:r,Xt=li(r.firstChild),Xs=o,kt=!0,qr=null,ai=!0,u=$1(o,null,m,u),o.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(Ba(),m===x){o=pr(r,o,u);break e}Qs(r,o,m,u)}o=o.child}return o;case 26:return _d(r,o),r===null?(u=aw(o.type,null,o.pendingProps,null))?o.memoizedState=u:kt||(u=o.type,r=o.pendingProps,m=Pd(te.current).createElement(u),m[bs]=o,m[nn]=r,Js(m,u,r),Ss(m),o.stateNode=m):o.memoizedState=aw(o.type,r.memoizedProps,o.pendingProps,r.memoizedState),null;case 27:return Ye(o),r===null&&kt&&(m=o.stateNode=nw(o.type,o.pendingProps,te.current),Xs=o,ai=!0,x=Xt,ra(o.type)?(Jp=x,Xt=li(m.firstChild)):Xt=x),Qs(r,o,o.pendingProps.children,u),_d(r,o),r===null&&(o.flags|=4194304),o.child;case 5:return r===null&&kt&&((x=m=Xt)&&(m=MT(m,o.type,o.pendingProps,ai),m!==null?(o.stateNode=m,Xs=o,Xt=li(m.firstChild),ai=!1,x=!0):x=!1),x||Gr(o)),Ye(o),x=o.type,_=o.pendingProps,j=r!==null?r.memoizedProps:null,m=_.children,Kp(x,_)?m=null:j!==null&&Kp(x,j)&&(o.flags|=32),o.memoizedState!==null&&(x=Wm(r,o,WA,null,null,u),wc._currentValue=x),_d(r,o),Qs(r,o,m,u),o.child;case 6:return r===null&&kt&&((r=u=Xt)&&(u=DT(u,o.pendingProps,ai),u!==null?(o.stateNode=u,Xs=o,Xt=null,r=!0):r=!1),r||Gr(o)),null;case 13:return Vy(r,o,u);case 4:return Ee(o,o.stateNode.containerInfo),m=o.pendingProps,r===null?o.child=Fa(o,null,m,u):Qs(r,o,m,u),o.child;case 11:return By(r,o,o.type,o.pendingProps,u);case 7:return Qs(r,o,o.pendingProps,u),o.child;case 8:return Qs(r,o,o.pendingProps.children,u),o.child;case 12:return Qs(r,o,o.pendingProps.children,u),o.child;case 10:return m=o.pendingProps,Vr(o,o.type,m.value),Qs(r,o,m.children,u),o.child;case 9:return x=o.type._context,m=o.pendingProps.children,Ia(o),x=Zs(x),m=m(x),o.flags|=1,Qs(r,o,m,u),o.child;case 14:return Py(r,o,o.type,o.pendingProps,u);case 15:return Iy(r,o,o.type,o.pendingProps,u);case 19:return Ky(r,o,u);case 31:return tT(r,o,u);case 22:return $y(r,o,u,o.pendingProps);case 24:return Ia(o),m=Zs(Ns),r===null?(x=Bm(),x===null&&(x=Vt,_=Om(),x.pooledCache=_,_.refCount++,_!==null&&(x.pooledCacheLanes|=u),x=_),o.memoizedState={parent:m,cache:x},Im(o),Vr(o,Ns,x)):((r.lanes&u)!==0&&($m(r,o),sc(o,null,null,u),tc()),x=r.memoizedState,_=o.memoizedState,x.parent!==m?(x={parent:m,cache:m},o.memoizedState=x,o.lanes===0&&(o.memoizedState=o.updateQueue.baseState=x),Vr(o,Ns,m)):(m=_.cache,Vr(o,Ns,m),m!==x.cache&&Lm(o,[Ns],u,!0))),Qs(r,o,o.pendingProps.children,u),o.child;case 29:throw o.pendingProps}throw Error(i(156,o.tag))}function gr(r){r.flags|=4}function _p(r,o,u,m,x){if((o=(r.mode&32)!==0)&&(o=!1),o){if(r.flags|=16777216,(x&335544128)===x)if(r.stateNode.complete)r.flags|=8192;else if(w_())r.flags|=8192;else throw Ua=ad,Pm}else r.flags&=-16777217}function Xy(r,o){if(o.type!=="stylesheet"||(o.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!dw(o))if(w_())r.flags|=8192;else throw Ua=ad,Pm}function Sd(r,o){o!==null&&(r.flags|=4),r.flags&16384&&(o=r.tag!==22?Pe():536870912,r.lanes|=o,Xo|=o)}function lc(r,o){if(!kt)switch(r.tailMode){case"hidden":o=r.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?r.tail=null:u.sibling=null;break;case"collapsed":u=r.tail;for(var m=null;u!==null;)u.alternate!==null&&(m=u),u=u.sibling;m===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:m.sibling=null}}function Zt(r){var o=r.alternate!==null&&r.alternate.child===r.child,u=0,m=0;if(o)for(var x=r.child;x!==null;)u|=x.lanes|x.childLanes,m|=x.subtreeFlags&65011712,m|=x.flags&65011712,x.return=r,x=x.sibling;else for(x=r.child;x!==null;)u|=x.lanes|x.childLanes,m|=x.subtreeFlags,m|=x.flags,x.return=r,x=x.sibling;return r.subtreeFlags|=m,r.childLanes=u,o}function nT(r,o,u){var m=o.pendingProps;switch(Am(o),o.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Zt(o),null;case 1:return Zt(o),null;case 3:return u=o.stateNode,m=null,r!==null&&(m=r.memoizedState.cache),o.memoizedState.cache!==m&&(o.flags|=2048),hr(Ns),De(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(r===null||r.child===null)&&(Bo(o)?gr(o):r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,Rm())),Zt(o),null;case 26:var x=o.type,_=o.memoizedState;return r===null?(gr(o),_!==null?(Zt(o),Xy(o,_)):(Zt(o),_p(o,x,null,m,u))):_?_!==r.memoizedState?(gr(o),Zt(o),Xy(o,_)):(Zt(o),o.flags&=-16777217):(r=r.memoizedProps,r!==m&&gr(o),Zt(o),_p(o,x,r,m,u)),null;case 27:if(we(o),u=te.current,x=o.type,r!==null&&o.stateNode!=null)r.memoizedProps!==m&&gr(o);else{if(!m){if(o.stateNode===null)throw Error(i(166));return Zt(o),null}r=fe.current,Bo(o)?A1(o):(r=nw(x,m,u),o.stateNode=r,gr(o))}return Zt(o),null;case 5:if(we(o),x=o.type,r!==null&&o.stateNode!=null)r.memoizedProps!==m&&gr(o);else{if(!m){if(o.stateNode===null)throw Error(i(166));return Zt(o),null}if(_=fe.current,Bo(o))A1(o);else{var j=Pd(te.current);switch(_){case 1:_=j.createElementNS("http://www.w3.org/2000/svg",x);break;case 2:_=j.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;default:switch(x){case"svg":_=j.createElementNS("http://www.w3.org/2000/svg",x);break;case"math":_=j.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;case"script":_=j.createElement("div"),_.innerHTML="<script><\/script>",_=_.removeChild(_.firstChild);break;case"select":_=typeof m.is=="string"?j.createElement("select",{is:m.is}):j.createElement("select"),m.multiple?_.multiple=!0:m.size&&(_.size=m.size);break;default:_=typeof m.is=="string"?j.createElement(x,{is:m.is}):j.createElement(x)}}_[bs]=o,_[nn]=m;e:for(j=o.child;j!==null;){if(j.tag===5||j.tag===6)_.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===o)break e;for(;j.sibling===null;){if(j.return===null||j.return===o)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}o.stateNode=_;e:switch(Js(_,x,m),x){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}m&&gr(o)}}return Zt(o),_p(o,o.type,r===null?null:r.memoizedProps,o.pendingProps,u),null;case 6:if(r&&o.stateNode!=null)r.memoizedProps!==m&&gr(o);else{if(typeof m!="string"&&o.stateNode===null)throw Error(i(166));if(r=te.current,Bo(o)){if(r=o.stateNode,u=o.memoizedProps,m=null,x=Xs,x!==null)switch(x.tag){case 27:case 5:m=x.memoizedProps}r[bs]=o,r=!!(r.nodeValue===u||m!==null&&m.suppressHydrationWarning===!0||V_(r.nodeValue,u)),r||Gr(o,!0)}else r=Pd(r).createTextNode(m),r[bs]=o,o.stateNode=r}return Zt(o),null;case 31:if(u=o.memoizedState,r===null||r.memoizedState!==null){if(m=Bo(o),u!==null){if(r===null){if(!m)throw Error(i(318));if(r=o.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(557));r[bs]=o}else Ba(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Zt(o),r=!1}else u=Rm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=u),r=!0;if(!r)return o.flags&256?(Hn(o),o):(Hn(o),null);if((o.flags&128)!==0)throw Error(i(558))}return Zt(o),null;case 13:if(m=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(x=Bo(o),m!==null&&m.dehydrated!==null){if(r===null){if(!x)throw Error(i(318));if(x=o.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(i(317));x[bs]=o}else Ba(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Zt(o),x=!1}else x=Rm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=x),x=!0;if(!x)return o.flags&256?(Hn(o),o):(Hn(o),null)}return Hn(o),(o.flags&128)!==0?(o.lanes=u,o):(u=m!==null,r=r!==null&&r.memoizedState!==null,u&&(m=o.child,x=null,m.alternate!==null&&m.alternate.memoizedState!==null&&m.alternate.memoizedState.cachePool!==null&&(x=m.alternate.memoizedState.cachePool.pool),_=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(_=m.memoizedState.cachePool.pool),_!==x&&(m.flags|=2048)),u!==r&&u&&(o.child.flags|=8192),Sd(o,o.updateQueue),Zt(o),null);case 4:return De(),r===null&&Fp(o.stateNode.containerInfo),Zt(o),null;case 10:return hr(o.type),Zt(o),null;case 19:if(F(vs),m=o.memoizedState,m===null)return Zt(o),null;if(x=(o.flags&128)!==0,_=m.rendering,_===null)if(x)lc(m,!1);else{if(cs!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(_=ud(r),_!==null){for(o.flags|=128,lc(m,!1),r=_.updateQueue,o.updateQueue=r,Sd(o,r),o.subtreeFlags=0,r=u,u=o.child;u!==null;)k1(u,r),u=u.sibling;return re(vs,vs.current&1|2),kt&&ur(o,m.treeForkCount),o.child}r=r.sibling}m.tail!==null&&Lt()>jd&&(o.flags|=128,x=!0,lc(m,!1),o.lanes=4194304)}else{if(!x)if(r=ud(_),r!==null){if(o.flags|=128,x=!0,r=r.updateQueue,o.updateQueue=r,Sd(o,r),lc(m,!0),m.tail===null&&m.tailMode==="hidden"&&!_.alternate&&!kt)return Zt(o),null}else 2*Lt()-m.renderingStartTime>jd&&u!==536870912&&(o.flags|=128,x=!0,lc(m,!1),o.lanes=4194304);m.isBackwards?(_.sibling=o.child,o.child=_):(r=m.last,r!==null?r.sibling=_:o.child=_,m.last=_)}return m.tail!==null?(r=m.tail,m.rendering=r,m.tail=r.sibling,m.renderingStartTime=Lt(),r.sibling=null,u=vs.current,re(vs,x?u&1|2:u&1),kt&&ur(o,m.treeForkCount),r):(Zt(o),null);case 22:case 23:return Hn(o),qm(),m=o.memoizedState!==null,r!==null?r.memoizedState!==null!==m&&(o.flags|=8192):m&&(o.flags|=8192),m?(u&536870912)!==0&&(o.flags&128)===0&&(Zt(o),o.subtreeFlags&6&&(o.flags|=8192)):Zt(o),u=o.updateQueue,u!==null&&Sd(o,u.retryQueue),u=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),m=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(m=o.memoizedState.cachePool.pool),m!==u&&(o.flags|=2048),r!==null&&F($a),null;case 24:return u=null,r!==null&&(u=r.memoizedState.cache),o.memoizedState.cache!==u&&(o.flags|=2048),hr(Ns),Zt(o),null;case 25:return null;case 30:return null}throw Error(i(156,o.tag))}function iT(r,o){switch(Am(o),o.tag){case 1:return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return hr(Ns),De(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 26:case 27:case 5:return we(o),null;case 31:if(o.memoizedState!==null){if(Hn(o),o.alternate===null)throw Error(i(340));Ba()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 13:if(Hn(o),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(i(340));Ba()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return F(vs),null;case 4:return De(),null;case 10:return hr(o.type),null;case 22:case 23:return Hn(o),qm(),r!==null&&F($a),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 24:return hr(Ns),null;case 25:return null;default:return null}}function Zy(r,o){switch(Am(o),o.tag){case 3:hr(Ns),De();break;case 26:case 27:case 5:we(o);break;case 4:De();break;case 31:o.memoizedState!==null&&Hn(o);break;case 13:Hn(o);break;case 19:F(vs);break;case 10:hr(o.type);break;case 22:case 23:Hn(o),qm(),r!==null&&F($a);break;case 24:hr(Ns)}}function cc(r,o){try{var u=o.updateQueue,m=u!==null?u.lastEffect:null;if(m!==null){var x=m.next;u=x;do{if((u.tag&r)===r){m=void 0;var _=u.create,j=u.inst;m=_(),j.destroy=m}u=u.next}while(u!==x)}}catch(z){Pt(o,o.return,z)}}function Qr(r,o,u){try{var m=o.updateQueue,x=m!==null?m.lastEffect:null;if(x!==null){var _=x.next;m=_;do{if((m.tag&r)===r){var j=m.inst,z=j.destroy;if(z!==void 0){j.destroy=void 0,x=o;var X=u,de=z;try{de()}catch(ve){Pt(x,X,ve)}}}m=m.next}while(m!==_)}}catch(ve){Pt(o,o.return,ve)}}function Qy(r){var o=r.updateQueue;if(o!==null){var u=r.stateNode;try{U1(o,u)}catch(m){Pt(r,r.return,m)}}}function Jy(r,o,u){u.props=Ga(r.type,r.memoizedProps),u.state=r.memoizedState;try{u.componentWillUnmount()}catch(m){Pt(r,o,m)}}function uc(r,o){try{var u=r.ref;if(u!==null){switch(r.tag){case 26:case 27:case 5:var m=r.stateNode;break;case 30:m=r.stateNode;break;default:m=r.stateNode}typeof u=="function"?r.refCleanup=u(m):u.current=m}}catch(x){Pt(r,o,x)}}function Ii(r,o){var u=r.ref,m=r.refCleanup;if(u!==null)if(typeof m=="function")try{m()}catch(x){Pt(r,o,x)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(x){Pt(r,o,x)}else u.current=null}function e_(r){var o=r.type,u=r.memoizedProps,m=r.stateNode;try{e:switch(o){case"button":case"input":case"select":case"textarea":u.autoFocus&&m.focus();break e;case"img":u.src?m.src=u.src:u.srcSet&&(m.srcset=u.srcSet)}}catch(x){Pt(r,r.return,x)}}function wp(r,o,u){try{var m=r.stateNode;CT(m,r.type,u,o),m[nn]=o}catch(x){Pt(r,r.return,x)}}function t_(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&ra(r.type)||r.tag===4}function Sp(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||t_(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&ra(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function kp(r,o,u){var m=r.tag;if(m===5||m===6)r=r.stateNode,o?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(r,o):(o=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,o.appendChild(r),u=u._reactRootContainer,u!=null||o.onclick!==null||(o.onclick=Ie));else if(m!==4&&(m===27&&ra(r.type)&&(u=r.stateNode,o=null),r=r.child,r!==null))for(kp(r,o,u),r=r.sibling;r!==null;)kp(r,o,u),r=r.sibling}function kd(r,o,u){var m=r.tag;if(m===5||m===6)r=r.stateNode,o?u.insertBefore(r,o):u.appendChild(r);else if(m!==4&&(m===27&&ra(r.type)&&(u=r.stateNode),r=r.child,r!==null))for(kd(r,o,u),r=r.sibling;r!==null;)kd(r,o,u),r=r.sibling}function s_(r){var o=r.stateNode,u=r.memoizedProps;try{for(var m=r.type,x=o.attributes;x.length;)o.removeAttributeNode(x[0]);Js(o,m,u),o[bs]=r,o[nn]=u}catch(_){Pt(r,r.return,_)}}var br=!1,js=!1,Np=!1,n_=typeof WeakSet=="function"?WeakSet:Set,Us=null;function rT(r,o){if(r=r.containerInfo,Vp=Gd,r=p1(r),xm(r)){if("selectionStart"in r)var u={start:r.selectionStart,end:r.selectionEnd};else e:{u=(u=r.ownerDocument)&&u.defaultView||window;var m=u.getSelection&&u.getSelection();if(m&&m.rangeCount!==0){u=m.anchorNode;var x=m.anchorOffset,_=m.focusNode;m=m.focusOffset;try{u.nodeType,_.nodeType}catch{u=null;break e}var j=0,z=-1,X=-1,de=0,ve=0,Ce=r,he=null;t:for(;;){for(var pe;Ce!==u||x!==0&&Ce.nodeType!==3||(z=j+x),Ce!==_||m!==0&&Ce.nodeType!==3||(X=j+m),Ce.nodeType===3&&(j+=Ce.nodeValue.length),(pe=Ce.firstChild)!==null;)he=Ce,Ce=pe;for(;;){if(Ce===r)break t;if(he===u&&++de===x&&(z=j),he===_&&++ve===m&&(X=j),(pe=Ce.nextSibling)!==null)break;Ce=he,he=Ce.parentNode}Ce=pe}u=z===-1||X===-1?null:{start:z,end:X}}else u=null}u=u||{start:0,end:0}}else u=null;for(Wp={focusedElem:r,selectionRange:u},Gd=!1,Us=o;Us!==null;)if(o=Us,r=o.child,(o.subtreeFlags&1028)!==0&&r!==null)r.return=o,Us=r;else for(;Us!==null;){switch(o=Us,_=o.alternate,r=o.flags,o.tag){case 0:if((r&4)!==0&&(r=o.updateQueue,r=r!==null?r.events:null,r!==null))for(u=0;u<r.length;u++)x=r[u],x.ref.impl=x.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&_!==null){r=void 0,u=o,x=_.memoizedProps,_=_.memoizedState,m=u.stateNode;try{var Ke=Ga(u.type,x);r=m.getSnapshotBeforeUpdate(Ke,_),m.__reactInternalSnapshotBeforeUpdate=r}catch(it){Pt(u,u.return,it)}}break;case 3:if((r&1024)!==0){if(r=o.stateNode.containerInfo,u=r.nodeType,u===9)Xp(r);else if(u===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":Xp(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(i(163))}if(r=o.sibling,r!==null){r.return=o.return,Us=r;break}Us=o.return}}function i_(r,o,u){var m=u.flags;switch(u.tag){case 0:case 11:case 15:vr(r,u),m&4&&cc(5,u);break;case 1:if(vr(r,u),m&4)if(r=u.stateNode,o===null)try{r.componentDidMount()}catch(j){Pt(u,u.return,j)}else{var x=Ga(u.type,o.memoizedProps);o=o.memoizedState;try{r.componentDidUpdate(x,o,r.__reactInternalSnapshotBeforeUpdate)}catch(j){Pt(u,u.return,j)}}m&64&&Qy(u),m&512&&uc(u,u.return);break;case 3:if(vr(r,u),m&64&&(r=u.updateQueue,r!==null)){if(o=null,u.child!==null)switch(u.child.tag){case 27:case 5:o=u.child.stateNode;break;case 1:o=u.child.stateNode}try{U1(r,o)}catch(j){Pt(u,u.return,j)}}break;case 27:o===null&&m&4&&s_(u);case 26:case 5:vr(r,u),o===null&&m&4&&e_(u),m&512&&uc(u,u.return);break;case 12:vr(r,u);break;case 31:vr(r,u),m&4&&o_(r,u);break;case 13:vr(r,u),m&4&&l_(r,u),m&64&&(r=u.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(u=mT.bind(null,u),LT(r,u))));break;case 22:if(m=u.memoizedState!==null||br,!m){o=o!==null&&o.memoizedState!==null||js,x=br;var _=js;br=m,(js=o)&&!_?yr(r,u,(u.subtreeFlags&8772)!==0):vr(r,u),br=x,js=_}break;case 30:break;default:vr(r,u)}}function r_(r){var o=r.alternate;o!==null&&(r.alternate=null,r_(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&Ll(o)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var ss=null,Nn=!1;function xr(r,o,u){for(u=u.child;u!==null;)a_(r,o,u),u=u.sibling}function a_(r,o,u){if(oe&&typeof oe.onCommitFiberUnmount=="function")try{oe.onCommitFiberUnmount(_e,u)}catch{}switch(u.tag){case 26:js||Ii(u,o),xr(r,o,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:js||Ii(u,o);var m=ss,x=Nn;ra(u.type)&&(ss=u.stateNode,Nn=!1),xr(r,o,u),vc(u.stateNode),ss=m,Nn=x;break;case 5:js||Ii(u,o);case 6:if(m=ss,x=Nn,ss=null,xr(r,o,u),ss=m,Nn=x,ss!==null)if(Nn)try{(ss.nodeType===9?ss.body:ss.nodeName==="HTML"?ss.ownerDocument.body:ss).removeChild(u.stateNode)}catch(_){Pt(u,o,_)}else try{ss.removeChild(u.stateNode)}catch(_){Pt(u,o,_)}break;case 18:ss!==null&&(Nn?(r=ss,Q_(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,u.stateNode),il(r)):Q_(ss,u.stateNode));break;case 4:m=ss,x=Nn,ss=u.stateNode.containerInfo,Nn=!0,xr(r,o,u),ss=m,Nn=x;break;case 0:case 11:case 14:case 15:Qr(2,u,o),js||Qr(4,u,o),xr(r,o,u);break;case 1:js||(Ii(u,o),m=u.stateNode,typeof m.componentWillUnmount=="function"&&Jy(u,o,m)),xr(r,o,u);break;case 21:xr(r,o,u);break;case 22:js=(m=js)||u.memoizedState!==null,xr(r,o,u),js=m;break;default:xr(r,o,u)}}function o_(r,o){if(o.memoizedState===null&&(r=o.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{il(r)}catch(u){Pt(o,o.return,u)}}}function l_(r,o){if(o.memoizedState===null&&(r=o.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{il(r)}catch(u){Pt(o,o.return,u)}}function aT(r){switch(r.tag){case 31:case 13:case 19:var o=r.stateNode;return o===null&&(o=r.stateNode=new n_),o;case 22:return r=r.stateNode,o=r._retryCache,o===null&&(o=r._retryCache=new n_),o;default:throw Error(i(435,r.tag))}}function Nd(r,o){var u=aT(r);o.forEach(function(m){if(!u.has(m)){u.add(m);var x=pT.bind(null,r,m);m.then(x,x)}})}function Cn(r,o){var u=o.deletions;if(u!==null)for(var m=0;m<u.length;m++){var x=u[m],_=r,j=o,z=j;e:for(;z!==null;){switch(z.tag){case 27:if(ra(z.type)){ss=z.stateNode,Nn=!1;break e}break;case 5:ss=z.stateNode,Nn=!1;break e;case 3:case 4:ss=z.stateNode.containerInfo,Nn=!0;break e}z=z.return}if(ss===null)throw Error(i(160));a_(_,j,x),ss=null,Nn=!1,_=x.alternate,_!==null&&(_.return=null),x.return=null}if(o.subtreeFlags&13886)for(o=o.child;o!==null;)c_(o,r),o=o.sibling}var Ni=null;function c_(r,o){var u=r.alternate,m=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Cn(o,r),En(r),m&4&&(Qr(3,r,r.return),cc(3,r),Qr(5,r,r.return));break;case 1:Cn(o,r),En(r),m&512&&(js||u===null||Ii(u,u.return)),m&64&&br&&(r=r.updateQueue,r!==null&&(m=r.callbacks,m!==null&&(u=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=u===null?m:u.concat(m))));break;case 26:var x=Ni;if(Cn(o,r),En(r),m&512&&(js||u===null||Ii(u,u.return)),m&4){var _=u!==null?u.memoizedState:null;if(m=r.memoizedState,u===null)if(m===null)if(r.stateNode===null){e:{m=r.type,u=r.memoizedProps,x=x.ownerDocument||x;t:switch(m){case"title":_=x.getElementsByTagName("title")[0],(!_||_[Aa]||_[bs]||_.namespaceURI==="http://www.w3.org/2000/svg"||_.hasAttribute("itemprop"))&&(_=x.createElement(m),x.head.insertBefore(_,x.querySelector("head > title"))),Js(_,m,u),_[bs]=r,Ss(_),m=_;break e;case"link":var j=cw("link","href",x).get(m+(u.href||""));if(j){for(var z=0;z<j.length;z++)if(_=j[z],_.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&_.getAttribute("rel")===(u.rel==null?null:u.rel)&&_.getAttribute("title")===(u.title==null?null:u.title)&&_.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){j.splice(z,1);break t}}_=x.createElement(m),Js(_,m,u),x.head.appendChild(_);break;case"meta":if(j=cw("meta","content",x).get(m+(u.content||""))){for(z=0;z<j.length;z++)if(_=j[z],_.getAttribute("content")===(u.content==null?null:""+u.content)&&_.getAttribute("name")===(u.name==null?null:u.name)&&_.getAttribute("property")===(u.property==null?null:u.property)&&_.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&_.getAttribute("charset")===(u.charSet==null?null:u.charSet)){j.splice(z,1);break t}}_=x.createElement(m),Js(_,m,u),x.head.appendChild(_);break;default:throw Error(i(468,m))}_[bs]=r,Ss(_),m=_}r.stateNode=m}else uw(x,r.type,r.stateNode);else r.stateNode=lw(x,m,r.memoizedProps);else _!==m?(_===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):_.count--,m===null?uw(x,r.type,r.stateNode):lw(x,m,r.memoizedProps)):m===null&&r.stateNode!==null&&wp(r,r.memoizedProps,u.memoizedProps)}break;case 27:Cn(o,r),En(r),m&512&&(js||u===null||Ii(u,u.return)),u!==null&&m&4&&wp(r,r.memoizedProps,u.memoizedProps);break;case 5:if(Cn(o,r),En(r),m&512&&(js||u===null||Ii(u,u.return)),r.flags&32){x=r.stateNode;try{rt(x,"")}catch(Ke){Pt(r,r.return,Ke)}}m&4&&r.stateNode!=null&&(x=r.memoizedProps,wp(r,x,u!==null?u.memoizedProps:x)),m&1024&&(Np=!0);break;case 6:if(Cn(o,r),En(r),m&4){if(r.stateNode===null)throw Error(i(162));m=r.memoizedProps,u=r.stateNode;try{u.nodeValue=m}catch(Ke){Pt(r,r.return,Ke)}}break;case 3:if(Hd=null,x=Ni,Ni=Id(o.containerInfo),Cn(o,r),Ni=x,En(r),m&4&&u!==null&&u.memoizedState.isDehydrated)try{il(o.containerInfo)}catch(Ke){Pt(r,r.return,Ke)}Np&&(Np=!1,u_(r));break;case 4:m=Ni,Ni=Id(r.stateNode.containerInfo),Cn(o,r),En(r),Ni=m;break;case 12:Cn(o,r),En(r);break;case 31:Cn(o,r),En(r),m&4&&(m=r.updateQueue,m!==null&&(r.updateQueue=null,Nd(r,m)));break;case 13:Cn(o,r),En(r),r.child.flags&8192&&r.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(Ed=Lt()),m&4&&(m=r.updateQueue,m!==null&&(r.updateQueue=null,Nd(r,m)));break;case 22:x=r.memoizedState!==null;var X=u!==null&&u.memoizedState!==null,de=br,ve=js;if(br=de||x,js=ve||X,Cn(o,r),js=ve,br=de,En(r),m&8192)e:for(o=r.stateNode,o._visibility=x?o._visibility&-2:o._visibility|1,x&&(u===null||X||br||js||Va(r)),u=null,o=r;;){if(o.tag===5||o.tag===26){if(u===null){X=u=o;try{if(_=X.stateNode,x)j=_.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none";else{z=X.stateNode;var Ce=X.memoizedProps.style,he=Ce!=null&&Ce.hasOwnProperty("display")?Ce.display:null;z.style.display=he==null||typeof he=="boolean"?"":(""+he).trim()}}catch(Ke){Pt(X,X.return,Ke)}}}else if(o.tag===6){if(u===null){X=o;try{X.stateNode.nodeValue=x?"":X.memoizedProps}catch(Ke){Pt(X,X.return,Ke)}}}else if(o.tag===18){if(u===null){X=o;try{var pe=X.stateNode;x?J_(pe,!0):J_(X.stateNode,!1)}catch(Ke){Pt(X,X.return,Ke)}}}else if((o.tag!==22&&o.tag!==23||o.memoizedState===null||o===r)&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break e;for(;o.sibling===null;){if(o.return===null||o.return===r)break e;u===o&&(u=null),o=o.return}u===o&&(u=null),o.sibling.return=o.return,o=o.sibling}m&4&&(m=r.updateQueue,m!==null&&(u=m.retryQueue,u!==null&&(m.retryQueue=null,Nd(r,u))));break;case 19:Cn(o,r),En(r),m&4&&(m=r.updateQueue,m!==null&&(r.updateQueue=null,Nd(r,m)));break;case 30:break;case 21:break;default:Cn(o,r),En(r)}}function En(r){var o=r.flags;if(o&2){try{for(var u,m=r.return;m!==null;){if(t_(m)){u=m;break}m=m.return}if(u==null)throw Error(i(160));switch(u.tag){case 27:var x=u.stateNode,_=Sp(r);kd(r,_,x);break;case 5:var j=u.stateNode;u.flags&32&&(rt(j,""),u.flags&=-33);var z=Sp(r);kd(r,z,j);break;case 3:case 4:var X=u.stateNode.containerInfo,de=Sp(r);kp(r,de,X);break;default:throw Error(i(161))}}catch(ve){Pt(r,r.return,ve)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function u_(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var o=r;u_(o),o.tag===5&&o.flags&1024&&o.stateNode.reset(),r=r.sibling}}function vr(r,o){if(o.subtreeFlags&8772)for(o=o.child;o!==null;)i_(r,o.alternate,o),o=o.sibling}function Va(r){for(r=r.child;r!==null;){var o=r;switch(o.tag){case 0:case 11:case 14:case 15:Qr(4,o,o.return),Va(o);break;case 1:Ii(o,o.return);var u=o.stateNode;typeof u.componentWillUnmount=="function"&&Jy(o,o.return,u),Va(o);break;case 27:vc(o.stateNode);case 26:case 5:Ii(o,o.return),Va(o);break;case 22:o.memoizedState===null&&Va(o);break;case 30:Va(o);break;default:Va(o)}r=r.sibling}}function yr(r,o,u){for(u=u&&(o.subtreeFlags&8772)!==0,o=o.child;o!==null;){var m=o.alternate,x=r,_=o,j=_.flags;switch(_.tag){case 0:case 11:case 15:yr(x,_,u),cc(4,_);break;case 1:if(yr(x,_,u),m=_,x=m.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(de){Pt(m,m.return,de)}if(m=_,x=m.updateQueue,x!==null){var z=m.stateNode;try{var X=x.shared.hiddenCallbacks;if(X!==null)for(x.shared.hiddenCallbacks=null,x=0;x<X.length;x++)H1(X[x],z)}catch(de){Pt(m,m.return,de)}}u&&j&64&&Qy(_),uc(_,_.return);break;case 27:s_(_);case 26:case 5:yr(x,_,u),u&&m===null&&j&4&&e_(_),uc(_,_.return);break;case 12:yr(x,_,u);break;case 31:yr(x,_,u),u&&j&4&&o_(x,_);break;case 13:yr(x,_,u),u&&j&4&&l_(x,_);break;case 22:_.memoizedState===null&&yr(x,_,u),uc(_,_.return);break;case 30:break;default:yr(x,_,u)}o=o.sibling}}function Cp(r,o){var u=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),r=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(r=o.memoizedState.cachePool.pool),r!==u&&(r!=null&&r.refCount++,u!=null&&Xl(u))}function Ep(r,o){r=null,o.alternate!==null&&(r=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==r&&(o.refCount++,r!=null&&Xl(r))}function Ci(r,o,u,m){if(o.subtreeFlags&10256)for(o=o.child;o!==null;)d_(r,o,u,m),o=o.sibling}function d_(r,o,u,m){var x=o.flags;switch(o.tag){case 0:case 11:case 15:Ci(r,o,u,m),x&2048&&cc(9,o);break;case 1:Ci(r,o,u,m);break;case 3:Ci(r,o,u,m),x&2048&&(r=null,o.alternate!==null&&(r=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==r&&(o.refCount++,r!=null&&Xl(r)));break;case 12:if(x&2048){Ci(r,o,u,m),r=o.stateNode;try{var _=o.memoizedProps,j=_.id,z=_.onPostCommit;typeof z=="function"&&z(j,o.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(X){Pt(o,o.return,X)}}else Ci(r,o,u,m);break;case 31:Ci(r,o,u,m);break;case 13:Ci(r,o,u,m);break;case 23:break;case 22:_=o.stateNode,j=o.alternate,o.memoizedState!==null?_._visibility&2?Ci(r,o,u,m):dc(r,o):_._visibility&2?Ci(r,o,u,m):(_._visibility|=2,Wo(r,o,u,m,(o.subtreeFlags&10256)!==0||!1)),x&2048&&Cp(j,o);break;case 24:Ci(r,o,u,m),x&2048&&Ep(o.alternate,o);break;default:Ci(r,o,u,m)}}function Wo(r,o,u,m,x){for(x=x&&((o.subtreeFlags&10256)!==0||!1),o=o.child;o!==null;){var _=r,j=o,z=u,X=m,de=j.flags;switch(j.tag){case 0:case 11:case 15:Wo(_,j,z,X,x),cc(8,j);break;case 23:break;case 22:var ve=j.stateNode;j.memoizedState!==null?ve._visibility&2?Wo(_,j,z,X,x):dc(_,j):(ve._visibility|=2,Wo(_,j,z,X,x)),x&&de&2048&&Cp(j.alternate,j);break;case 24:Wo(_,j,z,X,x),x&&de&2048&&Ep(j.alternate,j);break;default:Wo(_,j,z,X,x)}o=o.sibling}}function dc(r,o){if(o.subtreeFlags&10256)for(o=o.child;o!==null;){var u=r,m=o,x=m.flags;switch(m.tag){case 22:dc(u,m),x&2048&&Cp(m.alternate,m);break;case 24:dc(u,m),x&2048&&Ep(m.alternate,m);break;default:dc(u,m)}o=o.sibling}}var hc=8192;function Ko(r,o,u){if(r.subtreeFlags&hc)for(r=r.child;r!==null;)h_(r,o,u),r=r.sibling}function h_(r,o,u){switch(r.tag){case 26:Ko(r,o,u),r.flags&hc&&r.memoizedState!==null&&VT(u,Ni,r.memoizedState,r.memoizedProps);break;case 5:Ko(r,o,u);break;case 3:case 4:var m=Ni;Ni=Id(r.stateNode.containerInfo),Ko(r,o,u),Ni=m;break;case 22:r.memoizedState===null&&(m=r.alternate,m!==null&&m.memoizedState!==null?(m=hc,hc=16777216,Ko(r,o,u),hc=m):Ko(r,o,u));break;default:Ko(r,o,u)}}function f_(r){var o=r.alternate;if(o!==null&&(r=o.child,r!==null)){o.child=null;do o=r.sibling,r.sibling=null,r=o;while(r!==null)}}function fc(r){var o=r.deletions;if((r.flags&16)!==0){if(o!==null)for(var u=0;u<o.length;u++){var m=o[u];Us=m,p_(m,r)}f_(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)m_(r),r=r.sibling}function m_(r){switch(r.tag){case 0:case 11:case 15:fc(r),r.flags&2048&&Qr(9,r,r.return);break;case 3:fc(r);break;case 12:fc(r);break;case 22:var o=r.stateNode;r.memoizedState!==null&&o._visibility&2&&(r.return===null||r.return.tag!==13)?(o._visibility&=-3,Cd(r)):fc(r);break;default:fc(r)}}function Cd(r){var o=r.deletions;if((r.flags&16)!==0){if(o!==null)for(var u=0;u<o.length;u++){var m=o[u];Us=m,p_(m,r)}f_(r)}for(r=r.child;r!==null;){switch(o=r,o.tag){case 0:case 11:case 15:Qr(8,o,o.return),Cd(o);break;case 22:u=o.stateNode,u._visibility&2&&(u._visibility&=-3,Cd(o));break;default:Cd(o)}r=r.sibling}}function p_(r,o){for(;Us!==null;){var u=Us;switch(u.tag){case 0:case 11:case 15:Qr(8,u,o);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var m=u.memoizedState.cachePool.pool;m!=null&&m.refCount++}break;case 24:Xl(u.memoizedState.cache)}if(m=u.child,m!==null)m.return=u,Us=m;else e:for(u=r;Us!==null;){m=Us;var x=m.sibling,_=m.return;if(r_(m),m===u){Us=null;break e}if(x!==null){x.return=_,Us=x;break e}Us=_}}}var oT={getCacheForType:function(r){var o=Zs(Ns),u=o.data.get(r);return u===void 0&&(u=r(),o.data.set(r,u)),u},cacheSignal:function(){return Zs(Ns).controller.signal}},lT=typeof WeakMap=="function"?WeakMap:Map,Tt=0,Vt=null,xt=null,_t=0,Bt=0,Un=null,Jr=!1,Yo=!1,jp=!1,_r=0,cs=0,ea=0,Wa=0,Ap=0,Fn=0,Xo=0,mc=null,jn=null,Tp=!1,Ed=0,g_=0,jd=1/0,Ad=null,ta=null,Ds=0,sa=null,Zo=null,wr=0,Rp=0,Mp=null,b_=null,pc=0,Dp=null;function qn(){return(Tt&2)!==0&&_t!==0?_t&-_t:I.T!==null?Ip():So()}function x_(){if(Fn===0)if((_t&536870912)===0||kt){var r=Ae;Ae<<=1,(Ae&3932160)===0&&(Ae=262144),Fn=r}else Fn=536870912;return r=$n.current,r!==null&&(r.flags|=32),Fn}function An(r,o,u){(r===Vt&&(Bt===2||Bt===9)||r.cancelPendingCommit!==null)&&(Qo(r,0),na(r,_t,Fn,!1)),Mt(r,u),((Tt&2)===0||r!==Vt)&&(r===Vt&&((Tt&2)===0&&(Wa|=u),cs===4&&na(r,_t,Fn,!1)),$i(r))}function v_(r,o,u){if((Tt&6)!==0)throw Error(i(327));var m=!u&&(o&127)===0&&(o&r.expiredLanes)===0||ne(r,o),x=m?dT(r,o):Op(r,o,!0),_=m;do{if(x===0){Yo&&!m&&na(r,o,0,!1);break}else{if(u=r.current.alternate,_&&!cT(u)){x=Op(r,o,!1),_=!1;continue}if(x===2){if(_=o,r.errorRecoveryDisabledLanes&_)var j=0;else j=r.pendingLanes&-536870913,j=j!==0?j:j&536870912?536870912:0;if(j!==0){o=j;e:{var z=r;x=mc;var X=z.current.memoizedState.isDehydrated;if(X&&(Qo(z,j).flags|=256),j=Op(z,j,!1),j!==2){if(jp&&!X){z.errorRecoveryDisabledLanes|=_,Wa|=_,x=4;break e}_=jn,jn=x,_!==null&&(jn===null?jn=_:jn.push.apply(jn,_))}x=j}if(_=!1,x!==2)continue}}if(x===1){Qo(r,0),na(r,o,0,!0);break}e:{switch(m=r,_=x,_){case 0:case 1:throw Error(i(345));case 4:if((o&4194048)!==o)break;case 6:na(m,o,Fn,!Jr);break e;case 2:jn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((o&62914560)===o&&(x=Ed+300-Lt(),10<x)){if(na(m,o,Fn,!Jr),q(m,0,!0)!==0)break e;wr=o,m.timeoutHandle=X_(y_.bind(null,m,u,jn,Ad,Tp,o,Fn,Wa,Xo,Jr,_,"Throttled",-0,0),x);break e}y_(m,u,jn,Ad,Tp,o,Fn,Wa,Xo,Jr,_,null,-0,0)}}break}while(!0);$i(r)}function y_(r,o,u,m,x,_,j,z,X,de,ve,Ce,he,pe){if(r.timeoutHandle=-1,Ce=o.subtreeFlags,Ce&8192||(Ce&16785408)===16785408){Ce={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ie},h_(o,_,Ce);var Ke=(_&62914560)===_?Ed-Lt():(_&4194048)===_?g_-Lt():0;if(Ke=WT(Ce,Ke),Ke!==null){wr=_,r.cancelPendingCommit=Ke(j_.bind(null,r,o,_,u,m,x,j,z,X,ve,Ce,null,he,pe)),na(r,_,j,!de);return}}j_(r,o,_,u,m,x,j,z,X)}function cT(r){for(var o=r;;){var u=o.tag;if((u===0||u===11||u===15)&&o.flags&16384&&(u=o.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var m=0;m<u.length;m++){var x=u[m],_=x.getSnapshot;x=x.value;try{if(!Pn(_(),x))return!1}catch{return!1}}if(u=o.child,o.subtreeFlags&16384&&u!==null)u.return=o,o=u;else{if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function na(r,o,u,m){o&=~Ap,o&=~Wa,r.suspendedLanes|=o,r.pingedLanes&=~o,m&&(r.warmLanes|=o),m=r.expirationTimes;for(var x=o;0<x;){var _=31-M(x),j=1<<_;m[_]=-1,x&=~j}u!==0&&Ue(r,u,o)}function Td(){return(Tt&6)===0?(gc(0),!1):!0}function Lp(){if(xt!==null){if(Bt===0)var r=xt.return;else r=xt,dr=Pa=null,Xm(r),Uo=null,Ql=0,r=xt;for(;r!==null;)Zy(r.alternate,r),r=r.return;xt=null}}function Qo(r,o){var u=r.timeoutHandle;u!==-1&&(r.timeoutHandle=-1,AT(u)),u=r.cancelPendingCommit,u!==null&&(r.cancelPendingCommit=null,u()),wr=0,Lp(),Vt=r,xt=u=cr(r.current,null),_t=o,Bt=0,Un=null,Jr=!1,Yo=ne(r,o),jp=!1,Xo=Fn=Ap=Wa=ea=cs=0,jn=mc=null,Tp=!1,(o&8)!==0&&(o|=o&32);var m=r.entangledLanes;if(m!==0)for(r=r.entanglements,m&=o;0<m;){var x=31-M(m),_=1<<x;o|=r[x],m&=~_}return _r=o,Zu(),u}function __(r,o){dt=null,I.H=ac,o===Ho||o===rd?(o=B1(),Bt=3):o===Pm?(o=B1(),Bt=4):Bt=o===hp?8:o!==null&&typeof o=="object"&&typeof o.then=="function"?6:1,Un=o,xt===null&&(cs=1,vd(r,ni(o,r.current)))}function w_(){var r=$n.current;return r===null?!0:(_t&4194048)===_t?oi===null:(_t&62914560)===_t||(_t&536870912)!==0?r===oi:!1}function S_(){var r=I.H;return I.H=ac,r===null?ac:r}function k_(){var r=I.A;return I.A=oT,r}function Rd(){cs=4,Jr||(_t&4194048)!==_t&&$n.current!==null||(Yo=!0),(ea&134217727)===0&&(Wa&134217727)===0||Vt===null||na(Vt,_t,Fn,!1)}function Op(r,o,u){var m=Tt;Tt|=2;var x=S_(),_=k_();(Vt!==r||_t!==o)&&(Ad=null,Qo(r,o)),o=!1;var j=cs;e:do try{if(Bt!==0&&xt!==null){var z=xt,X=Un;switch(Bt){case 8:Lp(),j=6;break e;case 3:case 2:case 9:case 6:$n.current===null&&(o=!0);var de=Bt;if(Bt=0,Un=null,Jo(r,z,X,de),u&&Yo){j=0;break e}break;default:de=Bt,Bt=0,Un=null,Jo(r,z,X,de)}}uT(),j=cs;break}catch(ve){__(r,ve)}while(!0);return o&&r.shellSuspendCounter++,dr=Pa=null,Tt=m,I.H=x,I.A=_,xt===null&&(Vt=null,_t=0,Zu()),j}function uT(){for(;xt!==null;)N_(xt)}function dT(r,o){var u=Tt;Tt|=2;var m=S_(),x=k_();Vt!==r||_t!==o?(Ad=null,jd=Lt()+500,Qo(r,o)):Yo=ne(r,o);e:do try{if(Bt!==0&&xt!==null){o=xt;var _=Un;t:switch(Bt){case 1:Bt=0,Un=null,Jo(r,o,_,1);break;case 2:case 9:if(O1(_)){Bt=0,Un=null,C_(o);break}o=function(){Bt!==2&&Bt!==9||Vt!==r||(Bt=7),$i(r)},_.then(o,o);break e;case 3:Bt=7;break e;case 4:Bt=5;break e;case 7:O1(_)?(Bt=0,Un=null,C_(o)):(Bt=0,Un=null,Jo(r,o,_,7));break;case 5:var j=null;switch(xt.tag){case 26:j=xt.memoizedState;case 5:case 27:var z=xt;if(j?dw(j):z.stateNode.complete){Bt=0,Un=null;var X=z.sibling;if(X!==null)xt=X;else{var de=z.return;de!==null?(xt=de,Md(de)):xt=null}break t}}Bt=0,Un=null,Jo(r,o,_,5);break;case 6:Bt=0,Un=null,Jo(r,o,_,6);break;case 8:Lp(),cs=6;break e;default:throw Error(i(462))}}hT();break}catch(ve){__(r,ve)}while(!0);return dr=Pa=null,I.H=m,I.A=x,Tt=u,xt!==null?0:(Vt=null,_t=0,Zu(),cs)}function hT(){for(;xt!==null&&!ei();)N_(xt)}function N_(r){var o=Yy(r.alternate,r,_r);r.memoizedProps=r.pendingProps,o===null?Md(r):xt=o}function C_(r){var o=r,u=o.alternate;switch(o.tag){case 15:case 0:o=Fy(u,o,o.pendingProps,o.type,void 0,_t);break;case 11:o=Fy(u,o,o.pendingProps,o.type.render,o.ref,_t);break;case 5:Xm(o);default:Zy(u,o),o=xt=k1(o,_r),o=Yy(u,o,_r)}r.memoizedProps=r.pendingProps,o===null?Md(r):xt=o}function Jo(r,o,u,m){dr=Pa=null,Xm(o),Uo=null,Ql=0;var x=o.return;try{if(eT(r,x,o,u,_t)){cs=1,vd(r,ni(u,r.current)),xt=null;return}}catch(_){if(x!==null)throw xt=x,_;cs=1,vd(r,ni(u,r.current)),xt=null;return}o.flags&32768?(kt||m===1?r=!0:Yo||(_t&536870912)!==0?r=!1:(Jr=r=!0,(m===2||m===9||m===3||m===6)&&(m=$n.current,m!==null&&m.tag===13&&(m.flags|=16384))),E_(o,r)):Md(o)}function Md(r){var o=r;do{if((o.flags&32768)!==0){E_(o,Jr);return}r=o.return;var u=nT(o.alternate,o,_r);if(u!==null){xt=u;return}if(o=o.sibling,o!==null){xt=o;return}xt=o=r}while(o!==null);cs===0&&(cs=5)}function E_(r,o){do{var u=iT(r.alternate,r);if(u!==null){u.flags&=32767,xt=u;return}if(u=r.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!o&&(r=r.sibling,r!==null)){xt=r;return}xt=r=u}while(r!==null);cs=6,xt=null}function j_(r,o,u,m,x,_,j,z,X){r.cancelPendingCommit=null;do Dd();while(Ds!==0);if((Tt&6)!==0)throw Error(i(327));if(o!==null){if(o===r.current)throw Error(i(177));if(_=o.lanes|o.childLanes,_|=Sm,qe(r,u,_,j,z,X),r===Vt&&(xt=Vt=null,_t=0),Zo=o,sa=r,wr=u,Rp=_,Mp=x,b_=m,(o.subtreeFlags&10256)!==0||(o.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,gT(tt,function(){return D_(),null})):(r.callbackNode=null,r.callbackPriority=0),m=(o.flags&13878)!==0,(o.subtreeFlags&13878)!==0||m){m=I.T,I.T=null,x=Y.p,Y.p=2,j=Tt,Tt|=4;try{rT(r,o,u)}finally{Tt=j,Y.p=x,I.T=m}}Ds=1,A_(),T_(),R_()}}function A_(){if(Ds===1){Ds=0;var r=sa,o=Zo,u=(o.flags&13878)!==0;if((o.subtreeFlags&13878)!==0||u){u=I.T,I.T=null;var m=Y.p;Y.p=2;var x=Tt;Tt|=4;try{c_(o,r);var _=Wp,j=p1(r.containerInfo),z=_.focusedElem,X=_.selectionRange;if(j!==z&&z&&z.ownerDocument&&m1(z.ownerDocument.documentElement,z)){if(X!==null&&xm(z)){var de=X.start,ve=X.end;if(ve===void 0&&(ve=de),"selectionStart"in z)z.selectionStart=de,z.selectionEnd=Math.min(ve,z.value.length);else{var Ce=z.ownerDocument||document,he=Ce&&Ce.defaultView||window;if(he.getSelection){var pe=he.getSelection(),Ke=z.textContent.length,it=Math.min(X.start,Ke),Ut=X.end===void 0?it:Math.min(X.end,Ke);!pe.extend&&it>Ut&&(j=Ut,Ut=it,it=j);var ie=f1(z,it),Q=f1(z,Ut);if(ie&&Q&&(pe.rangeCount!==1||pe.anchorNode!==ie.node||pe.anchorOffset!==ie.offset||pe.focusNode!==Q.node||pe.focusOffset!==Q.offset)){var ue=Ce.createRange();ue.setStart(ie.node,ie.offset),pe.removeAllRanges(),it>Ut?(pe.addRange(ue),pe.extend(Q.node,Q.offset)):(ue.setEnd(Q.node,Q.offset),pe.addRange(ue))}}}}for(Ce=[],pe=z;pe=pe.parentNode;)pe.nodeType===1&&Ce.push({element:pe,left:pe.scrollLeft,top:pe.scrollTop});for(typeof z.focus=="function"&&z.focus(),z=0;z<Ce.length;z++){var ke=Ce[z];ke.element.scrollLeft=ke.left,ke.element.scrollTop=ke.top}}Gd=!!Vp,Wp=Vp=null}finally{Tt=x,Y.p=m,I.T=u}}r.current=o,Ds=2}}function T_(){if(Ds===2){Ds=0;var r=sa,o=Zo,u=(o.flags&8772)!==0;if((o.subtreeFlags&8772)!==0||u){u=I.T,I.T=null;var m=Y.p;Y.p=2;var x=Tt;Tt|=4;try{i_(r,o.alternate,o)}finally{Tt=x,Y.p=m,I.T=u}}Ds=3}}function R_(){if(Ds===4||Ds===3){Ds=0,On();var r=sa,o=Zo,u=wr,m=b_;(o.subtreeFlags&10256)!==0||(o.flags&10256)!==0?Ds=5:(Ds=0,Zo=sa=null,M_(r,r.pendingLanes));var x=r.pendingLanes;if(x===0&&(ta=null),ir(u),o=o.stateNode,oe&&typeof oe.onCommitFiberRoot=="function")try{oe.onCommitFiberRoot(_e,o,void 0,(o.current.flags&128)===128)}catch{}if(m!==null){o=I.T,x=Y.p,Y.p=2,I.T=null;try{for(var _=r.onRecoverableError,j=0;j<m.length;j++){var z=m[j];_(z.value,{componentStack:z.stack})}}finally{I.T=o,Y.p=x}}(wr&3)!==0&&Dd(),$i(r),x=r.pendingLanes,(u&261930)!==0&&(x&42)!==0?r===Dp?pc++:(pc=0,Dp=r):pc=0,gc(0)}}function M_(r,o){(r.pooledCacheLanes&=o)===0&&(o=r.pooledCache,o!=null&&(r.pooledCache=null,Xl(o)))}function Dd(){return A_(),T_(),R_(),D_()}function D_(){if(Ds!==5)return!1;var r=sa,o=Rp;Rp=0;var u=ir(wr),m=I.T,x=Y.p;try{Y.p=32>u?32:u,I.T=null,u=Mp,Mp=null;var _=sa,j=wr;if(Ds=0,Zo=sa=null,wr=0,(Tt&6)!==0)throw Error(i(331));var z=Tt;if(Tt|=4,m_(_.current),d_(_,_.current,j,u),Tt=z,gc(0,!1),oe&&typeof oe.onPostCommitFiberRoot=="function")try{oe.onPostCommitFiberRoot(_e,_)}catch{}return!0}finally{Y.p=x,I.T=m,M_(r,o)}}function L_(r,o,u){o=ni(u,o),o=dp(r.stateNode,o,2),r=Yr(r,o,2),r!==null&&(Mt(r,2),$i(r))}function Pt(r,o,u){if(r.tag===3)L_(r,r,u);else for(;o!==null;){if(o.tag===3){L_(o,r,u);break}else if(o.tag===1){var m=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(ta===null||!ta.has(m))){r=ni(u,r),u=Oy(2),m=Yr(o,u,2),m!==null&&(zy(u,m,o,r),Mt(m,2),$i(m));break}}o=o.return}}function zp(r,o,u){var m=r.pingCache;if(m===null){m=r.pingCache=new lT;var x=new Set;m.set(o,x)}else x=m.get(o),x===void 0&&(x=new Set,m.set(o,x));x.has(u)||(jp=!0,x.add(u),r=fT.bind(null,r,o,u),o.then(r,r))}function fT(r,o,u){var m=r.pingCache;m!==null&&m.delete(o),r.pingedLanes|=r.suspendedLanes&u,r.warmLanes&=~u,Vt===r&&(_t&u)===u&&(cs===4||cs===3&&(_t&62914560)===_t&&300>Lt()-Ed?(Tt&2)===0&&Qo(r,0):Ap|=u,Xo===_t&&(Xo=0)),$i(r)}function O_(r,o){o===0&&(o=Pe()),r=Oa(r,o),r!==null&&(Mt(r,o),$i(r))}function mT(r){var o=r.memoizedState,u=0;o!==null&&(u=o.retryLane),O_(r,u)}function pT(r,o){var u=0;switch(r.tag){case 31:case 13:var m=r.stateNode,x=r.memoizedState;x!==null&&(u=x.retryLane);break;case 19:m=r.stateNode;break;case 22:m=r.stateNode._retryCache;break;default:throw Error(i(314))}m!==null&&m.delete(o),O_(r,u)}function gT(r,o){return Hs(r,o)}var Ld=null,el=null,Bp=!1,Od=!1,Pp=!1,ia=0;function $i(r){r!==el&&r.next===null&&(el===null?Ld=el=r:el=el.next=r),Od=!0,Bp||(Bp=!0,xT())}function gc(r,o){if(!Pp&&Od){Pp=!0;do for(var u=!1,m=Ld;m!==null;){if(r!==0){var x=m.pendingLanes;if(x===0)var _=0;else{var j=m.suspendedLanes,z=m.pingedLanes;_=(1<<31-M(42|r)+1)-1,_&=x&~(j&~z),_=_&201326741?_&201326741|1:_?_|2:0}_!==0&&(u=!0,I_(m,_))}else _=_t,_=q(m,m===Vt?_:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(_&3)===0||ne(m,_)||(u=!0,I_(m,_));m=m.next}while(u);Pp=!1}}function bT(){z_()}function z_(){Od=Bp=!1;var r=0;ia!==0&&jT()&&(r=ia);for(var o=Lt(),u=null,m=Ld;m!==null;){var x=m.next,_=B_(m,o);_===0?(m.next=null,u===null?Ld=x:u.next=x,x===null&&(el=u)):(u=m,(r!==0||(_&3)!==0)&&(Od=!0)),m=x}Ds!==0&&Ds!==5||gc(r),ia!==0&&(ia=0)}function B_(r,o){for(var u=r.suspendedLanes,m=r.pingedLanes,x=r.expirationTimes,_=r.pendingLanes&-62914561;0<_;){var j=31-M(_),z=1<<j,X=x[j];X===-1?((z&u)===0||(z&m)!==0)&&(x[j]=xe(z,o)):X<=o&&(r.expiredLanes|=z),_&=~z}if(o=Vt,u=_t,u=q(r,r===o?u:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),m=r.callbackNode,u===0||r===o&&(Bt===2||Bt===9)||r.cancelPendingCommit!==null)return m!==null&&m!==null&&un(m),r.callbackNode=null,r.callbackPriority=0;if((u&3)===0||ne(r,u)){if(o=u&-u,o===r.callbackPriority)return o;switch(m!==null&&un(m),ir(u)){case 2:case 8:u=et;break;case 32:u=tt;break;case 268435456:u=S;break;default:u=tt}return m=P_.bind(null,r),u=Hs(u,m),r.callbackPriority=o,r.callbackNode=u,o}return m!==null&&m!==null&&un(m),r.callbackPriority=2,r.callbackNode=null,2}function P_(r,o){if(Ds!==0&&Ds!==5)return r.callbackNode=null,r.callbackPriority=0,null;var u=r.callbackNode;if(Dd()&&r.callbackNode!==u)return null;var m=_t;return m=q(r,r===Vt?m:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),m===0?null:(v_(r,m,o),B_(r,Lt()),r.callbackNode!=null&&r.callbackNode===u?P_.bind(null,r):null)}function I_(r,o){if(Dd())return null;v_(r,o,!0)}function xT(){TT(function(){(Tt&6)!==0?Hs(is,bT):z_()})}function Ip(){if(ia===0){var r=Io;r===0&&(r=me,me<<=1,(me&261888)===0&&(me=256)),ia=r}return ia}function $_(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Hr(""+r)}function H_(r,o){var u=o.ownerDocument.createElement("input");return u.name=o.name,u.value=o.value,r.id&&u.setAttribute("form",r.id),o.parentNode.insertBefore(u,o),r=new FormData(r),u.parentNode.removeChild(u),r}function vT(r,o,u,m,x){if(o==="submit"&&u&&u.stateNode===x){var _=$_((x[nn]||null).action),j=m.submitter;j&&(o=(o=j[nn]||null)?$_(o.formAction):j.getAttribute("formAction"),o!==null&&(_=o,j=null));var z=new Wu("action","action",null,m,x);r.push({event:z,listeners:[{instance:null,listener:function(){if(m.defaultPrevented){if(ia!==0){var X=j?H_(x,j):new FormData(x);rp(u,{pending:!0,data:X,method:x.method,action:_},null,X)}}else typeof _=="function"&&(z.preventDefault(),X=j?H_(x,j):new FormData(x),rp(u,{pending:!0,data:X,method:x.method,action:_},_,X))},currentTarget:x}]})}}for(var $p=0;$p<wm.length;$p++){var Hp=wm[$p],yT=Hp.toLowerCase(),_T=Hp[0].toUpperCase()+Hp.slice(1);ki(yT,"on"+_T)}ki(x1,"onAnimationEnd"),ki(v1,"onAnimationIteration"),ki(y1,"onAnimationStart"),ki("dblclick","onDoubleClick"),ki("focusin","onFocus"),ki("focusout","onBlur"),ki(BA,"onTransitionRun"),ki(PA,"onTransitionStart"),ki(IA,"onTransitionCancel"),ki(_1,"onTransitionEnd"),Le("onMouseEnter",["mouseout","mouseover"]),Le("onMouseLeave",["mouseout","mouseover"]),Le("onPointerEnter",["pointerout","pointerover"]),Le("onPointerLeave",["pointerout","pointerover"]),ar("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ar("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ar("onBeforeInput",["compositionend","keypress","textInput","paste"]),ar("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ar("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ar("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var bc="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(" "),wT=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(bc));function U_(r,o){o=(o&4)!==0;for(var u=0;u<r.length;u++){var m=r[u],x=m.event;m=m.listeners;e:{var _=void 0;if(o)for(var j=m.length-1;0<=j;j--){var z=m[j],X=z.instance,de=z.currentTarget;if(z=z.listener,X!==_&&x.isPropagationStopped())break e;_=z,x.currentTarget=de;try{_(x)}catch(ve){Xu(ve)}x.currentTarget=null,_=X}else for(j=0;j<m.length;j++){if(z=m[j],X=z.instance,de=z.currentTarget,z=z.listener,X!==_&&x.isPropagationStopped())break e;_=z,x.currentTarget=de;try{_(x)}catch(ve){Xu(ve)}x.currentTarget=null,_=X}}}}function vt(r,o){var u=o[Dl];u===void 0&&(u=o[Dl]=new Set);var m=r+"__bubble";u.has(m)||(F_(o,r,2,!1),u.add(m))}function Up(r,o,u){var m=0;o&&(m|=4),F_(u,r,m,o)}var zd="_reactListening"+Math.random().toString(36).slice(2);function Fp(r){if(!r[zd]){r[zd]=!0,Iu.forEach(function(u){u!=="selectionchange"&&(wT.has(u)||Up(u,!1,r),Up(u,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[zd]||(o[zd]=!0,Up("selectionchange",!1,o))}}function F_(r,o,u,m){switch(xw(o)){case 2:var x=XT;break;case 8:x=ZT;break;default:x=ig}u=x.bind(null,o,u,r),x=void 0,!cm||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(x=!0),m?x!==void 0?r.addEventListener(o,u,{capture:!0,passive:x}):r.addEventListener(o,u,!0):x!==void 0?r.addEventListener(o,u,{passive:x}):r.addEventListener(o,u,!1)}function qp(r,o,u,m,x){var _=m;if((o&1)===0&&(o&2)===0&&m!==null)e:for(;;){if(m===null)return;var j=m.tag;if(j===3||j===4){var z=m.stateNode.containerInfo;if(z===x)break;if(j===4)for(j=m.return;j!==null;){var X=j.tag;if((X===3||X===4)&&j.stateNode.containerInfo===x)return;j=j.return}for(;z!==null;){if(j=dn(z),j===null)return;if(X=j.tag,X===5||X===6||X===26||X===27){m=_=j;continue e}z=z.parentNode}}m=m.return}Fu(function(){var de=_,ve=ut(u),Ce=[];e:{var he=w1.get(r);if(he!==void 0){var pe=Wu,Ke=r;switch(r){case"keypress":if(Gu(u)===0)break e;case"keydown":case"keyup":pe=pA;break;case"focusin":Ke="focus",pe=fm;break;case"focusout":Ke="blur",pe=fm;break;case"beforeblur":case"afterblur":pe=fm;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":pe=Zv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":pe=nA;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":pe=xA;break;case x1:case v1:case y1:pe=aA;break;case _1:pe=yA;break;case"scroll":case"scrollend":pe=tA;break;case"wheel":pe=wA;break;case"copy":case"cut":case"paste":pe=lA;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":pe=Jv;break;case"toggle":case"beforetoggle":pe=kA}var it=(o&4)!==0,Ut=!it&&(r==="scroll"||r==="scrollend"),ie=it?he!==null?he+"Capture":null:he;it=[];for(var Q=de,ue;Q!==null;){var ke=Q;if(ue=ke.stateNode,ke=ke.tag,ke!==5&&ke!==26&&ke!==27||ue===null||ie===null||(ke=Il(Q,ie),ke!=null&&it.push(xc(Q,ke,ue))),Ut)break;Q=Q.return}0<it.length&&(he=new pe(he,Ke,null,u,ve),Ce.push({event:he,listeners:it}))}}if((o&7)===0){e:{if(he=r==="mouseover"||r==="pointerover",pe=r==="mouseout"||r==="pointerout",he&&u!==Ze&&(Ke=u.relatedTarget||u.fromElement)&&(dn(Ke)||Ke[Br]))break e;if((pe||he)&&(he=ve.window===ve?ve:(he=ve.ownerDocument)?he.defaultView||he.parentWindow:window,pe?(Ke=u.relatedTarget||u.toElement,pe=de,Ke=Ke?dn(Ke):null,Ke!==null&&(Ut=l(Ke),it=Ke.tag,Ke!==Ut||it!==5&&it!==27&&it!==6)&&(Ke=null)):(pe=null,Ke=de),pe!==Ke)){if(it=Zv,ke="onMouseLeave",ie="onMouseEnter",Q="mouse",(r==="pointerout"||r==="pointerover")&&(it=Jv,ke="onPointerLeave",ie="onPointerEnter",Q="pointer"),Ut=pe==null?he:Pr(pe),ue=Ke==null?he:Pr(Ke),he=new it(ke,Q+"leave",pe,u,ve),he.target=Ut,he.relatedTarget=ue,ke=null,dn(ve)===de&&(it=new it(ie,Q+"enter",Ke,u,ve),it.target=ue,it.relatedTarget=Ut,ke=it),Ut=ke,pe&&Ke)t:{for(it=ST,ie=pe,Q=Ke,ue=0,ke=ie;ke;ke=it(ke))ue++;ke=0;for(var nt=Q;nt;nt=it(nt))ke++;for(;0<ue-ke;)ie=it(ie),ue--;for(;0<ke-ue;)Q=it(Q),ke--;for(;ue--;){if(ie===Q||Q!==null&&ie===Q.alternate){it=ie;break t}ie=it(ie),Q=it(Q)}it=null}else it=null;pe!==null&&q_(Ce,he,pe,it,!1),Ke!==null&&Ut!==null&&q_(Ce,Ut,Ke,it,!0)}}e:{if(he=de?Pr(de):window,pe=he.nodeName&&he.nodeName.toLowerCase(),pe==="select"||pe==="input"&&he.type==="file")var Et=o1;else if(r1(he))if(l1)Et=LA;else{Et=MA;var Qe=RA}else pe=he.nodeName,!pe||pe.toLowerCase()!=="input"||he.type!=="checkbox"&&he.type!=="radio"?de&&$r(de.elementType)&&(Et=o1):Et=DA;if(Et&&(Et=Et(r,de))){a1(Ce,Et,u,ve);break e}Qe&&Qe(r,he,de),r==="focusout"&&de&&he.type==="number"&&de.memoizedProps.value!=null&&jo(he,"number",he.value)}switch(Qe=de?Pr(de):window,r){case"focusin":(r1(Qe)||Qe.contentEditable==="true")&&(Ro=Qe,vm=de,Wl=null);break;case"focusout":Wl=vm=Ro=null;break;case"mousedown":ym=!0;break;case"contextmenu":case"mouseup":case"dragend":ym=!1,g1(Ce,u,ve);break;case"selectionchange":if(zA)break;case"keydown":case"keyup":g1(Ce,u,ve)}var ht;if(pm)e:{switch(r){case"compositionstart":var wt="onCompositionStart";break e;case"compositionend":wt="onCompositionEnd";break e;case"compositionupdate":wt="onCompositionUpdate";break e}wt=void 0}else To?n1(r,u)&&(wt="onCompositionEnd"):r==="keydown"&&u.keyCode===229&&(wt="onCompositionStart");wt&&(e1&&u.locale!=="ko"&&(To||wt!=="onCompositionStart"?wt==="onCompositionEnd"&&To&&(ht=Yv()):(Ur=ve,um="value"in Ur?Ur.value:Ur.textContent,To=!0)),Qe=Bd(de,wt),0<Qe.length&&(wt=new Qv(wt,r,null,u,ve),Ce.push({event:wt,listeners:Qe}),ht?wt.data=ht:(ht=i1(u),ht!==null&&(wt.data=ht)))),(ht=CA?EA(r,u):jA(r,u))&&(wt=Bd(de,"onBeforeInput"),0<wt.length&&(Qe=new Qv("onBeforeInput","beforeinput",null,u,ve),Ce.push({event:Qe,listeners:wt}),Qe.data=ht)),vT(Ce,r,de,u,ve)}U_(Ce,o)})}function xc(r,o,u){return{instance:r,listener:o,currentTarget:u}}function Bd(r,o){for(var u=o+"Capture",m=[];r!==null;){var x=r,_=x.stateNode;if(x=x.tag,x!==5&&x!==26&&x!==27||_===null||(x=Il(r,u),x!=null&&m.unshift(xc(r,x,_)),x=Il(r,o),x!=null&&m.push(xc(r,x,_))),r.tag===3)return m;r=r.return}return[]}function ST(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function q_(r,o,u,m,x){for(var _=o._reactName,j=[];u!==null&&u!==m;){var z=u,X=z.alternate,de=z.stateNode;if(z=z.tag,X!==null&&X===m)break;z!==5&&z!==26&&z!==27||de===null||(X=de,x?(de=Il(u,_),de!=null&&j.unshift(xc(u,de,X))):x||(de=Il(u,_),de!=null&&j.push(xc(u,de,X)))),u=u.return}j.length!==0&&r.push({event:o,listeners:j})}var kT=/\r\n?/g,NT=/\u0000|\uFFFD/g;function G_(r){return(typeof r=="string"?r:""+r).replace(kT,`
10
+ `).replace(NT,"")}function V_(r,o){return o=G_(o),G_(r)===o}function Ht(r,o,u,m,x,_){switch(u){case"children":typeof m=="string"?o==="body"||o==="textarea"&&m===""||rt(r,m):(typeof m=="number"||typeof m=="bigint")&&o!=="body"&&rt(r,""+m);break;case"className":zn(r,"class",m);break;case"tabIndex":zn(r,"tabindex",m);break;case"dir":case"role":case"viewBox":case"width":case"height":zn(r,u,m);break;case"style":zt(r,m,_);break;case"data":if(o!=="object"){zn(r,"data",m);break}case"src":case"href":if(m===""&&(o!=="a"||u!=="href")){r.removeAttribute(u);break}if(m==null||typeof m=="function"||typeof m=="symbol"||typeof m=="boolean"){r.removeAttribute(u);break}m=Hr(""+m),r.setAttribute(u,m);break;case"action":case"formAction":if(typeof m=="function"){r.setAttribute(u,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof _=="function"&&(u==="formAction"?(o!=="input"&&Ht(r,o,"name",x.name,x,null),Ht(r,o,"formEncType",x.formEncType,x,null),Ht(r,o,"formMethod",x.formMethod,x,null),Ht(r,o,"formTarget",x.formTarget,x,null)):(Ht(r,o,"encType",x.encType,x,null),Ht(r,o,"method",x.method,x,null),Ht(r,o,"target",x.target,x,null)));if(m==null||typeof m=="symbol"||typeof m=="boolean"){r.removeAttribute(u);break}m=Hr(""+m),r.setAttribute(u,m);break;case"onClick":m!=null&&(r.onclick=Ie);break;case"onScroll":m!=null&&vt("scroll",r);break;case"onScrollEnd":m!=null&&vt("scrollend",r);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(i(61));if(u=m.__html,u!=null){if(x.children!=null)throw Error(i(60));r.innerHTML=u}}break;case"multiple":r.multiple=m&&typeof m!="function"&&typeof m!="symbol";break;case"muted":r.muted=m&&typeof m!="function"&&typeof m!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(m==null||typeof m=="function"||typeof m=="boolean"||typeof m=="symbol"){r.removeAttribute("xlink:href");break}u=Hr(""+m),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":m!=null&&typeof m!="function"&&typeof m!="symbol"?r.setAttribute(u,""+m):r.removeAttribute(u);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":m&&typeof m!="function"&&typeof m!="symbol"?r.setAttribute(u,""):r.removeAttribute(u);break;case"capture":case"download":m===!0?r.setAttribute(u,""):m!==!1&&m!=null&&typeof m!="function"&&typeof m!="symbol"?r.setAttribute(u,m):r.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":m!=null&&typeof m!="function"&&typeof m!="symbol"&&!isNaN(m)&&1<=m?r.setAttribute(u,m):r.removeAttribute(u);break;case"rowSpan":case"start":m==null||typeof m=="function"||typeof m=="symbol"||isNaN(m)?r.removeAttribute(u):r.setAttribute(u,m);break;case"popover":vt("beforetoggle",r),vt("toggle",r),rn(r,"popover",m);break;case"xlinkActuate":wn(r,"http://www.w3.org/1999/xlink","xlink:actuate",m);break;case"xlinkArcrole":wn(r,"http://www.w3.org/1999/xlink","xlink:arcrole",m);break;case"xlinkRole":wn(r,"http://www.w3.org/1999/xlink","xlink:role",m);break;case"xlinkShow":wn(r,"http://www.w3.org/1999/xlink","xlink:show",m);break;case"xlinkTitle":wn(r,"http://www.w3.org/1999/xlink","xlink:title",m);break;case"xlinkType":wn(r,"http://www.w3.org/1999/xlink","xlink:type",m);break;case"xmlBase":wn(r,"http://www.w3.org/XML/1998/namespace","xml:base",m);break;case"xmlLang":wn(r,"http://www.w3.org/XML/1998/namespace","xml:lang",m);break;case"xmlSpace":wn(r,"http://www.w3.org/XML/1998/namespace","xml:space",m);break;case"is":rn(r,"is",m);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=or.get(u)||u,rn(r,u,m))}}function Gp(r,o,u,m,x,_){switch(u){case"style":zt(r,m,_);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(i(61));if(u=m.__html,u!=null){if(x.children!=null)throw Error(i(60));r.innerHTML=u}}break;case"children":typeof m=="string"?rt(r,m):(typeof m=="number"||typeof m=="bigint")&&rt(r,""+m);break;case"onScroll":m!=null&&vt("scroll",r);break;case"onScrollEnd":m!=null&&vt("scrollend",r);break;case"onClick":m!=null&&(r.onclick=Ie);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ta.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(x=u.endsWith("Capture"),o=u.slice(2,x?u.length-7:void 0),_=r[nn]||null,_=_!=null?_[u]:null,typeof _=="function"&&r.removeEventListener(o,_,x),typeof m=="function")){typeof _!="function"&&_!==null&&(u in r?r[u]=null:r.hasAttribute(u)&&r.removeAttribute(u)),r.addEventListener(o,m,x);break e}u in r?r[u]=m:m===!0?r.setAttribute(u,""):rn(r,u,m)}}}function Js(r,o,u){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":vt("error",r),vt("load",r);var m=!1,x=!1,_;for(_ in u)if(u.hasOwnProperty(_)){var j=u[_];if(j!=null)switch(_){case"src":m=!0;break;case"srcSet":x=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,o));default:Ht(r,o,_,j,u,null)}}x&&Ht(r,o,"srcSet",u.srcSet,u,null),m&&Ht(r,o,"src",u.src,u,null);return;case"input":vt("invalid",r);var z=_=j=x=null,X=null,de=null;for(m in u)if(u.hasOwnProperty(m)){var ve=u[m];if(ve!=null)switch(m){case"name":x=ve;break;case"type":j=ve;break;case"checked":X=ve;break;case"defaultChecked":de=ve;break;case"value":_=ve;break;case"defaultValue":z=ve;break;case"children":case"dangerouslySetInnerHTML":if(ve!=null)throw Error(i(137,o));break;default:Ht(r,o,m,ve,u,null)}}Ra(r,_,z,X,de,j,x,!1);return;case"select":vt("invalid",r),m=j=_=null;for(x in u)if(u.hasOwnProperty(x)&&(z=u[x],z!=null))switch(x){case"value":_=z;break;case"defaultValue":j=z;break;case"multiple":m=z;default:Ht(r,o,x,z,u,null)}o=_,u=j,r.multiple=!!m,o!=null?Ys(r,!!m,o,!1):u!=null&&Ys(r,!!m,u,!0);return;case"textarea":vt("invalid",r),_=x=m=null;for(j in u)if(u.hasOwnProperty(j)&&(z=u[j],z!=null))switch(j){case"value":m=z;break;case"defaultValue":x=z;break;case"children":_=z;break;case"dangerouslySetInnerHTML":if(z!=null)throw Error(i(91));break;default:Ht(r,o,j,z,u,null)}Ao(r,m,x,_);return;case"option":for(X in u)u.hasOwnProperty(X)&&(m=u[X],m!=null)&&(X==="selected"?r.selected=m&&typeof m!="function"&&typeof m!="symbol":Ht(r,o,X,m,u,null));return;case"dialog":vt("beforetoggle",r),vt("toggle",r),vt("cancel",r),vt("close",r);break;case"iframe":case"object":vt("load",r);break;case"video":case"audio":for(m=0;m<bc.length;m++)vt(bc[m],r);break;case"image":vt("error",r),vt("load",r);break;case"details":vt("toggle",r);break;case"embed":case"source":case"link":vt("error",r),vt("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(de in u)if(u.hasOwnProperty(de)&&(m=u[de],m!=null))switch(de){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,o));default:Ht(r,o,de,m,u,null)}return;default:if($r(o)){for(ve in u)u.hasOwnProperty(ve)&&(m=u[ve],m!==void 0&&Gp(r,o,ve,m,u,void 0));return}}for(z in u)u.hasOwnProperty(z)&&(m=u[z],m!=null&&Ht(r,o,z,m,u,null))}function CT(r,o,u,m){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var x=null,_=null,j=null,z=null,X=null,de=null,ve=null;for(pe in u){var Ce=u[pe];if(u.hasOwnProperty(pe)&&Ce!=null)switch(pe){case"checked":break;case"value":break;case"defaultValue":X=Ce;default:m.hasOwnProperty(pe)||Ht(r,o,pe,null,m,Ce)}}for(var he in m){var pe=m[he];if(Ce=u[he],m.hasOwnProperty(he)&&(pe!=null||Ce!=null))switch(he){case"type":_=pe;break;case"name":x=pe;break;case"checked":de=pe;break;case"defaultChecked":ve=pe;break;case"value":j=pe;break;case"defaultValue":z=pe;break;case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(i(137,o));break;default:pe!==Ce&&Ht(r,o,he,pe,m,Ce)}}zl(r,j,z,X,de,ve,_,x);return;case"select":pe=j=z=he=null;for(_ in u)if(X=u[_],u.hasOwnProperty(_)&&X!=null)switch(_){case"value":break;case"multiple":pe=X;default:m.hasOwnProperty(_)||Ht(r,o,_,null,m,X)}for(x in m)if(_=m[x],X=u[x],m.hasOwnProperty(x)&&(_!=null||X!=null))switch(x){case"value":he=_;break;case"defaultValue":z=_;break;case"multiple":j=_;default:_!==X&&Ht(r,o,x,_,m,X)}o=z,u=j,m=pe,he!=null?Ys(r,!!u,he,!1):!!m!=!!u&&(o!=null?Ys(r,!!u,o,!0):Ys(r,!!u,u?[]:"",!1));return;case"textarea":pe=he=null;for(z in u)if(x=u[z],u.hasOwnProperty(z)&&x!=null&&!m.hasOwnProperty(z))switch(z){case"value":break;case"children":break;default:Ht(r,o,z,null,m,x)}for(j in m)if(x=m[j],_=u[j],m.hasOwnProperty(j)&&(x!=null||_!=null))switch(j){case"value":he=x;break;case"defaultValue":pe=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(i(91));break;default:x!==_&&Ht(r,o,j,x,m,_)}Hu(r,he,pe);return;case"option":for(var Ke in u)he=u[Ke],u.hasOwnProperty(Ke)&&he!=null&&!m.hasOwnProperty(Ke)&&(Ke==="selected"?r.selected=!1:Ht(r,o,Ke,null,m,he));for(X in m)he=m[X],pe=u[X],m.hasOwnProperty(X)&&he!==pe&&(he!=null||pe!=null)&&(X==="selected"?r.selected=he&&typeof he!="function"&&typeof he!="symbol":Ht(r,o,X,he,m,pe));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var it in u)he=u[it],u.hasOwnProperty(it)&&he!=null&&!m.hasOwnProperty(it)&&Ht(r,o,it,null,m,he);for(de in m)if(he=m[de],pe=u[de],m.hasOwnProperty(de)&&he!==pe&&(he!=null||pe!=null))switch(de){case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(i(137,o));break;default:Ht(r,o,de,he,m,pe)}return;default:if($r(o)){for(var Ut in u)he=u[Ut],u.hasOwnProperty(Ut)&&he!==void 0&&!m.hasOwnProperty(Ut)&&Gp(r,o,Ut,void 0,m,he);for(ve in m)he=m[ve],pe=u[ve],!m.hasOwnProperty(ve)||he===pe||he===void 0&&pe===void 0||Gp(r,o,ve,he,m,pe);return}}for(var ie in u)he=u[ie],u.hasOwnProperty(ie)&&he!=null&&!m.hasOwnProperty(ie)&&Ht(r,o,ie,null,m,he);for(Ce in m)he=m[Ce],pe=u[Ce],!m.hasOwnProperty(Ce)||he===pe||he==null&&pe==null||Ht(r,o,Ce,he,m,pe)}function W_(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function ET(){if(typeof performance.getEntriesByType=="function"){for(var r=0,o=0,u=performance.getEntriesByType("resource"),m=0;m<u.length;m++){var x=u[m],_=x.transferSize,j=x.initiatorType,z=x.duration;if(_&&z&&W_(j)){for(j=0,z=x.responseEnd,m+=1;m<u.length;m++){var X=u[m],de=X.startTime;if(de>z)break;var ve=X.transferSize,Ce=X.initiatorType;ve&&W_(Ce)&&(X=X.responseEnd,j+=ve*(X<z?1:(z-de)/(X-de)))}if(--m,o+=8*(_+j)/(x.duration/1e3),r++,10<r)break}}if(0<r)return o/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var Vp=null,Wp=null;function Pd(r){return r.nodeType===9?r:r.ownerDocument}function K_(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Y_(r,o){if(r===0)switch(o){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&o==="foreignObject"?0:r}function Kp(r,o){return r==="textarea"||r==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.children=="bigint"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var Yp=null;function jT(){var r=window.event;return r&&r.type==="popstate"?r===Yp?!1:(Yp=r,!0):(Yp=null,!1)}var X_=typeof setTimeout=="function"?setTimeout:void 0,AT=typeof clearTimeout=="function"?clearTimeout:void 0,Z_=typeof Promise=="function"?Promise:void 0,TT=typeof queueMicrotask=="function"?queueMicrotask:typeof Z_<"u"?function(r){return Z_.resolve(null).then(r).catch(RT)}:X_;function RT(r){setTimeout(function(){throw r})}function ra(r){return r==="head"}function Q_(r,o){var u=o,m=0;do{var x=u.nextSibling;if(r.removeChild(u),x&&x.nodeType===8)if(u=x.data,u==="/$"||u==="/&"){if(m===0){r.removeChild(x),il(o);return}m--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")m++;else if(u==="html")vc(r.ownerDocument.documentElement);else if(u==="head"){u=r.ownerDocument.head,vc(u);for(var _=u.firstChild;_;){var j=_.nextSibling,z=_.nodeName;_[Aa]||z==="SCRIPT"||z==="STYLE"||z==="LINK"&&_.rel.toLowerCase()==="stylesheet"||u.removeChild(_),_=j}}else u==="body"&&vc(r.ownerDocument.body);u=x}while(u);il(o)}function J_(r,o){var u=r;r=0;do{var m=u.nextSibling;if(u.nodeType===1?o?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(o?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),m&&m.nodeType===8)if(u=m.data,u==="/$"){if(r===0)break;r--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||r++;u=m}while(u)}function Xp(r){var o=r.firstChild;for(o&&o.nodeType===10&&(o=o.nextSibling);o;){var u=o;switch(o=o.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":Xp(u),Ll(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}r.removeChild(u)}}function MT(r,o,u,m){for(;r.nodeType===1;){var x=u;if(r.nodeName.toLowerCase()!==o.toLowerCase()){if(!m&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(m){if(!r[Aa])switch(o){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(_=r.getAttribute("rel"),_==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(_!==x.rel||r.getAttribute("href")!==(x.href==null||x.href===""?null:x.href)||r.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin)||r.getAttribute("title")!==(x.title==null?null:x.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(_=r.getAttribute("src"),(_!==(x.src==null?null:x.src)||r.getAttribute("type")!==(x.type==null?null:x.type)||r.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin))&&_&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(o==="input"&&r.type==="hidden"){var _=x.name==null?null:""+x.name;if(x.type==="hidden"&&r.getAttribute("name")===_)return r}else return r;if(r=li(r.nextSibling),r===null)break}return null}function DT(r,o,u){if(o==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!u||(r=li(r.nextSibling),r===null))return null;return r}function ew(r,o){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!o||(r=li(r.nextSibling),r===null))return null;return r}function Zp(r){return r.data==="$?"||r.data==="$~"}function Qp(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function LT(r,o){var u=r.ownerDocument;if(r.data==="$~")r._reactRetry=o;else if(r.data!=="$?"||u.readyState!=="loading")o();else{var m=function(){o(),u.removeEventListener("DOMContentLoaded",m)};u.addEventListener("DOMContentLoaded",m),r._reactRetry=m}}function li(r){for(;r!=null;r=r.nextSibling){var o=r.nodeType;if(o===1||o===3)break;if(o===8){if(o=r.data,o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"||o==="F!"||o==="F")break;if(o==="/$"||o==="/&")return null}}return r}var Jp=null;function tw(r){r=r.nextSibling;for(var o=0;r;){if(r.nodeType===8){var u=r.data;if(u==="/$"||u==="/&"){if(o===0)return li(r.nextSibling);o--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||o++}r=r.nextSibling}return null}function sw(r){r=r.previousSibling;for(var o=0;r;){if(r.nodeType===8){var u=r.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(o===0)return r;o--}else u!=="/$"&&u!=="/&"||o++}r=r.previousSibling}return null}function nw(r,o,u){switch(o=Pd(u),r){case"html":if(r=o.documentElement,!r)throw Error(i(452));return r;case"head":if(r=o.head,!r)throw Error(i(453));return r;case"body":if(r=o.body,!r)throw Error(i(454));return r;default:throw Error(i(451))}}function vc(r){for(var o=r.attributes;o.length;)r.removeAttributeNode(o[0]);Ll(r)}var ci=new Map,iw=new Set;function Id(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var Sr=Y.d;Y.d={f:OT,r:zT,D:BT,C:PT,L:IT,m:$T,X:UT,S:HT,M:FT};function OT(){var r=Sr.f(),o=Td();return r||o}function zT(r){var o=rr(r);o!==null&&o.tag===5&&o.type==="form"?_y(o):Sr.r(r)}var tl=typeof document>"u"?null:document;function rw(r,o,u){var m=tl;if(m&&typeof o=="string"&&o){var x=Sn(o);x='link[rel="'+r+'"][href="'+x+'"]',typeof u=="string"&&(x+='[crossorigin="'+u+'"]'),iw.has(x)||(iw.add(x),r={rel:r,crossOrigin:u,href:o},m.querySelector(x)===null&&(o=m.createElement("link"),Js(o,"link",r),Ss(o),m.head.appendChild(o)))}}function BT(r){Sr.D(r),rw("dns-prefetch",r,null)}function PT(r,o){Sr.C(r,o),rw("preconnect",r,o)}function IT(r,o,u){Sr.L(r,o,u);var m=tl;if(m&&r&&o){var x='link[rel="preload"][as="'+Sn(o)+'"]';o==="image"&&u&&u.imageSrcSet?(x+='[imagesrcset="'+Sn(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(x+='[imagesizes="'+Sn(u.imageSizes)+'"]')):x+='[href="'+Sn(r)+'"]';var _=x;switch(o){case"style":_=sl(r);break;case"script":_=nl(r)}ci.has(_)||(r=g({rel:"preload",href:o==="image"&&u&&u.imageSrcSet?void 0:r,as:o},u),ci.set(_,r),m.querySelector(x)!==null||o==="style"&&m.querySelector(yc(_))||o==="script"&&m.querySelector(_c(_))||(o=m.createElement("link"),Js(o,"link",r),Ss(o),m.head.appendChild(o)))}}function $T(r,o){Sr.m(r,o);var u=tl;if(u&&r){var m=o&&typeof o.as=="string"?o.as:"script",x='link[rel="modulepreload"][as="'+Sn(m)+'"][href="'+Sn(r)+'"]',_=x;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":_=nl(r)}if(!ci.has(_)&&(r=g({rel:"modulepreload",href:r},o),ci.set(_,r),u.querySelector(x)===null)){switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(_c(_)))return}m=u.createElement("link"),Js(m,"link",r),Ss(m),u.head.appendChild(m)}}}function HT(r,o,u){Sr.S(r,o,u);var m=tl;if(m&&r){var x=Ir(m).hoistableStyles,_=sl(r);o=o||"default";var j=x.get(_);if(!j){var z={loading:0,preload:null};if(j=m.querySelector(yc(_)))z.loading=5;else{r=g({rel:"stylesheet",href:r,"data-precedence":o},u),(u=ci.get(_))&&eg(r,u);var X=j=m.createElement("link");Ss(X),Js(X,"link",r),X._p=new Promise(function(de,ve){X.onload=de,X.onerror=ve}),X.addEventListener("load",function(){z.loading|=1}),X.addEventListener("error",function(){z.loading|=2}),z.loading|=4,$d(j,o,m)}j={type:"stylesheet",instance:j,count:1,state:z},x.set(_,j)}}}function UT(r,o){Sr.X(r,o);var u=tl;if(u&&r){var m=Ir(u).hoistableScripts,x=nl(r),_=m.get(x);_||(_=u.querySelector(_c(x)),_||(r=g({src:r,async:!0},o),(o=ci.get(x))&&tg(r,o),_=u.createElement("script"),Ss(_),Js(_,"link",r),u.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},m.set(x,_))}}function FT(r,o){Sr.M(r,o);var u=tl;if(u&&r){var m=Ir(u).hoistableScripts,x=nl(r),_=m.get(x);_||(_=u.querySelector(_c(x)),_||(r=g({src:r,async:!0,type:"module"},o),(o=ci.get(x))&&tg(r,o),_=u.createElement("script"),Ss(_),Js(_,"link",r),u.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},m.set(x,_))}}function aw(r,o,u,m){var x=(x=te.current)?Id(x):null;if(!x)throw Error(i(446));switch(r){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(o=sl(u.href),u=Ir(x).hoistableStyles,m=u.get(o),m||(m={type:"style",instance:null,count:0,state:null},u.set(o,m)),m):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){r=sl(u.href);var _=Ir(x).hoistableStyles,j=_.get(r);if(j||(x=x.ownerDocument||x,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},_.set(r,j),(_=x.querySelector(yc(r)))&&!_._p&&(j.instance=_,j.state.loading=5),ci.has(r)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},ci.set(r,u),_||qT(x,r,u,j.state))),o&&m===null)throw Error(i(528,""));return j}if(o&&m!==null)throw Error(i(529,""));return null;case"script":return o=u.async,u=u.src,typeof u=="string"&&o&&typeof o!="function"&&typeof o!="symbol"?(o=nl(u),u=Ir(x).hoistableScripts,m=u.get(o),m||(m={type:"script",instance:null,count:0,state:null},u.set(o,m)),m):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,r))}}function sl(r){return'href="'+Sn(r)+'"'}function yc(r){return'link[rel="stylesheet"]['+r+"]"}function ow(r){return g({},r,{"data-precedence":r.precedence,precedence:null})}function qT(r,o,u,m){r.querySelector('link[rel="preload"][as="style"]['+o+"]")?m.loading=1:(o=r.createElement("link"),m.preload=o,o.addEventListener("load",function(){return m.loading|=1}),o.addEventListener("error",function(){return m.loading|=2}),Js(o,"link",u),Ss(o),r.head.appendChild(o))}function nl(r){return'[src="'+Sn(r)+'"]'}function _c(r){return"script[async]"+r}function lw(r,o,u){if(o.count++,o.instance===null)switch(o.type){case"style":var m=r.querySelector('style[data-href~="'+Sn(u.href)+'"]');if(m)return o.instance=m,Ss(m),m;var x=g({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return m=(r.ownerDocument||r).createElement("style"),Ss(m),Js(m,"style",x),$d(m,u.precedence,r),o.instance=m;case"stylesheet":x=sl(u.href);var _=r.querySelector(yc(x));if(_)return o.state.loading|=4,o.instance=_,Ss(_),_;m=ow(u),(x=ci.get(x))&&eg(m,x),_=(r.ownerDocument||r).createElement("link"),Ss(_);var j=_;return j._p=new Promise(function(z,X){j.onload=z,j.onerror=X}),Js(_,"link",m),o.state.loading|=4,$d(_,u.precedence,r),o.instance=_;case"script":return _=nl(u.src),(x=r.querySelector(_c(_)))?(o.instance=x,Ss(x),x):(m=u,(x=ci.get(_))&&(m=g({},u),tg(m,x)),r=r.ownerDocument||r,x=r.createElement("script"),Ss(x),Js(x,"link",m),r.head.appendChild(x),o.instance=x);case"void":return null;default:throw Error(i(443,o.type))}else o.type==="stylesheet"&&(o.state.loading&4)===0&&(m=o.instance,o.state.loading|=4,$d(m,u.precedence,r));return o.instance}function $d(r,o,u){for(var m=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=m.length?m[m.length-1]:null,_=x,j=0;j<m.length;j++){var z=m[j];if(z.dataset.precedence===o)_=z;else if(_!==x)break}_?_.parentNode.insertBefore(r,_.nextSibling):(o=u.nodeType===9?u.head:u,o.insertBefore(r,o.firstChild))}function eg(r,o){r.crossOrigin==null&&(r.crossOrigin=o.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=o.referrerPolicy),r.title==null&&(r.title=o.title)}function tg(r,o){r.crossOrigin==null&&(r.crossOrigin=o.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=o.referrerPolicy),r.integrity==null&&(r.integrity=o.integrity)}var Hd=null;function cw(r,o,u){if(Hd===null){var m=new Map,x=Hd=new Map;x.set(u,m)}else x=Hd,m=x.get(u),m||(m=new Map,x.set(u,m));if(m.has(r))return m;for(m.set(r,null),u=u.getElementsByTagName(r),x=0;x<u.length;x++){var _=u[x];if(!(_[Aa]||_[bs]||r==="link"&&_.getAttribute("rel")==="stylesheet")&&_.namespaceURI!=="http://www.w3.org/2000/svg"){var j=_.getAttribute(o)||"";j=r+j;var z=m.get(j);z?z.push(_):m.set(j,[_])}}return m}function uw(r,o,u){r=r.ownerDocument||r,r.head.insertBefore(u,o==="title"?r.querySelector("head > title"):null)}function GT(r,o,u){if(u===1||o.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof o.precedence!="string"||typeof o.href!="string"||o.href==="")break;return!0;case"link":if(typeof o.rel!="string"||typeof o.href!="string"||o.href===""||o.onLoad||o.onError)break;return o.rel==="stylesheet"?(r=o.disabled,typeof o.precedence=="string"&&r==null):!0;case"script":if(o.async&&typeof o.async!="function"&&typeof o.async!="symbol"&&!o.onLoad&&!o.onError&&o.src&&typeof o.src=="string")return!0}return!1}function dw(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function VT(r,o,u,m){if(u.type==="stylesheet"&&(typeof m.media!="string"||matchMedia(m.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var x=sl(m.href),_=o.querySelector(yc(x));if(_){o=_._p,o!==null&&typeof o=="object"&&typeof o.then=="function"&&(r.count++,r=Ud.bind(r),o.then(r,r)),u.state.loading|=4,u.instance=_,Ss(_);return}_=o.ownerDocument||o,m=ow(m),(x=ci.get(x))&&eg(m,x),_=_.createElement("link"),Ss(_);var j=_;j._p=new Promise(function(z,X){j.onload=z,j.onerror=X}),Js(_,"link",m),u.instance=_}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(u,o),(o=u.state.preload)&&(u.state.loading&3)===0&&(r.count++,u=Ud.bind(r),o.addEventListener("load",u),o.addEventListener("error",u))}}var sg=0;function WT(r,o){return r.stylesheets&&r.count===0&&qd(r,r.stylesheets),0<r.count||0<r.imgCount?function(u){var m=setTimeout(function(){if(r.stylesheets&&qd(r,r.stylesheets),r.unsuspend){var _=r.unsuspend;r.unsuspend=null,_()}},6e4+o);0<r.imgBytes&&sg===0&&(sg=62500*ET());var x=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&qd(r,r.stylesheets),r.unsuspend)){var _=r.unsuspend;r.unsuspend=null,_()}},(r.imgBytes>sg?50:800)+o);return r.unsuspend=u,function(){r.unsuspend=null,clearTimeout(m),clearTimeout(x)}}:null}function Ud(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)qd(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Fd=null;function qd(r,o){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Fd=new Map,o.forEach(KT,r),Fd=null,Ud.call(r))}function KT(r,o){if(!(o.state.loading&4)){var u=Fd.get(r);if(u)var m=u.get(null);else{u=new Map,Fd.set(r,u);for(var x=r.querySelectorAll("link[data-precedence],style[data-precedence]"),_=0;_<x.length;_++){var j=x[_];(j.nodeName==="LINK"||j.getAttribute("media")!=="not all")&&(u.set(j.dataset.precedence,j),m=j)}m&&u.set(null,m)}x=o.instance,j=x.getAttribute("data-precedence"),_=u.get(j)||m,_===m&&u.set(null,x),u.set(j,x),this.count++,m=Ud.bind(this),x.addEventListener("load",m),x.addEventListener("error",m),_?_.parentNode.insertBefore(x,_.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(x,r.firstChild)),o.state.loading|=4}}var wc={$$typeof:A,Provider:null,Consumer:null,_currentValue:W,_currentValue2:W,_threadCount:0};function YT(r,o,u,m,x,_,j,z,X){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=at(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=at(0),this.hiddenUpdates=at(null),this.identifierPrefix=m,this.onUncaughtError=x,this.onCaughtError=_,this.onRecoverableError=j,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=X,this.incompleteTransitions=new Map}function hw(r,o,u,m,x,_,j,z,X,de,ve,Ce){return r=new YT(r,o,u,j,X,de,ve,Ce,z),o=1,_===!0&&(o|=24),_=In(3,null,null,o),r.current=_,_.stateNode=r,o=Om(),o.refCount++,r.pooledCache=o,o.refCount++,_.memoizedState={element:m,isDehydrated:u,cache:o},Im(_),r}function fw(r){return r?(r=Lo,r):Lo}function mw(r,o,u,m,x,_){x=fw(x),m.context===null?m.context=x:m.pendingContext=x,m=Kr(o),m.payload={element:u},_=_===void 0?null:_,_!==null&&(m.callback=_),u=Yr(r,m,o),u!==null&&(An(u,r,o),ec(u,r,o))}function pw(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var u=r.retryLane;r.retryLane=u!==0&&u<o?u:o}}function ng(r,o){pw(r,o),(r=r.alternate)&&pw(r,o)}function gw(r){if(r.tag===13||r.tag===31){var o=Oa(r,67108864);o!==null&&An(o,r,67108864),ng(r,67108864)}}function bw(r){if(r.tag===13||r.tag===31){var o=qn();o=ts(o);var u=Oa(r,o);u!==null&&An(u,r,o),ng(r,o)}}var Gd=!0;function XT(r,o,u,m){var x=I.T;I.T=null;var _=Y.p;try{Y.p=2,ig(r,o,u,m)}finally{Y.p=_,I.T=x}}function ZT(r,o,u,m){var x=I.T;I.T=null;var _=Y.p;try{Y.p=8,ig(r,o,u,m)}finally{Y.p=_,I.T=x}}function ig(r,o,u,m){if(Gd){var x=rg(m);if(x===null)qp(r,o,m,Vd,u),vw(r,m);else if(JT(x,r,o,u,m))m.stopPropagation();else if(vw(r,m),o&4&&-1<QT.indexOf(r)){for(;x!==null;){var _=rr(x);if(_!==null)switch(_.tag){case 3:if(_=_.stateNode,_.current.memoizedState.isDehydrated){var j=Be(_.pendingLanes);if(j!==0){var z=_;for(z.pendingLanes|=2,z.entangledLanes|=2;j;){var X=1<<31-M(j);z.entanglements[1]|=X,j&=~X}$i(_),(Tt&6)===0&&(jd=Lt()+500,gc(0))}}break;case 31:case 13:z=Oa(_,2),z!==null&&An(z,_,2),Td(),ng(_,2)}if(_=rg(m),_===null&&qp(r,o,m,Vd,u),_===x)break;x=_}x!==null&&m.stopPropagation()}else qp(r,o,m,null,u)}}function rg(r){return r=ut(r),ag(r)}var Vd=null;function ag(r){if(Vd=null,r=dn(r),r!==null){var o=l(r);if(o===null)r=null;else{var u=o.tag;if(u===13){if(r=c(o),r!==null)return r;r=null}else if(u===31){if(r=h(o),r!==null)return r;r=null}else if(u===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null)}}return Vd=r,null}function xw(r){switch(r){case"beforetoggle":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"toggle":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 2;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"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ps()){case is:return 2;case et:return 8;case tt:case Ct:return 32;case S:return 268435456;default:return 32}default:return 32}}var og=!1,aa=null,oa=null,la=null,Sc=new Map,kc=new Map,ca=[],QT="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".split(" ");function vw(r,o){switch(r){case"focusin":case"focusout":aa=null;break;case"dragenter":case"dragleave":oa=null;break;case"mouseover":case"mouseout":la=null;break;case"pointerover":case"pointerout":Sc.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":kc.delete(o.pointerId)}}function Nc(r,o,u,m,x,_){return r===null||r.nativeEvent!==_?(r={blockedOn:o,domEventName:u,eventSystemFlags:m,nativeEvent:_,targetContainers:[x]},o!==null&&(o=rr(o),o!==null&&gw(o)),r):(r.eventSystemFlags|=m,o=r.targetContainers,x!==null&&o.indexOf(x)===-1&&o.push(x),r)}function JT(r,o,u,m,x){switch(o){case"focusin":return aa=Nc(aa,r,o,u,m,x),!0;case"dragenter":return oa=Nc(oa,r,o,u,m,x),!0;case"mouseover":return la=Nc(la,r,o,u,m,x),!0;case"pointerover":var _=x.pointerId;return Sc.set(_,Nc(Sc.get(_)||null,r,o,u,m,x)),!0;case"gotpointercapture":return _=x.pointerId,kc.set(_,Nc(kc.get(_)||null,r,o,u,m,x)),!0}return!1}function yw(r){var o=dn(r.target);if(o!==null){var u=l(o);if(u!==null){if(o=u.tag,o===13){if(o=c(u),o!==null){r.blockedOn=o,ko(r.priority,function(){bw(u)});return}}else if(o===31){if(o=h(u),o!==null){r.blockedOn=o,ko(r.priority,function(){bw(u)});return}}else if(o===3&&u.stateNode.current.memoizedState.isDehydrated){r.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Wd(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var u=rg(r.nativeEvent);if(u===null){u=r.nativeEvent;var m=new u.constructor(u.type,u);Ze=m,u.target.dispatchEvent(m),Ze=null}else return o=rr(u),o!==null&&gw(o),r.blockedOn=u,!1;o.shift()}return!0}function _w(r,o,u){Wd(r)&&u.delete(o)}function eR(){og=!1,aa!==null&&Wd(aa)&&(aa=null),oa!==null&&Wd(oa)&&(oa=null),la!==null&&Wd(la)&&(la=null),Sc.forEach(_w),kc.forEach(_w)}function Kd(r,o){r.blockedOn===o&&(r.blockedOn=null,og||(og=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,eR)))}var Yd=null;function ww(r){Yd!==r&&(Yd=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Yd===r&&(Yd=null);for(var o=0;o<r.length;o+=3){var u=r[o],m=r[o+1],x=r[o+2];if(typeof m!="function"){if(ag(m||u)===null)continue;break}var _=rr(u);_!==null&&(r.splice(o,3),o-=3,rp(_,{pending:!0,data:x,method:u.method,action:m},m,x))}}))}function il(r){function o(X){return Kd(X,r)}aa!==null&&Kd(aa,r),oa!==null&&Kd(oa,r),la!==null&&Kd(la,r),Sc.forEach(o),kc.forEach(o);for(var u=0;u<ca.length;u++){var m=ca[u];m.blockedOn===r&&(m.blockedOn=null)}for(;0<ca.length&&(u=ca[0],u.blockedOn===null);)yw(u),u.blockedOn===null&&ca.shift();if(u=(r.ownerDocument||r).$$reactFormReplay,u!=null)for(m=0;m<u.length;m+=3){var x=u[m],_=u[m+1],j=x[nn]||null;if(typeof _=="function")j||ww(u);else if(j){var z=null;if(_&&_.hasAttribute("formAction")){if(x=_,j=_[nn]||null)z=j.formAction;else if(ag(x)!==null)continue}else z=j.action;typeof z=="function"?u[m+1]=z:(u.splice(m,3),m-=3),ww(u)}}}function Sw(){function r(_){_.canIntercept&&_.info==="react-transition"&&_.intercept({handler:function(){return new Promise(function(j){return x=j})},focusReset:"manual",scroll:"manual"})}function o(){x!==null&&(x(),x=null),m||setTimeout(u,20)}function u(){if(!m&&!navigation.transition){var _=navigation.currentEntry;_&&_.url!=null&&navigation.navigate(_.url,{state:_.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var m=!1,x=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",o),navigation.addEventListener("navigateerror",o),setTimeout(u,100),function(){m=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",o),navigation.removeEventListener("navigateerror",o),x!==null&&(x(),x=null)}}}function lg(r){this._internalRoot=r}Xd.prototype.render=lg.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(i(409));var u=o.current,m=qn();mw(u,m,r,o,null,null)},Xd.prototype.unmount=lg.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;mw(r.current,2,null,r,null,null),Td(),o[Br]=null}};function Xd(r){this._internalRoot=r}Xd.prototype.unstable_scheduleHydration=function(r){if(r){var o=So();r={blockedOn:null,target:r,priority:o};for(var u=0;u<ca.length&&o!==0&&o<ca[u].priority;u++);ca.splice(u,0,r),u===0&&yw(r)}};var kw=t.version;if(kw!=="19.2.6")throw Error(i(527,kw,"19.2.6"));Y.findDOMNode=function(r){var o=r._reactInternals;if(o===void 0)throw typeof r.render=="function"?Error(i(188)):(r=Object.keys(r).join(","),Error(i(268,r)));return r=d(o),r=r!==null?p(r):null,r=r===null?null:r.stateNode,r};var tR={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Zd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Zd.isDisabled&&Zd.supportsFiber)try{_e=Zd.inject(tR),oe=Zd}catch{}}return Ec.createRoot=function(r,o){if(!a(r))throw Error(i(299));var u=!1,m="",x=Ry,_=My,j=Dy;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onUncaughtError!==void 0&&(x=o.onUncaughtError),o.onCaughtError!==void 0&&(_=o.onCaughtError),o.onRecoverableError!==void 0&&(j=o.onRecoverableError)),o=hw(r,1,!1,null,null,u,m,null,x,_,j,Sw),r[Br]=o.current,Fp(r),new lg(o)},Ec.hydrateRoot=function(r,o,u){if(!a(r))throw Error(i(299));var m=!1,x="",_=Ry,j=My,z=Dy,X=null;return u!=null&&(u.unstable_strictMode===!0&&(m=!0),u.identifierPrefix!==void 0&&(x=u.identifierPrefix),u.onUncaughtError!==void 0&&(_=u.onUncaughtError),u.onCaughtError!==void 0&&(j=u.onCaughtError),u.onRecoverableError!==void 0&&(z=u.onRecoverableError),u.formState!==void 0&&(X=u.formState)),o=hw(r,1,!0,o,u??null,m,x,X,_,j,z,Sw),o.context=fw(null),u=o.current,m=qn(),m=ts(m),x=Kr(m),x.callback=null,Yr(u,x,m),u=m,o.current.lanes=u,Mt(o,u),$i(o),r[Br]=o.current,Fp(r),new Xd(o)},Ec.version="19.2.6",Ec}var Lw;function dR(){if(Lw)return dg.exports;Lw=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(),dg.exports=uR(),dg.exports}var TC=dR();const RC=(...e)=>e.filter((t,s,i)=>!!t&&t.trim()!==""&&i.indexOf(t)===s).join(" ").trim();const hR=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const fR=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,s,i)=>i?i.toUpperCase():s.toLowerCase());const Ow=e=>{const t=fR(e);return t.charAt(0).toUpperCase()+t.slice(1)};var pg={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const mR=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},pR=y.createContext({}),gR=()=>y.useContext(pR),bR=y.forwardRef(({color:e,size:t,strokeWidth:s,absoluteStrokeWidth:i,className:a="",children:l,iconNode:c,...h},f)=>{const{size:d=24,strokeWidth:p=2,absoluteStrokeWidth:g=!1,color:b="currentColor",className:v=""}=gR()??{},w=i??g?Number(s??p)*24/Number(t??d):s??p;return y.createElement("svg",{ref:f,...pg,width:t??d??pg.width,height:t??d??pg.height,stroke:e??b,strokeWidth:w,className:RC("lucide",v,a),...!l&&!mR(h)&&{"aria-hidden":"true"},...h},[...c.map(([k,N])=>y.createElement(k,N)),...Array.isArray(l)?l:[l]])});const be=(e,t)=>{const s=y.forwardRef(({className:i,...a},l)=>y.createElement(bR,{ref:l,iconNode:t,className:RC(`lucide-${hR(Ow(e))}`,`lucide-${e}`,i),...a}));return s.displayName=Ow(e),s};const xR=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],oo=be("activity",xR);const vR=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],zw=be("archive",vR);const yR=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],jf=be("arrow-down",yR);const _R=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],yu=be("arrow-left",_R);const wR=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],SR=be("arrow-right",wR);const kR=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Af=be("arrow-up",kR);const NR=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],CR=be("bell",NR);const ER=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],jR=be("blocks",ER);const AR=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],MC=be("book-open",AR);const TR=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],C0=be("bot",TR);const RR=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],Tf=be("box",RR);const MR=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],DR=be("braces",MR);const LR=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],DC=be("brain",LR);const OR=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],zR=be("calendar",OR);const BR=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],LC=be("camera",BR);const PR=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ws=be("check",PR);const IR=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Jn=be("chevron-down",IR);const $R=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],HR=be("chevron-left",$R);const UR=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Dn=be("chevron-right",UR);const FR=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Rf=be("chevron-up",FR);const qR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Mf=be("circle-alert",qR);const GR=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Df=be("circle-check-big",GR);const VR=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]],WR=be("circle-dashed",VR);const KR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],YR=be("circle-dot",KR);const XR=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ZR=be("circle-play",XR);const QR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],JR=be("circle-question-mark",QR);const e6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],E0=be("circle-x",e6);const t6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],vl=be("circle",t6);const s6=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],OC=be("cloud-upload",s6);const n6=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],zC=be("code-xml",n6);const i6=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Wh=be("copy",i6);const r6=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],a6=be("corner-down-right",r6);const o6=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],l6=be("cpu",o6);const c6=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Qn=be("database",c6);const u6=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],d6=be("dollar-sign",u6);const h6=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],cu=be("download",h6);const f6=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Kh=be("earth",f6);const m6=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],BC=be("ellipsis",m6);const p6=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Sa=be("external-link",p6);const g6=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],j0=be("eye-off",g6);const b6=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Lf=be("eye",b6);const x6=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],PC=be("file-code-corner",x6);const v6=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]],IC=be("file-diff",v6);const y6=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],$C=be("file-exclamation-point",y6);const _6=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],w6=be("file-spreadsheet",_6);const S6=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],A0=be("file-text",S6);const k6=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],HC=be("file",k6);const N6=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],C6=be("flask-conical",N6);const E6=[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],T0=be("folder-git-2",E6);const j6=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Of=be("folder-open",j6);const A6=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],R0=be("folder-plus",A6);const T6=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],xo=be("folder",T6);const R6=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],M6=be("funnel",R6);const D6=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],UC=be("gauge",D6);const L6=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],Mn=be("git-branch",L6);const O6=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],z6=be("git-commit-horizontal",O6);const B6=[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]],Bw=be("git-fork",B6);const P6=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],Yh=be("git-merge",P6);const I6=[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 9v12",key:"1sc30k"}],["path",{d:"m21 3-6 6",key:"16nqsk"}],["path",{d:"m21 9-6-6",key:"9j17rh"}],["path",{d:"M18 11.5V15",key:"65xf6f"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]],$6=be("git-pull-request-closed",I6);const H6=[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 9v12",key:"1sc30k"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v3",key:"1jb6z3"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]],U6=be("git-pull-request-create",H6);const F6=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]],FC=be("git-pull-request",F6);const q6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],M0=be("globe",q6);const G6=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],V6=be("grip-vertical",G6);const W6=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],K6=be("heart",W6);const Y6=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],X6=be("history",Y6);const Z6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Q6=be("image",Z6);const J6=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],uu=be("inbox",J6);const eM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],tM=be("info",eM);const sM=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],qC=be("key-round",sM);const nM=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],iM=be("languages",nM);const rM=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],aM=be("layers",rM);const oM=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],lM=be("link",oM);const cM=[["path",{d:"M10 5h11",key:"1hkqpe"}],["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 19h11",key:"14g2nv"}],["path",{d:"m3 10 3-3-3-3",key:"i7pm08"}],["path",{d:"m3 20 3-3-3-3",key:"20gx1n"}]],uM=be("list-collapse",cM);const dM=[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]],hM=be("list-tree",dM);const fM=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Rt=be("loader-circle",fM);const mM=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],Pw=be("loader",mM);const pM=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],gM=be("lock-keyhole",pM);const bM=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],GC=be("lock-open",bM);const xM=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],vM=be("lock",xM);const yM=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],_M=be("log-in",yM);const wM=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],SM=be("log-out",wM);const kM=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],D0=be("maximize-2",kM);const NM=[["path",{d:"M12 12v-2",key:"fwoke6"}],["path",{d:"M12 18v-2",key:"qj6yno"}],["path",{d:"M16 12v-2",key:"heuere"}],["path",{d:"M16 18v-2",key:"s1ct0w"}],["path",{d:"M2 11h1.5",key:"15p63e"}],["path",{d:"M20 18v-2",key:"12ehxp"}],["path",{d:"M20.5 11H22",key:"khsy7a"}],["path",{d:"M4 18v-2",key:"1c3oqr"}],["path",{d:"M8 12v-2",key:"1mwtfd"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["rect",{x:"2",y:"6",width:"20",height:"10",rx:"2",key:"1qcswk"}]],CM=be("memory-stick",NM);const EM=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]],jM=be("message-square-plus",EM);const AM=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],TM=be("message-square",AM);const RM=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],L0=be("minimize-2",RM);const MM=[["path",{d:"M5 12h14",key:"1ays0h"}]],VC=be("minus",MM);const DM=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],LM=be("moon",DM);const OM=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],zM=be("network",OM);const BM=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],PM=be("package",BM);const IM=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],WC=be("palette",IM);const $M=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],HM=be("panel-left-close",$M);const UM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],FM=be("panel-left-open",UM);const qM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],GM=be("panel-left",qM);const VM=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],WM=be("paperclip",VM);const KM=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],YM=be("pen-line",KM);const XM=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],yl=be("pencil",XM);const ZM=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Mr=be("play",ZM);const QM=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],KC=be("plug",QM);const JM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ws=be("plus",JM);const e8=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],O0=be("puzzle",e8);const t8=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],s8=be("radio",t8);const n8=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Dr=be("refresh-cw",n8);const i8=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],zf=be("rotate-ccw",i8);const r8=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],a8=be("rotate-cw",r8);const o8=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],YC=be("save",o8);const l8=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],XC=be("scroll-text",l8);const c8=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ZC=be("search",c8);const u8=[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],d8=be("send-horizontal",u8);const h8=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Bf=be("server",h8);const f8=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],z0=be("settings-2",f8);const m8=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],QC=be("settings",m8);const p8=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],g8=be("shield-alert",p8);const b8=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],JC=be("shield-check",b8);const x8=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}],["path",{d:"M12 17h.01",key:"p32p05"}]],eE=be("shield-question-mark",x8);const v8=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],tE=be("skip-forward",v8);const y8=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],Li=be("sparkles",y8);const _8=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],_u=be("square-terminal",_8);const w8=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],fo=be("square",w8);const S8=[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]],k8=be("stethoscope",S8);const N8=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],C8=be("sun",N8);const E8=[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]],sE=be("table-2",E8);const j8=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],kl=be("terminal",j8);const A8=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Oi=be("trash-2",A8);const T8=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Rr=be("triangle-alert",T8);const R8=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Pf=be("upload",R8);const M8=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],D8=be("user",M8);const L8=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],O8=be("wand-sparkles",L8);const z8=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],B8=be("webhook",z8);const P8=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],Xh=be("workflow",P8);const I8=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],qt=be("x",I8);const $8=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],nE=be("zap",$8);class iE extends Error{conflict;constructor(t,s){super(t),this.name="PortConflictResponseError",this.conflict=s}}async function Te(e,t){const s=await fetch(e,t),i=await s.json().catch(()=>{});if(!s.ok)throw s.status===409&&i?.conflict?.code==="PORT_IN_USE"?new iE(i?.error||"Port already in use",i.conflict):new Error(i?.error||s.statusText);return i}async function Mi(e,t){const s=new URLSearchParams;for(const[i,a]of Object.entries(t))a!==void 0&&String(a).trim()&&s.set(i,String(a));await Te(e,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s})}async function Yn(e,t){const s=new URLSearchParams;for(const[i,a]of Object.entries(t))a!==void 0&&String(a).trim()&&s.set(i,String(a));return Te(e,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s})}const H8="modulepreload",U8=function(e){return"/"+e},Iw={},wu=function(t,s,i){let a=Promise.resolve();if(s&&s.length>0){let f=function(d){return Promise.all(d.map(p=>Promise.resolve(p).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),h=c?.nonce||c?.getAttribute("nonce");a=f(s.map(d=>{if(d=U8(d),d in Iw)return;Iw[d]=!0;const p=d.endsWith(".css"),g=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${g}`))return;const b=document.createElement("link");if(b.rel=p?"stylesheet":H8,p||(b.as="script"),b.crossOrigin="",b.href=d,h&&b.setAttribute("nonce",h),document.head.appendChild(b),p)return new Promise((v,w)=>{b.addEventListener("load",v),b.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${d}`)))})}))}function l(c){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=c,window.dispatchEvent(h),!h.defaultPrevented)throw c}return a.then(c=>{for(const h of c||[])h.status==="rejected"&&l(h.reason);return t().catch(l)})},$s=()=>typeof window<"u"&&(!!window.__TAURI_INTERNALS__||!!window.__TAURI__);async function If(){if(!$s())return null;try{return await wu(()=>import("./window-DlR023_X.js"),__vite__mapDeps([0,1,2]))}catch{return null}}async function F8(){await(await If())?.getCurrentWindow().minimize()}async function q8(){await(await If())?.getCurrentWindow().toggleMaximize()}async function G8(){await(await If())?.getCurrentWindow().hide()}async function V8(){await(await If())?.getCurrentWindow().startDragging()}async function $f(e){if($s())try{const{invoke:t}=await wu(async()=>{const{invoke:s}=await import("./core-DhEqZVGG.js");return{invoke:s}},[]);await t("open_external",{url:e});return}catch{}window.open(e,"_blank","noopener,noreferrer")}let gg=null,bg=null;async function W8(){return gg||(gg=(await wu(()=>import("./core-DhEqZVGG.js"),[])).invoke),gg}async function K8(){return bg||(bg=(await wu(()=>import("./event-BK_86lmQ.js"),__vite__mapDeps([2,1]))).listen),bg}async function Oe(e,t){return(await W8())(e,t)}async function B0(e,t){return(await K8())(e,i=>t(i.payload))}function Y8(e){const t=e.state.toLowerCase();return{name:e.name,state:t==="stopping"?"stopped":t,pid:e.pid??void 0,exitCode:e.exitCode??null,url:e.url??void 0}}function X8(e){const t={};for(const s of e.runtime.services)t[s.name]=Y8(s);for(const s of e.config.services)typeof s.name!="string"||t[s.name]||(t[s.name]={name:s.name,state:"stopped",pid:void 0,exitCode:null,url:void 0});return{ok:!0,cwd:"",config:{services:e.config.services,bundles:e.config.bundles,gitRepositories:e.config.gitRepositories,selectedGitRepository:e.config.selectedGitRepository??void 0,gitBoardRepositories:e.config.gitBoardRepositories??void 0},runtime:{services:t},ports:[],health:{},timeline:[],logs:[],git:{cwd:"",selectedRepository:null,status:null,branches:[]}}}function Z8(e){const t=[];return e.map(s=>{let i=t.indexOf(s.hash);i===-1&&(i=t.indexOf(null),i===-1&&(i=t.length,t.push(null))),t[i]=null;const a=[];for(let h=0;h<s.parents.length;h++){const f=s.parents[h],d=t.indexOf(f);if(d!==-1){const g=d===i?"straight":"merge";a.push({fromLane:i,toLane:d,parentHash:f,kind:g});continue}let p;h===0?(p=i,t[i]=f,a.push({fromLane:i,toLane:i,parentHash:f,kind:"straight"})):(p=t.indexOf(null),p===-1?(p=t.length,t.push(f)):t[p]=f,a.push({fromLane:i,toLane:p,parentHash:f,kind:"branch"}))}const l=t.map((h,f)=>h!==null&&f!==i?f:-1).filter(h=>h!==-1),c=t.reduce((h,f,d)=>f!==null?Math.max(h,d+1):h,i+1);return{lane:i,laneCount:c,edges:a,throughLanes:l}})}function Q8(e){const t=Z8(e);return e.map((s,i)=>({hash:s.hash,parents:s.parents,author:s.author,email:s.email,timestamp:new Date(s.date).getTime()/1e3,subject:s.subject,refs:s.refs.map(a=>({name:a,kind:a.startsWith("HEAD")?"head":a.startsWith("origin/")||a.includes("/")?"remote":"branch"})),lane:t[i].lane,laneCount:t[i].laneCount,edges:t[i].edges,throughLanes:t[i].throughLanes}))}function J8(e){return e.map(t=>({name:t.name,current:t.isCurrent,remote:t.isRemote}))}async function eD(e){return Oe("service_processes",{name:e})}async function tD(){const e=await Oe("get_dashboard"),t=X8(e),s=e.runtime.services.filter(d=>d.state.toLowerCase()==="running"),i={};await Promise.all(s.map(async d=>{const p=await eD(d.name).catch(()=>null);p&&(i[d.name]={service:d.name,status:"unknown",summary:"",checkedAt:new Date().toISOString(),checks:[],processTree:p,ports:[],agentContext:""})})),t.health=i;const a=e.config.gitRepositories??[],l=e.config.selectedGitRepository,c=l?a.find(d=>d.name===l)??null:null;if(!c)return t;const[h,f]=await Promise.all([aE().catch(()=>null),vD().catch(()=>[])]);return{...t,git:{cwd:c.path,selectedRepository:c,status:h,branches:f}}}async function rE(e){await Oe("start_service",{name:e})}async function sD(e){await Oe("stop_service",{name:e})}async function nD(e){await Oe("restart_service",{name:e})}async function iD(e){await Oe("start_bundle",{name:e})}async function rD(e){await Oe("stop_bundle",{name:e})}async function aD(e){await Oe("remove_service",{name:e})}async function oD(e){return Oe("register_service",{service:e})}async function lD(e){return Oe("register_bundle",{bundle:e})}async function cD(e,t){return{logs:await Oe("get_logs",{service:e,limit:t??200}),queryable:!1}}async function aE(e){return Oe("git_status",{repo:null})}async function uD(e,t){return Oe("git_diff",{file:e??null,repo:t??null})}async function dD(e=200){const t=await Oe("git_graph",{limit:e,repo:null});return Q8(t)}async function hD(e,t){return Oe("git_commit_diff",{hash:e,file:t??null,repo:null})}async function fD(e){return await Oe("git_commit_files",{hash:e,repo:null})}async function mD(e,t){await Oe("git_stage",{paths:e,repo:t??null})}async function pD(e,t){await Oe("git_unstage",{paths:e,repo:t??null})}async function gD(e,t){return Oe("git_commit",{message:e,repo:t??null})}async function bD(e){return{output:await Oe("git_push",{remote:null,repo:e??null}),branch:"",setUpstream:!1}}async function xD(e,t){return await Oe("git_create_branch",{name:e,repo:null}),""}async function vD(e){const t=await Oe("git_branches",{repo:null});return J8(t)}async function yD(e){return{output:await Oe("git_pull_default",{repo:null}),branch:""}}async function _D(e){return Oe("git_list_files",{repo:null})}async function wD(e){return Oe("git_file_sizes",{repo:null})}async function SD(e){await Oe("select_git_repository",{name:e})}async function kD(e,t){const s=await Oe("git_read_file",{path:e,repo:null});return{content:s,truncated:!1,binary:!1,size:s.length}}async function ND(e,t,s){await Oe("git_write_file",{path:e,content:t,repo:null})}async function CD(e){await Oe("remove_git_repository",{name:e})}async function oE(e){return Oe("register_git_repository",{repo:e})}async function ED(e){return Oe("clone_git_repository",{url:e})}async function jD(e){return await Oe("set_git_board_repositories",{names:e}),e}async function AD(){const e=await Oe("get_dashboard"),t=e.config.gitRepositories,s=e.config.gitBoardRepositories;return{repos:(await Promise.allSettled(t.map(async l=>{const c=await Oe("git_status",{repo:l.name});return{name:l.name,path:l.path,branch:c.branch,ahead:c.ahead,behind:c.behind,files:c.files}}))).map((l,c)=>l.status==="fulfilled"?l.value:{name:t[c].name,path:t[c].path,branch:"",ahead:0,behind:0,files:[],error:String(l.reason)}),board:s??t.map(l=>l.name)}}async function TD(){return Oe("get_github_token_status")}async function $w(e,t){await Oe("set_github_token",{host:e,token:t})}async function RD(e){await Oe("remove_github_token",{host:e})}async function fn(e){return Oe("get_github_repo",{repo:null})}async function MD(e,t,s){return Oe("list_pull_requests",{owner:e,repo:t,stateFilter:s??"open"})}async function DD(e,t,s){return Oe("list_issues",{owner:e,repo:t,stateFilter:s??"open"})}async function Hw(e,t,s){return Oe("get_pull_request",{owner:e,repo:t,number:s})}async function LD(e){return Oe("create_pull_request",e)}async function OD(e){return Oe("github_oauth_start",{clientId:e})}async function zD(e,t){return Oe("github_oauth_poll",{clientId:e,deviceCode:t})}async function BD(e,t,s){return Oe("get_pr_diff",{owner:e,repo:t,number:s})}async function PD(e,t,s){return Oe("list_pr_files",{owner:e,repo:t,number:s})}async function ID(e,t,s){return Oe("list_pr_reviews",{owner:e,repo:t,number:s})}async function $D(e,t,s){return Oe("list_pr_comments",{owner:e,repo:t,number:s})}async function HD(e,t,s,i={}){return Oe("merge_pull_request",{owner:e,repo:t,number:s,method:i.method??null,commitTitle:i.commitTitle??null,commitMessage:i.commitMessage??null})}async function UD(e,t,s){return Oe("get_github_issue",{owner:e,repo:t,number:s})}async function FD(e,t,s){return Oe("list_issue_comments",{owner:e,repo:t,number:s})}async function qD(e,t,s,i){return Oe("add_issue_comment",{owner:e,repo:t,number:s,body:i})}async function GD(e,t){return Oe("list_github_branches",{owner:e,repo:t})}async function Uw(e,t){return Oe("get_github_repo_info",{owner:e,repo:t})}async function Fw(e,t,s){return Oe("list_commit_check_runs",{owner:e,repo:t,sha:s})}async function VD(e,t,s,i){return Oe("list_workflow_runs",{owner:e,repo:t,branch:s??null,page:i??null})}async function WD(e,t,s){return Oe("list_workflow_run_jobs",{owner:e,repo:t,runId:s})}async function KD(){return Oe("list_databases")}async function xg(e,t,s){return Oe("query_database",{name:e,sql:t,limit:s??null})}async function YD(e,t){return Oe("execute_database",{name:e,sql:t})}async function XD(e){return Oe("list_tables",{name:e})}async function lE(e){await Oe("register_database",{db:e})}async function ZD(e){await Oe("remove_database",{name:e})}async function QD(e,t){await Oe("set_database_write_access",{name:e,unlocked:t})}async function JD(){return(await Oe("get_config")).logSources}async function e7(e){await Oe("register_log_source",{source:e})}async function t7(e){return Oe("list_snapshots",{repo:null})}async function s7(e,t){return Oe("create_snapshot",{label:e??null,repo:null})}async function n7(e,t){await Oe("restore_snapshot",{sha:e,repo:null})}async function i7(e,t){await Oe("delete_snapshot",{sha:e,repo:null})}async function r7(e,t){return Oe("get_snapshot_files",{sha:e,repo:null})}async function a7(e,t,s){return Oe("get_snapshot_diff",{sha:e,path:t??null,repo:null})}async function o7(){return Oe("list_workflows")}async function l7(e){return Oe("save_workflow",{workflow:e})}async function c7(e){return Oe("delete_workflow",{id:e})}async function u7(){return Oe("get_agent_info")}async function d7(){return Oe("get_agent_chat_status")}async function h7(e){return Oe("set_chat_provider",{provider:e})}async function f7(e,t,s){await Oe("start_agent_chat",{message:e,resumeSessionId:t??null,provider:s??null})}async function m7(e){return Oe("scan_repo_url",{url:e})}async function p7(e,t){await Oe("run_install_command",{cwd:e,command:t})}async function g7(){return(await Oe("list_terminal_sessions")).map(t=>({...t,serviceName:t.serviceName??void 0,label:t.serviceName??t.label??void 0}))}async function qw(e){const t=await Oe("create_terminal_session",{serviceName:e?.serviceName??null,cwd:e?.cwd??null,agent:e?.agent??null});return{...t,serviceName:t.serviceName??void 0,label:t.serviceName??t.label??void 0}}async function Gw(e,t){await Oe("write_terminal_input",{id:e,data:t})}async function b7(e){await Oe("start_terminal_stream",{id:e})}async function x7(e,t,s){await Oe("resize_terminal",{id:e,cols:t,rows:s})}async function v7(e){await Oe("close_terminal_session",{id:e})}async function y7(e,t){return B0(`terminal-output-${e}`,s=>t(s))}const _7={async getAgentInfo(){return(await Te("/api/agent")).agent},async getMcpAuthStatuses(e){return(await Te(`/api/agent/mcp-status?agent=${encodeURIComponent(e)}`)).statuses},async getAgentUsage(){return(await Te("/api/agent/usage")).usage},async getAgentUsageHistory(e){const t=e?`?since=${encodeURIComponent(e)}`:"",s=await Te(`/api/agent/usage/history${t}`);return{entries:s.entries,summary:s.summary}},async getClaudeAgentSettings(){return(await Te("/api/agent/claude-settings")).settings},async updateClaudeAgentSettings(e){return(await Te("/api/agent/claude-settings",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).settings}},w7={getAgentInfo:()=>u7(),getMcpAuthStatuses:async()=>[],getAgentUsage:async()=>({}),getAgentUsageHistory:async()=>({entries:[],summary:{runs:0,totalCostUSD:0,totalInputTokens:0,totalOutputTokens:0,totalTokens:0,byDay:[],codexTotalTokens:0}}),getClaudeAgentSettings:async()=>({coAuthorWithClaude:!0}),updateClaudeAgentSettings:async e=>({coAuthorWithClaude:e.coAuthorWithClaude??!0})},S7=$s()?w7:_7,{getAgentInfo:cE,getMcpAuthStatuses:k7,getAgentUsage:N7,getAgentUsageHistory:C7,getClaudeAgentSettings:E7,updateClaudeAgentSettings:j7}=S7,A7={async getAgentChatStatus(){const e=await Te("/api/agent/chat/status");return{configured:e.configured,approvals:e.approvals,provider:e.provider,providers:e.providers??[]}},async setChatProvider(e){return(await Te("/api/agent/chat/provider",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({provider:e})})).provider},async approveAgentTool(e,t,s){await Te("/api/agent/chat/approve",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sessionId:e,requestId:t,decision:s})})},async streamAgentChat(e,t,s,i,a,l){const c=await fetch("/api/agent/chat",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({message:e,resumeSessionId:t,autoApprove:a,provider:l}),signal:i});if(!c.ok||!c.body){const p=await c.json().catch(()=>{});throw new Error(p?.error||c.statusText||"Agent request failed")}const h=c.body.getReader(),f=new TextDecoder;let d="";for(;;){const{done:p,value:g}=await h.read();if(p)break;d+=f.decode(g,{stream:!0});let b=d.indexOf(`
11
+
12
+ `);for(;b!==-1;){const v=d.slice(0,b);d=d.slice(b+2);const w=v.split(`
13
+ `).find(k=>k.startsWith("data:"));if(w){const k=w.slice(5).trim();if(k)try{s(JSON.parse(k))}catch{}}b=d.indexOf(`
14
+
15
+ `)}}}};let vg="claude";const T7={async getAgentChatStatus(){const t=await d7();return vg=t.provider?.id??"claude",{...t,providers:t.providers??[]}},async setChatProvider(e){const s=await h7(e)??null;return vg=s?.id??e,s??{id:e}},approveAgentTool:async()=>{},streamAgentChat(e,t,s,i,a,l){let c,h=!1;return new Promise(f=>{(async()=>{if(c=await B0("agent-chat-event",d=>{if(h)return;const p=d;s(p),(p.type==="done"||p.type==="error")&&(h=!0,c?.(),f())}),i?.aborted){h=!0,c?.(),f();return}i?.addEventListener("abort",()=>{h||(h=!0,c?.(),f())});try{await f7(e,t,l??vg)}catch(d){h=!0,c?.(),s({type:"error",message:String(d)}),s({type:"done",stopReason:"error"}),f()}})().catch(d=>{h||(h=!0,c?.(),s({type:"error",message:String(d)}),s({type:"done",stopReason:"error"}),f())})})}},R7=$s()?T7:A7,{getAgentChatStatus:M7,setChatProvider:D7,approveAgentTool:L7,streamAgentChat:O7}=R7;function Ei(e,t){return Te(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)})}const z7={async getAgentEnvAgents(){return(await Te("/api/agent-env/agents")).agents},async getAgentEnvConfigs(){return(await Te("/api/agent-env/live")).configs},async getAgentEnvDoctor(){const e=await Te("/api/agent-env/doctor");return{checks:e.checks,hasIssues:e.hasIssues}},async previewAgentEnvChanges(e){const t=await Ei("/api/agent-env/changes/preview",{changes:e});return{valid:t.valid,items:t.items,agents:t.agents}},async applyAgentEnvChanges(e){return Ei("/api/agent-env/changes/apply",{changes:e})},async getAgentEnvSettings(e){return(await Te(`/api/agent-env/settings/${e}`)).settings},async saveAgentEnvSettings(e,t){const s=await Te(`/api/agent-env/settings/${e}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({content:t})});return{settings:s.settings,backup:s.backup}},async setAgentEnvModel(e,t){const s=await Ei(`/api/agent-env/settings/${e}/model`,{model:t});return{settings:s.settings,backup:s.backup}},async listAgentEnvProfiles(){return(await Te("/api/agent-env/profiles")).profiles},async getAgentEnvProfile(e){return(await Te(`/api/agent-env/profiles/${encodeURIComponent(e)}`)).profile},async updateAgentEnvProfile(e,t){return(await Te(`/api/agent-env/profiles/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)})).profile},async deleteAgentEnvProfile(e){await Te(`/api/agent-env/profiles/${encodeURIComponent(e)}`,{method:"DELETE"})},async snapshotAgentEnvProfile(e){return(await Ei("/api/agent-env/profiles/snapshot",e)).profile},async previewAgentEnvProfileApply(e,t){return Ei(`/api/agent-env/profiles/${encodeURIComponent(e)}/apply-preview`,{agent:t})},async applyAgentEnvProfile({name:e,agent:t,skip:s}){return Ei(`/api/agent-env/profiles/${encodeURIComponent(e)}/apply`,{agent:t,skip:s})},async exportAgentEnvProfile(e){return{archivePath:(await Ei(`/api/agent-env/profiles/${encodeURIComponent(e)}/export`,{})).archivePath}},async importAgentEnvProfile(e,t){return Te(`/api/agent-env/profiles/import${t?.force?"?force=1":""}`,{method:"POST",headers:{"content-type":"application/gzip"},body:e})},async getRegistryAuthStatus(){const e=await Te("/api/agent-env/auth/status"),{ok:t,...s}=e;return s},async startRegistryAuth(){const e=await Ei("/api/agent-env/auth/start",{});return{url:e.url,state:e.state}},async getRegistryAuthOutcome(e){return Te(`/api/agent-env/auth/outcome?state=${encodeURIComponent(e)}`)},async registryLogout(){await Ei("/api/agent-env/auth/logout",{})},async publishAgentEnvProfile({name:e,...t}){return Ei(`/api/agent-env/profiles/${encodeURIComponent(e)}/publish`,t)},async installAgentEnvProfileFromRegistry(e){return Ei("/api/agent-env/profiles/install-from-registry",e)}},Ls=()=>Promise.reject(new Error("Agent Environments is not available in desktop mode yet.")),B7={getAgentEnvAgents:async()=>[],getAgentEnvConfigs:async()=>[],getAgentEnvDoctor:async()=>({checks:[{label:"Desktop mode",status:"warn",message:"Agent Environments is not available in desktop mode yet."}],hasIssues:!0}),previewAgentEnvChanges:Ls,applyAgentEnvChanges:Ls,getAgentEnvSettings:Ls,saveAgentEnvSettings:Ls,setAgentEnvModel:Ls,listAgentEnvProfiles:async()=>[],getAgentEnvProfile:Ls,updateAgentEnvProfile:Ls,deleteAgentEnvProfile:Ls,snapshotAgentEnvProfile:Ls,previewAgentEnvProfileApply:Ls,applyAgentEnvProfile:Ls,exportAgentEnvProfile:Ls,importAgentEnvProfile:Ls,getRegistryAuthStatus:Ls,startRegistryAuth:Ls,getRegistryAuthOutcome:Ls,registryLogout:Ls,publishAgentEnvProfile:Ls,installAgentEnvProfileFromRegistry:Ls},P7=$s()?B7:z7,{getAgentEnvAgents:I7,getAgentEnvConfigs:$7,getAgentEnvDoctor:H7,previewAgentEnvChanges:U7,applyAgentEnvChanges:F7,getAgentEnvSettings:q7,saveAgentEnvSettings:G7,setAgentEnvModel:V7,listAgentEnvProfiles:W7,getAgentEnvProfile:K7,updateAgentEnvProfile:Y7,deleteAgentEnvProfile:X7,snapshotAgentEnvProfile:Z7,previewAgentEnvProfileApply:Q7,applyAgentEnvProfile:J7,exportAgentEnvProfile:eL,importAgentEnvProfile:Vw,getRegistryAuthStatus:tL,startRegistryAuth:sL,getRegistryAuthOutcome:nL,registryLogout:iL,publishAgentEnvProfile:rL,installAgentEnvProfileFromRegistry:Ww}=P7,aL={async listDatabases(){return(await Te("/api/databases")).connections},async detectDatabases(){return(await Te("/api/databases/detect")).detected},async addDatabase(e){await Yn("/api/databases",e)},testDatabase(e){return Yn("/api/databases/test",e)},async deleteDatabase(e){await Te(`/api/databases/${encodeURIComponent(e)}`,{method:"DELETE"})},async getDatabaseTables(e){return(await Te(`/api/databases/${encodeURIComponent(e)}/tables`)).tables},runDatabaseQuery(e,t,s=100){return Yn(`/api/databases/${encodeURIComponent(e)}/query`,{sql:t,limit:s})},async setDatabaseWriteAccess(e,t){await Yn(`/api/databases/${encodeURIComponent(e)}/write-access`,{unlocked:String(t)})},executeDatabaseWrite(e,t,s){return Yn(`/api/databases/${encodeURIComponent(e)}/execute`,{sql:t,mode:s})},getDatabaseRows(e,t,s=100,i=0){return Te(`/api/databases/${encodeURIComponent(e)}/rows?table=${encodeURIComponent(t)}&limit=${s}&offset=${i}`)}};function Kw(e){const t=e.columns.map(i=>({name:i,dataType:"text",nullable:!0,primaryKey:!1})),s=e.rows.map(i=>{const a={};return e.columns.forEach((l,c)=>{a[l]=i[c]}),a});return{columns:t,rows:s,rowCount:e.rowCount}}const oL={async listDatabases(){return await KD()},detectDatabases:async()=>[],async addDatabase(e){await lE(e)},async testDatabase(){try{return await xg("__test__","SELECT 1",1),{ok:!0}}catch(e){return{ok:!1,error:String(e)}}},async deleteDatabase(e){await ZD(e)},async getDatabaseTables(e){return(await XD(e)).map(s=>({name:s,qualifiedName:s}))},async runDatabaseQuery(e,t,s=100){const i=await xg(e,t,s),{columns:a,rows:l,rowCount:c}=Kw(i);return{engine:"sqlite",columns:a,rows:l,rowCount:c,truncated:!1}},async setDatabaseWriteAccess(e,t){await QD(e,t)},async executeDatabaseWrite(e,t,s){return s==="preview"?{engine:"sqlite",previewUnavailable:!0}:{engine:"sqlite",previewUnavailable:!1,affectedRows:await YD(e,t),committed:!0}},async getDatabaseRows(e,t,s=100,i=0){const a=i>0?`SELECT * FROM ${t} LIMIT ${s} OFFSET ${i}`:`SELECT * FROM ${t} LIMIT ${s}`,l=await xg(e,a,s),{columns:c,rows:h,rowCount:f}=Kw(l);return{engine:"sqlite",table:{name:t,qualifiedName:t},columns:c,rows:h,rowCount:f,limit:s,offset:i}}},lL=$s()?oL:aL,{listDatabases:uE,detectDatabases:cL,addDatabase:uL,testDatabase:dL,deleteDatabase:hL,getDatabaseTables:dE,runDatabaseQuery:fL,setDatabaseWriteAccess:mL,executeDatabaseWrite:Yw,getDatabaseRows:pL}=lL,hE={async getErrorIncidents(e=100){return(await Te(`/api/errors?limit=${e}`)).incidents},getErrorPrompt(e){return Te(`/api/errors/${e}/prompt`)},getErrorBundle(e,t=!1){return Te(`/api/errors/${e}/bundle${t?"?save=1":""}`)},startFix(e){return Te(`/api/errors/${e}/fix`,{method:"POST"})}},gL={...hE,getErrorIncidents:async()=>[]},bL=$s()?gL:hE,{getErrorIncidents:fE,startFix:xL}=bL,vL={async getGitGraph(e=200){return(await Te(`/api/git/graph?limit=${e}`)).commits},async getGitCommitDiff(e,t){const s=new URLSearchParams({hash:e});t&&s.set("file",t);const i=await fetch(`/api/git/commit?${s.toString()}`);if(!i.ok){const a=await i.json().catch(()=>({error:i.statusText}));throw new Error(a.error||"Unable to load commit diff")}return i.text()},async getGitCommitFiles(e){return(await Te(`/api/git/commit/files?hash=${encodeURIComponent(e)}`)).files},async getGitFiles(){return(await Te("/api/git/files")).files},async getFileSizeRanking(){return(await Te("/api/git/file-sizes")).files},async getGitFile(e){const t=await Te(`/api/git/file?path=${encodeURIComponent(e)}`);return{content:t.content,truncated:t.truncated,binary:t.binary,size:t.size}},async updateGitFile(e,t){await Te("/api/git/file",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({path:e,content:t})})},async getGitDiff(e,t){const s=new URLSearchParams({file:e});t&&s.set("repo",t);const i=await fetch(`/api/git/diff?${s.toString()}`);if(!i.ok){const a=await i.json().catch(()=>({error:i.statusText}));throw new Error(a.error||"Unable to load diff")}return i.text()},async getGitOverview(){const e=await Te("/api/git/overview"),t=e.repos??[],s=e.board??t.map(i=>i.name);return{repos:t,board:s}},async setGitBoard(e){return(await Te("/api/git/board",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({names:e})})).board},async gitStage(e,t){await Te("/api/git/stage",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t?{paths:e,repo:t}:{paths:e})})},async gitUnstage(e,t){await Te("/api/git/unstage",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t?{paths:e,repo:t}:{paths:e})})},async gitCommit(e,t){return(await Yn("/api/git/commit",{message:e,...t?{repo:t}:{}})).output},async gitPush(e){const t=await Yn("/api/git/push",e?{repo:e}:{});return{output:t.output,branch:t.branch,setUpstream:t.setUpstream}},async gitCheckoutDefaultAndPull(){const e=await Yn("/api/git/default-branch/pull",{});return{output:e.output,branch:e.branch}},async gitCreateBranch(e){return(await Yn("/api/git/branches",{name:e})).output},async deleteGitRepository(e){await Te(`/api/git/repositories/${encodeURIComponent(e)}`,{method:"DELETE"})},async selectGitRepository(e){await Mi("/api/git/select",{name:e})},async registerGitRepository(e,t){await Mi("/api/git/repositories",{name:e,path:t})},async cloneGitRepository(e){const t=await Yn("/api/git/clone",{url:e});return{name:t.name,path:t.path}}},yL={getGitGraph:(e=200)=>dD(e),getGitCommitDiff:(e,t)=>hD(e,t),getGitCommitFiles:e=>fD(e),getGitFiles:()=>_D(),getFileSizeRanking:()=>wD(),getGitFile:e=>kD(e),updateGitFile:(e,t)=>ND(e,t),getGitDiff:(e,t)=>uD(e,t),getGitOverview:()=>AD(),setGitBoard:e=>jD(e),gitStage:(e,t)=>mD(e,t),gitUnstage:(e,t)=>pD(e,t),gitCommit:(e,t)=>gD(e,t),gitPush:e=>bD(e),gitCheckoutDefaultAndPull:()=>yD(),gitCreateBranch:e=>xD(e),deleteGitRepository:e=>CD(e),selectGitRepository:e=>SD(e),registerGitRepository:async(e,t)=>{await oE({name:e,path:t})},cloneGitRepository:e=>ED(e)},_L=$s()?yL:vL,{getGitGraph:wL,getGitCommitDiff:SL,getGitCommitFiles:kL,getGitFiles:NL,getFileSizeRanking:CL,getGitFile:EL,updateGitFile:jL,getGitDiff:mE,getGitOverview:yg,setGitBoard:Xw,gitStage:P0,gitUnstage:pE,gitCommit:gE,gitPush:Hf,gitCheckoutDefaultAndPull:AL,gitCreateBranch:TL,deleteGitRepository:RL,selectGitRepository:bE,registerGitRepository:ML,cloneGitRepository:DL}=_L,LL={getGitHubTokenInfo(){return Te("/api/github/token")},startGitHubDeviceFlow(){return Te("/api/github/oauth/start",{method:"POST"})},async pollGitHubDeviceFlow(e){const t=await Te("/api/github/oauth/poll",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({device_code:e})});return{done:t.done,slowDown:t.slowDown}},async setGitHubToken(e,t){const s=new URLSearchParams({host:e,token:t});await Te("/api/github/token",{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s})},async removeGitHubToken(e){await Te(`/api/github/token/${encodeURIComponent(e)}`,{method:"DELETE"})},async listGitHubBranches(){const e=await Te("/api/github/branches");return{repository:e.repository,defaultBranch:e.defaultBranch,currentBranch:e.currentBranch,branches:e.branches}},async listGitHubPRs(e="open",t=1){return(await Te(`/api/github/prs?state=${e}&page=${t}`)).prs},async getGitHubPR(e){return(await Te(`/api/github/prs/${e}`)).pr},async getGitHubPRDiff(e){const t=await fetch(`/api/github/prs/${e}/diff`);if(!t.ok){const s=await t.json().catch(()=>({error:t.statusText}));throw new Error(s.error||"Unable to load PR diff")}return t.text()},async getGitHubPRReviewCockpit(e){return(await Te(`/api/github/prs/${e}/review`)).cockpit},async getGitHubPRTemplate(){return(await Te("/api/github/pr-template")).template},async createGitHubPR(e){return(await Te("/api/github/prs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).pr},async mergeGitHubPR(e,t={}){const s=await Te(`/api/github/prs/${e}/merge`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({method:t.method??"squash",...t})});return{merged:s.merged,sha:s.sha,message:s.message}},async listGitHubIssues(e="open",t=1){return(await Te(`/api/github/issues?state=${e}&page=${t}`)).issues},async getGitHubIssue(e){return(await Te(`/api/github/issues/${e}`)).issue},async listGitHubIssueComments(e){return(await Te(`/api/github/issues/${e}/comments`)).comments},async addGitHubIssueComment(e,t){return(await Te(`/api/github/issues/${e}/comments`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({body:t})})).comment},async getCommitCIStatus(e){return(await Te(`/api/github/ci/${encodeURIComponent(e)}`)).status},async listGitHubWorkflowRuns(e,t=1){const s=new URLSearchParams({page:String(t)});return e&&s.set("branch",e),(await Te(`/api/github/runs?${s}`)).runs},async listGitHubWorkflowRunJobs(e){return(await Te(`/api/github/runs/${e}/jobs`)).jobs}},Zw="Iv23liCxW0Mv0KJP1Svr";function Qw(e){if(e.length===0)return"unknown";const t=e.map(s=>s.conclusion);return t.every(s=>s==="success")?"success":t.some(s=>s==="failure"||s==="cancelled")?"failure":"pending"}const OL={async getGitHubTokenInfo(){const e=await TD();return{configured:e.configured,deviceFlowAvailable:!0,status:e.configured?"connected":"not_configured"}},async startGitHubDeviceFlow(){return await OD(Zw)},async pollGitHubDeviceFlow(e){const t=await zD(Zw,e);return t.access_token?(await $w("github.com",t.access_token),{done:!0}):{done:!1,slowDown:t.error==="slow_down"}},async setGitHubToken(e,t){await $w(e,t)},async removeGitHubToken(e){await RD(e)},async listGitHubBranches(){const[e,t]=await fn(),[s,i]=await Promise.all([GD(e,t),Uw(e,t)]);return{repository:{full_name:i.full_name??`${e}/${t}`,html_url:i.html_url??"",default_branch:i.default_branch},defaultBranch:i.default_branch??null,currentBranch:null,branches:Array.isArray(s)?s:[]}},async listGitHubPRs(e="open",t=1){const[s,i]=await fn();return(await MD(s,i,e)).slice((t-1)*50,t*50)},async getGitHubPR(e){const[t,s]=await fn();return Hw(t,s,e)},async getGitHubPRDiff(e){const[t,s]=await fn();return BD(t,s,e)},async getGitHubPRReviewCockpit(e){const[t,s]=await fn(),i=await Hw(t,s,e),[a,l,c,h]=await Promise.all([PD(t,s,e),ID(t,s,e),$D(t,s,e),Fw(t,s,i.head.sha)]),f=h.check_runs??[];return{pr:i,files:Array.isArray(a)?a:[],reviews:Array.isArray(l)?l:[],comments:Array.isArray(c)?c:[],checks:{sha:i.head.sha,state:Qw(f),totalCount:h.total_count??f.length,runs:f}}},async getGitHubPRTemplate(){const[e,t]=await fn(),s=await Uw(e,t),i=s.default_branch??"main";return{repository:{full_name:s.full_name??`${e}/${t}`,html_url:s.html_url??"",default_branch:s.default_branch},currentBranch:null,suggestedBase:i,base:i,head:"",title:"",body:"",draft:!1,compare:{base:i,head:"",aheadBy:0,headSha:null,commits:[],files:[]},warnings:[]}},async createGitHubPR(e){const[t,s]=await fn();return LD({owner:t,repo:s,title:e.title,body:e.body??"",head:e.head,base:e.base,draft:e.draft})},async mergeGitHubPR(e,t={}){const[s,i]=await fn();return await HD(s,i,e,t)},async listGitHubIssues(e="open",t=1){const[s,i]=await fn();return(await DD(s,i,e)).slice((t-1)*50,t*50)},async getGitHubIssue(e){const[t,s]=await fn();return UD(t,s,e)},async listGitHubIssueComments(e){const[t,s]=await fn();return FD(t,s,e)},async addGitHubIssueComment(e,t){const[s,i]=await fn();return qD(s,i,e,t)},async getCommitCIStatus(e){const[t,s]=await fn(),i=await Fw(t,s,e),a=i.check_runs??[];return{sha:e,state:Qw(a),totalCount:i.total_count??a.length,runs:a}},async listGitHubWorkflowRuns(e,t=1){const[s,i]=await fn();return(await VD(s,i,e,t)).workflow_runs??[]},async listGitHubWorkflowRunJobs(e){const[t,s]=await fn();return(await WD(t,s,e)).jobs??[]}},zL=$s()?OL:LL,{getGitHubTokenInfo:BL,startGitHubDeviceFlow:PL,pollGitHubDeviceFlow:IL,setGitHubToken:$L,removeGitHubToken:HL,listGitHubBranches:UL,listGitHubPRs:_g,getGitHubPR:FL,getGitHubPRDiff:qL,getGitHubPRReviewCockpit:GL,getGitHubPRTemplate:VL,createGitHubPR:WL,mergeGitHubPR:KL,listGitHubIssues:wg,getGitHubIssue:YL,listGitHubIssueComments:XL,addGitHubIssueComment:ZL,getCommitCIStatus:QL,listGitHubWorkflowRuns:Th,listGitHubWorkflowRunJobs:Jw}=zL,JL={async listLogSources(){return(await Te("/api/log-sources")).sources},async addLogSource(e){return(await Yn("/api/log-sources",e)).sources},async getLogSourceLogs(e,t={}){const s=new URLSearchParams;return s.set("lines",String(t.lines??500)),t.since&&s.set("since",t.since),t.until&&s.set("until",t.until),t.grep&&s.set("grep",t.grep),t.level&&s.set("level",t.level),t.cursor&&s.set("cursor",t.cursor),t.before&&s.set("before",t.before),(await Te(`/api/log-sources/${encodeURIComponent(e)}/logs?${s.toString()}`)).logs}};async function eS(){return await JD()??[]}const eO={listLogSources:eS,async addLogSource(e){return await e7(e),eS()},getLogSourceLogs:async()=>[]},tO=$s()?eO:JL,{listLogSources:sO,addLogSource:nO,getLogSourceLogs:xE}=tO,Sg={"content-type":"application/json"};function iO(e,t){let s="message",i="";for(const a of e.split(`
16
+ `))a.startsWith("event:")?s=a.slice(6).trim():a.startsWith("data:")&&(i+=a.slice(5).trim());if(i)try{const a=JSON.parse(i);s==="output"?t.onLine(a):s==="done"?t.onDone(a.exitCode??null):s==="error"&&t.onError(a.error??"Install failed.")}catch{}}const rO={async scanRepo(e){const t=await Te("/api/onboard/scan",{method:"POST",headers:Sg,body:JSON.stringify({url:e})});return{profile:t.profile,proposals:t.proposals,databases:t.databases??[]}},async registerOnboarded(e,t,s){const i=s?{name:s.name,engine:s.engine,url:s.url}:void 0;await Te("/api/onboard/register",{method:"POST",headers:Sg,body:JSON.stringify({...e,start:t,database:i})})},async streamInstall(e,t){const s=await fetch("/api/onboard/install/stream",{method:"POST",headers:Sg,body:JSON.stringify(e)});if(!s.ok||!s.body){const c=await s.json().catch(()=>{});t.onError(c?.error||s.statusText);return}const i=s.body.getReader(),a=new TextDecoder;let l="";for(;;){const{done:c,value:h}=await i.read();if(c)break;l+=a.decode(h,{stream:!0});const f=l.split(`
17
+
18
+ `);l=f.pop()??"";for(const d of f)iO(d,t)}}},aO={scanRepo:e=>m7(e),async registerOnboarded(e,t,s){await oE({name:e.name,path:e.cwd}),await oD({name:e.name,kind:e.kind,command:e.command??null,cwd:e.cwd,port:e.port??null,composeFile:e.composeFile??null,composeService:e.composeService??null}),s&&await lE({name:s.name,engine:s.engine,url:s.url}),t&&await rE(e.name)},async streamInstall(e,t){let s;s=await B0("install-output",i=>{const a=i;a.type==="line"?t.onLine({stream:a.stream??"stdout",text:a.text??""}):a.type==="done"?(s?.(),t.onDone(a.exitCode??null)):a.type==="error"&&(s?.(),t.onError(a.message??"Install failed"))});try{await p7(e.clonePath,e.command)}catch(i){s?.(),t.onError(String(i))}}},oO=$s()?aO:rO,{scanRepo:lO,registerOnboarded:cO,streamInstall:uO}=oO,vE={getDashboard(){return Te("/api/dashboard")},async getServiceGraph(){return(await Te("/api/services/graph")).graph},async startService(e){await Te(`/api/services/${encodeURIComponent(e)}/start`,{method:"POST"})},async stopService(e){await Te(`/api/services/${encodeURIComponent(e)}/stop`,{method:"POST"})},async restartService(e){await Te(`/api/services/${encodeURIComponent(e)}/restart`,{method:"POST"})},async startBundle(e){await Te(`/api/bundles/${encodeURIComponent(e)}/start`,{method:"POST"})},async stopBundle(e){await Te(`/api/bundles/${encodeURIComponent(e)}/stop`,{method:"POST"})},async deleteService(e){await Te(`/api/services/${encodeURIComponent(e)}`,{method:"DELETE"})},async registerBundle(e){await Mi("/api/bundles",{name:e.name,originalName:e.name,services:e.services.join(",")})},async getServiceLogs(e,t={}){const s=new URLSearchParams;s.set("lines",String(t.lines??500)),t.since&&s.set("since",t.since),t.until&&s.set("until",t.until),t.grep&&s.set("grep",t.grep),t.level&&s.set("level",t.level),t.cursor&&s.set("cursor",t.cursor),t.before&&s.set("before",t.before);const i=await Te(`/api/services/${encodeURIComponent(e)}/logs?${s.toString()}`);return{logs:i.logs,queryable:!!i.queryable}},getDirectories(e,{files:t=!1}={}){const s=new URLSearchParams({path:e});return t&&s.set("files","1"),Te(`/api/fs/directories?${s.toString()}`)},browseServiceConfig(e,t){const s=t?`?path=${encodeURIComponent(t)}`:"";return Te(`/api/services/${encodeURIComponent(e)}/config-browse${s}`)},async getServiceConfigFiles(e){const t=await Te(`/api/services/${encodeURIComponent(e)}/config-files`);return{cwd:t.cwd,files:t.files}},getServiceConfigFile(e,t){return Te(`/api/services/${encodeURIComponent(e)}/config-file?path=${encodeURIComponent(t)}`)},putServiceConfigFileEnv(e,t,s){return Te(`/api/services/${encodeURIComponent(e)}/config-file?path=${encodeURIComponent(t)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({entries:s})})},putServiceConfigFileText(e,t,s){return Te(`/api/services/${encodeURIComponent(e)}/config-file?path=${encodeURIComponent(t)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({content:s})})},async getServiceEnvRuntime(e){return(await Te(`/api/services/${encodeURIComponent(e)}/env/runtime`)).runtime},async getServiceMetrics(e){return(await Te(`/api/services/${encodeURIComponent(e)}/metrics`)).metrics},testServiceCommand(e){return Yn("/api/services/test",e)},runServiceTests(e,t){return Yn(`/api/services/${encodeURIComponent(e)}/test`,t?{pattern:t}:{})}},dO={...vE,getDashboard:()=>tD(),startService:e=>rE(e),stopService:e=>sD(e),restartService:e=>nD(e),startBundle:e=>iD(e),stopBundle:e=>rD(e),deleteService:e=>aD(e),registerBundle:e=>lD(e).then(()=>{}),getServiceLogs:(e,t={})=>cD(e,t.lines)},jr=$s()?dO:vE,{getDashboard:hO,getServiceGraph:fO,startService:mO,stopService:pO,restartService:yE,startBundle:Nee,stopBundle:tS,deleteService:gO,getServiceLogs:_E,getDirectories:wE,browseServiceConfig:bO,getServiceConfigFiles:xO,getServiceConfigFile:sS,putServiceConfigFileEnv:vO,putServiceConfigFileText:yO,getServiceEnvRuntime:_O,getServiceMetrics:wO,testServiceCommand:SO,runServiceTests:kO}=jr;async function NO(e,t,s){t.includes(s)||await jr.registerBundle({name:e,services:[...t,s]})}async function nS(e,t){let s,i;try{s=await jr.getDashboard(),i=await jr.getServiceGraph()}catch{await jr.startBundle(e);return}const a=s.config.bundles.find(g=>g.name===e);if(!a){await jr.startBundle(e);return}const l=new Map(i.nodes.map(g=>[g.name,g.dependsOn])),c=new Map(s.config.services.map(g=>[g.name,g.port])),h=new Set,f=[...a.services];for(;f.length>0;){const g=f.pop();if(!(h.has(g)||!l.has(g))){h.add(g);for(const b of l.get(g)??[])f.push(b)}}const d=i.order.filter(g=>h.has(g)),p=d.length>0?d:a.services;for(const g of p){for(const b of l.get(g)??[]){const v=c.get(b);v&&await CO(v)}await jr.startService(g),await t?.(g)}}async function CO(e,t=15e3){const s=Date.now()+t;for(;Date.now()<s;){try{if((await jr.getDashboard()).ports.some(a=>a.port===e&&!a.available))return}catch{return}await new Promise(i=>setTimeout(i,400))}}async function EO(e,t,s){t.includes(s)&&await jr.registerBundle({name:e,services:t.filter(i=>i!==s)})}const Qd=(e,t)=>({method:e,headers:t===void 0?void 0:{"content-type":"application/json"},body:t===void 0?void 0:JSON.stringify(t)}),iS={async getSettings(e){const t=e===void 0?"/api/settings":`/api/settings?projectPath=${encodeURIComponent(e)}`,s=await Te(t);return{global:s.global,project:s.project}},async updateGlobalSettings(e){return(await Te("/api/settings/global",Qd("PATCH",e))).global},async updateProjectSettings(e,t){return(await Te(`/api/settings/project?projectPath=${encodeURIComponent(e)}`,Qd("PATCH",t))).project},async resetGlobalSettings(){return(await Te("/api/settings/global/reset",Qd("POST"))).global},async resetProjectSettings(e){return(await Te(`/api/settings/project/reset?projectPath=${encodeURIComponent(e)}`,Qd("POST"))).project}},jO=($s(),iS),{getSettings:kg,updateGlobalSettings:AO,updateProjectSettings:TO,resetGlobalSettings:RO,resetProjectSettings:MO}=jO;async function rS(e){const t=await fetch(e);if(!t.ok){const s=await t.json().catch(()=>({error:t.statusText}));throw new Error(s.error||"Request failed")}return t.text()}const DO={async listSnapshots(){return(await Te("/api/snapshots")).snapshots},async createSnapshot(e){return(await Te("/api/snapshots",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({label:e})})).snapshot},async renameSnapshot(e,t){return(await Te(`/api/snapshots/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({label:t})})).snapshot},async deleteSnapshot(e){await Te(`/api/snapshots/${encodeURIComponent(e)}`,{method:"DELETE"})},async getSnapshotFiles(e){return(await Te(`/api/snapshots/${encodeURIComponent(e)}/files`)).files},getSnapshotDiff(e,t){const s=t?`?path=${encodeURIComponent(t)}`:"";return rS(`/api/snapshots/${encodeURIComponent(e)}/diff${s}`)},restoreSnapshot(e){return Te(`/api/snapshots/${encodeURIComponent(e)}/restore`,{method:"POST"})},async listChangeSets(){return(await Te("/api/agent/change-sets")).sessions},getChangeSet(e){return Te(`/api/agent/change-sets/${encodeURIComponent(e)}`)},getChangeSetDiff(e,t){const s=t?`?path=${encodeURIComponent(t)}`:"";return rS(`/api/agent/change-sets/${encodeURIComponent(e)}/diff${s}`)},restoreChangeSet(e){return Te(`/api/agent/change-sets/${encodeURIComponent(e)}/restore`,{method:"POST"})}},LO={listSnapshots:()=>t7(),createSnapshot:e=>s7(e),renameSnapshot:async()=>{throw new Error("Snapshot rename is not supported in desktop mode")},deleteSnapshot:e=>i7(e),getSnapshotFiles:e=>r7(e),getSnapshotDiff:(e,t)=>a7(e,t),async restoreSnapshot(e){return await n7(e),{ok:!0}},listChangeSets:async()=>[],getChangeSet:async()=>{throw new Error("Agent change sets are not available in desktop mode")},getChangeSetDiff:async()=>"",restoreChangeSet:async()=>{throw new Error("Agent change sets are not available in desktop mode")}},OO=$s()?LO:DO,{listSnapshots:zO,createSnapshot:BO,renameSnapshot:PO,deleteSnapshot:IO,getSnapshotFiles:$O,getSnapshotDiff:HO,restoreSnapshot:UO,listChangeSets:FO,getChangeSet:qO,getChangeSetDiff:GO,restoreChangeSet:VO}=OO,WO={async listTerminalSessions(){return(await Te("/api/terminal/sessions")).sessions},async createTerminalSession(e){return(await Te("/api/terminal/sessions",{method:"POST",...e?.serviceName?{headers:{"content-type":"application/json"},body:JSON.stringify({serviceName:e.serviceName})}:{}})).session},async createAgentTerminalSession(e){return(await Te("/api/terminal/sessions",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({agent:e})})).session},async closeTerminalSession(e){await Te(`/api/terminal/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})}},KO={listTerminalSessions:()=>g7(),createTerminalSession:e=>qw(e),createAgentTerminalSession:e=>qw({agent:e}),closeTerminalSession:e=>v7(e)};function Uf(){return $s()?KO:WO}function SE(){return Uf().listTerminalSessions()}function Rh(e){return Uf().createTerminalSession(e)}function YO(e){return Uf().createAgentTerminalSession(e)}function Zb(e){return Uf().closeTerminalSession(e)}const XO={async listWorkflows(){return(await Te("/api/workflows")).workflows},async saveWorkflow(e){return(await Te("/api/workflows",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).workflows},async deleteWorkflow(e){return(await Te(`/api/workflows/${encodeURIComponent(e)}`,{method:"DELETE"})).workflows},async getGitStatus(){return(await Te("/api/git/status")).status},async listWorkflowTriggers(){return(await Te("/api/workflow-triggers")).triggers},async saveWorkflowTrigger(e){return(await Te("/api/workflow-triggers",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).triggers},async deleteWorkflowTrigger(e){return(await Te(`/api/workflow-triggers/${encodeURIComponent(e)}`,{method:"DELETE"})).triggers},async listPendingRuns(){return(await Te("/api/workflow-triggers/pending")).pending},async ackPendingRun(e){await Te(`/api/workflow-triggers/pending/${encodeURIComponent(e)}/ack`,{method:"POST"})}},ZO={listWorkflows:()=>o7(),saveWorkflow:e=>l7(e),deleteWorkflow:e=>c7(e),async getGitStatus(){const e=await aE();return{branch:e.branch,upstream:e.upstream??void 0,ahead:e.ahead,behind:e.behind,files:e.files}},listWorkflowTriggers:async()=>[],saveWorkflowTrigger:async()=>[],deleteWorkflowTrigger:async()=>[],listPendingRuns:async()=>[],ackPendingRun:async()=>{}},QO=$s()?ZO:XO,{listWorkflows:kE,saveWorkflow:JO,deleteWorkflow:e9,getGitStatus:Ng,listWorkflowTriggers:t9,saveWorkflowTrigger:s9,deleteWorkflowTrigger:n9,listPendingRuns:i9,ackPendingRun:r9}=QO;function NE(e){var t,s,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(s=NE(e[t]))&&(i&&(i+=" "),i+=s)}else for(s in e)e[s]&&(i&&(i+=" "),i+=s);return i}function du(){for(var e,t,s=0,i="",a=arguments.length;s<a;s++)(e=arguments[s])&&(t=NE(e))&&(i&&(i+=" "),i+=t);return i}const aS=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,oS=du,CE=(e,t)=>s=>{var i;if(t?.variants==null)return oS(e,s?.class,s?.className);const{variants:a,defaultVariants:l}=t,c=Object.keys(a).map(d=>{const p=s?.[d],g=l?.[d];if(p===null)return null;const b=aS(p)||aS(g);return a[d][b]}),h=s&&Object.entries(s).reduce((d,p)=>{let[g,b]=p;return b===void 0||(d[g]=b),d},{}),f=t==null||(i=t.compoundVariants)===null||i===void 0?void 0:i.reduce((d,p)=>{let{class:g,className:b,...v}=p;return Object.entries(v).every(w=>{let[k,N]=w;return Array.isArray(N)?N.includes({...l,...h}[k]):{...l,...h}[k]===N})?[...d,g,b]:d},[]);return oS(e,c,f,s?.class,s?.className)},a9=(e,t)=>{const s=new Array(e.length+t.length);for(let i=0;i<e.length;i++)s[i]=e[i];for(let i=0;i<t.length;i++)s[e.length+i]=t[i];return s},o9=(e,t)=>({classGroupId:e,validator:t}),EE=(e=new Map,t=null,s)=>({nextPart:e,validators:t,classGroupId:s}),Zh="-",lS=[],l9="arbitrary..",c9=e=>{const t=d9(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return u9(c);const h=c.split(Zh),f=h[0]===""&&h.length>1?1:0;return jE(h,f,t)},getConflictingClassGroupIds:(c,h)=>{if(h){const f=i[c],d=s[c];return f?d?a9(d,f):f:d||lS}return s[c]||lS}}},jE=(e,t,s)=>{if(e.length-t===0)return s.classGroupId;const a=e[t],l=s.nextPart.get(a);if(l){const d=jE(e,t+1,l);if(d)return d}const c=s.validators;if(c===null)return;const h=t===0?e.join(Zh):e.slice(t).join(Zh),f=c.length;for(let d=0;d<f;d++){const p=c[d];if(p.validator(h))return p.classGroupId}},u9=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),s=t.indexOf(":"),i=t.slice(0,s);return i?l9+i:void 0})(),d9=e=>{const{theme:t,classGroups:s}=e;return h9(s,t)},h9=(e,t)=>{const s=EE();for(const i in e){const a=e[i];I0(a,s,i,t)}return s},I0=(e,t,s,i)=>{const a=e.length;for(let l=0;l<a;l++){const c=e[l];f9(c,t,s,i)}},f9=(e,t,s,i)=>{if(typeof e=="string"){m9(e,t,s);return}if(typeof e=="function"){p9(e,t,s,i);return}g9(e,t,s,i)},m9=(e,t,s)=>{const i=e===""?t:AE(t,e);i.classGroupId=s},p9=(e,t,s,i)=>{if(b9(e)){I0(e(i),t,s,i);return}t.validators===null&&(t.validators=[]),t.validators.push(o9(s,e))},g9=(e,t,s,i)=>{const a=Object.entries(e),l=a.length;for(let c=0;c<l;c++){const[h,f]=a[c];I0(f,AE(t,h),s,i)}},AE=(e,t)=>{let s=e;const i=t.split(Zh),a=i.length;for(let l=0;l<a;l++){const c=i[l];let h=s.nextPart.get(c);h||(h=EE(),s.nextPart.set(c,h)),s=h}return s},b9=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,x9=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,s=Object.create(null),i=Object.create(null);const a=(l,c)=>{s[l]=c,t++,t>e&&(t=0,i=s,s=Object.create(null))};return{get(l){let c=s[l];if(c!==void 0)return c;if((c=i[l])!==void 0)return a(l,c),c},set(l,c){l in s?s[l]=c:a(l,c)}}},Qb="!",cS=":",v9=[],uS=(e,t,s,i,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:s,maybePostfixModifierPosition:i,isExternal:a}),y9=e=>{const{prefix:t,experimentalParseClassName:s}=e;let i=a=>{const l=[];let c=0,h=0,f=0,d;const p=a.length;for(let k=0;k<p;k++){const N=a[k];if(c===0&&h===0){if(N===cS){l.push(a.slice(f,k)),f=k+1;continue}if(N==="/"){d=k;continue}}N==="["?c++:N==="]"?c--:N==="("?h++:N===")"&&h--}const g=l.length===0?a:a.slice(f);let b=g,v=!1;g.endsWith(Qb)?(b=g.slice(0,-1),v=!0):g.startsWith(Qb)&&(b=g.slice(1),v=!0);const w=d&&d>f?d-f:void 0;return uS(l,v,b,w)};if(t){const a=t+cS,l=i;i=c=>c.startsWith(a)?l(c.slice(a.length)):uS(v9,!1,c,void 0,!0)}if(s){const a=i;i=l=>s({className:l,parseClassName:a})}return i},_9=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((s,i)=>{t.set(s,1e6+i)}),s=>{const i=[];let a=[];for(let l=0;l<s.length;l++){const c=s[l],h=c[0]==="[",f=t.has(c);h||f?(a.length>0&&(a.sort(),i.push(...a),a=[]),i.push(c)):a.push(c)}return a.length>0&&(a.sort(),i.push(...a)),i}},w9=e=>({cache:x9(e.cacheSize),parseClassName:y9(e),sortModifiers:_9(e),postfixLookupClassGroupIds:S9(e),...c9(e)}),S9=e=>{const t=Object.create(null),s=e.postfixLookupClassGroups;if(s)for(let i=0;i<s.length;i++)t[s[i]]=!0;return t},k9=/\s+/,N9=(e,t)=>{const{parseClassName:s,getClassGroupId:i,getConflictingClassGroupIds:a,sortModifiers:l,postfixLookupClassGroupIds:c}=t,h=[],f=e.trim().split(k9);let d="";for(let p=f.length-1;p>=0;p-=1){const g=f[p],{isExternal:b,modifiers:v,hasImportantModifier:w,baseClassName:k,maybePostfixModifierPosition:N}=s(g);if(b){d=g+(d.length>0?" "+d:d);continue}let E=!!N,T;if(E){const H=k.substring(0,N);T=i(H);const B=T&&c[T]?i(k):void 0;B&&B!==T&&(T=B,E=!1)}else T=i(k);if(!T){if(!E){d=g+(d.length>0?" "+d:d);continue}if(T=i(k),!T){d=g+(d.length>0?" "+d:d);continue}E=!1}const A=v.length===0?"":v.length===1?v[0]:l(v).join(":"),C=w?A+Qb:A,R=C+T;if(h.indexOf(R)>-1)continue;h.push(R);const L=a(T,E);for(let H=0;H<L.length;++H){const B=L[H];h.push(C+B)}d=g+(d.length>0?" "+d:d)}return d},C9=(...e)=>{let t=0,s,i,a="";for(;t<e.length;)(s=e[t++])&&(i=TE(s))&&(a&&(a+=" "),a+=i);return a},TE=e=>{if(typeof e=="string")return e;let t,s="";for(let i=0;i<e.length;i++)e[i]&&(t=TE(e[i]))&&(s&&(s+=" "),s+=t);return s},E9=(e,...t)=>{let s,i,a,l;const c=f=>{const d=t.reduce((p,g)=>g(p),e());return s=w9(d),i=s.cache.get,a=s.cache.set,l=h,h(f)},h=f=>{const d=i(f);if(d)return d;const p=N9(f,s);return a(f,p),p};return l=c,(...f)=>l(C9(...f))},j9=[],Os=e=>{const t=s=>s[e]||j9;return t.isThemeGetter=!0,t},RE=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ME=/^\((?:(\w[\w-]*):)?(.+)\)$/i,A9=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,T9=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,R9=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,M9=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,D9=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,L9=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,da=e=>A9.test(e),pt=e=>!!e&&!Number.isNaN(Number(e)),Hi=e=>!!e&&Number.isInteger(Number(e)),Cg=e=>e.endsWith("%")&&pt(e.slice(0,-1)),kr=e=>T9.test(e),DE=()=>!0,O9=e=>R9.test(e)&&!M9.test(e),$0=()=>!1,z9=e=>D9.test(e),B9=e=>L9.test(e),P9=e=>!Ge(e)&&!Ve(e),I9=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),$9=e=>Ca(e,zE,$0),Ge=e=>RE.test(e),Ka=e=>Ca(e,BE,O9),dS=e=>Ca(e,K9,pt),H9=e=>Ca(e,IE,DE),U9=e=>Ca(e,PE,$0),hS=e=>Ca(e,LE,$0),F9=e=>Ca(e,OE,B9),Jd=e=>Ca(e,$E,z9),Ve=e=>ME.test(e),jc=e=>vo(e,BE),q9=e=>vo(e,PE),fS=e=>vo(e,LE),G9=e=>vo(e,zE),V9=e=>vo(e,OE),eh=e=>vo(e,$E,!0),W9=e=>vo(e,IE,!0),Ca=(e,t,s)=>{const i=RE.exec(e);return i?i[1]?t(i[1]):s(i[2]):!1},vo=(e,t,s=!1)=>{const i=ME.exec(e);return i?i[1]?t(i[1]):s:!1},LE=e=>e==="position"||e==="percentage",OE=e=>e==="image"||e==="url",zE=e=>e==="length"||e==="size"||e==="bg-size",BE=e=>e==="length",K9=e=>e==="number",PE=e=>e==="family-name",IE=e=>e==="number"||e==="weight",$E=e=>e==="shadow",Y9=()=>{const e=Os("color"),t=Os("font"),s=Os("text"),i=Os("font-weight"),a=Os("tracking"),l=Os("leading"),c=Os("breakpoint"),h=Os("container"),f=Os("spacing"),d=Os("radius"),p=Os("shadow"),g=Os("inset-shadow"),b=Os("text-shadow"),v=Os("drop-shadow"),w=Os("blur"),k=Os("perspective"),N=Os("aspect"),E=Os("ease"),T=Os("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],R=()=>[...C(),Ve,Ge],L=()=>["auto","hidden","clip","visible","scroll"],H=()=>["auto","contain","none"],B=()=>[Ve,Ge,f],P=()=>[da,"full","auto",...B()],D=()=>[Hi,"none","subgrid",Ve,Ge],G=()=>["auto",{span:["full",Hi,Ve,Ge]},Hi,Ve,Ge],$=()=>[Hi,"auto",Ve,Ge],O=()=>["auto","min","max","fr",Ve,Ge],V=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],K=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",...B()],Y=()=>[da,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...B()],W=()=>[da,"screen","full","dvw","lvw","svw","min","max","fit",...B()],le=()=>[da,"screen","full","lh","dvh","lvh","svh","min","max","fit",...B()],J=()=>[e,Ve,Ge],U=()=>[...C(),fS,hS,{position:[Ve,Ge]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],re=()=>["auto","cover","contain",G9,$9,{size:[Ve,Ge]}],fe=()=>[Cg,jc,Ka],se=()=>["","none","full",d,Ve,Ge],te=()=>["",pt,jc,Ka],ye=()=>["solid","dashed","dotted","double"],Ee=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],De=()=>[pt,Cg,fS,hS],Ye=()=>["","none",w,Ve,Ge],we=()=>["none",pt,Ve,Ge],He=()=>["none",pt,Ve,Ge],$e=()=>[pt,Ve,Ge],St=()=>[da,"full",...B()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[kr],breakpoint:[kr],color:[DE],container:[kr],"drop-shadow":[kr],ease:["in","out","in-out"],font:[P9],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[kr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[kr],shadow:[kr],spacing:["px",pt],text:[kr],"text-shadow":[kr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",da,Ge,Ve,N]}],container:["container"],"container-type":[{"@container":["","normal","size",Ve,Ge]}],"container-named":[I9],columns:[{columns:[pt,Ge,Ve,h]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:R()}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:H()}],"overscroll-x":[{"overscroll-x":H()}],"overscroll-y":[{"overscroll-y":H()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{"inset-s":P(),start:P()}],end:[{"inset-e":P(),end:P()}],"inset-bs":[{"inset-bs":P()}],"inset-be":[{"inset-be":P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[Hi,"auto",Ve,Ge]}],basis:[{basis:[da,"full","auto",h,...B()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[pt,da,"auto","initial","none",Ge]}],grow:[{grow:["",pt,Ve,Ge]}],shrink:[{shrink:["",pt,Ve,Ge]}],order:[{order:[Hi,"first","last","none",Ve,Ge]}],"grid-cols":[{"grid-cols":D()}],"col-start-end":[{col:G()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":D()}],"row-start-end":[{row:G()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":O()}],"auto-rows":[{"auto-rows":O()}],gap:[{gap:B()}],"gap-x":[{"gap-x":B()}],"gap-y":[{"gap-y":B()}],"justify-content":[{justify:[...V(),"normal"]}],"justify-items":[{"justify-items":[...K(),"normal"]}],"justify-self":[{"justify-self":["auto",...K()]}],"align-content":[{content:["normal",...V()]}],"align-items":[{items:[...K(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...K(),{baseline:["","last"]}]}],"place-content":[{"place-content":V()}],"place-items":[{"place-items":[...K(),"baseline"]}],"place-self":[{"place-self":["auto",...K()]}],p:[{p:B()}],px:[{px:B()}],py:[{py:B()}],ps:[{ps:B()}],pe:[{pe:B()}],pbs:[{pbs:B()}],pbe:[{pbe:B()}],pt:[{pt:B()}],pr:[{pr:B()}],pb:[{pb:B()}],pl:[{pl:B()}],m:[{m:I()}],mx:[{mx:I()}],my:[{my:I()}],ms:[{ms:I()}],me:[{me:I()}],mbs:[{mbs:I()}],mbe:[{mbe:I()}],mt:[{mt:I()}],mr:[{mr:I()}],mb:[{mb:I()}],ml:[{ml:I()}],"space-x":[{"space-x":B()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":B()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],"inline-size":[{inline:["auto",...W()]}],"min-inline-size":[{"min-inline":["auto",...W()]}],"max-inline-size":[{"max-inline":["none",...W()]}],"block-size":[{block:["auto",...le()]}],"min-block-size":[{"min-block":["auto",...le()]}],"max-block-size":[{"max-block":["none",...le()]}],w:[{w:[h,"screen",...Y()]}],"min-w":[{"min-w":[h,"screen","none",...Y()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[c]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",s,jc,Ka]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,W9,H9]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Cg,Ge]}],"font-family":[{font:[q9,U9,t]}],"font-features":[{"font-features":[Ge]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,Ve,Ge]}],"line-clamp":[{"line-clamp":[pt,"none",Ve,dS]}],leading:[{leading:[l,...B()]}],"list-image":[{"list-image":["none",Ve,Ge]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ve,Ge]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:J()}],"text-color":[{text:J()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ye(),"wavy"]}],"text-decoration-thickness":[{decoration:[pt,"from-font","auto",Ve,Ka]}],"text-decoration-color":[{decoration:J()}],"underline-offset":[{"underline-offset":[pt,"auto",Ve,Ge]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:B()}],"tab-size":[{tab:[Hi,Ve,Ge]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ve,Ge]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ve,Ge]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:U()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:re()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Hi,Ve,Ge],radial:["",Ve,Ge],conic:[Hi,Ve,Ge]},V9,F9]}],"bg-color":[{bg:J()}],"gradient-from-pos":[{from:fe()}],"gradient-via-pos":[{via:fe()}],"gradient-to-pos":[{to:fe()}],"gradient-from":[{from:J()}],"gradient-via":[{via:J()}],"gradient-to":[{to:J()}],rounded:[{rounded:se()}],"rounded-s":[{"rounded-s":se()}],"rounded-e":[{"rounded-e":se()}],"rounded-t":[{"rounded-t":se()}],"rounded-r":[{"rounded-r":se()}],"rounded-b":[{"rounded-b":se()}],"rounded-l":[{"rounded-l":se()}],"rounded-ss":[{"rounded-ss":se()}],"rounded-se":[{"rounded-se":se()}],"rounded-ee":[{"rounded-ee":se()}],"rounded-es":[{"rounded-es":se()}],"rounded-tl":[{"rounded-tl":se()}],"rounded-tr":[{"rounded-tr":se()}],"rounded-br":[{"rounded-br":se()}],"rounded-bl":[{"rounded-bl":se()}],"border-w":[{border:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-bs":[{"border-bs":te()}],"border-w-be":[{"border-be":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":te()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ye(),"hidden","none"]}],"divide-style":[{divide:[...ye(),"hidden","none"]}],"border-color":[{border:J()}],"border-color-x":[{"border-x":J()}],"border-color-y":[{"border-y":J()}],"border-color-s":[{"border-s":J()}],"border-color-e":[{"border-e":J()}],"border-color-bs":[{"border-bs":J()}],"border-color-be":[{"border-be":J()}],"border-color-t":[{"border-t":J()}],"border-color-r":[{"border-r":J()}],"border-color-b":[{"border-b":J()}],"border-color-l":[{"border-l":J()}],"divide-color":[{divide:J()}],"outline-style":[{outline:[...ye(),"none","hidden"]}],"outline-offset":[{"outline-offset":[pt,Ve,Ge]}],"outline-w":[{outline:["",pt,jc,Ka]}],"outline-color":[{outline:J()}],shadow:[{shadow:["","none",p,eh,Jd]}],"shadow-color":[{shadow:J()}],"inset-shadow":[{"inset-shadow":["none",g,eh,Jd]}],"inset-shadow-color":[{"inset-shadow":J()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:J()}],"ring-offset-w":[{"ring-offset":[pt,Ka]}],"ring-offset-color":[{"ring-offset":J()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":J()}],"text-shadow":[{"text-shadow":["none",b,eh,Jd]}],"text-shadow-color":[{"text-shadow":J()}],opacity:[{opacity:[pt,Ve,Ge]}],"mix-blend":[{"mix-blend":[...Ee(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ee()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[pt]}],"mask-image-linear-from-pos":[{"mask-linear-from":De()}],"mask-image-linear-to-pos":[{"mask-linear-to":De()}],"mask-image-linear-from-color":[{"mask-linear-from":J()}],"mask-image-linear-to-color":[{"mask-linear-to":J()}],"mask-image-t-from-pos":[{"mask-t-from":De()}],"mask-image-t-to-pos":[{"mask-t-to":De()}],"mask-image-t-from-color":[{"mask-t-from":J()}],"mask-image-t-to-color":[{"mask-t-to":J()}],"mask-image-r-from-pos":[{"mask-r-from":De()}],"mask-image-r-to-pos":[{"mask-r-to":De()}],"mask-image-r-from-color":[{"mask-r-from":J()}],"mask-image-r-to-color":[{"mask-r-to":J()}],"mask-image-b-from-pos":[{"mask-b-from":De()}],"mask-image-b-to-pos":[{"mask-b-to":De()}],"mask-image-b-from-color":[{"mask-b-from":J()}],"mask-image-b-to-color":[{"mask-b-to":J()}],"mask-image-l-from-pos":[{"mask-l-from":De()}],"mask-image-l-to-pos":[{"mask-l-to":De()}],"mask-image-l-from-color":[{"mask-l-from":J()}],"mask-image-l-to-color":[{"mask-l-to":J()}],"mask-image-x-from-pos":[{"mask-x-from":De()}],"mask-image-x-to-pos":[{"mask-x-to":De()}],"mask-image-x-from-color":[{"mask-x-from":J()}],"mask-image-x-to-color":[{"mask-x-to":J()}],"mask-image-y-from-pos":[{"mask-y-from":De()}],"mask-image-y-to-pos":[{"mask-y-to":De()}],"mask-image-y-from-color":[{"mask-y-from":J()}],"mask-image-y-to-color":[{"mask-y-to":J()}],"mask-image-radial":[{"mask-radial":[Ve,Ge]}],"mask-image-radial-from-pos":[{"mask-radial-from":De()}],"mask-image-radial-to-pos":[{"mask-radial-to":De()}],"mask-image-radial-from-color":[{"mask-radial-from":J()}],"mask-image-radial-to-color":[{"mask-radial-to":J()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":C()}],"mask-image-conic-pos":[{"mask-conic":[pt]}],"mask-image-conic-from-pos":[{"mask-conic-from":De()}],"mask-image-conic-to-pos":[{"mask-conic-to":De()}],"mask-image-conic-from-color":[{"mask-conic-from":J()}],"mask-image-conic-to-color":[{"mask-conic-to":J()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:U()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:re()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ve,Ge]}],filter:[{filter:["","none",Ve,Ge]}],blur:[{blur:Ye()}],brightness:[{brightness:[pt,Ve,Ge]}],contrast:[{contrast:[pt,Ve,Ge]}],"drop-shadow":[{"drop-shadow":["","none",v,eh,Jd]}],"drop-shadow-color":[{"drop-shadow":J()}],grayscale:[{grayscale:["",pt,Ve,Ge]}],"hue-rotate":[{"hue-rotate":[pt,Ve,Ge]}],invert:[{invert:["",pt,Ve,Ge]}],saturate:[{saturate:[pt,Ve,Ge]}],sepia:[{sepia:["",pt,Ve,Ge]}],"backdrop-filter":[{"backdrop-filter":["","none",Ve,Ge]}],"backdrop-blur":[{"backdrop-blur":Ye()}],"backdrop-brightness":[{"backdrop-brightness":[pt,Ve,Ge]}],"backdrop-contrast":[{"backdrop-contrast":[pt,Ve,Ge]}],"backdrop-grayscale":[{"backdrop-grayscale":["",pt,Ve,Ge]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[pt,Ve,Ge]}],"backdrop-invert":[{"backdrop-invert":["",pt,Ve,Ge]}],"backdrop-opacity":[{"backdrop-opacity":[pt,Ve,Ge]}],"backdrop-saturate":[{"backdrop-saturate":[pt,Ve,Ge]}],"backdrop-sepia":[{"backdrop-sepia":["",pt,Ve,Ge]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":B()}],"border-spacing-x":[{"border-spacing-x":B()}],"border-spacing-y":[{"border-spacing-y":B()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ve,Ge]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[pt,"initial",Ve,Ge]}],ease:[{ease:["linear","initial",E,Ve,Ge]}],delay:[{delay:[pt,Ve,Ge]}],animate:[{animate:["none",T,Ve,Ge]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,Ve,Ge]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:we()}],"rotate-x":[{"rotate-x":we()}],"rotate-y":[{"rotate-y":we()}],"rotate-z":[{"rotate-z":we()}],scale:[{scale:He()}],"scale-x":[{"scale-x":He()}],"scale-y":[{"scale-y":He()}],"scale-z":[{"scale-z":He()}],"scale-3d":["scale-3d"],skew:[{skew:$e()}],"skew-x":[{"skew-x":$e()}],"skew-y":[{"skew-y":$e()}],transform:[{transform:[Ve,Ge,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:St()}],"translate-x":[{"translate-x":St()}],"translate-y":[{"translate-y":St()}],"translate-z":[{"translate-z":St()}],"translate-none":["translate-none"],zoom:[{zoom:[Hi,Ve,Ge]}],accent:[{accent:J()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:J()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ve,Ge]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":J()}],"scrollbar-track-color":[{"scrollbar-track":J()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":B()}],"scroll-mx":[{"scroll-mx":B()}],"scroll-my":[{"scroll-my":B()}],"scroll-ms":[{"scroll-ms":B()}],"scroll-me":[{"scroll-me":B()}],"scroll-mbs":[{"scroll-mbs":B()}],"scroll-mbe":[{"scroll-mbe":B()}],"scroll-mt":[{"scroll-mt":B()}],"scroll-mr":[{"scroll-mr":B()}],"scroll-mb":[{"scroll-mb":B()}],"scroll-ml":[{"scroll-ml":B()}],"scroll-p":[{"scroll-p":B()}],"scroll-px":[{"scroll-px":B()}],"scroll-py":[{"scroll-py":B()}],"scroll-ps":[{"scroll-ps":B()}],"scroll-pe":[{"scroll-pe":B()}],"scroll-pbs":[{"scroll-pbs":B()}],"scroll-pbe":[{"scroll-pbe":B()}],"scroll-pt":[{"scroll-pt":B()}],"scroll-pr":[{"scroll-pr":B()}],"scroll-pb":[{"scroll-pb":B()}],"scroll-pl":[{"scroll-pl":B()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ve,Ge]}],fill:[{fill:["none",...J()]}],"stroke-w":[{stroke:[pt,jc,Ka,dS]}],stroke:[{stroke:["none",...J()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},X9=E9(Y9);function ae(...e){return X9(du(e))}const Z9=[{unit:"year",ms:365*24*60*60*1e3},{unit:"month",ms:720*60*60*1e3},{unit:"day",ms:1440*60*1e3},{unit:"hour",ms:3600*1e3},{unit:"minute",ms:60*1e3}],Q9=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});function HE(e){const t=new Date(e).getTime();if(Number.isNaN(t))return"";const s=t-Date.now(),i=Math.abs(s);if(i<60*1e3)return"just now";for(const{unit:a,ms:l}of Z9)if(i>=l)return Q9.format(Math.round(s/l),a);return"just now"}const J9=CE("inline-flex h-9 shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md border border-transparent px-3 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",outline:"border-border bg-background hover:bg-muted",ghost:"hover:bg-muted",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",success:"bg-emerald-600 text-white hover:bg-emerald-700"},size:{default:"h-9 px-3",sm:"h-8 px-2.5 text-xs",icon:"size-9 p-0","icon-sm":"size-7 p-0"}},defaultVariants:{variant:"default",size:"default"}});function Z({className:e,variant:t,size:s,...i}){return n.jsx("button",{className:ae(J9({variant:t,size:s,className:e})),...i})}const UE=y.createContext({});function ez(e){const t=y.useRef(null);return t.current===null&&(t.current=e()),t.current}const tz=typeof window<"u",sz=tz?y.useLayoutEffect:y.useEffect,H0=y.createContext(null);function U0(e,t){e.indexOf(t)===-1&&e.push(t)}function Qh(e,t){const s=e.indexOf(t);s>-1&&e.splice(s,1)}const Ji=(e,t,s)=>s>t?t:s<e?e:s;let F0=()=>{};const ka={},FE=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function qE(e){return typeof e=="object"&&e!==null}const GE=e=>/^0[^.\s]+$/u.test(e);function VE(e){let t;return()=>(t===void 0&&(t=e()),t)}const pi=e=>e,nz=(e,t)=>s=>t(e(s)),Su=(...e)=>e.reduce(nz),hu=(e,t,s)=>{const i=t-e;return i===0?1:(s-e)/i};class q0{constructor(){this.subscriptions=[]}add(t){return U0(this.subscriptions,t),()=>Qh(this.subscriptions,t)}notify(t,s,i){const a=this.subscriptions.length;if(a)if(a===1)this.subscriptions[0](t,s,i);else for(let l=0;l<a;l++){const c=this.subscriptions[l];c&&c(t,s,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Xn=e=>e*1e3,mi=e=>e/1e3;function WE(e,t){return t?e*(1e3/t):0}const KE=(e,t,s)=>(((1-3*s+3*t)*e+(3*s-6*t))*e+3*t)*e,iz=1e-7,rz=12;function az(e,t,s,i,a){let l,c,h=0;do c=t+(s-t)/2,l=KE(c,i,a)-e,l>0?s=c:t=c;while(Math.abs(l)>iz&&++h<rz);return c}function ku(e,t,s,i){if(e===t&&s===i)return pi;const a=l=>az(l,0,1,e,s);return l=>l===0||l===1?l:KE(a(l),t,i)}const YE=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,XE=e=>t=>1-e(1-t),ZE=ku(.33,1.53,.69,.99),G0=XE(ZE),QE=YE(G0),JE=e=>e>=1?1:(e*=2)<1?.5*G0(e):.5*(2-Math.pow(2,-10*(e-1))),V0=e=>1-Math.sin(Math.acos(e)),ej=XE(V0),tj=YE(V0),oz=ku(.42,0,1,1),lz=ku(0,0,.58,1),sj=ku(.42,0,.58,1),cz=e=>Array.isArray(e)&&typeof e[0]!="number",nj=e=>Array.isArray(e)&&typeof e[0]=="number",uz={linear:pi,easeIn:oz,easeInOut:sj,easeOut:lz,circIn:V0,circInOut:tj,circOut:ej,backIn:G0,backInOut:QE,backOut:ZE,anticipate:JE},dz=e=>typeof e=="string",mS=e=>{if(nj(e)){F0(e.length===4);const[t,s,i,a]=e;return ku(t,s,i,a)}else if(dz(e))return uz[e];return e},th=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function hz(e,t){let s=new Set,i=new Set,a=!1,l=!1;const c=new WeakSet;let h={delta:0,timestamp:0,isProcessing:!1};function f(p){c.has(p)&&(d.schedule(p),e()),p(h)}const d={schedule:(p,g=!1,b=!1)=>{const w=b&&a?s:i;return g&&c.add(p),w.add(p),p},cancel:p=>{i.delete(p),c.delete(p)},process:p=>{if(h=p,a){l=!0;return}a=!0;const g=s;s=i,i=g,s.forEach(f),s.clear(),a=!1,l&&(l=!1,d.process(p))}};return d}const fz=40;function ij(e,t){let s=!1,i=!0;const a={delta:0,timestamp:0,isProcessing:!1},l=()=>s=!0,c=th.reduce((A,C)=>(A[C]=hz(l),A),{}),{setup:h,read:f,resolveKeyframes:d,preUpdate:p,update:g,preRender:b,render:v,postRender:w}=c,k=()=>{const A=ka.useManualTiming,C=A?a.timestamp:performance.now();s=!1,A||(a.delta=i?1e3/60:Math.max(Math.min(C-a.timestamp,fz),1)),a.timestamp=C,a.isProcessing=!0,h.process(a),f.process(a),d.process(a),p.process(a),g.process(a),b.process(a),v.process(a),w.process(a),a.isProcessing=!1,s&&t&&(i=!1,e(k))},N=()=>{s=!0,i=!0,a.isProcessing||e(k)};return{schedule:th.reduce((A,C)=>{const R=c[C];return A[C]=(L,H=!1,B=!1)=>(s||N(),R.schedule(L,H,B)),A},{}),cancel:A=>{for(let C=0;C<th.length;C++)c[th[C]].cancel(A)},state:a,steps:c}}const{schedule:Wt,cancel:Na,state:en,steps:Eg}=ij(typeof requestAnimationFrame<"u"?requestAnimationFrame:pi,!0);let Mh;function mz(){Mh=void 0}const gn={now:()=>(Mh===void 0&&gn.set(en.isProcessing||ka.useManualTiming?en.timestamp:performance.now()),Mh),set:e=>{Mh=e,queueMicrotask(mz)}},rj=e=>t=>typeof t=="string"&&t.startsWith(e),aj=rj("--"),pz=rj("var(--"),W0=e=>pz(e)?gz.test(e.split("/*")[0].trim()):!1,gz=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function pS(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Nl={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},fu={...Nl,transform:e=>Ji(0,1,e)},sh={...Nl,default:1},eu=e=>Math.round(e*1e5)/1e5,K0=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function bz(e){return e==null}const xz=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Y0=(e,t)=>s=>!!(typeof s=="string"&&xz.test(s)&&s.startsWith(e)||t&&!bz(s)&&Object.prototype.hasOwnProperty.call(s,t)),oj=(e,t,s)=>i=>{if(typeof i!="string")return i;const[a,l,c,h]=i.match(K0);return{[e]:parseFloat(a),[t]:parseFloat(l),[s]:parseFloat(c),alpha:h!==void 0?parseFloat(h):1}},vz=e=>Ji(0,255,e),jg={...Nl,transform:e=>Math.round(vz(e))},no={test:Y0("rgb","red"),parse:oj("red","green","blue"),transform:({red:e,green:t,blue:s,alpha:i=1})=>"rgba("+jg.transform(e)+", "+jg.transform(t)+", "+jg.transform(s)+", "+eu(fu.transform(i))+")"};function yz(e){let t="",s="",i="",a="";return e.length>5?(t=e.substring(1,3),s=e.substring(3,5),i=e.substring(5,7),a=e.substring(7,9)):(t=e.substring(1,2),s=e.substring(2,3),i=e.substring(3,4),a=e.substring(4,5),t+=t,s+=s,i+=i,a+=a),{red:parseInt(t,16),green:parseInt(s,16),blue:parseInt(i,16),alpha:a?parseInt(a,16)/255:1}}const Jb={test:Y0("#"),parse:yz,transform:no.transform},Nu=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),xa=Nu("deg"),Xi=Nu("%"),Xe=Nu("px"),_z=Nu("vh"),wz=Nu("vw"),gS={...Xi,parse:e=>Xi.parse(e)/100,transform:e=>Xi.transform(e*100)},dl={test:Y0("hsl","hue"),parse:oj("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:s,alpha:i=1})=>"hsla("+Math.round(e)+", "+Xi.transform(eu(t))+", "+Xi.transform(eu(s))+", "+eu(fu.transform(i))+")"},Ts={test:e=>no.test(e)||Jb.test(e)||dl.test(e),parse:e=>no.test(e)?no.parse(e):dl.test(e)?dl.parse(e):Jb.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?no.transform(e):dl.transform(e),getAnimatableNone:e=>{const t=Ts.parse(e);return t.alpha=0,Ts.transform(t)}},Sz=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function kz(e){return isNaN(e)&&typeof e=="string"&&(e.match(K0)?.length||0)+(e.match(Sz)?.length||0)>0}const lj="number",cj="color",Nz="var",Cz="var(",bS="${}",Ez=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function _l(e){const t=e.toString(),s=[],i={color:[],number:[],var:[]},a=[];let l=0;const h=t.replace(Ez,f=>(Ts.test(f)?(i.color.push(l),a.push(cj),s.push(Ts.parse(f))):f.startsWith(Cz)?(i.var.push(l),a.push(Nz),s.push(f)):(i.number.push(l),a.push(lj),s.push(parseFloat(f))),++l,bS)).split(bS);return{values:s,split:h,indexes:i,types:a}}function jz(e){return _l(e).values}function uj({split:e,types:t}){const s=e.length;return i=>{let a="";for(let l=0;l<s;l++)if(a+=e[l],i[l]!==void 0){const c=t[l];c===lj?a+=eu(i[l]):c===cj?a+=Ts.transform(i[l]):a+=i[l]}return a}}function Az(e){return uj(_l(e))}const Tz=e=>typeof e=="number"?0:Ts.test(e)?Ts.getAnimatableNone(e):e,Rz=(e,t)=>typeof e=="number"?t?.trim().endsWith("/")?e:0:Tz(e);function Mz(e){const t=_l(e);return uj(t)(t.values.map((i,a)=>Rz(i,t.split[a])))}const Di={test:kz,parse:jz,createTransformer:Az,getAnimatableNone:Mz};function Ag(e,t,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?e+(t-e)*6*s:s<1/2?t:s<2/3?e+(t-e)*(2/3-s)*6:e}function Dz({hue:e,saturation:t,lightness:s,alpha:i}){e/=360,t/=100,s/=100;let a=0,l=0,c=0;if(!t)a=l=c=s;else{const h=s<.5?s*(1+t):s+t-s*t,f=2*s-h;a=Ag(f,h,e+1/3),l=Ag(f,h,e),c=Ag(f,h,e-1/3)}return{red:Math.round(a*255),green:Math.round(l*255),blue:Math.round(c*255),alpha:i}}function Jh(e,t){return s=>s>0?t:e}const Jt=(e,t,s)=>e+(t-e)*s,Tg=(e,t,s)=>{const i=e*e,a=s*(t*t-i)+i;return a<0?0:Math.sqrt(a)},Lz=[Jb,no,dl],Oz=e=>Lz.find(t=>t.test(e));function xS(e){const t=Oz(e);if(!t)return!1;let s=t.parse(e);return t===dl&&(s=Dz(s)),s}const vS=(e,t)=>{const s=xS(e),i=xS(t);if(!s||!i)return Jh(e,t);const a={...s};return l=>(a.red=Tg(s.red,i.red,l),a.green=Tg(s.green,i.green,l),a.blue=Tg(s.blue,i.blue,l),a.alpha=Jt(s.alpha,i.alpha,l),no.transform(a))},ex=new Set(["none","hidden"]);function zz(e,t){return ex.has(e)?s=>s<=0?e:t:s=>s>=1?t:e}function Bz(e,t){return s=>Jt(e,t,s)}function X0(e){return typeof e=="number"?Bz:typeof e=="string"?W0(e)?Jh:Ts.test(e)?vS:$z:Array.isArray(e)?dj:typeof e=="object"?Ts.test(e)?vS:Pz:Jh}function dj(e,t){const s=[...e],i=s.length,a=e.map((l,c)=>X0(l)(l,t[c]));return l=>{for(let c=0;c<i;c++)s[c]=a[c](l);return s}}function Pz(e,t){const s={...e,...t},i={};for(const a in s)e[a]!==void 0&&t[a]!==void 0&&(i[a]=X0(e[a])(e[a],t[a]));return a=>{for(const l in i)s[l]=i[l](a);return s}}function Iz(e,t){const s=[],i={color:0,var:0,number:0};for(let a=0;a<t.values.length;a++){const l=t.types[a],c=e.indexes[l][i[l]],h=e.values[c]??0;s[a]=h,i[l]++}return s}const $z=(e,t)=>{const s=Di.createTransformer(t),i=_l(e),a=_l(t);return i.indexes.var.length===a.indexes.var.length&&i.indexes.color.length===a.indexes.color.length&&i.indexes.number.length>=a.indexes.number.length?ex.has(e)&&!a.values.length||ex.has(t)&&!i.values.length?zz(e,t):Su(dj(Iz(i,a),a.values),s):Jh(e,t)};function hj(e,t,s){return typeof e=="number"&&typeof t=="number"&&typeof s=="number"?Jt(e,t,s):X0(e)(e,t)}const Hz=e=>{const t=({timestamp:s})=>e(s);return{start:(s=!0)=>Wt.update(t,s),stop:()=>Na(t),now:()=>en.isProcessing?en.timestamp:gn.now()}},fj=(e,t,s=10)=>{let i="";const a=Math.max(Math.round(t/s),2);for(let l=0;l<a;l++)i+=Math.round(e(l/(a-1))*1e4)/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},ef=2e4;function Z0(e){let t=0;const s=50;let i=e.next(t);for(;!i.done&&t<ef;)t+=s,i=e.next(t);return t>=ef?1/0:t}function Uz(e,t=100,s){const i=s({...e,keyframes:[0,t]}),a=Math.min(Z0(i),ef);return{type:"keyframes",ease:l=>i.next(a*l).value/t,duration:mi(a)}}const us={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function tx(e,t){return e*Math.sqrt(1-t*t)}const Fz=12;function qz(e,t,s){let i=s;for(let a=1;a<Fz;a++)i=i-e(i)/t(i);return i}const Rg=.001;function Gz({duration:e=us.duration,bounce:t=us.bounce,velocity:s=us.velocity,mass:i=us.mass}){let a,l,c=1-t;c=Ji(us.minDamping,us.maxDamping,c),e=Ji(us.minDuration,us.maxDuration,mi(e)),c<1?(a=d=>{const p=d*c,g=p*e,b=p-s,v=tx(d,c),w=Math.exp(-g);return Rg-b/v*w},l=d=>{const g=d*c*e,b=g*s+s,v=Math.pow(c,2)*Math.pow(d,2)*e,w=Math.exp(-g),k=tx(Math.pow(d,2),c);return(-a(d)+Rg>0?-1:1)*((b-v)*w)/k}):(a=d=>{const p=Math.exp(-d*e),g=(d-s)*e+1;return-Rg+p*g},l=d=>{const p=Math.exp(-d*e),g=(s-d)*(e*e);return p*g});const h=5/e,f=qz(a,l,h);if(e=Xn(e),isNaN(f))return{stiffness:us.stiffness,damping:us.damping,duration:e};{const d=Math.pow(f,2)*i;return{stiffness:d,damping:c*2*Math.sqrt(i*d),duration:e}}}const Vz=["duration","bounce"],Wz=["stiffness","damping","mass"];function yS(e,t){return t.some(s=>e[s]!==void 0)}function Kz(e){let t={velocity:us.velocity,stiffness:us.stiffness,damping:us.damping,mass:us.mass,isResolvedFromDuration:!1,...e};if(!yS(e,Wz)&&yS(e,Vz))if(t.velocity=0,e.visualDuration){const s=e.visualDuration,i=2*Math.PI/(s*1.2),a=i*i,l=2*Ji(.05,1,1-(e.bounce||0))*Math.sqrt(a);t={...t,mass:us.mass,stiffness:a,damping:l}}else{const s=Gz({...e,velocity:0});t={...t,...s,mass:us.mass},t.isResolvedFromDuration=!0}return t}function tf(e=us.visualDuration,t=us.bounce){const s=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:i,restDelta:a}=s;const l=s.keyframes[0],c=s.keyframes[s.keyframes.length-1],h={done:!1,value:l},{stiffness:f,damping:d,mass:p,duration:g,velocity:b,isResolvedFromDuration:v}=Kz({...s,velocity:-mi(s.velocity||0)}),w=b||0,k=d/(2*Math.sqrt(f*p)),N=c-l,E=mi(Math.sqrt(f/p)),T=Math.abs(N)<5;i||(i=T?us.restSpeed.granular:us.restSpeed.default),a||(a=T?us.restDelta.granular:us.restDelta.default);let A,C,R,L,H,B;if(k<1)R=tx(E,k),L=(w+k*E*N)/R,A=D=>{const G=Math.exp(-k*E*D);return c-G*(L*Math.sin(R*D)+N*Math.cos(R*D))},H=k*E*L+N*R,B=k*E*N-L*R,C=D=>Math.exp(-k*E*D)*(H*Math.sin(R*D)+B*Math.cos(R*D));else if(k===1){A=G=>c-Math.exp(-E*G)*(N+(w+E*N)*G);const D=w+E*N;C=G=>Math.exp(-E*G)*(E*D*G-w)}else{const D=E*Math.sqrt(k*k-1);A=V=>{const K=Math.exp(-k*E*V),I=Math.min(D*V,300);return c-K*((w+k*E*N)*Math.sinh(I)+D*N*Math.cosh(I))/D};const G=(w+k*E*N)/D,$=k*E*G-N*D,O=k*E*N-G*D;C=V=>{const K=Math.exp(-k*E*V),I=Math.min(D*V,300);return K*($*Math.sinh(I)+O*Math.cosh(I))}}const P={calculatedDuration:v&&g||null,velocity:D=>Xn(C(D)),next:D=>{if(!v&&k<1){const $=Math.exp(-k*E*D),O=Math.sin(R*D),V=Math.cos(R*D),K=c-$*(L*O+N*V),I=Xn($*(H*O+B*V));return h.done=Math.abs(I)<=i&&Math.abs(c-K)<=a,h.value=h.done?c:K,h}const G=A(D);if(v)h.done=D>=g;else{const $=Xn(C(D));h.done=Math.abs($)<=i&&Math.abs(c-G)<=a}return h.value=h.done?c:G,h},toString:()=>{const D=Math.min(Z0(P),ef),G=fj($=>P.next(D*$).value,D,30);return D+"ms "+G},toTransition:()=>{}};return P}tf.applyToOptions=e=>{const t=Uz(e,100,tf);return e.ease=t.ease,e.duration=Xn(t.duration),e.type="keyframes",e};const Yz=5;function mj(e,t,s){const i=Math.max(t-Yz,0);return WE(s-e(i),t-i)}function sx({keyframes:e,velocity:t=0,power:s=.8,timeConstant:i=325,bounceDamping:a=10,bounceStiffness:l=500,modifyTarget:c,min:h,max:f,restDelta:d=.5,restSpeed:p}){const g=e[0],b={done:!1,value:g},v=B=>h!==void 0&&B<h||f!==void 0&&B>f,w=B=>h===void 0?f:f===void 0||Math.abs(h-B)<Math.abs(f-B)?h:f;let k=s*t;const N=g+k,E=c===void 0?N:c(N);E!==N&&(k=E-g);const T=B=>-k*Math.exp(-B/i),A=B=>E+T(B),C=B=>{const P=T(B),D=A(B);b.done=Math.abs(P)<=d,b.value=b.done?E:D};let R,L;const H=B=>{v(b.value)&&(R=B,L=tf({keyframes:[b.value,w(b.value)],velocity:mj(A,B,b.value),damping:a,stiffness:l,restDelta:d,restSpeed:p}))};return H(0),{calculatedDuration:null,next:B=>{let P=!1;return!L&&R===void 0&&(P=!0,C(B),H(B)),R!==void 0&&B>=R?L.next(B-R):(!P&&C(B),b)}}}function Xz(e,t,s){const i=[],a=s||ka.mix||hj,l=e.length-1;for(let c=0;c<l;c++){let h=a(e[c],e[c+1]);if(t){const f=Array.isArray(t)?t[c]||pi:t;h=Su(f,h)}i.push(h)}return i}function Zz(e,t,{clamp:s=!0,ease:i,mixer:a}={}){const l=e.length;if(F0(l===t.length),l===1)return()=>t[0];if(l===2&&t[0]===t[1])return()=>t[1];const c=e[0]===e[1];e[0]>e[l-1]&&(e=[...e].reverse(),t=[...t].reverse());const h=Xz(t,i,a),f=h.length,d=p=>{if(c&&p<e[0])return t[0];let g=0;if(f>1)for(;g<e.length-2&&!(p<e[g+1]);g++);const b=hu(e[g],e[g+1],p);return h[g](b)};return s?p=>d(Ji(e[0],e[l-1],p)):d}function Qz(e,t){const s=e[e.length-1];for(let i=1;i<=t;i++){const a=hu(0,t,i);e.push(Jt(s,1,a))}}function Jz(e){const t=[0];return Qz(t,e.length-1),t}function eB(e,t){return e.map(s=>s*t)}function tB(e,t){return e.map(()=>t||sj).splice(0,e.length-1)}function tu({duration:e=300,keyframes:t,times:s,ease:i="easeInOut"}){const a=cz(i)?i.map(mS):mS(i),l={done:!1,value:t[0]},c=eB(s&&s.length===t.length?s:Jz(t),e),h=Zz(c,t,{ease:Array.isArray(a)?a:tB(t,a)});return{calculatedDuration:e,next:f=>(l.value=h(f),l.done=f>=e,l)}}const sB=e=>e!==null;function Ff(e,{repeat:t,repeatType:s="loop"},i,a=1){const l=e.filter(sB),h=a<0||t&&s!=="loop"&&t%2===1?0:l.length-1;return!h||i===void 0?l[h]:i}const nB={decay:sx,inertia:sx,tween:tu,keyframes:tu,spring:tf};function pj(e){typeof e.type=="string"&&(e.type=nB[e.type])}class Q0{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,s){return this.finished.then(t,s)}}const iB=e=>e/100;class sf extends Q0{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:s}=this.options;s&&s.updatedAt!==gn.now()&&this.tick(gn.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;pj(t);const{type:s=tu,repeat:i=0,repeatDelay:a=0,repeatType:l,velocity:c=0}=t;let{keyframes:h}=t;const f=s||tu;f!==tu&&typeof h[0]!="number"&&(this.mixKeyframes=Su(iB,hj(h[0],h[1])),h=[0,100]);const d=f({...t,keyframes:h});l==="mirror"&&(this.mirroredGenerator=f({...t,keyframes:[...h].reverse(),velocity:-c})),d.calculatedDuration===null&&(d.calculatedDuration=Z0(d));const{calculatedDuration:p}=d;this.calculatedDuration=p,this.resolvedDuration=p+a,this.totalDuration=this.resolvedDuration*(i+1)-a,this.generator=d}updateTime(t){const s=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=s}tick(t,s=!1){const{generator:i,totalDuration:a,mixKeyframes:l,mirroredGenerator:c,resolvedDuration:h,calculatedDuration:f}=this;if(this.startTime===null)return i.next(0);const{delay:d=0,keyframes:p,repeat:g,repeatType:b,repeatDelay:v,type:w,onUpdate:k,finalKeyframe:N}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-a/this.speed,this.startTime)),s?this.currentTime=t:this.updateTime(t);const E=this.currentTime-d*(this.playbackSpeed>=0?1:-1),T=this.playbackSpeed>=0?E<0:E>a;this.currentTime=Math.max(E,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=a);let A=this.currentTime,C=i;if(g){const B=Math.min(this.currentTime,a)/h;let P=Math.floor(B),D=B%1;!D&&B>=1&&(D=1),D===1&&P--,P=Math.min(P,g+1),P%2&&(b==="reverse"?(D=1-D,v&&(D-=v/h)):b==="mirror"&&(C=c)),A=Ji(0,1,D)*h}let R;T?(this.delayState.value=p[0],R=this.delayState):R=C.next(A),l&&!T&&(R.value=l(R.value));let{done:L}=R;!T&&f!==null&&(L=this.playbackSpeed>=0?this.currentTime>=a:this.currentTime<=0);const H=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&L);return H&&w!==sx&&(R.value=Ff(p,this.options,N,this.speed)),k&&k(R.value),H&&this.finish(),R}then(t,s){return this.finished.then(t,s)}get duration(){return mi(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+mi(t)}get time(){return mi(this.currentTime)}set time(t){t=Xn(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);const s=this.generator.next(t).value;return mj(i=>this.generator.next(i).value,t,s)}get speed(){return this.playbackSpeed}set speed(t){const s=this.playbackSpeed!==t;s&&this.driver&&this.updateTime(gn.now()),this.playbackSpeed=t,s&&this.driver&&(this.time=mi(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=Hz,startTime:s}=this.options;this.driver||(this.driver=t(a=>this.tick(a))),this.options.onPlay?.();const i=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=i):this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime||(this.startTime=s??i),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(gn.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function rB(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const io=e=>e*180/Math.PI,nx=e=>{const t=io(Math.atan2(e[1],e[0]));return ix(t)},aB={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:nx,rotateZ:nx,skewX:e=>io(Math.atan(e[1])),skewY:e=>io(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},ix=e=>(e=e%360,e<0&&(e+=360),e),_S=nx,wS=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),SS=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),oB={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:wS,scaleY:SS,scale:e=>(wS(e)+SS(e))/2,rotateX:e=>ix(io(Math.atan2(e[6],e[5]))),rotateY:e=>ix(io(Math.atan2(-e[2],e[0]))),rotateZ:_S,rotate:_S,skewX:e=>io(Math.atan(e[4])),skewY:e=>io(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function rx(e){return e.includes("scale")?1:0}function ax(e,t){if(!e||e==="none")return rx(t);const s=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,a;if(s)i=oB,a=s;else{const h=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=aB,a=h}if(!a)return rx(t);const l=i[t],c=a[1].split(",").map(cB);return typeof l=="function"?l(c):c[l]}const lB=(e,t)=>{const{transform:s="none"}=getComputedStyle(e);return ax(s,t)};function cB(e){return parseFloat(e.trim())}const Cl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],El=new Set(Cl),kS=e=>e===Nl||e===Xe,uB=new Set(["x","y","z"]),dB=Cl.filter(e=>!uB.has(e));function hB(e){const t=[];return dB.forEach(s=>{const i=e.getValue(s);i!==void 0&&(t.push([s,i.get()]),i.set(s.startsWith("scale")?1:0))}),t}const ya={width:({x:e},{paddingLeft:t="0",paddingRight:s="0",boxSizing:i})=>{const a=e.max-e.min;return i==="border-box"?a:a-parseFloat(t)-parseFloat(s)},height:({y:e},{paddingTop:t="0",paddingBottom:s="0",boxSizing:i})=>{const a=e.max-e.min;return i==="border-box"?a:a-parseFloat(t)-parseFloat(s)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>ax(t,"x"),y:(e,{transform:t})=>ax(t,"y")};ya.translateX=ya.x;ya.translateY=ya.y;const lo=new Set;let ox=!1,lx=!1,cx=!1;function gj(){if(lx){const e=Array.from(lo).filter(i=>i.needsMeasurement),t=new Set(e.map(i=>i.element)),s=new Map;t.forEach(i=>{const a=hB(i);a.length&&(s.set(i,a),i.render())}),e.forEach(i=>i.measureInitialState()),t.forEach(i=>{i.render();const a=s.get(i);a&&a.forEach(([l,c])=>{i.getValue(l)?.set(c)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}lx=!1,ox=!1,lo.forEach(e=>e.complete(cx)),lo.clear()}function bj(){lo.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(lx=!0)})}function fB(){cx=!0,bj(),gj(),cx=!1}class J0{constructor(t,s,i,a,l,c=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=s,this.name=i,this.motionValue=a,this.element=l,this.isAsync=c}scheduleResolve(){this.state="scheduled",this.isAsync?(lo.add(this),ox||(ox=!0,Wt.read(bj),Wt.resolveKeyframes(gj))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:s,element:i,motionValue:a}=this;if(t[0]===null){const l=a?.get(),c=t[t.length-1];if(l!==void 0)t[0]=l;else if(i&&s){const h=i.readValue(s,c);h!=null&&(t[0]=h)}t[0]===void 0&&(t[0]=c),a&&l===void 0&&a.set(t[0])}rB(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),lo.delete(this)}cancel(){this.state==="scheduled"&&(lo.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const mB=e=>e.startsWith("--");function xj(e,t,s){mB(t)?e.style.setProperty(t,s):e.style[t]=s}const pB={};function vj(e,t){const s=VE(e);return()=>pB[t]??s()}const gB=vj(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),yj=vj(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),qc=([e,t,s,i])=>`cubic-bezier(${e}, ${t}, ${s}, ${i})`,NS={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:qc([0,.65,.55,1]),circOut:qc([.55,0,1,.45]),backIn:qc([.31,.01,.66,-.59]),backOut:qc([.33,1.53,.69,.99])};function _j(e,t){if(e)return typeof e=="function"?yj()?fj(e,t):"ease-out":nj(e)?qc(e):Array.isArray(e)?e.map(s=>_j(s,t)||NS.easeOut):NS[e]}function bB(e,t,s,{delay:i=0,duration:a=300,repeat:l=0,repeatType:c="loop",ease:h="easeOut",times:f}={},d=void 0){const p={[t]:s};f&&(p.offset=f);const g=_j(h,a);Array.isArray(g)&&(p.easing=g);const b={delay:i,duration:a,easing:Array.isArray(g)?"linear":g,fill:"both",iterations:l+1,direction:c==="reverse"?"alternate":"normal"};return d&&(b.pseudoElement=d),e.animate(p,b)}function wj(e){return typeof e=="function"&&"applyToOptions"in e}function xB({type:e,...t}){return wj(e)&&yj()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class Sj extends Q0{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:s,name:i,keyframes:a,pseudoElement:l,allowFlatten:c=!1,finalKeyframe:h,onComplete:f}=t;this.isPseudoElement=!!l,this.allowFlatten=c,this.options=t,F0(typeof t.type!="string");const d=xB(t);this.animation=bB(s,i,a,d,l),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!l){const p=Ff(a,this.options,h,this.speed);this.updateMotionValue&&this.updateMotionValue(p),xj(s,i,p),this.animation.cancel()}f?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return mi(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+mi(t)}get time(){return mi(Number(this.animation.currentTime)||0)}set time(t){const s=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Xn(t),s&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:s,rangeEnd:i,observe:a}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&gB()?(this.animation.timeline=t,s&&(this.animation.rangeStart=s),i&&(this.animation.rangeEnd=i),pi):a(this)}}const kj={anticipate:JE,backInOut:QE,circInOut:tj};function vB(e){return e in kj}function yB(e){typeof e.ease=="string"&&vB(e.ease)&&(e.ease=kj[e.ease])}const Mg=10;class _B extends Sj{constructor(t){yB(t),pj(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:s,onUpdate:i,onComplete:a,element:l,...c}=this.options;if(!s)return;if(t!==void 0){s.set(t);return}const h=new sf({...c,autoplay:!1}),f=Math.max(Mg,gn.now()-this.startTime),d=Ji(0,Mg,f-Mg),p=h.sample(f).value,{name:g}=this.options;l&&g&&xj(l,g,p),s.setWithVelocity(h.sample(Math.max(0,f-d)).value,p,d),h.stop()}}const CS=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Di.test(e)||e==="0")&&!e.startsWith("url("));function wB(e){const t=e[0];if(e.length===1)return!0;for(let s=0;s<e.length;s++)if(e[s]!==t)return!0}function SB(e,t,s,i){const a=e[0];if(a===null)return!1;if(t==="display"||t==="visibility")return!0;const l=e[e.length-1],c=CS(a,t),h=CS(l,t);return!c||!h?!1:wB(e)||(s==="spring"||wj(s))&&i}function ux(e){e.duration=0,e.type="keyframes"}const Nj=new Set(["opacity","clipPath","filter","transform"]),kB=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function NB(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&kB.test(e[t]))return!0;return!1}const CB=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),EB=VE(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function jB(e){const{motionValue:t,name:s,repeatDelay:i,repeatType:a,damping:l,type:c,keyframes:h}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:d,transformTemplate:p}=t.owner.getProps();return EB()&&s&&(Nj.has(s)||CB.has(s)&&NB(h))&&(s!=="transform"||!p)&&!d&&!i&&a!=="mirror"&&l!==0&&c!=="inertia"}const AB=40;class TB extends Q0{constructor({autoplay:t=!0,delay:s=0,type:i="keyframes",repeat:a=0,repeatDelay:l=0,repeatType:c="loop",keyframes:h,name:f,motionValue:d,element:p,...g}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=gn.now();const b={autoplay:t,delay:s,type:i,repeat:a,repeatDelay:l,repeatType:c,name:f,motionValue:d,element:p,...g},v=p?.KeyframeResolver||J0;this.keyframeResolver=new v(h,(w,k,N)=>this.onKeyframesResolved(w,k,b,!N),f,d,p),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,s,i,a){this.keyframeResolver=void 0;const{name:l,type:c,velocity:h,delay:f,isHandoff:d,onUpdate:p}=i;this.resolvedAt=gn.now();let g=!0;SB(t,l,c,h)||(g=!1,(ka.instantAnimations||!f)&&p?.(Ff(t,i,s)),t[0]=t[t.length-1],ux(i),i.repeat=0);const v={startTime:a?this.resolvedAt?this.resolvedAt-this.createdAt>AB?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:s,...i,keyframes:t},w=g&&!d&&jB(v),k=v.motionValue?.owner?.current;let N;if(w)try{N=new _B({...v,element:k})}catch{N=new sf(v)}else N=new sf(v);N.finished.then(()=>{this.notifyFinished()}).catch(pi),this.pendingTimeline&&(this.stopTimeline=N.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=N}get finished(){return this._animation?this.animation.finished:this._finished}then(t,s){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),fB()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function Cj(e,t,s,i=0,a=1){const l=Array.from(e).sort((d,p)=>d.sortNodePosition(p)).indexOf(t),c=e.size,h=(c-1)*i;return typeof s=="function"?s(l,c):a===1?l*i:h-l*i}const RB=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function MB(e){const t=RB.exec(e);if(!t)return[,];const[,s,i,a]=t;return[`--${s??i}`,a]}function Ej(e,t,s=1){const[i,a]=MB(e);if(!i)return;const l=window.getComputedStyle(t).getPropertyValue(i);if(l){const c=l.trim();return FE(c)?parseFloat(c):c}return W0(a)?Ej(a,t,s+1):a}const DB={type:"spring",stiffness:500,damping:25,restSpeed:10},LB=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),OB={type:"keyframes",duration:.8},zB={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},BB=(e,{keyframes:t})=>t.length>2?OB:El.has(e)?e.startsWith("scale")?LB(t[1]):DB:zB;function jj(e,t){if(e?.inherit&&t){const{inherit:s,...i}=e;return{...t,...i}}return e}function ev(e,t){const s=e?.[t]??e?.default??e;return s!==e?jj(s,e):s}const PB=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function IB(e){for(const t in e)if(!PB.has(t))return!0;return!1}const tv=(e,t,s,i={},a,l)=>c=>{const h=ev(i,e)||{},f=h.delay||i.delay||0;let{elapsed:d=0}=i;d=d-Xn(f);const p={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:t.getVelocity(),...h,delay:-d,onUpdate:b=>{t.set(b),h.onUpdate&&h.onUpdate(b)},onComplete:()=>{c(),h.onComplete&&h.onComplete()},name:e,motionValue:t,element:l?void 0:a};IB(h)||Object.assign(p,BB(e,p)),p.duration&&(p.duration=Xn(p.duration)),p.repeatDelay&&(p.repeatDelay=Xn(p.repeatDelay)),p.from!==void 0&&(p.keyframes[0]=p.from);let g=!1;if((p.type===!1||p.duration===0&&!p.repeatDelay)&&(ux(p),p.delay===0&&(g=!0)),(ka.instantAnimations||ka.skipAnimations||a?.shouldSkipAnimations)&&(g=!0,ux(p),p.delay=0),p.allowFlatten=!h.type&&!h.ease,g&&!l&&t.get()!==void 0){const b=Ff(p.keyframes,h);if(b!==void 0){Wt.update(()=>{p.onUpdate(b),p.onComplete()});return}}return h.isSync?new sf(p):new TB(p)};function ES(e){const t=[{},{}];return e?.values.forEach((s,i)=>{t[0][i]=s.get(),t[1][i]=s.getVelocity()}),t}function sv(e,t,s,i){if(typeof t=="function"){const[a,l]=ES(i);t=t(s!==void 0?s:e.custom,a,l)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[a,l]=ES(i);t=t(s!==void 0?s:e.custom,a,l)}return t}function co(e,t,s){const i=e.getProps();return sv(i,t,s!==void 0?s:i.custom,e)}const Aj=new Set(["width","height","top","left","right","bottom",...Cl]),jS=30,$B=e=>!isNaN(parseFloat(e));class HB{constructor(t,s={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=i=>{const a=gn.now();if(this.updatedAt!==a&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const l of this.dependents)l.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=s.owner}setCurrent(t){this.current=t,this.updatedAt=gn.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=$B(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,s){this.events[t]||(this.events[t]=new q0);const i=this.events[t].add(s);return t==="change"?()=>{i(),Wt.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,s){this.passiveEffect=t,this.stopPassiveEffect=s}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,s,i){this.set(s),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-i}jump(t,s=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,s&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=gn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>jS)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,jS);return WE(parseFloat(this.current)-parseFloat(this.prevFrameValue),s)}start(t){return this.stop(),new Promise(s=>{this.hasAnimated=!0,this.animation=t(s),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function wl(e,t){return new HB(e,t)}const dx=e=>Array.isArray(e);function UB(e,t,s){e.hasValue(t)?e.getValue(t).set(s):e.addValue(t,wl(s))}function FB(e){return dx(e)?e[e.length-1]||0:e}function qB(e,t){const s=co(e,t);let{transitionEnd:i={},transition:a={},...l}=s||{};l={...l,...i};for(const c in l){const h=FB(l[c]);UB(e,c,h)}}const sn=e=>!!(e&&e.getVelocity);function GB(e){return!!(sn(e)&&e.add)}function hx(e,t){const s=e.getValue("willChange");if(GB(s))return s.add(t);if(!s&&ka.WillChange){const i=new ka.WillChange("auto");e.addValue("willChange",i),i.add(t)}}function nv(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const VB="framerAppearId",Tj="data-"+nv(VB);function Rj(e){return e.props[Tj]}function WB({protectedKeys:e,needsAnimating:t},s){const i=e.hasOwnProperty(s)&&t[s]!==!0;return t[s]=!1,i}function Mj(e,t,{delay:s=0,transitionOverride:i,type:a}={}){let{transition:l,transitionEnd:c,...h}=t;const f=e.getDefaultTransition();l=l?jj(l,f):f;const d=l?.reduceMotion;i&&(l=i);const p=[],g=a&&e.animationState&&e.animationState.getState()[a];for(const b in h){const v=e.getValue(b,e.latestValues[b]??null),w=h[b];if(w===void 0||g&&WB(g,b))continue;const k={delay:s,...ev(l||{},b)},N=v.get();if(N!==void 0&&!v.isAnimating()&&!Array.isArray(w)&&w===N&&!k.velocity){Wt.update(()=>v.set(w));continue}let E=!1;if(window.MotionHandoffAnimation){const C=Rj(e);if(C){const R=window.MotionHandoffAnimation(C,b,Wt);R!==null&&(k.startTime=R,E=!0)}}hx(e,b);const T=d??e.shouldReduceMotion;v.start(tv(b,v,w,T&&Aj.has(b)?{type:!1}:k,e,E));const A=v.animation;A&&p.push(A)}if(c){const b=()=>Wt.update(()=>{c&&qB(e,c)});p.length?Promise.all(p).then(b):b()}return p}function fx(e,t,s={}){const i=co(e,t,s.type==="exit"?e.presenceContext?.custom:void 0);let{transition:a=e.getDefaultTransition()||{}}=i||{};s.transitionOverride&&(a=s.transitionOverride);const l=i?()=>Promise.all(Mj(e,i,s)):()=>Promise.resolve(),c=e.variantChildren&&e.variantChildren.size?(f=0)=>{const{delayChildren:d=0,staggerChildren:p,staggerDirection:g}=a;return KB(e,t,f,d,p,g,s)}:()=>Promise.resolve(),{when:h}=a;if(h){const[f,d]=h==="beforeChildren"?[l,c]:[c,l];return f().then(()=>d())}else return Promise.all([l(),c(s.delay)])}function KB(e,t,s=0,i=0,a=0,l=1,c){const h=[];for(const f of e.variantChildren)f.notify("AnimationStart",t),h.push(fx(f,t,{...c,delay:s+(typeof i=="function"?0:i)+Cj(e.variantChildren,f,i,a,l)}).then(()=>f.notify("AnimationComplete",t)));return Promise.all(h)}function YB(e,t,s={}){e.notify("AnimationStart",t);let i;if(Array.isArray(t)){const a=t.map(l=>fx(e,l,s));i=Promise.all(a)}else if(typeof t=="string")i=fx(e,t,s);else{const a=typeof t=="function"?co(e,t,s.custom):t;i=Promise.all(Mj(e,a,s))}return i.then(()=>{e.notify("AnimationComplete",t)})}const XB={test:e=>e==="auto",parse:e=>e},Dj=e=>t=>t.test(e),Lj=[Nl,Xe,Xi,xa,wz,_z,XB],AS=e=>Lj.find(Dj(e));function ZB(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||GE(e):!0}const QB=new Set(["brightness","contrast","saturate","opacity"]);function JB(e){const[t,s]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[i]=s.match(K0)||[];if(!i)return e;const a=s.replace(i,"");let l=QB.has(t)?1:0;return i!==s&&(l*=100),t+"("+l+a+")"}const eP=/\b([a-z-]*)\(.*?\)/gu,mx={...Di,getAnimatableNone:e=>{const t=e.match(eP);return t?t.map(JB).join(" "):e}},px={...Di,getAnimatableNone:e=>{const t=Di.parse(e);return Di.createTransformer(e)(t.map(i=>typeof i=="number"?0:typeof i=="object"?{...i,alpha:1}:i))}},TS={...Nl,transform:Math.round},tP={rotate:xa,rotateX:xa,rotateY:xa,rotateZ:xa,scale:sh,scaleX:sh,scaleY:sh,scaleZ:sh,skew:xa,skewX:xa,skewY:xa,distance:Xe,translateX:Xe,translateY:Xe,translateZ:Xe,x:Xe,y:Xe,z:Xe,perspective:Xe,transformPerspective:Xe,opacity:fu,originX:gS,originY:gS,originZ:Xe},iv={borderWidth:Xe,borderTopWidth:Xe,borderRightWidth:Xe,borderBottomWidth:Xe,borderLeftWidth:Xe,borderRadius:Xe,borderTopLeftRadius:Xe,borderTopRightRadius:Xe,borderBottomRightRadius:Xe,borderBottomLeftRadius:Xe,width:Xe,maxWidth:Xe,height:Xe,maxHeight:Xe,top:Xe,right:Xe,bottom:Xe,left:Xe,inset:Xe,insetBlock:Xe,insetBlockStart:Xe,insetBlockEnd:Xe,insetInline:Xe,insetInlineStart:Xe,insetInlineEnd:Xe,padding:Xe,paddingTop:Xe,paddingRight:Xe,paddingBottom:Xe,paddingLeft:Xe,paddingBlock:Xe,paddingBlockStart:Xe,paddingBlockEnd:Xe,paddingInline:Xe,paddingInlineStart:Xe,paddingInlineEnd:Xe,margin:Xe,marginTop:Xe,marginRight:Xe,marginBottom:Xe,marginLeft:Xe,marginBlock:Xe,marginBlockStart:Xe,marginBlockEnd:Xe,marginInline:Xe,marginInlineStart:Xe,marginInlineEnd:Xe,fontSize:Xe,backgroundPositionX:Xe,backgroundPositionY:Xe,...tP,zIndex:TS,fillOpacity:fu,strokeOpacity:fu,numOctaves:TS},sP={...iv,color:Ts,backgroundColor:Ts,outlineColor:Ts,fill:Ts,stroke:Ts,borderColor:Ts,borderTopColor:Ts,borderRightColor:Ts,borderBottomColor:Ts,borderLeftColor:Ts,filter:mx,WebkitFilter:mx,mask:px,WebkitMask:px},Oj=e=>sP[e],nP=new Set([mx,px]);function zj(e,t){let s=Oj(e);return nP.has(s)||(s=Di),s.getAnimatableNone?s.getAnimatableNone(t):void 0}const iP=new Set(["auto","none","0"]);function rP(e,t,s){let i=0,a;for(;i<e.length&&!a;){const l=e[i];typeof l=="string"&&!iP.has(l)&&_l(l).values.length&&(a=e[i]),i++}if(a&&s)for(const l of t)e[l]=zj(s,a)}class aP extends J0{constructor(t,s,i,a,l){super(t,s,i,a,l,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:s,name:i}=this;if(!s||!s.current)return;super.readKeyframes();for(let p=0;p<t.length;p++){let g=t[p];if(typeof g=="string"&&(g=g.trim(),W0(g))){const b=Ej(g,s.current);b!==void 0&&(t[p]=b),p===t.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!Aj.has(i)||t.length!==2)return;const[a,l]=t,c=AS(a),h=AS(l),f=pS(a),d=pS(l);if(f!==d&&ya[i]){this.needsMeasurement=!0;return}if(c!==h)if(kS(c)&&kS(h))for(let p=0;p<t.length;p++){const g=t[p];typeof g=="string"&&(t[p]=parseFloat(g))}else ya[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:s}=this,i=[];for(let a=0;a<t.length;a++)(t[a]===null||ZB(t[a]))&&i.push(a);i.length&&rP(t,i,s)}measureInitialState(){const{element:t,unresolvedKeyframes:s,name:i}=this;if(!t||!t.current)return;i==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ya[i](t.measureViewportBox(),window.getComputedStyle(t.current)),s[0]=this.measuredOrigin;const a=s[s.length-1];a!==void 0&&t.getValue(i,a).jump(a,!1)}measureEndState(){const{element:t,name:s,unresolvedKeyframes:i}=this;if(!t||!t.current)return;const a=t.getValue(s);a&&a.jump(this.measuredOrigin,!1);const l=i.length-1,c=i[l];i[l]=ya[s](t.measureViewportBox(),window.getComputedStyle(t.current)),c!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=c),this.removedTransforms?.length&&this.removedTransforms.forEach(([h,f])=>{t.getValue(h).set(f)}),this.resolveNoneKeyframes()}}function Bj(e,t,s){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let i=document;const a=s?.[e]??i.querySelectorAll(e);return a?Array.from(a):[]}return Array.from(e).filter(i=>i!=null)}const Pj=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function oP(e){return qE(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:rv}=ij(queueMicrotask,!1),Ai={x:!1,y:!1};function Ij(){return Ai.x||Ai.y}function lP(e){return e==="x"||e==="y"?Ai[e]?null:(Ai[e]=!0,()=>{Ai[e]=!1}):Ai.x||Ai.y?null:(Ai.x=Ai.y=!0,()=>{Ai.x=Ai.y=!1})}function $j(e,t){const s=Bj(e),i=new AbortController,a={passive:!0,...t,signal:i.signal};return[s,a,()=>i.abort()]}function cP(e){return!(e.pointerType==="touch"||Ij())}function uP(e,t,s={}){const[i,a,l]=$j(e,s);return i.forEach(c=>{let h=!1,f=!1,d;const p=()=>{c.removeEventListener("pointerleave",w)},g=N=>{d&&(d(N),d=void 0),p()},b=N=>{h=!1,window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",b),f&&(f=!1,g(N))},v=()=>{h=!0,window.addEventListener("pointerup",b,a),window.addEventListener("pointercancel",b,a)},w=N=>{if(N.pointerType!=="touch"){if(h){f=!0;return}g(N)}},k=N=>{if(!cP(N))return;f=!1;const E=t(c,N);typeof E=="function"&&(d=E,c.addEventListener("pointerleave",w,a))};c.addEventListener("pointerenter",k,a),c.addEventListener("pointerdown",v,a)}),l}const Hj=(e,t)=>t?e===t?!0:Hj(e,t.parentElement):!1,av=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,dP=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function hP(e){return dP.has(e.tagName)||e.isContentEditable===!0}const fP=new Set(["INPUT","SELECT","TEXTAREA"]);function mP(e){return fP.has(e.tagName)||e.isContentEditable===!0}const Dh=new WeakSet;function RS(e){return t=>{t.key==="Enter"&&e(t)}}function Dg(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const pP=(e,t)=>{const s=e.currentTarget;if(!s)return;const i=RS(()=>{if(Dh.has(s))return;Dg(s,"down");const a=RS(()=>{Dg(s,"up")}),l=()=>Dg(s,"cancel");s.addEventListener("keyup",a,t),s.addEventListener("blur",l,t)});s.addEventListener("keydown",i,t),s.addEventListener("blur",()=>s.removeEventListener("keydown",i),t)};function MS(e){return av(e)&&!Ij()}const DS=new WeakSet;function gP(e,t,s={}){const[i,a,l]=$j(e,s),c=h=>{const f=h.currentTarget;if(!MS(h)||DS.has(h))return;Dh.add(f),s.stopPropagation&&DS.add(h);const d=t(f,h),p=(v,w)=>{window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",b),Dh.has(f)&&Dh.delete(f),MS(v)&&typeof d=="function"&&d(v,{success:w})},g=v=>{p(v,f===window||f===document||s.useGlobalTarget||Hj(f,v.target))},b=v=>{p(v,!1)};window.addEventListener("pointerup",g,a),window.addEventListener("pointercancel",b,a)};return i.forEach(h=>{(s.useGlobalTarget?window:h).addEventListener("pointerdown",c,a),oP(h)&&(h.addEventListener("focus",d=>pP(d,a)),!hP(h)&&!h.hasAttribute("tabindex")&&(h.tabIndex=0))}),l}function ov(e){return qE(e)&&"ownerSVGElement"in e}const Lh=new WeakMap;let Oh;const Uj=(e,t,s)=>(i,a)=>a&&a[0]?a[0][e+"Size"]:ov(i)&&"getBBox"in i?i.getBBox()[t]:i[s],bP=Uj("inline","width","offsetWidth"),xP=Uj("block","height","offsetHeight");function vP({target:e,borderBoxSize:t}){Lh.get(e)?.forEach(s=>{s(e,{get width(){return bP(e,t)},get height(){return xP(e,t)}})})}function yP(e){e.forEach(vP)}function _P(){typeof ResizeObserver>"u"||(Oh=new ResizeObserver(yP))}function wP(e,t){Oh||_P();const s=Bj(e);return s.forEach(i=>{let a=Lh.get(i);a||(a=new Set,Lh.set(i,a)),a.add(t),Oh?.observe(i)}),()=>{s.forEach(i=>{const a=Lh.get(i);a?.delete(t),a?.size||Oh?.unobserve(i)})}}const zh=new Set;let hl;function SP(){hl=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};zh.forEach(t=>t(e))},window.addEventListener("resize",hl)}function kP(e){return zh.add(e),hl||SP(),()=>{zh.delete(e),!zh.size&&typeof hl=="function"&&(window.removeEventListener("resize",hl),hl=void 0)}}function LS(e,t){return typeof e=="function"?kP(e):wP(e,t)}function NP(e){return ov(e)&&e.tagName==="svg"}const CP=[...Lj,Ts,Di],EP=e=>CP.find(Dj(e)),OS=()=>({translate:0,scale:1,origin:0,originPoint:0}),fl=()=>({x:OS(),y:OS()}),zS=()=>({min:0,max:0}),Ps=()=>({x:zS(),y:zS()}),jP=new WeakMap;function qf(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function mu(e){return typeof e=="string"||Array.isArray(e)}const lv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],cv=["initial",...lv];function Gf(e){return qf(e.animate)||cv.some(t=>mu(e[t]))}function Fj(e){return!!(Gf(e)||e.variants)}function AP(e,t,s){for(const i in t){const a=t[i],l=s[i];if(sn(a))e.addValue(i,a);else if(sn(l))e.addValue(i,wl(a,{owner:e}));else if(l!==a)if(e.hasValue(i)){const c=e.getValue(i);c.liveStyle===!0?c.jump(a):c.hasAnimated||c.set(a)}else{const c=e.getStaticValue(i);e.addValue(i,wl(c!==void 0?c:a,{owner:e}))}}for(const i in s)t[i]===void 0&&e.removeValue(i);return t}const gx={current:null},qj={current:!1},TP=typeof window<"u";function RP(){if(qj.current=!0,!!TP)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>gx.current=e.matches;e.addEventListener("change",t),t()}else gx.current=!1}const BS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let nf={};function Gj(e){nf=e}function MP(){return nf}class DP{scrapeMotionValuesFromProps(t,s,i){return{}}constructor({parent:t,props:s,presenceContext:i,reducedMotionConfig:a,skipAnimations:l,blockInitialAnimation:c,visualState:h},f={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=J0,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const v=gn.now();this.renderScheduledAt<v&&(this.renderScheduledAt=v,Wt.render(this.render,!1,!0))};const{latestValues:d,renderState:p}=h;this.latestValues=d,this.baseTarget={...d},this.initialValues=s.initial?{...d}:{},this.renderState=p,this.parent=t,this.props=s,this.presenceContext=i,this.depth=t?t.depth+1:0,this.reducedMotionConfig=a,this.skipAnimationsConfig=l,this.options=f,this.blockInitialAnimation=!!c,this.isControllingVariants=Gf(s),this.isVariantNode=Fj(s),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:g,...b}=this.scrapeMotionValuesFromProps(s,{},this);for(const v in b){const w=b[v];d[v]!==void 0&&sn(w)&&w.set(d[v])}}mount(t){if(this.hasBeenMounted)for(const s in this.initialValues)this.values.get(s)?.jump(this.initialValues[s]),this.latestValues[s]=this.initialValues[s];this.current=t,jP.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((s,i)=>this.bindToMotionValue(i,s)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(qj.current||RP(),this.shouldReduceMotion=gx.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),Na(this.notifyUpdate),Na(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const s=this.features[t];s&&(s.unmount(),s.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,s){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),s.accelerate&&Nj.has(t)&&this.current instanceof HTMLElement){const{factory:c,keyframes:h,times:f,ease:d,duration:p}=s.accelerate,g=new Sj({element:this.current,name:t,keyframes:h,times:f,ease:d,duration:Xn(p)}),b=c(g);this.valueSubscriptions.set(t,()=>{b(),g.cancel()});return}const i=El.has(t);i&&this.onBindTransform&&this.onBindTransform();const a=s.on("change",c=>{this.latestValues[t]=c,this.props.onUpdate&&Wt.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let l;typeof window<"u"&&window.MotionCheckAppearSync&&(l=window.MotionCheckAppearSync(this,t,s)),this.valueSubscriptions.set(t,()=>{a(),l&&l(),s.owner&&s.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in nf){const s=nf[t];if(!s)continue;const{isEnabled:i,Feature:a}=s;if(!this.features[t]&&a&&i(this.props)&&(this.features[t]=new a(this)),this.features[t]){const l=this.features[t];l.isMounted?l.update():(l.mount(),l.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ps()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,s){this.latestValues[t]=s}update(t,s){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=s;for(let i=0;i<BS.length;i++){const a=BS[i];this.propEventSubscriptions[a]&&(this.propEventSubscriptions[a](),delete this.propEventSubscriptions[a]);const l="on"+a,c=t[l];c&&(this.propEventSubscriptions[a]=this.on(a,c))}this.prevMotionValues=AP(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const s=this.getClosestVariantNode();if(s)return s.variantChildren&&s.variantChildren.add(t),()=>s.variantChildren.delete(t)}addValue(t,s){const i=this.values.get(t);s!==i&&(i&&this.removeValue(t),this.bindToMotionValue(t,s),this.values.set(t,s),this.latestValues[t]=s.get())}removeValue(t){this.values.delete(t);const s=this.valueSubscriptions.get(t);s&&(s(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,s){if(this.props.values&&this.props.values[t])return this.props.values[t];let i=this.values.get(t);return i===void 0&&s!==void 0&&(i=wl(s===null?void 0:s,{owner:this}),this.addValue(t,i)),i}readValue(t,s){let i=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return i!=null&&(typeof i=="string"&&(FE(i)||GE(i))?i=parseFloat(i):!EP(i)&&Di.test(s)&&(i=zj(t,s)),this.setBaseTarget(t,sn(i)?i.get():i)),sn(i)?i.get():i}setBaseTarget(t,s){this.baseTarget[t]=s}getBaseTarget(t){const{initial:s}=this.props;let i;if(typeof s=="string"||typeof s=="object"){const l=sv(this.props,s,this.presenceContext?.custom);l&&(i=l[t])}if(s&&i!==void 0)return i;const a=this.getBaseTargetFromProps(this.props,t);return a!==void 0&&!sn(a)?a:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,s){return this.events[t]||(this.events[t]=new q0),this.events[t].add(s)}notify(t,...s){this.events[t]&&this.events[t].notify(...s)}scheduleRenderMicrotask(){rv.render(this.render)}}class Vj extends DP{constructor(){super(...arguments),this.KeyframeResolver=aP}sortInstanceNodePosition(t,s){return t.compareDocumentPosition(s)&2?1:-1}getBaseTargetFromProps(t,s){const i=t.style;return i?i[s]:void 0}removeValueFromRenderState(t,{vars:s,style:i}){delete s[t],delete i[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;sn(t)&&(this.childSubscription=t.on("change",s=>{this.current&&(this.current.textContent=`${s}`)}))}}class Ea{constructor(t){this.isMounted=!1,this.node=t}update(){}}function Wj({top:e,left:t,right:s,bottom:i}){return{x:{min:t,max:s},y:{min:e,max:i}}}function LP({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function OP(e,t){if(!t)return e;const s=t({x:e.left,y:e.top}),i=t({x:e.right,y:e.bottom});return{top:s.y,left:s.x,bottom:i.y,right:i.x}}function Lg(e){return e===void 0||e===1}function bx({scale:e,scaleX:t,scaleY:s}){return!Lg(e)||!Lg(t)||!Lg(s)}function Ja(e){return bx(e)||Kj(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Kj(e){return PS(e.x)||PS(e.y)}function PS(e){return e&&e!=="0%"}function rf(e,t,s){const i=e-s,a=t*i;return s+a}function IS(e,t,s,i,a){return a!==void 0&&(e=rf(e,a,i)),rf(e,s,i)+t}function xx(e,t=0,s=1,i,a){e.min=IS(e.min,t,s,i,a),e.max=IS(e.max,t,s,i,a)}function Yj(e,{x:t,y:s}){xx(e.x,t.translate,t.scale,t.originPoint),xx(e.y,s.translate,s.scale,s.originPoint)}const $S=.999999999999,HS=1.0000000000001;function zP(e,t,s,i=!1){const a=s.length;if(!a)return;t.x=t.y=1;let l,c;for(let h=0;h<a;h++){l=s[h],c=l.projectionDelta;const{visualElement:f}=l.options;f&&f.props.style&&f.props.style.display==="contents"||(i&&l.options.layoutScroll&&l.scroll&&l!==l.root&&(Ki(e.x,-l.scroll.offset.x),Ki(e.y,-l.scroll.offset.y)),c&&(t.x*=c.x.scale,t.y*=c.y.scale,Yj(e,c)),i&&Ja(l.latestValues)&&Bh(e,l.latestValues,l.layout?.layoutBox))}t.x<HS&&t.x>$S&&(t.x=1),t.y<HS&&t.y>$S&&(t.y=1)}function Ki(e,t){e.min+=t,e.max+=t}function US(e,t,s,i,a=.5){const l=Jt(e.min,e.max,a);xx(e,t,s,l,i)}function FS(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function Bh(e,t,s){const i=s??e;US(e.x,FS(t.x,i.x),t.scaleX,t.scale,t.originX),US(e.y,FS(t.y,i.y),t.scaleY,t.scale,t.originY)}function Xj(e,t){return Wj(OP(e.getBoundingClientRect(),t))}function BP(e,t,s){const i=Xj(e,s),{scroll:a}=t;return a&&(Ki(i.x,a.offset.x),Ki(i.y,a.offset.y)),i}const PP={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},IP=Cl.length;function $P(e,t,s){let i="",a=!0;for(let l=0;l<IP;l++){const c=Cl[l],h=e[c];if(h===void 0)continue;let f=!0;if(typeof h=="number")f=h===(c.startsWith("scale")?1:0);else{const d=parseFloat(h);f=c.startsWith("scale")?d===1:d===0}if(!f||s){const d=Pj(h,iv[c]);if(!f){a=!1;const p=PP[c]||c;i+=`${p}(${d}) `}s&&(t[c]=d)}}return i=i.trim(),s?i=s(t,a?"":i):a&&(i="none"),i}function uv(e,t,s){const{style:i,vars:a,transformOrigin:l}=e;let c=!1,h=!1;for(const f in t){const d=t[f];if(El.has(f)){c=!0;continue}else if(aj(f)){a[f]=d;continue}else{const p=Pj(d,iv[f]);f.startsWith("origin")?(h=!0,l[f]=p):i[f]=p}}if(t.transform||(c||s?i.transform=$P(t,e.transform,s):i.transform&&(i.transform="none")),h){const{originX:f="50%",originY:d="50%",originZ:p=0}=l;i.transformOrigin=`${f} ${d} ${p}`}}function Zj(e,{style:t,vars:s},i,a){const l=e.style;let c;for(c in t)l[c]=t[c];a?.applyProjectionStyles(l,i);for(c in s)l.setProperty(c,s[c])}function qS(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Ac={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Xe.test(e))e=parseFloat(e);else return e;const s=qS(e,t.target.x),i=qS(e,t.target.y);return`${s}% ${i}%`}},HP={correct:(e,{treeScale:t,projectionDelta:s})=>{const i=e,a=Di.parse(e);if(a.length>5)return i;const l=Di.createTransformer(e),c=typeof a[0]!="number"?1:0,h=s.x.scale*t.x,f=s.y.scale*t.y;a[0+c]/=h,a[1+c]/=f;const d=Jt(h,f,.5);return typeof a[2+c]=="number"&&(a[2+c]/=d),typeof a[3+c]=="number"&&(a[3+c]/=d),l(a)}},vx={borderRadius:{...Ac,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ac,borderTopRightRadius:Ac,borderBottomLeftRadius:Ac,borderBottomRightRadius:Ac,boxShadow:HP};function Qj(e,{layout:t,layoutId:s}){return El.has(e)||e.startsWith("origin")||(t||s!==void 0)&&(!!vx[e]||e==="opacity")}function dv(e,t,s){const i=e.style,a=t?.style,l={};if(!i)return l;for(const c in i)(sn(i[c])||a&&sn(a[c])||Qj(c,e)||s?.getValue(c)?.liveStyle!==void 0)&&(l[c]=i[c]);return l}function UP(e){return window.getComputedStyle(e)}class FP extends Vj{constructor(){super(...arguments),this.type="html",this.renderInstance=Zj}readValueFromInstance(t,s){if(El.has(s))return this.projection?.isProjecting?rx(s):lB(t,s);{const i=UP(t),a=(aj(s)?i.getPropertyValue(s):i[s])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(t,{transformPagePoint:s}){return Xj(t,s)}build(t,s,i){uv(t,s,i.transformTemplate)}scrapeMotionValuesFromProps(t,s,i){return dv(t,s,i)}}const qP={offset:"stroke-dashoffset",array:"stroke-dasharray"},GP={offset:"strokeDashoffset",array:"strokeDasharray"};function VP(e,t,s=1,i=0,a=!0){e.pathLength=1;const l=a?qP:GP;e[l.offset]=`${-i}`,e[l.array]=`${t} ${s}`}const WP=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Jj(e,{attrX:t,attrY:s,attrScale:i,pathLength:a,pathSpacing:l=1,pathOffset:c=0,...h},f,d,p){if(uv(e,h,d),f){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:g,style:b}=e;g.transform&&(b.transform=g.transform,delete g.transform),(b.transform||g.transformOrigin)&&(b.transformOrigin=g.transformOrigin??"50% 50%",delete g.transformOrigin),b.transform&&(b.transformBox=p?.transformBox??"fill-box",delete g.transformBox);for(const v of WP)g[v]!==void 0&&(b[v]=g[v],delete g[v]);t!==void 0&&(g.x=t),s!==void 0&&(g.y=s),i!==void 0&&(g.scale=i),a!==void 0&&VP(g,a,l,c,!1)}const e3=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),t3=e=>typeof e=="string"&&e.toLowerCase()==="svg";function KP(e,t,s,i){Zj(e,t,void 0,i);for(const a in t.attrs)e.setAttribute(e3.has(a)?a:nv(a),t.attrs[a])}function s3(e,t,s){const i=dv(e,t,s);for(const a in e)if(sn(e[a])||sn(t[a])){const l=Cl.indexOf(a)!==-1?"attr"+a.charAt(0).toUpperCase()+a.substring(1):a;i[l]=e[a]}return i}class YP extends Vj{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ps}getBaseTargetFromProps(t,s){return t[s]}readValueFromInstance(t,s){if(El.has(s)){const i=Oj(s);return i&&i.default||0}return s=e3.has(s)?s:nv(s),t.getAttribute(s)}scrapeMotionValuesFromProps(t,s,i){return s3(t,s,i)}build(t,s,i){Jj(t,s,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(t,s,i,a){KP(t,s,i,a)}mount(t){this.isSVGTag=t3(t.tagName),super.mount(t)}}const XP=cv.length;function n3(e){if(!e)return;if(!e.isControllingVariants){const s=e.parent?n3(e.parent)||{}:{};return e.props.initial!==void 0&&(s.initial=e.props.initial),s}const t={};for(let s=0;s<XP;s++){const i=cv[s],a=e.props[i];(mu(a)||a===!1)&&(t[i]=a)}return t}function i3(e,t){if(!Array.isArray(t))return!1;const s=t.length;if(s!==e.length)return!1;for(let i=0;i<s;i++)if(t[i]!==e[i])return!1;return!0}const ZP=[...lv].reverse(),QP=lv.length;function JP(e){return t=>Promise.all(t.map(({animation:s,options:i})=>YB(e,s,i)))}function eI(e){let t=JP(e),s=GS(),i=!0,a=!1;const l=d=>(p,g)=>{const b=co(e,g,d==="exit"?e.presenceContext?.custom:void 0);if(b){const{transition:v,transitionEnd:w,...k}=b;p={...p,...k,...w}}return p};function c(d){t=d(e)}function h(d){const{props:p}=e,g=n3(e.parent)||{},b=[],v=new Set;let w={},k=1/0;for(let E=0;E<QP;E++){const T=ZP[E],A=s[T],C=p[T]!==void 0?p[T]:g[T],R=mu(C),L=T===d?A.isActive:null;L===!1&&(k=E);let H=C===g[T]&&C!==p[T]&&R;if(H&&(i||a)&&e.manuallyAnimateOnMount&&(H=!1),A.protectedKeys={...w},!A.isActive&&L===null||!C&&!A.prevProp||qf(C)||typeof C=="boolean")continue;if(T==="exit"&&A.isActive&&L!==!0){A.prevResolvedValues&&(w={...w,...A.prevResolvedValues});continue}const B=tI(A.prevProp,C);let P=B||T===d&&A.isActive&&!H&&R||E>k&&R,D=!1;const G=Array.isArray(C)?C:[C];let $=G.reduce(l(T),{});L===!1&&($={});const{prevResolvedValues:O={}}=A,V={...O,...$},K=W=>{P=!0,v.has(W)&&(D=!0,v.delete(W)),A.needsAnimating[W]=!0;const le=e.getValue(W);le&&(le.liveStyle=!1)};for(const W in V){const le=$[W],J=O[W];if(w.hasOwnProperty(W))continue;let U=!1;dx(le)&&dx(J)?U=!i3(le,J):U=le!==J,U?le!=null?K(W):v.add(W):le!==void 0&&v.has(W)?K(W):A.protectedKeys[W]=!0}A.prevProp=C,A.prevResolvedValues=$,A.isActive&&(w={...w,...$}),(i||a)&&e.blockInitialAnimation&&(P=!1);const I=H&&B;P&&(!I||D)&&b.push(...G.map(W=>{const le={type:T};if(typeof W=="string"&&(i||a)&&!I&&e.manuallyAnimateOnMount&&e.parent){const{parent:J}=e,U=co(J,W);if(J.enteringChildren&&U){const{delayChildren:F}=U.transition||{};le.delay=Cj(J.enteringChildren,e,F)}}return{animation:W,options:le}}))}if(v.size){const E={};if(typeof p.initial!="boolean"){const T=co(e,Array.isArray(p.initial)?p.initial[0]:p.initial);T&&T.transition&&(E.transition=T.transition)}v.forEach(T=>{const A=e.getBaseTarget(T),C=e.getValue(T);C&&(C.liveStyle=!0),E[T]=A??null}),b.push({animation:E})}let N=!!b.length;return i&&(p.initial===!1||p.initial===p.animate)&&!e.manuallyAnimateOnMount&&(N=!1),i=!1,a=!1,N?t(b):Promise.resolve()}function f(d,p){if(s[d].isActive===p)return Promise.resolve();e.variantChildren?.forEach(b=>b.animationState?.setActive(d,p)),s[d].isActive=p;const g=h(d);for(const b in s)s[b].protectedKeys={};return g}return{animateChanges:h,setActive:f,setAnimateFunction:c,getState:()=>s,reset:()=>{s=GS(),a=!0}}}function tI(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!i3(t,e):!1}function Ya(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function GS(){return{animate:Ya(!0),whileInView:Ya(),whileHover:Ya(),whileTap:Ya(),whileDrag:Ya(),whileFocus:Ya(),exit:Ya()}}function yx(e,t){e.min=t.min,e.max=t.max}function ji(e,t){yx(e.x,t.x),yx(e.y,t.y)}function VS(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const r3=1e-4,sI=1-r3,nI=1+r3,a3=.01,iI=0-a3,rI=0+a3;function bn(e){return e.max-e.min}function aI(e,t,s){return Math.abs(e-t)<=s}function WS(e,t,s,i=.5){e.origin=i,e.originPoint=Jt(t.min,t.max,e.origin),e.scale=bn(s)/bn(t),e.translate=Jt(s.min,s.max,e.origin)-e.originPoint,(e.scale>=sI&&e.scale<=nI||isNaN(e.scale))&&(e.scale=1),(e.translate>=iI&&e.translate<=rI||isNaN(e.translate))&&(e.translate=0)}function su(e,t,s,i){WS(e.x,t.x,s.x,i?i.originX:void 0),WS(e.y,t.y,s.y,i?i.originY:void 0)}function KS(e,t,s,i=0){const a=i?Jt(s.min,s.max,i):s.min;e.min=a+t.min,e.max=e.min+bn(t)}function oI(e,t,s,i){KS(e.x,t.x,s.x,i?.x),KS(e.y,t.y,s.y,i?.y)}function YS(e,t,s,i=0){const a=i?Jt(s.min,s.max,i):s.min;e.min=t.min-a,e.max=e.min+bn(t)}function af(e,t,s,i){YS(e.x,t.x,s.x,i?.x),YS(e.y,t.y,s.y,i?.y)}function XS(e,t,s,i,a){return e-=t,e=rf(e,1/s,i),a!==void 0&&(e=rf(e,1/a,i)),e}function lI(e,t=0,s=1,i=.5,a,l=e,c=e){if(Xi.test(t)&&(t=parseFloat(t),t=Jt(c.min,c.max,t/100)-c.min),typeof t!="number")return;let h=Jt(l.min,l.max,i);e===l&&(h-=t),e.min=XS(e.min,t,s,h,a),e.max=XS(e.max,t,s,h,a)}function ZS(e,t,[s,i,a],l,c){lI(e,t[s],t[i],t[a],t.scale,l,c)}const cI=["x","scaleX","originX"],uI=["y","scaleY","originY"];function QS(e,t,s,i){ZS(e.x,t,cI,s?s.x:void 0,i?i.x:void 0),ZS(e.y,t,uI,s?s.y:void 0,i?i.y:void 0)}function JS(e){return e.translate===0&&e.scale===1}function o3(e){return JS(e.x)&&JS(e.y)}function e2(e,t){return e.min===t.min&&e.max===t.max}function dI(e,t){return e2(e.x,t.x)&&e2(e.y,t.y)}function t2(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function l3(e,t){return t2(e.x,t.x)&&t2(e.y,t.y)}function s2(e){return bn(e.x)/bn(e.y)}function n2(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Vi(e){return[e("x"),e("y")]}function hI(e,t,s){let i="";const a=e.x.translate/t.x,l=e.y.translate/t.y,c=s?.z||0;if((a||l||c)&&(i=`translate3d(${a}px, ${l}px, ${c}px) `),(t.x!==1||t.y!==1)&&(i+=`scale(${1/t.x}, ${1/t.y}) `),s){const{transformPerspective:d,rotate:p,rotateX:g,rotateY:b,skewX:v,skewY:w}=s;d&&(i=`perspective(${d}px) ${i}`),p&&(i+=`rotate(${p}deg) `),g&&(i+=`rotateX(${g}deg) `),b&&(i+=`rotateY(${b}deg) `),v&&(i+=`skewX(${v}deg) `),w&&(i+=`skewY(${w}deg) `)}const h=e.x.scale*t.x,f=e.y.scale*t.y;return(h!==1||f!==1)&&(i+=`scale(${h}, ${f})`),i||"none"}const c3=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],fI=c3.length,i2=e=>typeof e=="string"?parseFloat(e):e,r2=e=>typeof e=="number"||Xe.test(e);function mI(e,t,s,i,a,l){a?(e.opacity=Jt(0,s.opacity??1,pI(i)),e.opacityExit=Jt(t.opacity??1,0,gI(i))):l&&(e.opacity=Jt(t.opacity??1,s.opacity??1,i));for(let c=0;c<fI;c++){const h=c3[c];let f=a2(t,h),d=a2(s,h);if(f===void 0&&d===void 0)continue;f||(f=0),d||(d=0),f===0||d===0||r2(f)===r2(d)?(e[h]=Math.max(Jt(i2(f),i2(d),i),0),(Xi.test(d)||Xi.test(f))&&(e[h]+="%")):e[h]=d}(t.rotate||s.rotate)&&(e.rotate=Jt(t.rotate||0,s.rotate||0,i))}function a2(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const pI=u3(0,.5,ej),gI=u3(.5,.95,pi);function u3(e,t,s){return i=>i<e?0:i>t?1:s(hu(e,t,i))}function bI(e,t,s){const i=sn(e)?e:wl(e);return i.start(tv("",i,t,s)),i.animation}function pu(e,t,s,i={passive:!0}){return e.addEventListener(t,s,i),()=>e.removeEventListener(t,s)}const xI=(e,t)=>e.depth-t.depth;class vI{constructor(){this.children=[],this.isDirty=!1}add(t){U0(this.children,t),this.isDirty=!0}remove(t){Qh(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(xI),this.isDirty=!1,this.children.forEach(t)}}function yI(e,t){const s=gn.now(),i=({timestamp:a})=>{const l=a-s;l>=t&&(Na(i),e(l-t))};return Wt.setup(i,!0),()=>Na(i)}function Ph(e){return sn(e)?e.get():e}class _I{constructor(){this.members=[]}add(t){U0(this.members,t);for(let s=this.members.length-1;s>=0;s--){const i=this.members[s];if(i===t||i===this.lead||i===this.prevLead)continue;const a=i.instance;(!a||a.isConnected===!1)&&!i.snapshot&&(Qh(this.members,i),i.unmount())}t.scheduleRender()}remove(t){if(Qh(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const s=this.members[this.members.length-1];s&&this.promote(s)}}relegate(t){for(let s=this.members.indexOf(t)-1;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1&&i.instance?.isConnected!==!1)return this.promote(i),!0}return!1}promote(t,s){const i=this.lead;if(t!==i&&(this.prevLead=i,this.lead=t,t.show(),i)){i.updateSnapshot(),t.scheduleRender();const{layoutDependency:a}=i.options,{layoutDependency:l}=t.options;(a===void 0||a!==l)&&(t.resumeFrom=i,s&&(i.preserveOpacity=!0),i.snapshot&&(t.snapshot=i.snapshot,t.snapshot.latestValues=i.animationValues||i.latestValues),t.root?.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(t=>{t.options.onExitComplete?.(),t.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}const Ih={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Og=["","X","Y","Z"],wI=1e3;let SI=0;function zg(e,t,s,i){const{latestValues:a}=t;a[e]&&(s[e]=a[e],t.setStaticValue(e,0),i&&(i[e]=0))}function d3(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const s=Rj(t);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:a,layoutId:l}=e.options;window.MotionCancelOptimisedAnimation(s,"transform",Wt,!(a||l))}const{parent:i}=e;i&&!i.hasCheckedOptimisedAppear&&d3(i)}function h3({attachResizeListener:e,defaultParent:t,measureScroll:s,checkIsScrollRoot:i,resetTransform:a}){return class{constructor(c={},h=t?.()){this.id=SI++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(CI),this.nodes.forEach(MI),this.nodes.forEach(DI),this.nodes.forEach(EI)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=c,this.root=h?h.root||h:this,this.path=h?[...h.path,h]:[],this.parent=h,this.depth=h?h.depth+1:0;for(let f=0;f<this.path.length;f++)this.path[f].shouldResetTransform=!0;this.root===this&&(this.nodes=new vI)}addEventListener(c,h){return this.eventHandlers.has(c)||this.eventHandlers.set(c,new q0),this.eventHandlers.get(c).add(h)}notifyListeners(c,...h){const f=this.eventHandlers.get(c);f&&f.notify(...h)}hasListeners(c){return this.eventHandlers.has(c)}mount(c){if(this.instance)return;this.isSVG=ov(c)&&!NP(c),this.instance=c;const{layoutId:h,layout:f,visualElement:d}=this.options;if(d&&!d.current&&d.mount(c),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(f||h)&&(this.isLayoutDirty=!0),e){let p,g=0;const b=()=>this.root.updateBlockedByResize=!1;Wt.read(()=>{g=window.innerWidth}),e(c,()=>{const v=window.innerWidth;v!==g&&(g=v,this.root.updateBlockedByResize=!0,p&&p(),p=yI(b,250),Ih.hasAnimatedSinceResize&&(Ih.hasAnimatedSinceResize=!1,this.nodes.forEach(c2)))})}h&&this.root.registerSharedNode(h,this),this.options.animate!==!1&&d&&(h||f)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:g,hasRelativeLayoutChanged:b,layout:v})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const w=this.options.transition||d.getDefaultTransition()||PI,{onLayoutAnimationStart:k,onLayoutAnimationComplete:N}=d.getProps(),E=!this.targetLayout||!l3(this.targetLayout,v),T=!g&&b;if(this.options.layoutRoot||this.resumeFrom||T||g&&(E||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const A={...ev(w,"layout"),onPlay:k,onComplete:N};(d.shouldReduceMotion||this.options.layoutRoot)&&(A.delay=0,A.type=!1),this.startAnimation(A),this.setAnimationOrigin(p,T)}else g||c2(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=v})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const c=this.getStack();c&&c.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Na(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(LI),this.animationId++)}getTransformTemplate(){const{visualElement:c}=this.options;return c&&c.getProps().transformTemplate}willUpdate(c=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&d3(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let p=0;p<this.path.length;p++){const g=this.path[p];g.shouldResetTransform=!0,(typeof g.latestValues.x=="string"||typeof g.latestValues.y=="string")&&(g.isLayoutDirty=!0),g.updateScroll("snapshot"),g.options.layoutRoot&&g.willUpdate(!1)}const{layoutId:h,layout:f}=this.options;if(h===void 0&&!f)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),c&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const f=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),f&&this.nodes.forEach(AI),this.nodes.forEach(o2);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(l2);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(TI),this.nodes.forEach(RI),this.nodes.forEach(kI),this.nodes.forEach(NI)):this.nodes.forEach(l2),this.clearAllSnapshots();const h=gn.now();en.delta=Ji(0,1e3/60,h-en.timestamp),en.timestamp=h,en.isProcessing=!0,Eg.update.process(en),Eg.preRender.process(en),Eg.render.process(en),en.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,rv.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(jI),this.sharedNodes.forEach(OI)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Wt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Wt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!bn(this.snapshot.measuredBox.x)&&!bn(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let f=0;f<this.path.length;f++)this.path[f].updateScroll();const c=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=Ps()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:h}=this.options;h&&h.notify("LayoutMeasure",this.layout.layoutBox,c?c.layoutBox:void 0)}updateScroll(c="measure"){let h=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===c&&(h=!1),h&&this.instance){const f=i(this.instance);this.scroll={animationId:this.root.animationId,phase:c,isRoot:f,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:f}}}resetTransform(){if(!a)return;const c=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,h=this.projectionDelta&&!o3(this.projectionDelta),f=this.getTransformTemplate(),d=f?f(this.latestValues,""):void 0,p=d!==this.prevTransformTemplateValue;c&&this.instance&&(h||Ja(this.latestValues)||p)&&(a(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(c=!0){const h=this.measurePageBox();let f=this.removeElementScroll(h);return c&&(f=this.removeTransform(f)),II(f),{animationId:this.root.animationId,measuredBox:h,layoutBox:f,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:c}=this.options;if(!c)return Ps();const h=c.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some($I))){const{scroll:d}=this.root;d&&(Ki(h.x,d.offset.x),Ki(h.y,d.offset.y))}return h}removeElementScroll(c){const h=Ps();if(ji(h,c),this.scroll?.wasRoot)return h;for(let f=0;f<this.path.length;f++){const d=this.path[f],{scroll:p,options:g}=d;d!==this.root&&p&&g.layoutScroll&&(p.wasRoot&&ji(h,c),Ki(h.x,p.offset.x),Ki(h.y,p.offset.y))}return h}applyTransform(c,h=!1,f){const d=f||Ps();ji(d,c);for(let p=0;p<this.path.length;p++){const g=this.path[p];!h&&g.options.layoutScroll&&g.scroll&&g!==g.root&&(Ki(d.x,-g.scroll.offset.x),Ki(d.y,-g.scroll.offset.y)),Ja(g.latestValues)&&Bh(d,g.latestValues,g.layout?.layoutBox)}return Ja(this.latestValues)&&Bh(d,this.latestValues,this.layout?.layoutBox),d}removeTransform(c){const h=Ps();ji(h,c);for(let f=0;f<this.path.length;f++){const d=this.path[f];if(!Ja(d.latestValues))continue;let p;d.instance&&(bx(d.latestValues)&&d.updateSnapshot(),p=Ps(),ji(p,d.measurePageBox())),QS(h,d.latestValues,d.snapshot?.layoutBox,p)}return Ja(this.latestValues)&&QS(h,this.latestValues),h}setTargetDelta(c){this.targetDelta=c,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(c){this.options={...this.options,...c,crossfade:c.crossfade!==void 0?c.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==en.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(c=!1){const h=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=h.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=h.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=h.isSharedProjectionDirty);const f=!!this.resumingFrom||this!==h;if(!(c||f&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:p,layoutId:g}=this.options;if(!this.layout||!(p||g))return;this.resolvedRelativeTargetAt=en.timestamp;const b=this.getClosestProjectingParent();b&&this.linkedParentVersion!==b.layoutVersion&&!b.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&b&&b.layout?this.createRelativeTarget(b,this.layout.layoutBox,b.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Ps(),this.targetWithTransforms=Ps()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),oI(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):ji(this.target,this.layout.layoutBox),Yj(this.target,this.targetDelta)):ji(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&b&&!!b.resumingFrom==!!this.resumingFrom&&!b.options.layoutScroll&&b.target&&this.animationProgress!==1?this.createRelativeTarget(b,this.target,b.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||bx(this.parent.latestValues)||Kj(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(c,h,f){this.relativeParent=c,this.linkedParentVersion=c.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ps(),this.relativeTargetOrigin=Ps(),af(this.relativeTargetOrigin,h,f,this.options.layoutAnchor||void 0),ji(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const c=this.getLead(),h=!!this.resumingFrom||this!==c;let f=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(f=!1),h&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(f=!1),this.resolvedRelativeTargetAt===en.timestamp&&(f=!1),f)return;const{layout:d,layoutId:p}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||p))return;ji(this.layoutCorrected,this.layout.layoutBox);const g=this.treeScale.x,b=this.treeScale.y;zP(this.layoutCorrected,this.treeScale,this.path,h),c.layout&&!c.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(c.target=c.layout.layoutBox,c.targetWithTransforms=Ps());const{target:v}=c;if(!v){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(VS(this.prevProjectionDelta.x,this.projectionDelta.x),VS(this.prevProjectionDelta.y,this.projectionDelta.y)),su(this.projectionDelta,this.layoutCorrected,v,this.latestValues),(this.treeScale.x!==g||this.treeScale.y!==b||!n2(this.projectionDelta.x,this.prevProjectionDelta.x)||!n2(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",v))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(c=!0){if(this.options.visualElement?.scheduleRender(),c){const h=this.getStack();h&&h.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=fl(),this.projectionDelta=fl(),this.projectionDeltaWithTransform=fl()}setAnimationOrigin(c,h=!1){const f=this.snapshot,d=f?f.latestValues:{},p={...this.latestValues},g=fl();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!h;const b=Ps(),v=f?f.source:void 0,w=this.layout?this.layout.source:void 0,k=v!==w,N=this.getStack(),E=!N||N.members.length<=1,T=!!(k&&!E&&this.options.crossfade===!0&&!this.path.some(BI));this.animationProgress=0;let A;this.mixTargetDelta=C=>{const R=C/1e3;u2(g.x,c.x,R),u2(g.y,c.y,R),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(af(b,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),zI(this.relativeTarget,this.relativeTargetOrigin,b,R),A&&dI(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=Ps()),ji(A,this.relativeTarget)),k&&(this.animationValues=p,mI(p,d,this.latestValues,R,T,E)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=R},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(c){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Na(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Wt.update(()=>{Ih.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=wl(0)),this.motionValue.jump(0,!1),this.currentAnimation=bI(this.motionValue,[0,1e3],{...c,velocity:0,isSync:!0,onUpdate:h=>{this.mixTargetDelta(h),c.onUpdate&&c.onUpdate(h)},onStop:()=>{},onComplete:()=>{c.onComplete&&c.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const c=this.getStack();c&&c.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(wI),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const c=this.getLead();let{targetWithTransforms:h,target:f,layout:d,latestValues:p}=c;if(!(!h||!f||!d)){if(this!==c&&this.layout&&d&&f3(this.options.animationType,this.layout.layoutBox,d.layoutBox)){f=this.target||Ps();const g=bn(this.layout.layoutBox.x);f.x.min=c.target.x.min,f.x.max=f.x.min+g;const b=bn(this.layout.layoutBox.y);f.y.min=c.target.y.min,f.y.max=f.y.min+b}ji(h,f),Bh(h,p),su(this.projectionDeltaWithTransform,this.layoutCorrected,h,p)}}registerSharedNode(c,h){this.sharedNodes.has(c)||this.sharedNodes.set(c,new _I),this.sharedNodes.get(c).add(h);const d=h.options.initialPromotionConfig;h.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(h):void 0})}isLead(){const c=this.getStack();return c?c.lead===this:!0}getLead(){const{layoutId:c}=this.options;return c?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:c}=this.options;return c?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:c}=this.options;if(c)return this.root.sharedNodes.get(c)}promote({needsReset:c,transition:h,preserveFollowOpacity:f}={}){const d=this.getStack();d&&d.promote(this,f),c&&(this.projectionDelta=void 0,this.needsReset=!0),h&&this.setOptions({transition:h})}relegate(){const c=this.getStack();return c?c.relegate(this):!1}resetSkewAndRotation(){const{visualElement:c}=this.options;if(!c)return;let h=!1;const{latestValues:f}=c;if((f.z||f.rotate||f.rotateX||f.rotateY||f.rotateZ||f.skewX||f.skewY)&&(h=!0),!h)return;const d={};f.z&&zg("z",c,d,this.animationValues);for(let p=0;p<Og.length;p++)zg(`rotate${Og[p]}`,c,d,this.animationValues),zg(`skew${Og[p]}`,c,d,this.animationValues);c.render();for(const p in d)c.setStaticValue(p,d[p]),this.animationValues&&(this.animationValues[p]=d[p]);c.scheduleRender()}applyProjectionStyles(c,h){if(!this.instance||this.isSVG)return;if(!this.isVisible){c.visibility="hidden";return}const f=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,c.visibility="",c.opacity="",c.pointerEvents=Ph(h?.pointerEvents)||"",c.transform=f?f(this.latestValues,""):"none";return}const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(c.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,c.pointerEvents=Ph(h?.pointerEvents)||""),this.hasProjected&&!Ja(this.latestValues)&&(c.transform=f?f({},""):"none",this.hasProjected=!1);return}c.visibility="";const p=d.animationValues||d.latestValues;this.applyTransformsToTarget();let g=hI(this.projectionDeltaWithTransform,this.treeScale,p);f&&(g=f(p,g)),c.transform=g;const{x:b,y:v}=this.projectionDelta;c.transformOrigin=`${b.origin*100}% ${v.origin*100}% 0`,d.animationValues?c.opacity=d===this?p.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:p.opacityExit:c.opacity=d===this?p.opacity!==void 0?p.opacity:"":p.opacityExit!==void 0?p.opacityExit:0;for(const w in vx){if(p[w]===void 0)continue;const{correct:k,applyTo:N,isCSSVariable:E}=vx[w],T=g==="none"?p[w]:k(p[w],d);if(N){const A=N.length;for(let C=0;C<A;C++)c[N[C]]=T}else E?this.options.visualElement.renderState.vars[w]=T:c[w]=T}this.options.layoutId&&(c.pointerEvents=d===this?Ph(h?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(c=>c.currentAnimation?.stop()),this.root.nodes.forEach(o2),this.root.sharedNodes.clear()}}}function kI(e){e.updateLayout()}function NI(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:i}=e.layout,{animationType:a}=e.options,l=t.source!==e.layout.source;if(a==="size")Vi(p=>{const g=l?t.measuredBox[p]:t.layoutBox[p],b=bn(g);g.min=s[p].min,g.max=g.min+b});else if(a==="x"||a==="y"){const p=a==="x"?"y":"x";yx(l?t.measuredBox[p]:t.layoutBox[p],s[p])}else f3(a,t.layoutBox,s)&&Vi(p=>{const g=l?t.measuredBox[p]:t.layoutBox[p],b=bn(s[p]);g.max=g.min+b,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[p].max=e.relativeTarget[p].min+b)});const c=fl();su(c,s,t.layoutBox);const h=fl();l?su(h,e.applyTransform(i,!0),t.measuredBox):su(h,s,t.layoutBox);const f=!o3(c);let d=!1;if(!e.resumeFrom){const p=e.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:g,layout:b}=p;if(g&&b){const v=e.options.layoutAnchor||void 0,w=Ps();af(w,t.layoutBox,g.layoutBox,v);const k=Ps();af(k,s,b.layoutBox,v),l3(w,k)||(d=!0),p.options.layoutRoot&&(e.relativeTarget=k,e.relativeTargetOrigin=w,e.relativeParent=p)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:t,delta:h,layoutDelta:c,hasLayoutChanged:f,hasRelativeLayoutChanged:d})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function CI(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function EI(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function jI(e){e.clearSnapshot()}function o2(e){e.clearMeasurements()}function AI(e){e.isLayoutDirty=!0,e.updateLayout()}function l2(e){e.isLayoutDirty=!1}function TI(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function RI(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function c2(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function MI(e){e.resolveTargetDelta()}function DI(e){e.calcProjection()}function LI(e){e.resetSkewAndRotation()}function OI(e){e.removeLeadSnapshot()}function u2(e,t,s){e.translate=Jt(t.translate,0,s),e.scale=Jt(t.scale,1,s),e.origin=t.origin,e.originPoint=t.originPoint}function d2(e,t,s,i){e.min=Jt(t.min,s.min,i),e.max=Jt(t.max,s.max,i)}function zI(e,t,s,i){d2(e.x,t.x,s.x,i),d2(e.y,t.y,s.y,i)}function BI(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const PI={duration:.45,ease:[.4,0,.1,1]},h2=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),f2=h2("applewebkit/")&&!h2("chrome/")?Math.round:pi;function m2(e){e.min=f2(e.min),e.max=f2(e.max)}function II(e){m2(e.x),m2(e.y)}function f3(e,t,s){return e==="position"||e==="preserve-aspect"&&!aI(s2(t),s2(s),.2)}function $I(e){return e!==e.root&&e.scroll?.wasRoot}const HI=h3({attachResizeListener:(e,t)=>pu(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Bg={current:void 0},m3=h3({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Bg.current){const e=new HI({});e.mount(window),e.setOptions({layoutScroll:!0}),Bg.current=e}return Bg.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),p3=y.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function UI(e=!0){const t=y.useContext(H0);if(t===null)return[!0,null];const{isPresent:s,onExitComplete:i,register:a}=t,l=y.useId();y.useEffect(()=>{if(e)return a(l)},[e]);const c=y.useCallback(()=>e&&i&&i(l),[l,i,e]);return!s&&i?[!1,c]:[!0]}const g3=y.createContext({strict:!1}),p2={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let g2=!1;function FI(){if(g2)return;const e={};for(const t in p2)e[t]={isEnabled:s=>p2[t].some(i=>!!s[i])};Gj(e),g2=!0}function b3(){return FI(),MP()}function qI(e){const t=b3();for(const s in e)t[s]={...t[s],...e[s]};Gj(t)}const GI=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function of(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||GI.has(e)}let x3=e=>!of(e);function VI(e){typeof e=="function"&&(x3=t=>t.startsWith("on")?!of(t):e(t))}try{VI(require("@emotion/is-prop-valid").default)}catch{}function WI(e,t,s){const i={};for(const a in e)a==="values"&&typeof e.values=="object"||sn(e[a])||(x3(a)||s===!0&&of(a)||!t&&!of(a)||e.draggable&&a.startsWith("onDrag"))&&(i[a]=e[a]);return i}const Vf=y.createContext({});function KI(e,t){if(Gf(e)){const{initial:s,animate:i}=e;return{initial:s===!1||mu(s)?s:void 0,animate:mu(i)?i:void 0}}return e.inherit!==!1?t:{}}function YI(e){const{initial:t,animate:s}=KI(e,y.useContext(Vf));return y.useMemo(()=>({initial:t,animate:s}),[b2(t),b2(s)])}function b2(e){return Array.isArray(e)?e.join(" "):e}const hv=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function v3(e,t,s){for(const i in t)!sn(t[i])&&!Qj(i,s)&&(e[i]=t[i])}function XI({transformTemplate:e},t){return y.useMemo(()=>{const s=hv();return uv(s,t,e),Object.assign({},s.vars,s.style)},[t])}function ZI(e,t){const s=e.style||{},i={};return v3(i,s,e),Object.assign(i,XI(e,t)),i}function QI(e,t){const s={},i=ZI(e,t);return e.drag&&e.dragListener!==!1&&(s.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(s.tabIndex=0),s.style=i,s}const y3=()=>({...hv(),attrs:{}});function JI(e,t,s,i){const a=y.useMemo(()=>{const l=y3();return Jj(l,t,t3(i),e.transformTemplate,e.style),{...l.attrs,style:{...l.style}}},[t]);if(e.style){const l={};v3(l,e.style,e),a.style={...l,...a.style}}return a}const e$=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function fv(e){return typeof e!="string"||e.includes("-")?!1:!!(e$.indexOf(e)>-1||/[A-Z]/u.test(e))}function t$(e,t,s,{latestValues:i},a,l=!1,c){const f=(c??fv(e)?JI:QI)(t,i,a,e),d=WI(t,typeof e=="string",l),p=e!==y.Fragment?{...d,...f,ref:s}:{},{children:g}=t,b=y.useMemo(()=>sn(g)?g.get():g,[g]);return y.createElement(e,{...p,children:b})}function s$({scrapeMotionValuesFromProps:e,createRenderState:t},s,i,a){return{latestValues:n$(s,i,a,e),renderState:t()}}function n$(e,t,s,i){const a={},l=i(e,{});for(const b in l)a[b]=Ph(l[b]);let{initial:c,animate:h}=e;const f=Gf(e),d=Fj(e);t&&d&&!f&&e.inherit!==!1&&(c===void 0&&(c=t.initial),h===void 0&&(h=t.animate));let p=s?s.initial===!1:!1;p=p||c===!1;const g=p?h:c;if(g&&typeof g!="boolean"&&!qf(g)){const b=Array.isArray(g)?g:[g];for(let v=0;v<b.length;v++){const w=sv(e,b[v]);if(w){const{transitionEnd:k,transition:N,...E}=w;for(const T in E){let A=E[T];if(Array.isArray(A)){const C=p?A.length-1:0;A=A[C]}A!==null&&(a[T]=A)}for(const T in k)a[T]=k[T]}}}return a}const _3=e=>(t,s)=>{const i=y.useContext(Vf),a=y.useContext(H0),l=()=>s$(e,t,i,a);return s?l():ez(l)},i$=_3({scrapeMotionValuesFromProps:dv,createRenderState:hv}),r$=_3({scrapeMotionValuesFromProps:s3,createRenderState:y3}),a$=Symbol.for("motionComponentSymbol");function o$(e,t,s){const i=y.useRef(s);y.useInsertionEffect(()=>{i.current=s});const a=y.useRef(null);return y.useCallback(l=>{l&&e.onMount?.(l);const c=i.current;if(typeof c=="function")if(l){const h=c(l);typeof h=="function"&&(a.current=h)}else a.current?(a.current(),a.current=null):c(l);else c&&(c.current=l);t&&(l?t.mount(l):t.unmount())},[t])}const w3=y.createContext({});function cl(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function l$(e,t,s,i,a,l){const{visualElement:c}=y.useContext(Vf),h=y.useContext(g3),f=y.useContext(H0),d=y.useContext(p3),p=d.reducedMotion,g=d.skipAnimations,b=y.useRef(null),v=y.useRef(!1);i=i||h.renderer,!b.current&&i&&(b.current=i(e,{visualState:t,parent:c,props:s,presenceContext:f,blockInitialAnimation:f?f.initial===!1:!1,reducedMotionConfig:p,skipAnimations:g,isSVG:l}),v.current&&b.current&&(b.current.manuallyAnimateOnMount=!0));const w=b.current,k=y.useContext(w3);w&&!w.projection&&a&&(w.type==="html"||w.type==="svg")&&c$(b.current,s,a,k);const N=y.useRef(!1);y.useInsertionEffect(()=>{w&&N.current&&w.update(s,f)});const E=s[Tj],T=y.useRef(!!E&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(E)&&window.MotionHasOptimisedAnimation?.(E));return sz(()=>{v.current=!0,w&&(N.current=!0,window.MotionIsMounted=!0,w.updateFeatures(),w.scheduleRenderMicrotask(),T.current&&w.animationState&&w.animationState.animateChanges())}),y.useEffect(()=>{w&&(!T.current&&w.animationState&&w.animationState.animateChanges(),T.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(E)}),T.current=!1),w.enteringChildren=void 0)}),w}function c$(e,t,s,i){const{layoutId:a,layout:l,drag:c,dragConstraints:h,layoutScroll:f,layoutRoot:d,layoutAnchor:p,layoutCrossfade:g}=t;e.projection=new s(e.latestValues,t["data-framer-portal-id"]?void 0:S3(e.parent)),e.projection.setOptions({layoutId:a,layout:l,alwaysMeasureLayout:!!c||h&&cl(h),visualElement:e,animationType:typeof l=="string"?l:"both",initialPromotionConfig:i,crossfade:g,layoutScroll:f,layoutRoot:d,layoutAnchor:p})}function S3(e){if(e)return e.options.allowProjection!==!1?e.projection:S3(e.parent)}function Pg(e,{forwardMotionProps:t=!1,type:s}={},i,a){i&&qI(i);const l=s?s==="svg":fv(e),c=l?r$:i$;function h(d,p){let g;const b={...y.useContext(p3),...d,layoutId:u$(d)},{isStatic:v}=b,w=YI(d),k=c(d,v);if(!v&&typeof window<"u"){d$();const N=h$(b);g=N.MeasureLayout,w.visualElement=l$(e,k,b,a,N.ProjectionNode,l)}return n.jsxs(Vf.Provider,{value:w,children:[g&&w.visualElement?n.jsx(g,{visualElement:w.visualElement,...b}):null,t$(e,d,o$(k,w.visualElement,p),k,v,t,l)]})}h.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const f=y.forwardRef(h);return f[a$]=e,f}function u$({layoutId:e}){const t=y.useContext(UE).id;return t&&e!==void 0?t+"-"+e:e}function d$(e,t){y.useContext(g3).strict}function h$(e){const t=b3(),{drag:s,layout:i}=t;if(!s&&!i)return{};const a={...s,...i};return{MeasureLayout:s?.isEnabled(e)||i?.isEnabled(e)?a.MeasureLayout:void 0,ProjectionNode:a.ProjectionNode}}function f$(e,t){if(typeof Proxy>"u")return Pg;const s=new Map,i=(l,c)=>Pg(l,c,e,t),a=(l,c)=>i(l,c);return new Proxy(a,{get:(l,c)=>c==="create"?i:(s.has(c)||s.set(c,Pg(c,void 0,e,t)),s.get(c))})}const m$=(e,t)=>t.isSVG??fv(e)?new YP(t):new FP(t,{allowProjection:e!==y.Fragment});class p$ extends Ea{constructor(t){super(t),t.animationState||(t.animationState=eI(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();qf(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:s}=this.node.prevProps||{};t!==s&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let g$=0;class b$ extends Ea{constructor(){super(...arguments),this.id=g$++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:s}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;if(t&&i===!1){if(this.isExitComplete){const{initial:l,custom:c}=this.node.getProps();if(typeof l=="string"){const h=co(this.node,l,c);if(h){const{transition:f,transitionEnd:d,...p}=h;for(const g in p)this.node.getValue(g)?.jump(p[g])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const a=this.node.animationState.setActive("exit",!t);s&&!t&&a.then(()=>{this.isExitComplete=!0,s(this.id)})}mount(){const{register:t,onExitComplete:s}=this.node.presenceContext||{};s&&s(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const x$={animation:{Feature:p$},exit:{Feature:b$}};function Cu(e){return{point:{x:e.pageX,y:e.pageY}}}const v$=e=>t=>av(t)&&e(t,Cu(t));function nu(e,t,s,i){return pu(e,t,v$(s),i)}const k3=({current:e})=>e?e.ownerDocument.defaultView:null,x2=(e,t)=>Math.abs(e-t);function y$(e,t){const s=x2(e.x,t.x),i=x2(e.y,t.y);return Math.sqrt(s**2+i**2)}const v2=new Set(["auto","scroll"]);class N3{constructor(t,s,{transformPagePoint:i,contextWindow:a=window,dragSnapToOrigin:l=!1,distanceThreshold:c=3,element:h}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=v=>{this.handleScroll(v.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=nh(this.lastRawMoveEventInfo,this.transformPagePoint));const v=Ig(this.lastMoveEventInfo,this.history),w=this.startEvent!==null,k=y$(v.offset,{x:0,y:0})>=this.distanceThreshold;if(!w&&!k)return;const{point:N}=v,{timestamp:E}=en;this.history.push({...N,timestamp:E});const{onStart:T,onMove:A}=this.handlers;w||(T&&T(this.lastMoveEvent,v),this.startEvent=this.lastMoveEvent),A&&A(this.lastMoveEvent,v)},this.handlePointerMove=(v,w)=>{this.lastMoveEvent=v,this.lastRawMoveEventInfo=w,this.lastMoveEventInfo=nh(w,this.transformPagePoint),Wt.update(this.updatePoint,!0)},this.handlePointerUp=(v,w)=>{this.end();const{onEnd:k,onSessionEnd:N,resumeAnimation:E}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&E&&E(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const T=Ig(v.type==="pointercancel"?this.lastMoveEventInfo:nh(w,this.transformPagePoint),this.history);this.startEvent&&k&&k(v,T),N&&N(v,T)},!av(t))return;this.dragSnapToOrigin=l,this.handlers=s,this.transformPagePoint=i,this.distanceThreshold=c,this.contextWindow=a||window;const f=Cu(t),d=nh(f,this.transformPagePoint),{point:p}=d,{timestamp:g}=en;this.history=[{...p,timestamp:g}];const{onSessionStart:b}=s;b&&b(t,Ig(d,this.history)),this.removeListeners=Su(nu(this.contextWindow,"pointermove",this.handlePointerMove),nu(this.contextWindow,"pointerup",this.handlePointerUp),nu(this.contextWindow,"pointercancel",this.handlePointerUp)),h&&this.startScrollTracking(h)}startScrollTracking(t){let s=t.parentElement;for(;s;){const i=getComputedStyle(s);(v2.has(i.overflowX)||v2.has(i.overflowY))&&this.scrollPositions.set(s,{x:s.scrollLeft,y:s.scrollTop}),s=s.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const s=this.scrollPositions.get(t);if(!s)return;const i=t===window,a=i?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},l={x:a.x-s.x,y:a.y-s.y};l.x===0&&l.y===0||(i?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=l.x,this.lastMoveEventInfo.point.y+=l.y):this.history.length>0&&(this.history[0].x-=l.x,this.history[0].y-=l.y),this.scrollPositions.set(t,a),Wt.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Na(this.updatePoint)}}function nh(e,t){return t?{point:t(e.point)}:e}function y2(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ig({point:e},t){return{point:e,delta:y2(e,C3(t)),offset:y2(e,_$(t)),velocity:w$(t,.1)}}function _$(e){return e[0]}function C3(e){return e[e.length-1]}function w$(e,t){if(e.length<2)return{x:0,y:0};let s=e.length-1,i=null;const a=C3(e);for(;s>=0&&(i=e[s],!(a.timestamp-i.timestamp>Xn(t)));)s--;if(!i)return{x:0,y:0};i===e[0]&&e.length>2&&a.timestamp-i.timestamp>Xn(t)*2&&(i=e[1]);const l=mi(a.timestamp-i.timestamp);if(l===0)return{x:0,y:0};const c={x:(a.x-i.x)/l,y:(a.y-i.y)/l};return c.x===1/0&&(c.x=0),c.y===1/0&&(c.y=0),c}function S$(e,{min:t,max:s},i){return t!==void 0&&e<t?e=i?Jt(t,e,i.min):Math.max(e,t):s!==void 0&&e>s&&(e=i?Jt(s,e,i.max):Math.min(e,s)),e}function _2(e,t,s){return{min:t!==void 0?e.min+t:void 0,max:s!==void 0?e.max+s-(e.max-e.min):void 0}}function k$(e,{top:t,left:s,bottom:i,right:a}){return{x:_2(e.x,s,a),y:_2(e.y,t,i)}}function w2(e,t){let s=t.min-e.min,i=t.max-e.max;return t.max-t.min<e.max-e.min&&([s,i]=[i,s]),{min:s,max:i}}function N$(e,t){return{x:w2(e.x,t.x),y:w2(e.y,t.y)}}function C$(e,t){let s=.5;const i=bn(e),a=bn(t);return a>i?s=hu(t.min,t.max-i,e.min):i>a&&(s=hu(e.min,e.max-a,t.min)),Ji(0,1,s)}function E$(e,t){const s={};return t.min!==void 0&&(s.min=t.min-e.min),t.max!==void 0&&(s.max=t.max-e.min),s}const _x=.35;function j$(e=_x){return e===!1?e=0:e===!0&&(e=_x),{x:S2(e,"left","right"),y:S2(e,"top","bottom")}}function S2(e,t,s){return{min:k2(e,t),max:k2(e,s)}}function k2(e,t){return typeof e=="number"?e:e[t]||0}const A$=new WeakMap;class T${constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ps(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:s=!1,distanceThreshold:i}={}){const{presenceContext:a}=this.visualElement;if(a&&a.isPresent===!1)return;const l=g=>{s&&this.snapToCursor(Cu(g).point),this.stopAnimation()},c=(g,b)=>{const{drag:v,dragPropagation:w,onDragStart:k}=this.getProps();if(v&&!w&&(this.openDragLock&&this.openDragLock(),this.openDragLock=lP(v),!this.openDragLock))return;this.latestPointerEvent=g,this.latestPanInfo=b,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Vi(E=>{let T=this.getAxisMotionValue(E).get()||0;if(Xi.test(T)){const{projection:A}=this.visualElement;if(A&&A.layout){const C=A.layout.layoutBox[E];C&&(T=bn(C)*(parseFloat(T)/100))}}this.originPoint[E]=T}),k&&Wt.update(()=>k(g,b),!1,!0),hx(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},h=(g,b)=>{this.latestPointerEvent=g,this.latestPanInfo=b;const{dragPropagation:v,dragDirectionLock:w,onDirectionLock:k,onDrag:N}=this.getProps();if(!v&&!this.openDragLock)return;const{offset:E}=b;if(w&&this.currentDirection===null){this.currentDirection=M$(E),this.currentDirection!==null&&k&&k(this.currentDirection);return}this.updateAxis("x",b.point,E),this.updateAxis("y",b.point,E),this.visualElement.render(),N&&Wt.update(()=>N(g,b),!1,!0)},f=(g,b)=>{this.latestPointerEvent=g,this.latestPanInfo=b,this.stop(g,b),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>{const{dragSnapToOrigin:g}=this.getProps();(g||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:p}=this.getProps();this.panSession=new N3(t,{onSessionStart:l,onStart:c,onMove:h,onSessionEnd:f,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:p,distanceThreshold:i,contextWindow:k3(this.visualElement),element:this.visualElement.current})}stop(t,s){const i=t||this.latestPointerEvent,a=s||this.latestPanInfo,l=this.isDragging;if(this.cancel(),!l||!a||!i)return;const{velocity:c}=a;this.startAnimation(c);const{onDragEnd:h}=this.getProps();h&&Wt.postRender(()=>h(i,a))}cancel(){this.isDragging=!1;const{projection:t,animationState:s}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),s&&s.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,s,i){const{drag:a}=this.getProps();if(!i||!ih(t,a,this.currentDirection))return;const l=this.getAxisMotionValue(t);let c=this.originPoint[t]+i[t];this.constraints&&this.constraints[t]&&(c=S$(c,this.constraints[t],this.elastic[t])),l.set(c)}resolveConstraints(){const{dragConstraints:t,dragElastic:s}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,a=this.constraints;t&&cl(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&i?this.constraints=k$(i.layoutBox,t):this.constraints=!1,this.elastic=j$(s),a!==this.constraints&&!cl(t)&&i&&this.constraints&&!this.hasMutatedConstraints&&Vi(l=>{this.constraints!==!1&&this.getAxisMotionValue(l)&&(this.constraints[l]=E$(i.layoutBox[l],this.constraints[l]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:s}=this.getProps();if(!t||!cl(t))return!1;const i=t.current,{projection:a}=this.visualElement;if(!a||!a.layout)return!1;const l=BP(i,a.root,this.visualElement.getTransformPagePoint());let c=N$(a.layout.layoutBox,l);if(s){const h=s(LP(c));this.hasMutatedConstraints=!!h,h&&(c=Wj(h))}return c}startAnimation(t){const{drag:s,dragMomentum:i,dragElastic:a,dragTransition:l,dragSnapToOrigin:c,onDragTransitionEnd:h}=this.getProps(),f=this.constraints||{},d=Vi(p=>{if(!ih(p,s,this.currentDirection))return;let g=f&&f[p]||{};(c===!0||c===p)&&(g={min:0,max:0});const b=a?200:1e6,v=a?40:1e7,w={type:"inertia",velocity:i?t[p]:0,bounceStiffness:b,bounceDamping:v,timeConstant:750,restDelta:1,restSpeed:10,...l,...g};return this.startAxisValueAnimation(p,w)});return Promise.all(d).then(h)}startAxisValueAnimation(t,s){const i=this.getAxisMotionValue(t);return hx(this.visualElement,t),i.start(tv(t,i,0,s,this.visualElement,!1))}stopAnimation(){Vi(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const s=`_drag${t.toUpperCase()}`,i=this.visualElement.getProps(),a=i[s];return a||this.visualElement.getValue(t,(i.initial?i.initial[t]:void 0)||0)}snapToCursor(t){Vi(s=>{const{drag:i}=this.getProps();if(!ih(s,i,this.currentDirection))return;const{projection:a}=this.visualElement,l=this.getAxisMotionValue(s);if(a&&a.layout){const{min:c,max:h}=a.layout.layoutBox[s],f=l.get()||0;l.set(t[s]-Jt(c,h,.5)+f)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:s}=this.getProps(),{projection:i}=this.visualElement;if(!cl(s)||!i||!this.constraints)return;this.stopAnimation();const a={x:0,y:0};Vi(c=>{const h=this.getAxisMotionValue(c);if(h&&this.constraints!==!1){const f=h.get();a[c]=C$({min:f,max:f},this.constraints[c])}});const{transformTemplate:l}=this.visualElement.getProps();this.visualElement.current.style.transform=l?l({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.constraints=!1,this.resolveConstraints(),Vi(c=>{if(!ih(c,t,null))return;const h=this.getAxisMotionValue(c),{min:f,max:d}=this.constraints[c];h.set(Jt(f,d,a[c]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;A$.set(this.visualElement,this);const t=this.visualElement.current,s=nu(t,"pointerdown",d=>{const{drag:p,dragListener:g=!0}=this.getProps(),b=d.target,v=b!==t&&mP(b);p&&g&&!v&&this.start(d)});let i;const a=()=>{const{dragConstraints:d}=this.getProps();cl(d)&&d.current&&(this.constraints=this.resolveRefConstraints(),i||(i=R$(t,d.current,()=>this.scalePositionWithinConstraints())))},{projection:l}=this.visualElement,c=l.addEventListener("measure",a);l&&!l.layout&&(l.root&&l.root.updateScroll(),l.updateLayout()),Wt.read(a);const h=pu(window,"resize",()=>this.scalePositionWithinConstraints()),f=l.addEventListener("didUpdate",(({delta:d,hasLayoutChanged:p})=>{this.isDragging&&p&&(Vi(g=>{const b=this.getAxisMotionValue(g);b&&(this.originPoint[g]+=d[g].translate,b.set(b.get()+d[g].translate))}),this.visualElement.render())}));return()=>{h(),s(),c(),f&&f(),i&&i()}}getProps(){const t=this.visualElement.getProps(),{drag:s=!1,dragDirectionLock:i=!1,dragPropagation:a=!1,dragConstraints:l=!1,dragElastic:c=_x,dragMomentum:h=!0}=t;return{...t,drag:s,dragDirectionLock:i,dragPropagation:a,dragConstraints:l,dragElastic:c,dragMomentum:h}}}function N2(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function R$(e,t,s){const i=LS(e,N2(s)),a=LS(t,N2(s));return()=>{i(),a()}}function ih(e,t,s){return(t===!0||t===e)&&(s===null||s===e)}function M$(e,t=10){let s=null;return Math.abs(e.y)>t?s="y":Math.abs(e.x)>t&&(s="x"),s}class D$ extends Ea{constructor(t){super(t),this.removeGroupControls=pi,this.removeListeners=pi,this.controls=new T$(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||pi}update(){const{dragControls:t}=this.node.getProps(),{dragControls:s}=this.node.prevProps||{};t!==s&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const $g=e=>(t,s)=>{e&&Wt.update(()=>e(t,s),!1,!0)};class L$ extends Ea{constructor(){super(...arguments),this.removePointerDownListener=pi}onPointerDown(t){this.session=new N3(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:k3(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:s,onPan:i,onPanEnd:a}=this.node.getProps();return{onSessionStart:$g(t),onStart:$g(s),onMove:$g(i),onEnd:(l,c)=>{delete this.session,a&&Wt.postRender(()=>a(l,c))}}}mount(){this.removePointerDownListener=nu(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Hg=!1;class O$ extends y.Component{componentDidMount(){const{visualElement:t,layoutGroup:s,switchLayoutGroup:i,layoutId:a}=this.props,{projection:l}=t;l&&(s.group&&s.group.add(l),i&&i.register&&a&&i.register(l),Hg&&l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Ih.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:s,visualElement:i,drag:a,isPresent:l}=this.props,{projection:c}=i;return c&&(c.isPresent=l,t.layoutDependency!==s&&c.setOptions({...c.options,layoutDependency:s}),Hg=!0,a||t.layoutDependency!==s||s===void 0||t.isPresent!==l?c.willUpdate():this.safeToRemove(),t.isPresent!==l&&(l?c.promote():c.relegate()||Wt.postRender(()=>{const h=c.getStack();(!h||!h.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:t,layoutAnchor:s}=this.props,{projection:i}=t;i&&(i.options.layoutAnchor=s,i.root.didUpdate(),rv.postRender(()=>{!i.currentAnimation&&i.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:s,switchLayoutGroup:i}=this.props,{projection:a}=t;Hg=!0,a&&(a.scheduleCheckAfterUnmount(),s&&s.group&&s.group.remove(a),i&&i.deregister&&i.deregister(a))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function E3(e){const[t,s]=UI(),i=y.useContext(UE);return n.jsx(O$,{...e,layoutGroup:i,switchLayoutGroup:y.useContext(w3),isPresent:t,safeToRemove:s})}const z$={pan:{Feature:L$},drag:{Feature:D$,ProjectionNode:m3,MeasureLayout:E3}};function C2(e,t,s){const{props:i}=e;e.animationState&&i.whileHover&&e.animationState.setActive("whileHover",s==="Start");const a="onHover"+s,l=i[a];l&&Wt.postRender(()=>l(t,Cu(t)))}class B$ extends Ea{mount(){const{current:t}=this.node;t&&(this.unmount=uP(t,(s,i)=>(C2(this.node,i,"Start"),a=>C2(this.node,a,"End"))))}unmount(){}}class P$ extends Ea{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Su(pu(this.node.current,"focus",()=>this.onFocus()),pu(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function E2(e,t,s){const{props:i}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&i.whileTap&&e.animationState.setActive("whileTap",s==="Start");const a="onTap"+(s==="End"?"":s),l=i[a];l&&Wt.postRender(()=>l(t,Cu(t)))}class I$ extends Ea{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:s,propagate:i}=this.node.props;this.unmount=gP(t,(a,l)=>(E2(this.node,l,"Start"),(c,{success:h})=>E2(this.node,c,h?"End":"Cancel")),{useGlobalTarget:s,stopPropagation:i?.tap===!1})}unmount(){}}const wx=new WeakMap,Ug=new WeakMap,$$=e=>{const t=wx.get(e.target);t&&t(e)},H$=e=>{e.forEach($$)};function U$({root:e,...t}){const s=e||document;Ug.has(s)||Ug.set(s,{});const i=Ug.get(s),a=JSON.stringify(t);return i[a]||(i[a]=new IntersectionObserver(H$,{root:e,...t})),i[a]}function F$(e,t,s){const i=U$(t);return wx.set(e,s),i.observe(e),()=>{wx.delete(e),i.unobserve(e)}}const q$={some:0,all:1};class G$ extends Ea{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:t={}}=this.node.getProps(),{root:s,margin:i,amount:a="some",once:l}=t,c={root:s?s.current:void 0,rootMargin:i,threshold:typeof a=="number"?a:q$[a]},h=f=>{const{isIntersecting:d}=f;if(this.isInView===d||(this.isInView=d,l&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:p,onViewportLeave:g}=this.node.getProps(),b=d?p:g;b&&b(f)};this.stopObserver=F$(this.node.current,c,h)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:s}=this.node;["amount","margin","root"].some(V$(t,s))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function V$({viewport:e={}},{viewport:t={}}={}){return s=>e[s]!==t[s]}const W$={inView:{Feature:G$},tap:{Feature:I$},focus:{Feature:P$},hover:{Feature:B$}},K$={layout:{ProjectionNode:m3,MeasureLayout:E3}},Y$={...x$,...W$,...z$,...K$},Fg=f$(Y$,m$),We=({label:e,children:t,variant:s="primary",size:i="medium",icon:a,onClick:l,removable:c=!1,className:h,maxWidth:f,appearance:d,onRemove:p,isLoading:g=!1})=>{const b=X$(s),v=d??(s==="outline"?"outline":"solid"),w=e??t,k=!!l,N={primary:{solid:"border border-transparent bg-primary text-primary-foreground dark:border-zinc-700/80 dark:bg-zinc-900/80 dark:text-zinc-100",outline:"border-2 border-primary/60 text-foreground dark:border-zinc-700/80 dark:bg-zinc-900/80 dark:text-zinc-100",subtle:"border border-transparent bg-primary/15 text-foreground dark:border-zinc-700/70 dark:bg-zinc-900/70 dark:text-zinc-200"},secondary:{solid:"border border-transparent bg-secondary text-secondary-foreground dark:border-zinc-700/80 dark:bg-zinc-900/80 dark:text-zinc-200",outline:"border-2 border-border bg-card text-foreground dark:border-zinc-700/80 dark:bg-zinc-900/80 dark:text-zinc-200",subtle:"border border-border bg-muted text-foreground dark:border-zinc-700/70 dark:bg-zinc-900/70 dark:text-zinc-200"},success:{solid:"border border-transparent bg-emerald-600 text-white dark:border-emerald-400/30 dark:bg-emerald-500/15 dark:text-emerald-300",outline:"border-2 border-emerald-600 text-emerald-700 dark:border-emerald-400/40 dark:bg-emerald-500/10 dark:text-emerald-300",subtle:"border border-transparent bg-emerald-500/15 text-emerald-700 dark:border-emerald-400/25 dark:bg-emerald-500/15 dark:text-emerald-300"},warning:{solid:"border border-transparent bg-amber-500 text-white dark:border-amber-400/30 dark:bg-amber-500/15 dark:text-amber-300",outline:"border-2 border-amber-500 text-amber-700 dark:border-amber-400/40 dark:bg-amber-500/10 dark:text-amber-300",subtle:"border border-transparent bg-amber-500/15 text-amber-700 dark:border-amber-400/25 dark:bg-amber-500/15 dark:text-amber-300"},error:{solid:"border border-transparent bg-destructive text-destructive-foreground dark:border-red-400/30 dark:bg-red-500/15 dark:text-red-300",outline:"border-2 border-destructive text-destructive dark:border-red-400/40 dark:bg-red-500/10 dark:text-red-300",subtle:"border border-transparent bg-destructive/20 text-destructive dark:border-red-400/25 dark:bg-red-500/15 dark:text-red-300"}},E={small:"text-xs px-2 py-1",medium:"text-xs px-2.5 py-1",large:"text-sm px-3 py-1.5"},T=C=>{C.stopPropagation(),l?.()},A=C=>{C.stopPropagation(),p?.()};return n.jsxs(Fg.div,{initial:{opacity:0,scale:.95,y:8,filter:"blur(8px)"},animate:{opacity:1,scale:1,y:0,filter:"blur(0px)"},transition:{duration:.32,ease:"easeInOut",type:"spring"},whileHover:{scale:k?1.04:1,transition:{duration:.2,ease:"easeInOut",type:"spring"}},onClick:T,style:{maxWidth:f},className:ae("inline-flex max-w-full items-center gap-1.5 rounded-lg font-medium shadow-[0_0_16px_rgba(0,0,0,0.14)] backdrop-blur-sm",N[b][v],E[i],k&&"cursor-pointer",h),children:[g?n.jsx(Fg.div,{animate:{rotate:360},transition:{duration:1,ease:"linear",repeat:1/0},className:"flex-shrink-0",children:n.jsx(Rt,{className:"size-3.5"})}):a&&n.jsx("span",{className:"flex-shrink-0",children:a}),n.jsx("span",{className:"min-w-0 truncate",children:w}),c&&n.jsx(Fg.button,{initial:{opacity:0,scale:.95,filter:"blur(8px)"},animate:{opacity:1,scale:1,filter:"blur(0px)"},whileHover:{scale:1.1,opacity:1,transition:{duration:.2,ease:"easeInOut",type:"spring"}},className:"flex items-center justify-center rounded-md bg-foreground/15 p-1 opacity-70 hover:opacity-100",onClick:A,type:"button",children:n.jsx(qt,{className:"size-3.5"})})]})};function X$(e){return e==="danger"?"error":e==="default"||e==="outline"?"primary":e}const Z$=CE("rounded-lg border p-4 text-sm has-[>svg]:flex has-[>svg]:items-start has-[>svg]:gap-2.5 [&>svg]:mt-0.5 [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"border-border bg-card text-card-foreground",muted:"border-border bg-muted text-muted-foreground",destructive:"border-destructive/40 bg-destructive/10 text-destructive dark:text-red-300"}},defaultVariants:{variant:"default"}});function Je({className:e,variant:t,...s}){return n.jsx("div",{className:ae(Z$({variant:t,className:e})),...s})}function j3({className:e,...t}){return n.jsx("h5",{className:ae("mb-1 font-medium leading-none",e),...t})}function A3({className:e,...t}){return n.jsx("p",{className:ae("leading-5",e),...t})}function lf(e){return ae("group/header-action inline-flex h-7 w-7 items-center overflow-hidden rounded-md text-xs font-medium text-muted-foreground transition-[width,background-color,color] duration-200 hover:w-24 hover:bg-muted hover:text-foreground focus:w-24 focus:bg-muted focus:text-foreground focus-visible:w-24 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",e)}function cf(e){return ae("flex size-7 shrink-0 items-center justify-center [&_svg]:size-4 [&_svg]:shrink-0",e)}function uf(e){return ae("max-w-0 overflow-hidden whitespace-nowrap text-left opacity-0 transition-[max-width,opacity] duration-200 group-hover/header-action:max-w-20 group-hover/header-action:opacity-100 group-focus/header-action:max-w-20 group-focus/header-action:opacity-100",e)}function bi({className:e,...t}){return n.jsx("div",{className:ae("rounded-lg border border-border bg-card text-card-foreground",e),...t})}function xi({className:e,...t}){return n.jsx("div",{className:ae("grid gap-1.5 p-4",e),...t})}function vi({className:e,...t}){return n.jsx("h3",{className:ae("text-sm font-semibold tracking-tight",e),...t})}function sr({className:e,...t}){return n.jsx("p",{className:ae("text-sm text-muted-foreground",e),...t})}function yi({className:e,...t}){return n.jsx("div",{className:ae("p-4 pt-0",e),...t})}const j2=100;function Q$(){const[e,t]=y.useState([]),[s,i]=y.useState(!1),a=y.useRef(new Set);y.useEffect(()=>{const c=new EventSource("/api/agent/tool-calls/stream");return c.addEventListener("open",()=>i(!0)),c.addEventListener("error",()=>i(!1)),c.addEventListener("tool-call",h=>{try{const f=JSON.parse(h.data);t(d=>{if(a.current.has(f.id))return d;a.current.add(f.id);const p=[...d,f];return p.length>j2&&p.splice(0,p.length-j2),p})}catch{}}),()=>{c.close()}},[]);const l=[...e].reverse();return n.jsxs(bi,{className:"min-w-0 rounded-none border-0 border-b border-border bg-transparent",children:[n.jsxs(xi,{className:"border-b border-border px-3 py-2",children:[n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(oo,{className:"size-4 text-muted-foreground"}),n.jsx(vi,{children:"Live MCP Tool Calls"}),n.jsx(We,{variant:"outline",size:"small",children:e.length})]}),n.jsx(We,{variant:"outline",size:"small",icon:n.jsx("span",{className:ae("inline-block size-1.5 rounded-full",s?"animate-pulse bg-emerald-500":"bg-muted-foreground/60")}),children:s?"live":"reconnecting…"})]}),n.jsx(sr,{className:"text-xs",children:"Streamed from this NoMoreIDE MCP server. Newest at the top."})]}),n.jsx(yi,{className:"p-0",children:l.length?n.jsx("ul",{className:"max-h-96 divide-y divide-border overflow-auto",children:l.map(c=>n.jsxs("li",{className:"px-3 py-2",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("span",{className:"truncate font-mono text-xs font-semibold",children:c.tool}),n.jsxs("div",{className:"flex shrink-0 items-center gap-2 font-mono text-[10px] text-muted-foreground",children:[n.jsxs("span",{children:[c.durationMs," ms"]}),n.jsx(We,{variant:c.status==="ok"?"success":"error",appearance:"outline",size:"small",children:c.status})]})]}),c.args?n.jsx("div",{className:"mt-0.5 truncate font-mono text-[11px] text-muted-foreground",children:c.args}):null,c.error?n.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-destructive",children:c.error}):null,n.jsx("div",{className:"mt-0.5 font-mono text-[10px] text-muted-foreground/80",children:new Date(c.startedAt).toLocaleTimeString()})]},c.id))}):n.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No tool calls yet. Invoke a NoMoreIDE MCP tool from your agent and it will appear here."})})]})}function J$({agent:e}){return n.jsxs(n.Fragment,{children:[n.jsx(Q$,{}),n.jsxs(bi,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[n.jsxs(xi,{className:"border-b border-border px-3 py-2",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Of,{className:"size-4 text-muted-foreground"}),n.jsx(vi,{children:"Recent Projects"})]}),n.jsx(We,{variant:"outline",size:"small",children:e.projects.length})]}),n.jsx(sr,{className:"text-xs",children:"Most recently active projects known to the agent."})]}),n.jsx(yi,{className:"p-0",children:e.projects.length?n.jsx("ul",{className:"divide-y divide-border",children:e.projects.map(t=>n.jsxs("li",{className:ae("flex items-start justify-between gap-3 px-3 py-2",t.current&&"bg-primary/5"),children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"truncate font-mono text-xs font-semibold",children:t.path}),t.current?n.jsx(We,{variant:"outline",size:"small",children:"current"}):null]}),t.lastSessionFirstPrompt?n.jsx("p",{className:"mt-0.5 truncate text-[11px] text-muted-foreground",children:t.lastSessionFirstPrompt}):null]}),n.jsxs("div",{className:"shrink-0 text-right font-mono text-[10px] text-muted-foreground",children:[t.mcpServerCount?n.jsxs("div",{children:[t.mcpServerCount," mcp"]}):null,t.lastSessionModified?n.jsx("div",{children:eH(t.lastSessionModified)}):null]})]},t.path))}):n.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No known projects."})})]})]})}function eH(e){const t=Date.parse(e);return Number.isNaN(t)?e:new Date(t).toLocaleString()}function ja({className:e}){return n.jsx("svg",{className:ae("size-3.5",e),viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:n.jsx("path",{d:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z"})})}function yo({className:e}){return n.jsx("svg",{className:ae("size-3.5",e),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":!0,children:n.jsx("path",{d:"M11.248 18.25q-.825 0-1.568-.314a4.3 4.3 0 0 1-1.32-.874 4 4 0 0 1-1.304.214 4 4 0 0 1-2.046-.544 4.27 4.27 0 0 1-1.518-1.485 4 4 0 0 1-.56-2.095q0-.48.131-1.04A4.4 4.4 0 0 1 2.04 10.71a4.07 4.07 0 0 1 .017-3.4 4.2 4.2 0 0 1 1.056-1.418 3.8 3.8 0 0 1 1.6-.842 3.9 3.9 0 0 1 .76-1.683q.593-.759 1.451-1.188a4.04 4.04 0 0 1 1.832-.429q.825 0 1.567.313.742.314 1.32.875a4 4 0 0 1 1.304-.215q1.106 0 2.046.545a4.14 4.14 0 0 1 1.501 1.485q.578.941.578 2.095 0 .48-.132 1.04.66.61 1.023 1.419.363.792.363 1.666 0 .892-.38 1.717a4.3 4.3 0 0 1-1.072 1.435 3.8 3.8 0 0 1-1.584.825 3.8 3.8 0 0 1-.775 1.683 4.06 4.06 0 0 1-1.436 1.188 4.04 4.04 0 0 1-1.832.429m-4.076-2.062q.825 0 1.435-.347l3.103-1.782a.36.36 0 0 0 .164-.313v-1.42L7.881 14.62a.67.67 0 0 1-.726 0l-3.118-1.798a.5.5 0 0 1-.017.115v.198q0 .841.396 1.551.413.693 1.139 1.089a3.2 3.2 0 0 0 1.617.412m.165-2.69a.4.4 0 0 0 .181.05q.083 0 .165-.05l1.238-.71-3.977-2.31a.7.7 0 0 1-.363-.643v-3.58q-.825.362-1.32 1.122a2.9 2.9 0 0 0-.495 1.65q0 .809.413 1.55.412.743 1.072 1.123zm3.91 3.663q.875 0 1.585-.396a2.96 2.96 0 0 0 1.534-2.64v-3.564a.32.32 0 0 0-.165-.297l-1.254-.726v4.604a.7.7 0 0 1-.363.643l-3.119 1.799a3 3 0 0 0 1.783.577m.627-6.039V8.878L10.01 7.822 8.129 8.878v2.244l1.881 1.056zM7.057 5.859a.7.7 0 0 1 .363-.644l3.119-1.798a3 3 0 0 0-1.782-.578q-.874 0-1.584.396A2.96 2.96 0 0 0 6.05 4.324a3.07 3.07 0 0 0-.396 1.551v3.547q0 .199.165.314l1.237.726zm8.383 7.887q.825-.364 1.303-1.123.495-.758.495-1.65a3.15 3.15 0 0 0-.412-1.55q-.413-.743-1.073-1.123l-3.086-1.782q-.099-.065-.181-.049a.3.3 0 0 0-.165.05l-1.238.692 3.993 2.327a.6.6 0 0 1 .264.264.64.64 0 0 1 .1.363zm-3.317-8.382a.63.63 0 0 1 .726 0l3.135 1.831v-.297q0-.792-.396-1.501a2.86 2.86 0 0 0-1.105-1.155q-.71-.43-1.65-.43-.825 0-1.436.347L8.294 5.941a.36.36 0 0 0-.165.314v1.418z"})})}function tH({className:e}){return n.jsx("svg",{className:ae("size-3.5",e),viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:n.jsx("path",{d:"M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81"})})}function sH({className:e}){return n.jsxs("svg",{className:ae("size-3.5",e),viewBox:"0 0 16 15",fill:"none","aria-hidden":!0,children:[n.jsx("mask",{id:"ag-mask",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"16",height:"15",children:n.jsx("path",{d:"M14.0777 13.984C14.945 14.6345 16.2458 14.2008 15.0533 13.0084C11.476 9.53949 12.2349 0 7.79033 0C3.34579 0 4.10461 9.53949 0.527295 13.0084C-0.773543 14.3092 0.635692 14.6345 1.50293 13.984C4.86344 11.7076 4.64663 7.69664 7.79033 7.69664C10.934 7.69664 10.7172 11.7076 14.0777 13.984Z",fill:"black"})}),n.jsxs("g",{mask:"url(#ag-mask)",children:[n.jsx("g",{filter:"url(#ag-blur-sm)",children:n.jsx("path",{d:"M-0.658907 -3.2306C-0.922679 -0.906781 1.07986 1.22861 3.81388 1.53894C6.54791 1.84927 8.97811 0.217009 9.24188 -2.10681C9.50565 -4.43063 7.50312 -6.56602 4.76909 -6.87635C2.03506 -7.18667 -0.395135 -5.55442 -0.658907 -3.2306Z",fill:"#FFE432"})}),n.jsx("g",{filter:"url(#ag-blur-lg)",children:n.jsx("path",{d:"M9.88233 4.36642C10.5673 7.31568 13.566 9.13902 16.5801 8.43896C19.5942 7.73891 21.4823 4.78056 20.7973 1.83131C20.1123 -1.11795 17.1136 -2.94128 14.0995 -2.24123C11.0854 -1.54118 9.19733 1.41717 9.88233 4.36642Z",fill:"#FC413D"})}),n.jsx("g",{filter:"url(#ag-blur-md)",children:n.jsx("path",{d:"M-8.05291 6.34512C-7.18736 9.38883 -3.28925 10.9473 0.653774 9.82598C4.5968 8.7047 7.09158 5.32829 6.22603 2.28458C5.36048 -0.759142 1.46236 -2.31758 -2.48066 -1.19629C-6.42368 -0.0750048 -8.91846 3.3014 -8.05291 6.34512Z",fill:"#00B95C"})}),n.jsx("g",{filter:"url(#ag-blur-md)",children:n.jsx("path",{d:"M-8.05291 6.34512C-7.18736 9.38883 -3.28925 10.9473 0.653774 9.82598C4.5968 8.7047 7.09158 5.32829 6.22603 2.28458C5.36048 -0.759142 1.46236 -2.31758 -2.48066 -1.19629C-6.42368 -0.0750048 -8.91846 3.3014 -8.05291 6.34512Z",fill:"#00B95C"})}),n.jsx("g",{filter:"url(#ag-blur-md)",children:n.jsx("path",{d:"M-4.92402 8.86746C-2.75421 11.0837 0.982691 10.9438 3.42257 8.55507C5.86246 6.1663 6.08139 2.43321 3.91158 0.216963C1.74177 -1.99928 -1.99513 -1.85942 -4.43501 0.529349C-6.87489 2.91812 -7.09383 6.65122 -4.92402 8.86746Z",fill:"#00B95C"})}),n.jsx("g",{filter:"url(#ag-blur-md)",children:n.jsx("path",{d:"M6.42819 17.2263C7.10197 20.1273 9.91278 21.953 12.7063 21.3042C15.4998 20.6553 17.2182 17.7777 16.5444 14.8767C15.8707 11.9757 13.0599 10.15 10.2663 10.7988C7.47281 11.4477 5.75441 14.3253 6.42819 17.2263Z",fill:"#3186FF"})}),n.jsx("g",{filter:"url(#ag-blur-md)",children:n.jsx("path",{d:"M1.66508 -5.94539C0.254213 -2.80254 1.7978 0.951609 5.11277 2.43973C8.42774 3.92785 12.2588 2.58642 13.6696 -0.556431C15.0805 -3.69928 13.5369 -7.45343 10.222 -8.94155C6.90699 -10.4297 3.07594 -9.08824 1.66508 -5.94539Z",fill:"#FBBC04"})}),n.jsx("g",{filter:"url(#ag-blur-md)",children:n.jsx("path",{d:"M-2.11428 24.3903C-5.52984 23.0496 0.307266 12.0177 1.75874 8.32038C3.21024 4.62304 7.15576 2.71272 10.5713 4.05357C13.9869 5.39442 18.0354 12.7796 16.5838 16.477C15.1323 20.1743 1.30129 25.7311 -2.11428 24.3903Z",fill:"#3186FF"})}),n.jsx("g",{filter:"url(#ag-blur-md)",children:n.jsx("path",{d:"M18.5814 10.6598C17.6669 11.727 15.2806 11.1828 13.2514 9.44417C11.2222 7.70556 10.3185 5.43097 11.2329 4.3637C12.1473 3.29646 14.5336 3.84069 16.5628 5.57928C18.592 7.31789 19.4958 9.59249 18.5814 10.6598Z",fill:"#749BFF"})}),n.jsx("g",{filter:"url(#ag-blur-md)",children:n.jsx("path",{d:"M11.7552 5.22715C15.5162 7.77124 19.8471 7.93838 21.4286 5.60045C23.0101 3.26253 21.2433 -0.695128 17.4823 -3.23922C13.7213 -5.78331 9.39044 -5.95044 7.80896 -3.61252C6.22747 -1.27459 7.99428 2.68306 11.7552 5.22715Z",fill:"#FC413D"})}),n.jsx("g",{filter:"url(#ag-blur-sm)",children:n.jsx("path",{d:"M-0.592149 1.08896C-1.5239 3.33663 -1.21959 5.59799 0.0875457 6.13985C1.39468 6.68171 3.20966 5.29888 4.14141 3.05121C5.07316 0.803541 4.76885 -1.45782 3.46171 -1.99968C2.15458 -2.54154 0.339602 -1.15871 -0.592149 1.08896Z",fill:"#FFEE48"})})]}),n.jsxs("defs",{children:[n.jsx("filter",{id:"ag-blur-sm",x:"-200%",y:"-200%",width:"500%",height:"500%",children:n.jsx("feGaussianBlur",{stdDeviation:"0.722959"})}),n.jsx("filter",{id:"ag-blur-md",x:"-200%",y:"-200%",width:"500%",height:"500%",children:n.jsx("feGaussianBlur",{stdDeviation:"2.9"})}),n.jsx("filter",{id:"ag-blur-lg",x:"-200%",y:"-200%",width:"500%",height:"500%",children:n.jsx("feGaussianBlur",{stdDeviation:"3.49513"})})]})]})}function nH({className:e}){return n.jsx(JR,{className:ae("size-3.5",e),"aria-hidden":!0})}const iH=800;function Eu({activeHunkIndex:e=0,diff:t}){const s=oH(t),i=y.useRef(null),a=y.useRef([]),[l,c]=y.useState(!1),h=y.useMemo(()=>s.reduce((d,p)=>Math.max(d,p.content.length),0),[s]),f=h>iH;if(y.useEffect(()=>{c(!1)},[t]),y.useEffect(()=>{if(f&&!l)return;const d=a.current[e],p=i.current;!d||!p||p.scrollTo({top:Math.max(d.offsetTop-8,0),behavior:"smooth"})},[e,t,f,l]),f&&!l){const d=s.filter(g=>g.kind==="add").length,p=s.filter(g=>g.kind==="delete").length;return n.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-card p-6",children:n.jsxs("div",{className:"max-w-sm space-y-3 text-center",children:[n.jsx("p",{className:"text-[13px] font-medium text-foreground",children:"Diff hidden for this data file"}),n.jsxs("p",{className:"text-[12px] text-muted-foreground",children:["Rows run up to ",h.toLocaleString()," characters, so this looks like a CSV, log, or other data dump rather than source code."]}),n.jsxs("p",{className:"font-mono text-[11px]",children:[n.jsxs("span",{className:"text-emerald-700",children:["+",d]})," ",n.jsxs("span",{className:"text-red-700",children:["-",p]})," lines changed"]}),n.jsx(Z,{onClick:()=>c(!0),size:"sm",type:"button",variant:"outline",children:"Show diff anyway"})]})})}return n.jsx("div",{className:"code-font-size absolute inset-0 overflow-auto bg-card leading-6 text-foreground",ref:i,children:n.jsx("div",{className:"min-w-full font-mono",children:s.map((d,p)=>n.jsxs("div",{className:ae("grid grid-cols-[3rem_3rem_minmax(0,1fr)]",d.kind==="add"&&"bg-emerald-50 text-emerald-800 dark:bg-emerald-500/15 dark:text-emerald-300",d.kind==="delete"&&"bg-red-50 text-red-800 dark:bg-red-500/15 dark:text-red-300",A2(s,p)&&d.hunkIndex===e&&"outline outline-1 outline-offset-[-1px] outline-primary/35"),ref:d.hunkIndex!==null&&A2(s,p)?g=>{a.current[d.hunkIndex??0]=g}:void 0,children:[n.jsx(T2,{value:d.oldLine}),n.jsx(T2,{value:d.newLine}),n.jsx("span",{className:"min-w-0 whitespace-pre-wrap break-all px-2",children:d.content||" "})]},`${p}-${d.content}`))})})}function rH(e){const t=[];let s=null;const i=()=>{if(!s)return;const a=s.join(`
19
+ `),l=mv(a);t.push({path:aH(s[0]),diff:a,additions:l.additions,deletions:l.deletions}),s=null};for(const a of e.split(`
20
+ `))a.startsWith("diff --git ")?(i(),s=[a]):s&&s.push(a);return i(),t}function aH(e){const t=/^diff --git a\/(.+?) b\/(.+)$/.exec(e);return t?t[2]:e.replace(/^diff --git /,"")}function mv(e){return e.split(`
21
+ `).reduce((t,s)=>(s.startsWith("@@")?t.hunks+=1:s.startsWith("+")&&!s.startsWith("+++")?t.additions+=1:s.startsWith("-")&&!s.startsWith("---")&&(t.deletions+=1),t),{additions:0,deletions:0,hunks:0})}function oH(e){const t=lH(e);return t.some(s=>s.kind==="hunk")?t.filter(s=>s.kind!=="meta"&&s.kind!=="hunk"):t}function lH(e){let t=null,s=null,i=null;return e.split(`
22
+ `).map(a=>{if(cH(a))return t=null,s=null,i=null,{content:a,hunkIndex:i,kind:"meta",oldLine:null,newLine:null};if(a.startsWith("@@")){const c=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(a);return c&&(t=Number(c[1]),s=Number(c[2])),i=(i??-1)+1,{content:a,hunkIndex:i,kind:"hunk",oldLine:null,newLine:null}}if(t===null||s===null)return{content:a,hunkIndex:null,kind:"meta",oldLine:null,newLine:null};if(a.startsWith("\\ No newline"))return{content:a,hunkIndex:i,kind:"meta",oldLine:null,newLine:null};if(a.startsWith("+")&&!a.startsWith("+++")){const c={content:a,hunkIndex:i,kind:"add",oldLine:null,newLine:s};return s+=1,c}if(a.startsWith("-")&&!a.startsWith("---")){const c={content:a,hunkIndex:i,kind:"delete",oldLine:t,newLine:null};return t+=1,c}const l={content:a,hunkIndex:i,kind:"context",oldLine:t,newLine:s};return t+=1,s+=1,l})}function A2(e,t){const s=e[t]?.hunkIndex;if(s===null)return!1;const i=e.findIndex(a=>a.hunkIndex===s&&(a.kind==="add"||a.kind==="delete"));return i!==-1?i===t:e.findIndex(a=>a.hunkIndex===s)===t}function cH(e){return e.startsWith("diff --git ")||e.startsWith("index ")||e.startsWith("--- ")||e.startsWith("+++ ")||e.startsWith("new file mode ")||e.startsWith("deleted file mode ")||e.startsWith("old mode ")||e.startsWith("new mode ")||e.startsWith("similarity index ")||e.startsWith("rename from ")||e.startsWith("rename to ")||e.startsWith("Binary files ")}function T2({value:e}){return n.jsx("span",{className:ae("select-none border-r border-border/70 px-2 text-right text-muted-foreground",e===null&&"text-transparent"),children:e??"-"})}function uH(){const[e,t]=y.useState([]),[s,i]=y.useState(""),[a,l]=y.useState(null),[c,h]=y.useState(!1),[f,d]=y.useState(null),p=y.useCallback(async()=>{try{const N=await zO();t(N),i(E=>E&&N.some(T=>T.sha===E)?E:N[0]?.sha??""),l(null)}catch(N){l(N instanceof Error?N.message:String(N))}},[]);y.useEffect(()=>{p()},[p]);async function g(){h(!0),d(null);try{const N=await BO("manual snapshot");await p(),i(N.sha),d(`Snapshot ${N.sha.slice(0,7)} created.`)}catch(N){l(N instanceof Error?N.message:String(N))}finally{h(!1)}}async function b(N,E){h(!0),d(null);try{const T=await PO(N,E);await p(),i(T.sha),d(`Snapshot renamed to “${T.label}”.`)}catch(T){l(T instanceof Error?T.message:String(T))}finally{h(!1)}}async function v(N){h(!0),d(null);try{await IO(N),await p(),d(`Snapshot ${N.slice(0,7)} deleted.`)}catch(E){l(E instanceof Error?E.message:String(E))}finally{h(!1)}}async function w(N){h(!0),d(null);try{const E=await UO(N);await p(),d(`Restored ${E.restoredFiles} file(s)`+(E.deletedPaths.length?`, removed ${E.deletedPaths.length} added since`:"")+`. Undo via pre-restore snapshot ${E.preRestore.sha.slice(0,7)}.`)}catch(E){l(E instanceof Error?E.message:String(E))}finally{h(!1)}}const k=e.find(N=>N.sha===s);return n.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden bg-card/85 xl:grid-cols-[320px_minmax(0,1fr)]",children:[n.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[n.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-semibold",children:[n.jsx(X6,{className:"size-3.5"}),"Snapshots"]}),n.jsxs(Z,{disabled:c,onClick:()=>{g()},size:"sm",type:"button",children:[n.jsx(LC,{className:"size-3.5"}),"Snapshot now"]})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:a?n.jsxs(Je,{variant:"destructive",className:"m-3",children:[n.jsx(Mf,{}),n.jsxs("div",{className:"min-w-0",children:[n.jsx(j3,{children:"Couldn’t load snapshots"}),n.jsx(A3,{className:"break-words",children:a})]})]}):e.length===0?n.jsx(Je,{variant:"muted",className:"m-3 border-dashed",children:"No snapshots yet. Take one before risky changes, or let agent sessions create them automatically."}):n.jsx("ul",{children:e.map(N=>n.jsx(dH,{busy:c,onDelete:v,onRename:b,onSelect:i,selected:N.sha===s,snapshot:N},N.ref))})})]}),n.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col",children:[f?n.jsx(Je,{variant:"muted",className:"m-3 mb-0",children:f}):null,k?n.jsx(hH,{busy:c,onRestore:w,snapshot:k}):n.jsx("div",{className:"p-4",children:n.jsx(Je,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a snapshot to compare it with the current working tree."})})]})]})}function dH({busy:e,onDelete:t,onRename:s,onSelect:i,selected:a,snapshot:l}){const[c,h]=y.useState(!1),[f,d]=y.useState(l.label),[p,g]=y.useState(!1);function b(){d(l.label),h(!0)}function v(){const w=f.trim();h(!1),w&&w!==l.label&&s(l.sha,w)}return n.jsx("li",{className:ae("group relative border-b border-border/60 transition-colors",a?"bg-background":"hover:bg-muted/50"),children:c?n.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2",children:[n.jsx("input",{ref:w=>w?.focus(),value:f,onChange:w=>d(w.target.value),onKeyDown:w=>{w.key==="Enter"&&v(),w.key==="Escape"&&h(!1)},className:"min-w-0 flex-1 rounded border border-border bg-background px-1.5 py-1 text-xs","aria-label":"Snapshot label"}),n.jsx(Z,{disabled:e,onClick:v,size:"icon-sm",type:"button",variant:"ghost",children:n.jsx(Ws,{className:"size-3.5"})}),n.jsx(Z,{onClick:()=>h(!1),size:"icon-sm",type:"button",variant:"ghost",children:n.jsx(qt,{className:"size-3.5"})})]}):n.jsxs(n.Fragment,{children:[n.jsxs("button",{type:"button",onClick:()=>i(l.sha),className:"w-full px-3 py-2 pr-16 text-left",children:[n.jsx("span",{className:"block truncate text-xs font-medium",children:l.label}),n.jsxs("span",{className:"mt-0.5 flex items-center gap-2 text-[10px] text-muted-foreground",children:[n.jsx("span",{className:"font-mono",children:l.sha.slice(0,7)}),n.jsx("span",{children:new Date(l.createdAt).toLocaleString()})]})]}),n.jsx("div",{className:"absolute right-2 top-1.5 flex items-center gap-0.5",children:p?n.jsxs(n.Fragment,{children:[n.jsx(Z,{disabled:e,onClick:()=>{g(!1),t(l.sha)},size:"icon-sm",title:"Confirm delete",type:"button",variant:"ghost",className:"text-red-600 hover:text-red-600",children:n.jsx(Ws,{className:"size-3.5"})}),n.jsx(Z,{onClick:()=>g(!1),size:"icon-sm",title:"Cancel",type:"button",variant:"ghost",children:n.jsx(qt,{className:"size-3.5"})})]}):n.jsxs("span",{className:"hidden items-center gap-0.5 group-hover:flex",children:[n.jsx(Z,{disabled:e,onClick:b,size:"icon-sm",title:"Rename snapshot",type:"button",variant:"ghost",children:n.jsx(yl,{className:"size-3.5"})}),n.jsx(Z,{disabled:e,onClick:()=>g(!0),size:"icon-sm",title:"Delete snapshot",type:"button",variant:"ghost",className:"text-muted-foreground hover:text-red-600",children:n.jsx(Oi,{className:"size-3.5"})})]})})]})})}function hH({busy:e,onRestore:t,snapshot:s}){const[i,a]=y.useState([]),[l,c]=y.useState(""),[h,f]=y.useState(""),[d,p]=y.useState(null),[g,b]=y.useState(!1);return y.useEffect(()=>{let v=!0;return b(!1),p(null),$O(s.sha).then(w=>{v&&(a(w),c(k=>k&&w.some(N=>N.path===k)?k:w[0]?.path??""))}).catch(w=>{v&&p(w instanceof Error?w.message:String(w))}),()=>{v=!1}},[s.sha]),y.useEffect(()=>{if(!l){f("");return}let v=!0;return HO(s.sha,l).then(w=>{v&&f(w)}).catch(w=>{v&&p(w instanceof Error?w.message:String(w))}),()=>{v=!1}},[s.sha,l]),n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-2",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:s.label}),n.jsx("p",{className:"text-[10px] text-muted-foreground",children:i.length?`${i.length} file(s) differ from the current working tree.`:"Identical to the current working tree."})]}),g?n.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[n.jsx(Z,{disabled:e,onClick:()=>{b(!1),t(s.sha)},size:"sm",type:"button",variant:"destructive",children:"Confirm restore"}),n.jsx(Z,{onClick:()=>b(!1),size:"sm",type:"button",variant:"outline",children:"Cancel"})]}):n.jsxs(Z,{disabled:e||i.length===0,onClick:()=>b(!0),size:"sm",title:"Reset the working tree to this snapshot (a pre-restore snapshot is taken first)",type:"button",variant:"outline",children:[n.jsx(zf,{className:"size-3.5"}),"Restore…"]})]}),n.jsx(T3,{diff:h,error:d,files:i,onSelectPath:c,selectedPath:l})]})}function T3({diff:e,error:t,files:s,onSelectPath:i,selectedPath:a}){return t?n.jsx("div",{className:"p-4",children:n.jsxs(Je,{variant:"destructive",children:[n.jsx(Mf,{}),n.jsxs("div",{className:"min-w-0",children:[n.jsx(j3,{children:"Couldn’t load this snapshot"}),n.jsx(A3,{className:"break-words",children:t})]})]})}):n.jsxs("div",{className:"grid min-h-0 flex-1 xl:grid-cols-[260px_minmax(0,1fr)]",children:[n.jsx("ul",{className:"min-h-0 overflow-auto border-r border-border",children:s.map(l=>n.jsx("li",{children:n.jsxs("button",{type:"button",onClick:()=>i(l.path),className:ae("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",l.path===a?"bg-background":"hover:bg-muted/50"),children:[n.jsx("span",{className:ae("w-3 shrink-0 font-mono text-[10px]",l.status==="A"&&"text-emerald-600",l.status==="D"&&"text-red-600",l.status==="M"&&"text-amber-600"),children:l.status}),n.jsx("span",{className:"truncate",children:l.path})]})},l.path))}),n.jsx("div",{className:"relative min-h-0 min-w-0",children:a?n.jsx(Eu,{diff:e||"No diff for this file."}):n.jsx("div",{className:"p-4",children:n.jsx(Je,{variant:"muted",className:"border-dashed p-8 text-center",children:"Select a file to see how it differs from the snapshot."})})})]})}function fH(){const[e,t]=y.useState([]),[s,i]=y.useState(""),[a,l]=y.useState(null),[c,h]=y.useState(null),[f,d]=y.useState(!1),p=y.useCallback(async()=>{try{const b=await FO();t(b),i(v=>v&&b.some(w=>w.id===v)?v:b[0]?.id??""),l(null)}catch(b){l(b instanceof Error?b.message:String(b))}},[]);y.useEffect(()=>{p()},[p]);async function g(b){d(!0),h(null);try{const v=await VO(b);await p(),h(`Restored ${v.restoredFiles} file(s)`+(v.deletedPaths.length?`, removed ${v.deletedPaths.length} created by the session`:"")+`. Undo via pre-restore snapshot ${v.preRestore.sha.slice(0,7)} in Git → Snapshots.`)}catch(v){l(v instanceof Error?v.message:String(v))}finally{d(!1)}}return e.length===0?n.jsx("div",{className:"p-4",children:n.jsx(Je,{variant:"muted",className:"border-dashed p-8 text-center",children:a??"No agent sessions recorded yet. Sessions appear here once an agent calls a nomoreide MCP tool; each one starts with a working-tree snapshot you can roll back to."})}):n.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[c?n.jsx(Je,{variant:"muted",className:"m-3 mb-0",children:c}):null,n.jsxs("div",{className:"grid min-h-0 flex-1 xl:grid-cols-[280px_minmax(0,1fr)]",children:[n.jsx("aside",{className:"min-h-0 overflow-auto border-r border-border",children:n.jsx("ul",{children:e.map(b=>n.jsx("li",{children:n.jsxs("button",{type:"button",onClick:()=>i(b.id),className:ae("w-full border-b border-border/60 px-3 py-2 text-left transition-colors",b.id===s?"bg-background":"hover:bg-muted/50"),children:[n.jsx("span",{className:"block truncate text-xs font-medium",children:new Date(b.startedAt).toLocaleString()}),n.jsxs("span",{className:"mt-0.5 flex items-center gap-2 text-[10px] text-muted-foreground",children:[n.jsxs("span",{children:[b.toolCount," tool call(s)"]}),b.snapshotSha?n.jsx("span",{className:"font-mono",children:b.snapshotSha.slice(0,7)}):n.jsx("span",{children:"no snapshot"})]})]})},b.id))})}),n.jsx("section",{className:"flex min-h-0 min-w-0 flex-col",children:s?n.jsx(mH,{busy:f,id:s,onRestore:g}):null})]})]})}function mH({busy:e,id:t,onRestore:s}){const[i,a]=y.useState(null),[l,c]=y.useState([]),[h,f]=y.useState(""),[d,p]=y.useState(""),[g,b]=y.useState(null),[v,w]=y.useState(!1);return y.useEffect(()=>{let k=!0;return w(!1),b(null),qO(t).then(N=>{k&&(a(N.session),c(N.files),f(E=>E&&N.files.some(T=>T.path===E)?E:N.files[0]?.path??""))}).catch(N=>{k&&b(N instanceof Error?N.message:String(N))}),()=>{k=!1}},[t]),y.useEffect(()=>{if(!h){p("");return}let k=!0;return GO(t,h).then(N=>{k&&p(N)}).catch(N=>{k&&b(N instanceof Error?N.message:String(N))}),()=>{k=!1}},[t,h]),n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-2",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:l.length?`${l.length} file(s) changed since this session started`:"No working-tree changes since this session started"}),n.jsx("p",{className:"truncate text-[10px] text-muted-foreground",children:i?.repoPath??""})]}),i?.snapshotSha?v?n.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[n.jsx(Z,{disabled:e,onClick:()=>{w(!1),s(t)},size:"sm",type:"button",variant:"destructive",children:"Confirm restore"}),n.jsx(Z,{onClick:()=>w(!1),size:"sm",type:"button",variant:"outline",children:"Cancel"})]}):n.jsxs(Z,{disabled:e||l.length===0,onClick:()=>w(!0),size:"sm",title:"Reset the working tree to before this session (a pre-restore snapshot is taken first)",type:"button",variant:"outline",children:[n.jsx(zf,{className:"size-3.5"}),"Restore to before this session…"]}):null]}),n.jsx(T3,{diff:d,error:g,files:l,onSelectPath:f,selectedPath:h})]})}function pH(e){return e==="codex"?{id:e,label:"Codex",commandName:"codex",installHint:"",intro:""}:{id:e,label:"Claude Code",commandName:"claude",installHint:"",intro:""}}function Tc(e){return e instanceof Error?e.message:String(e)}function gH(){const[e,t]=y.useState([]),s=y.useRef([]),[i,a]=y.useState(null),l=y.useRef(null),[c,h]=y.useState(0),[f,d]=y.useState(null),[p,g]=y.useState(new Set),b=y.useRef(new Set),[v,w]=y.useState(null),[k,N]=y.useState(null),[E,T]=y.useState([]),A=y.useRef(void 0),C=y.useRef(!0),R=y.useRef(0),L=y.useRef(0),H=y.useRef(0),B=y.useRef(new Map),P=y.useRef(0),D=y.useRef(new Set),G=y.useRef(new Set),$=y.useCallback(F=>[...F].sort((re,fe)=>{const se=B.current.get(re.id),te=B.current.get(fe.id);return!se||!te?se?1:te?-1:0:se.group!==te.group?se.group==="attached"?-1:1:se.index-te.index}),[]),O=y.useCallback(F=>{s.current=F,t(F)},[]),V=y.useCallback(F=>{l.current=F,a(F)},[]),K=y.useCallback(()=>{if(l.current||P.current>0)return;const F=$(s.current).find(re=>!D.current.has(re.id)&&B.current.get(re.id)?.group==="attached");F&&V(F.id)},[V,$]);y.useEffect(()=>(C.current=!0,()=>{C.current=!1}),[]),y.useEffect(()=>{SE().then(F=>{if(!C.current)return;const re=F.filter(Ee=>Ee.kind==="agent"&&!D.current.has(Ee.id));re.forEach((Ee,De)=>{B.current.has(Ee.id)||B.current.set(Ee.id,{group:"attached",index:De})});const fe=new Map(s.current.map(Ee=>[Ee.id,Ee])),se=re.map(Ee=>{const De=fe.get(Ee.id);return De?{...Ee,label:De.label??Ee.label,source:De.source,createdAt:De.createdAt}:Ee}),te=new Set(se.map(Ee=>Ee.id)),ye=[...se,...s.current.filter(Ee=>!te.has(Ee.id))];O($(ye)),K()}).catch(F=>{C.current&&d(Tc(F))})},[K,O,$]),y.useEffect(()=>{const F=H.current;M7().then(re=>{if(!C.current)return;if(T(re.providers),H.current===F){w(re.configured),N(re.provider),A.current=re.provider.id;return}const fe=re.providers.find(se=>se.id===A.current);fe&&w(fe.configured)}).catch(()=>{C.current&&H.current===F&&(w(!1),d("Unable to load agent provider status"))})},[]);const I=y.useCallback(async F=>{const re=++H.current,fe=E.find(se=>se.id===F);A.current=F,d(null),N(fe??pH(F)),fe&&w(fe.configured);try{const se=await D7(F);if(!C.current||H.current!==re)return;A.current=se.id,N(se);const te=E.find(ye=>ye.id===se.id);te&&w(te.configured)}catch(se){C.current&&H.current===re&&d(Tc(se))}},[E]),Y=y.useCallback(async({prompt:F,label:re,source:fe,background:se=!1})=>{const te=++R.current;P.current+=1,se||(L.current=te);const ye=Date.now(),Ee=A.current??"claude";d(null),h(De=>De+1);try{const De=await YO({provider:Ee,prompt:F,label:re});if(!C.current||D.current.has(De.id))return;const Ye={...De,label:De.label??re,source:fe,createdAt:ye,initialPrompt:F};B.current.set(Ye.id,{group:"created",index:te});const we=s.current.filter(He=>He.id!==Ye.id);return O($([...we,Ye])),!se&&L.current===te&&V(Ye.id),Ye}catch(De){C.current&&d(Tc(De));return}finally{P.current=Math.max(0,P.current-1),C.current&&P.current===0&&K(),C.current&&h(De=>Math.max(0,De-1))}},[K,V,O,$]),W=y.useCallback(async F=>{if(!b.current.has(F)){b.current.add(F),g(new Set(b.current)),D.current.add(F);try{if(await Zb(F),!C.current)return;const re=s.current,fe=re.findIndex(te=>te.id===F),se=re.filter(te=>te.id!==F);if(B.current.delete(F),O(se),l.current===F){const te=se[Math.min(Math.max(fe,0),se.length-1)];V(te?.id??null)}}catch(re){const fe=s.current,se=fe.findIndex(te=>te.id===F);if(fe[se]?.state==="exited"){const te=fe.filter(ye=>ye.id!==F);if(B.current.delete(F),O(te),l.current===F){const ye=te[Math.min(Math.max(se,0),te.length-1)];V(ye?.id??null)}return}D.current.delete(F),C.current&&d(Tc(re))}finally{b.current.delete(F),C.current&&g(new Set(b.current))}}},[V,O]),le=y.useCallback(async F=>{if(!b.current.has(F)){b.current.add(F),g(new Set(b.current)),d(null);try{if(await Zb(F),!C.current)return;const re=s.current.map(fe=>fe.id===F?{...fe,state:"exited"}:fe);O(re)}catch(re){C.current&&d(Tc(re))}finally{b.current.delete(F),C.current&&g(new Set(b.current))}}},[O]),J=y.useCallback((F,re)=>{const fe=s.current.map(se=>se.id===F?{...se,...re,id:F}:se);O(fe)},[O]),U=y.useCallback(F=>{if(G.current.has(F))return;const re=s.current.find(fe=>fe.id===F)?.initialPrompt;if(re)return G.current.add(F),re},[]);return{tasks:e,activeTaskId:i,setActiveTaskId:V,creating:c,terminalError:f,pendingTaskIds:p,error:f,provider:k,configured:v,providers:E,selectProvider:I,createTask:Y,closeTask:W,stopTask:le,updateTaskStatus:J,claimInitialPrompt:U}}const R3=y.createContext(null);function bH({children:e}){const t=gH(),[s,i]=y.useState(!1),[a,l]=y.useState(""),[c,h]=y.useState(null),[f,d]=y.useState(0),[p,g]=y.useState(!1),b=y.useCallback(()=>d(T=>T+1),[]),v=y.useCallback(()=>h(null),[]),w=y.useCallback(()=>{i(!0),g(!0)},[]),k=y.useCallback(T=>{i(!0),l(A=>A.trim()?`${A.replace(/\s*$/,"")}
23
+ ${T}`:T),b()},[b]),N=y.useCallback(({prompt:T,source:A,mode:C="send",label:R,background:L})=>C==="draft"?(i(!0),h(A??null),l(T),b(),{queued:!1}):(L||(i(!0),h(A??null)),t.createTask({prompt:T,label:R,source:A,background:L}),{queued:!1}),[t.createTask,b]),E={...t,open:s,setOpen:i,draft:a,setDraft:l,insertPath:k,activeSource:c,clearSource:v,focusNonce:f,sendToAgent:N,onboarding:p,setOnboarding:g,startOnboard:w};return n.jsx(R3.Provider,{value:E,children:e})}function Dt(){const e=y.useContext(R3);if(!e)throw new Error("useAgentDock must be used within an AgentProvider");return e}function xH({agent:e,agentId:t}){const s=e.project.instructionFileName??(e.project.claudeMdPath?"CLAUDE.md":void 0),i=e.project.instructionFilePreview??e.project.claudeMdPreview,a=e.project.memoryFiles.length+(s?1:0);return n.jsxs(bi,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[n.jsxs(xi,{className:"border-b border-border px-3 py-2",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(DC,{className:"size-4 text-muted-foreground"}),n.jsx(vi,{children:"Project Memory"})]}),n.jsx(We,{variant:"outline",size:"small",children:a})]}),n.jsx(sr,{className:"truncate text-xs",children:e.project.memoryDir??(t==="codex"?"No Codex memory directory found for this project.":"No memory directory found for this project.")})]}),n.jsxs(yi,{className:"space-y-2 p-3",children:[s?n.jsx(R2,{title:s,preview:i,defaultOpen:!0}):null,e.project.memoryFiles.length?e.project.memoryFiles.map(l=>n.jsx(R2,{title:l.name,subtitle:`${l.size} B`,preview:l.preview,defaultOpen:l.name==="MEMORY.md"},l.path)):s?null:n.jsx("p",{className:"text-xs text-muted-foreground",children:"No memory files persisted yet for this project."})]})]})}function R2({title:e,subtitle:t,preview:s,defaultOpen:i=!1}){const[a,l]=y.useState(i);return n.jsxs("div",{className:"rounded-md border border-border bg-background/40",children:[n.jsxs("button",{type:"button",onClick:()=>l(!a),className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-xs font-semibold",children:[n.jsx(Dn,{className:ae("size-3.5 text-muted-foreground transition-transform",a&&"rotate-90")}),n.jsx("span",{children:e}),t?n.jsx("span",{className:"font-mono text-[10px] font-normal text-muted-foreground",children:t}):null]}),a&&s?n.jsx("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap border-t border-border px-2.5 py-2 font-mono text-[11px] leading-relaxed text-muted-foreground",children:s}):null]})}const vH=[{animationDelay:"-1.2s",transform:"rotate(.0001deg) translate(146%)"},{animationDelay:"-1.1s",transform:"rotate(30deg) translate(146%)"},{animationDelay:"-1.0s",transform:"rotate(60deg) translate(146%)"},{animationDelay:"-0.9s",transform:"rotate(90deg) translate(146%)"},{animationDelay:"-0.8s",transform:"rotate(120deg) translate(146%)"},{animationDelay:"-0.7s",transform:"rotate(150deg) translate(146%)"},{animationDelay:"-0.6s",transform:"rotate(180deg) translate(146%)"},{animationDelay:"-0.5s",transform:"rotate(210deg) translate(146%)"},{animationDelay:"-0.4s",transform:"rotate(240deg) translate(146%)"},{animationDelay:"-0.3s",transform:"rotate(270deg) translate(146%)"},{animationDelay:"-0.2s",transform:"rotate(300deg) translate(146%)"},{animationDelay:"-0.1s",transform:"rotate(330deg) translate(146%)"}],yH=({size:e=20,color:t="#8f8f8f"})=>n.jsx("div",{style:{width:e,height:e},children:n.jsx("div",{className:"relative left-1/2 top-1/2",style:{width:e,height:e},children:vH.map(s=>n.jsx("div",{className:"absolute -left-[10%] -top-[3.9%] h-[8%] w-[24%] animate-fade-spin rounded-[5px]",style:{backgroundColor:t,...s}},s.transform))})}),_H=[{tiny:"px-1.5 h-6 text-sm",small:"px-1.5 h-8 text-sm",medium:"px-2.5 h-10 text-sm",large:"px-3.5 h-12 text-base"},{tiny:"w-6 h-6 text-sm",small:"w-8 h-8 text-sm",medium:"w-10 h-10 text-sm",large:"w-12 h-12 text-base"}],wH={primary:"bg-gray-1000 hover:bg-gray-1000-h text-background-100 fill-background-100",secondary:"bg-background-100 hover:bg-gray-alpha-200 text-gray-1000 fill-gray-1000 border border-gray-alpha-400",tertiary:"bg-none hover:bg-gray-alpha-200 text-gray-1000 fill-gray-1000",error:"bg-red-800 hover:bg-red-900 text-white fill-white",warning:"bg-amber-800 hover:bg-amber-850 text-black fill-black"},SH={square:{tiny:"rounded",small:"rounded-md",medium:"rounded-md",large:"rounded-lg"},circle:{tiny:"rounded-[100%]",small:"rounded-[100%]",medium:"rounded-[100%]",large:"rounded-[100%]"},rounded:{tiny:"rounded-[100px]",small:"rounded-[100px]",medium:"rounded-[100px]",large:"rounded-[100px]"}},rh=({size:e="medium",type:t="primary",variant:s="styled",shape:i="square",svgOnly:a=!1,children:l,prefix:c,suffix:h,shadow:f=!1,loading:d=!1,disabled:p=!1,fullWidth:g=!1,className:b,...v})=>n.jsxs("button",{disabled:p,tabIndex:0,className:du("flex items-center justify-center gap-0.5 duration-150",_H[+a][e],p||d?"cursor-not-allowed border border-gray-400 bg-gray-100 text-gray-700":wH[t],SH[i][e],f&&"shadow-border-small border-none",g&&"w-full",s==="unstyled"?"h-fit bg-transparent px-0 text-gray-1000 outline-none hover:bg-transparent":"focus:shadow-focus-ring focus:outline-0",b),type:"button",...v,children:[d?n.jsx(yH,{size:e==="large"?24:16}):c,n.jsx("span",{className:du("relative overflow-hidden overflow-ellipsis whitespace-nowrap font-sans",e!=="tiny"&&s!=="unstyled"&&"px-1.5"),children:l}),!d&&h]}),kH=({className:e})=>n.jsx("svg",{height:"16",strokeLinejoin:"round",viewBox:"0 0 16 16",width:"16",className:e,children:n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z"})}),NH=()=>n.jsx("svg",{height:"16",strokeLinejoin:"round",viewBox:"0 0 16 16",width:"16",className:"fill-gray-1000",children:n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.5 8C13.5 4.96643 11.0257 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z"})});let qg=null,CH=0;const Rs={toasts:[],listeners:new Set,add(e,t,s,i,a,l){const c=CH++,h={id:c,text:e,preserve:s,action:i,onAction:a,onUndoAction:l,type:t};if(!h.preserve){h.remaining=3e3,h.start=Date.now();const f=()=>{this.toasts=this.toasts.filter(d=>d.id!==c),this.notify()};h.timeout=setTimeout(f,h.remaining),h.pause=()=>{h.timeout&&(clearTimeout(h.timeout),h.timeout=void 0,h.remaining-=Date.now()-h.start)},h.resume=()=>{h.timeout||(h.start=Date.now(),h.timeout=setTimeout(f,h.remaining))}}this.toasts.push(h),this.notify()},remove(e){Rs.toasts=Rs.toasts.filter(t=>t.id!==e),Rs.notify()},subscribe(e){return Rs.listeners.add(e),()=>{Rs.listeners.delete(e)}},notify(){Rs.listeners.forEach(e=>{e()})}},EH=()=>{const[e,t]=y.useState([]),[s,i]=y.useState([]),[a,l]=y.useState(!1),c=w=>k=>{k&&w.measuredHeight==null&&(w.measuredHeight=k.getBoundingClientRect().height,Rs.notify())};y.useEffect(()=>(t([...Rs.toasts]),Rs.subscribe(()=>{t([...Rs.toasts])})),[]),y.useEffect(()=>{const w=e.filter(k=>!s.includes(k.id)).map(k=>k.id);w.length>0&&requestAnimationFrame(()=>{i(k=>[...k,...w])})},[s,e]);const f=Math.max(0,e.length-3),d=(w,k)=>{if(w===k-1)return"none";const N=k-1-w;let E=e[k-1]?.measuredHeight||63;for(let C=k-1;C>w;C--)a?E+=(e[C-1]?.measuredHeight||63)+10:E+=20;const T=-N,A=a?1:1-.05*N;return`translate3d(0, calc(100% - ${E}px), ${T}px) scale(${A})`},p=()=>{l(!0),Rs.toasts.forEach(w=>{w.pause?.()})},g=()=>{l(!1),Rs.toasts.forEach(w=>{w.resume?.()})},v=e.slice(f).reduce((w,k)=>w+(k.measuredHeight??63),0);return n.jsx("div",{className:"pointer-events-none fixed bottom-4 right-4 z-[9999] w-[min(420px,calc(100vw-2rem))]",style:{height:v},children:n.jsx("div",{className:"pointer-events-auto relative w-full",style:{height:v},onMouseEnter:p,onMouseLeave:g,children:e.map((w,k)=>{const N=k>=f;return n.jsx("div",{ref:c(w),className:du("absolute bottom-0 right-0 h-fit rounded-xl p-4 leading-[21px] shadow-menu",{message:"bg-geist-background text-gray-1000",success:"bg-blue-700 text-contrast-fg",warning:"bg-amber-800 text-gray-1000 dark:text-gray-100",error:"bg-red-800 text-contrast-fg"}[w.type],N?"opacity-100":"opacity-0",k<f&&"pointer-events-none"),style:{width:"100%",transition:"all .35s cubic-bezier(.25,.75,.6,.98)",transform:s.includes(w.id)?d(k,e.length):"translate3d(0, 100%, 150px) scale(1)"},children:n.jsxs("div",{className:"flex flex-col items-center justify-between text-[.875rem]",children:[n.jsxs("div",{className:"flex h-full w-full items-center justify-between gap-4",children:[n.jsx("span",{children:w.text}),!w.action&&n.jsxs("div",{className:"flex gap-1",children:[w.onUndoAction&&n.jsx(rh,{type:"tertiary",svgOnly:!0,size:"small",onClick:()=>{w.onUndoAction?.(),Rs.remove(w.id)},children:n.jsx(NH,{})}),n.jsx(rh,{type:"tertiary",svgOnly:!0,size:"small",onClick:()=>Rs.remove(w.id),children:n.jsx(kH,{className:{message:"fill-gray-1000",success:"fill-contrast-fg",warning:"fill-gray-1000 dark:fill-gray-100",error:"fill-contrast-fg"}[w.type]})})]})]}),w.action&&n.jsxs("div",{className:"flex w-full items-center justify-end gap-2",children:[n.jsx(rh,{type:"tertiary",size:"small",onClick:()=>Rs.remove(w.id),children:"Dismiss"}),n.jsx(rh,{type:"primary",size:"small",onClick:()=>{w.onAction?.(),Rs.remove(w.id)},children:w.action})]})]})},w.id)})})})},ah=()=>{if(qg)return;const e=document.createElement("div");e.className="fixed bottom-4 right-4 z-[9999]",document.body.appendChild(e),qg=TC.createRoot(e),qg.render(n.jsx(EH,{}))},hs=()=>({message:y.useCallback(({text:e,preserve:t,action:s,onAction:i,onUndoAction:a})=>{ah(),Rs.add(e,"message",t,s,i,a)},[]),success:y.useCallback(e=>{ah(),Rs.add(e,"success")},[]),warning:y.useCallback(e=>{ah(),Rs.add(e,"warning")},[]),error:y.useCallback(e=>{ah(),Rs.add(e,"error")},[])});function jH({usage:e}){const t=[{label:"Cache read",value:e.cacheReadInputTokens,className:"bg-emerald-500"},{label:"Cache create",value:e.cacheCreationInputTokens,className:"bg-teal-400"},{label:"Fresh input",value:e.inputTokens,className:"bg-amber-500"},{label:"Output",value:e.outputTokens,className:"bg-violet-500"}];return n.jsxs("div",{className:"rounded-md border border-border",children:[n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(ja,{className:"size-3.5 text-amber-700"}),n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Claude Code · last session"}),e.sessionId?n.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:e.sessionId.slice(0,8)}):null]}),n.jsxs("span",{className:"font-mono text-sm font-semibold text-emerald-700",children:["$",e.costUSD.toFixed(4)]})]}),n.jsx(M3,{segments:t}),n.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1.5 border-t border-border px-3 py-2 text-[11px] sm:grid-cols-4",children:[n.jsx(ln,{label:"Input",value:pn(e.inputTokens)}),n.jsx(ln,{label:"Output",value:pn(e.outputTokens)}),n.jsx(ln,{label:"Cache read",value:pn(e.cacheReadInputTokens)}),n.jsx(ln,{label:"Cache create",value:pn(e.cacheCreationInputTokens)}),n.jsx(ln,{label:"Lines +",value:String(e.linesAdded)}),n.jsx(ln,{label:"Lines −",value:String(e.linesRemoved)}),n.jsx(ln,{label:"Wall",value:M2(e.durationMs)}),n.jsx(ln,{label:"API",value:M2(e.apiDurationMs)})]}),e.fiveHour||e.weekly?n.jsxs("div",{className:"space-y-2 border-t border-border px-3 py-2",children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Rate limits"}),e.fiveHour?n.jsx(df,{label:"5h block",window:e.fiveHour}):null,e.weekly?n.jsx(df,{label:"This week",window:e.weekly}):null]}):null,e.models.length?n.jsxs("div",{className:"space-y-1 border-t border-border px-3 py-2",children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"By model"}),e.models.map(s=>n.jsxs("div",{className:"flex items-center justify-between gap-2 font-mono text-[11px]",children:[n.jsx("span",{className:"truncate",children:s.model}),n.jsxs("span",{className:"shrink-0 text-muted-foreground",children:[pn(s.inputTokens+s.outputTokens)," tok ·"," ",n.jsxs("span",{className:"text-emerald-700",children:["$",s.costUSD.toFixed(4)]})]})]},s.model))]}):null]})}function AH({usage:e}){const t=e.contextWindow&&e.contextWindow>0?e.lastTotalTokens/e.contextWindow*100:0,s=[{label:"Cache read",value:e.cachedInputTokens,className:"bg-emerald-500"},{label:"Fresh input",value:Math.max(0,e.inputTokens-e.cachedInputTokens),className:"bg-amber-500"},{label:"Output",value:e.outputTokens,className:"bg-violet-500"},{label:"Reasoning",value:e.reasoningOutputTokens,className:"bg-sky-500"}];return n.jsxs("div",{className:"rounded-md border border-border",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-1.5",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(yo,{className:"size-3.5 text-foreground"}),n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Codex · last session"})]}),e.timestamp?n.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:new Date(e.timestamp).toLocaleString()}):null]}),n.jsx(M3,{segments:s}),n.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1.5 border-t border-border px-3 py-2 text-[11px] sm:grid-cols-4",children:[n.jsx(ln,{label:"Input",value:pn(e.inputTokens)}),n.jsx(ln,{label:"Output",value:pn(e.outputTokens)}),n.jsx(ln,{label:"Cache read",value:pn(e.cachedInputTokens)}),n.jsx(ln,{label:"Reasoning",value:pn(e.reasoningOutputTokens)}),n.jsx(ln,{label:"Total",value:pn(e.totalTokens)}),n.jsx(ln,{label:"Last turn",value:pn(e.lastTotalTokens)}),n.jsx(ln,{label:"Context",value:e.contextWindow?pn(e.contextWindow):"n/a"}),n.jsx(ln,{label:"Cost",value:"n/a"})]}),e.contextWindow?n.jsx("div",{className:"border-t border-border px-3 py-2",children:n.jsx(TH,{label:"Last turn context share",value:t,tone:"bg-sky-500"})}):null,e.primary||e.secondary?n.jsxs("div",{className:"space-y-2 border-t border-border px-3 py-2",children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Rate limits"}),e.primary?n.jsx(df,{label:"5h window",window:e.primary}):null,e.secondary?n.jsx(df,{label:"Weekly window",window:e.secondary}):null]}):null]})}function M3({segments:e}){const t=e.reduce((a,l)=>a+l.value,0),s=e.filter(a=>a.label!=="Output").reduce((a,l)=>a+l.value,0),i=t-s;return n.jsxs("div",{className:"px-3 py-2.5",children:[n.jsxs("div",{className:"mb-1.5 flex items-center justify-between text-[10px] uppercase tracking-wide text-muted-foreground",children:[n.jsx("span",{className:"font-semibold",children:"Tokens"}),n.jsxs("span",{className:"font-mono normal-case",children:[pn(s)," in · ",pn(i)," out"]})]}),n.jsx("div",{className:"flex h-2.5 overflow-hidden rounded-full bg-muted",role:"img","aria-label":"Token composition",children:e.map(a=>t>0&&a.value>0?n.jsx("div",{className:ae("h-full",a.className),style:{width:`${(a.value/t*100).toFixed(2)}%`},title:`${a.label}: ${pn(a.value)} (${(a.value/t*100).toFixed(1)}%)`},a.label):null)}),n.jsx("div",{className:"mt-2 grid grid-cols-2 gap-x-3 gap-y-1 sm:grid-cols-4",children:e.map(a=>n.jsxs("div",{className:"flex items-center gap-1.5 text-[11px]",children:[n.jsx("span",{className:ae("size-2 shrink-0 rounded-sm",a.className)}),n.jsx("span",{className:"min-w-0 flex-1 truncate text-muted-foreground",children:a.label}),n.jsxs("span",{className:"shrink-0 font-mono text-foreground",children:[t>0?(a.value/t*100).toFixed(0):"0","%"]})]},a.label))})]})}function TH({label:e,value:t,tone:s}){const i=Math.min(100,Math.max(0,t));return n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between text-[11px] text-muted-foreground",children:[n.jsx("span",{children:e}),n.jsxs("span",{className:"font-mono",children:[i.toFixed(1),"%"]})]}),n.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-muted",children:n.jsx("div",{className:ae("h-full",s),style:{width:`${i.toFixed(2)}%`}})})]})}function df({label:e,window:t}){const s=Math.min(100,Math.max(0,t.usedPercent)),i=t.resetsAtUnix?new Date(t.resetsAtUnix*1e3).toLocaleString():null,a=s>=90?"bg-red-500":s>=70?"bg-amber-500":"bg-emerald-500";return n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[n.jsx("span",{className:"text-muted-foreground",children:e}),n.jsxs("span",{className:"font-mono",children:[s.toFixed(1),"%"]})]}),n.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-muted",children:n.jsx("div",{className:ae("h-full",a),style:{width:`${s.toFixed(2)}%`}})}),i?n.jsxs("div",{className:"mt-0.5 font-mono text-[10px] text-muted-foreground",children:["resets ",i]}):null]})}function ln({label:e,value:t}){return n.jsxs("div",{children:[n.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:e}),n.jsx("div",{className:"font-mono text-xs font-semibold",children:t})]})}function pn(e){return e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function M2(e){if(!e)return"0s";if(e<1e3)return`${e}ms`;const t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;const s=Math.floor(t/60),i=Math.round(t-s*60);return`${s}m ${i}s`}function RH(e=1e4){const[t,s]=y.useState(null),[i,a]=y.useState(null);return y.useEffect(()=>{let l=!0;const c=()=>{N7().then(f=>{l&&(s(f),a(null))}).catch(f=>{l&&a(f instanceof Error?f.message:String(f))})};c();const h=window.setInterval(c,e);return()=>{l=!1,window.clearInterval(h)}},[e]),{usage:t,error:i}}const MH={"claude-code":{label:"Claude Code",icon:n.jsx(ja,{})},codex:{label:"Codex",icon:n.jsx(yo,{})}};function DH({agent:e,agentId:t,isDetected:s}){const{usage:i,error:a}=RH(),l=MH[t],c=t==="codex";return n.jsxs(bi,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[n.jsxs(xi,{className:"border-b border-border px-3 py-2",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx(UC,{className:"size-4 text-muted-foreground"}),n.jsx(vi,{children:c?"Token Usage & Rate Limits":"Token & Cost Usage"}),n.jsx(We,{variant:"outline",size:"small",icon:l.icon,children:l.label}),s?n.jsx(We,{variant:"outline",size:"small",children:"active session"}):n.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Not the active agent in this session"}),c?null:n.jsx(LH,{className:"ml-auto"})]}),n.jsxs(sr,{className:"truncate text-xs",children:[c?n.jsxs(n.Fragment,{children:["Session metrics from ",n.jsx("code",{className:"font-mono",children:"~/.codex/sessions"})]}):n.jsxs(n.Fragment,{children:["Last-session metrics from ",n.jsx("code",{className:"font-mono",children:"~/.claude.json"})]})," · ",n.jsx("span",{className:"font-mono",children:e.project.cwd})]})]}),n.jsxs(yi,{className:"p-3",children:[a?n.jsx("p",{className:"text-xs text-destructive",children:a}):null,c?i?.codex?n.jsx(AH,{usage:i.codex}):a?null:n.jsx(D2,{agent:"Codex CLI"}):i?.claude?n.jsx(jH,{usage:i.claude}):a?null:n.jsx(D2,{agent:"Claude Code"})]})]})}function LH({className:e}){const[t,s]=y.useState(!0),[i,a]=y.useState(!0),[l,c]=y.useState(!1),h=hs();y.useEffect(()=>{let d=!0;return E7().then(p=>d&&s(p.coAuthorWithClaude)).catch(()=>{}).finally(()=>d&&a(!1)),()=>{d=!1}},[]);const f=async()=>{const d=!t;c(!0),s(d);try{const p=await j7({coAuthorWithClaude:d});s(p.coAuthorWithClaude),h.success(p.coAuthorWithClaude?"Claude co-author trailer enabled for commits":"Claude co-author trailer disabled for commits")}catch(p){s(!d),h.error(p instanceof Error?p.message:"Failed to update setting")}finally{c(!1)}};return n.jsxs(Z,{type:"button",variant:t?"default":"outline",size:"sm",onClick:f,disabled:i||l,"aria-pressed":t,title:t?"Claude will be added as commit co-author. Click to disable.":"Co-author trailer disabled. Click to enable.",className:ae("gap-1.5",e),children:[n.jsx(ja,{className:"size-3.5"}),"Co-author"]})}function D2({agent:e}){return n.jsxs("p",{className:"text-xs text-muted-foreground",children:["No usage data yet. Run a session with ",e," in this project."]})}const L2=["I want to add a new service to NoMoreIDE. Walk me through it one step at a time —","ask a single question per message and give me options to choose from where it helps.","","Whenever you offer me a set of choices, end that message with a fenced block","labelled `options`, one choice per line, so I can click them. For example:","```options","Local","Docker Compose","SSH (remote)","```","","When the answer is free text (not a pick-list), always show a concrete example","in the question so I know the format — e.g. ask for the SSH host as","'What SSH host alias should I use? (for example: `devbox`)', the command as","'(for example: `npm run dev`)', the directory as '(for example: `/srv/app`)',","and the name as '(for example: `backend`)'. Never ask for a value without an example.","","1. First ask whether it's local, a Docker Compose service, or remote over SSH.","2. For local or Docker: ask which folder it lives in — and remind me I can click"," the paperclip (attach) button at the bottom-left of this chat to browse and"," insert the folder path. Then look inside it (package.json scripts,"," docker-compose.yml, go.mod, etc.) and propose the start command and port —"," confirm with me, don't assume."," For SSH: ask for the host alias, the remote command, and the remote directory.","3. Confirm a short name for it.","","Once I've confirmed everything, register it by running the nomoreide CLI:",' nomoreide add service <name> --command "<cmd>" --cwd "<dir>" [--port <n>] [--description "<text>"]'," Docker: --kind docker-compose --compose-service <svc> [--compose-file <file>] --cwd <dir>",' SSH: --kind ssh --host <alias> --command "<cmd>" --cwd "<remote dir>"',"After it registers successfully, end your final message with the service name in a","fenced `service` block so I get Start / Open buttons for it, e.g.:","```service","backend","```"].join(`
24
+ `),OH=["I want to connect a database to NoMoreIDE so I can browse it in the Database tab.","Walk me through it one step at a time — ask a single question per message and give","me options to choose from where it helps.","","Whenever you offer me a set of choices, end that message with a fenced block","labelled `options`, one choice per line, so I can click them. For example:","```options","Postgres","MySQL","SQLite","```","","First, look at what's already here before asking me to type things:","- Call `nomoreide_list_services` and check for a database service (a docker-compose"," or local service using a postgres / pgvector / mysql / mariadb image).","- If I just onboarded a repo, prefer the database it exposed.","","Then confirm the connection details with me: engine, host, port, user, password,","and database name. When the answer is free text, show a concrete example in the","question — e.g. the host as '(for example: `127.0.0.1`)' and the port as","'(for example: `5432`)'. For a docker-compose database, use the published host","port (the left side of a `5433:5432` mapping), not the in-container port.","","Once I've confirmed everything, register it with the `nomoreide_register_database`","tool — pass name, engine (postgres|mysql|sqlite), and a connection url, e.g.","`postgres://user:password@127.0.0.1:5433/dbname` (or an absolute file path for","sqlite). After it registers, tell me it's ready to browse in the Database tab."].join(`
25
+ `);function zH(e){const t=e?.trim();return[t?`Onboard this repository into NoMoreIDE and get it running: ${t}`:"I want to add a project to NoMoreIDE from a Git URL. First ask me for the repository URL (for example: `https://github.com/owner/repo`).","","Then set it up end-to-end yourself — don't make me fill in a form:","1. Call the `nomoreide_onboard_repo` tool with the URL to clone and analyze it."," It returns the clone path, a profile (manifests, Docker/compose, env keys,"," README excerpt), and ranked proposals with install-command hints.","2. Pick the best proposal straight from that result. Trust the profile — don't"," crawl the repo with Read/Glob/Grep or shell file reads; it already has what"," you need. Only ask me if it's genuinely ambiguous (e.g. several equally-likely"," apps in a monorepo) — otherwise choose sensible defaults.","3. Install dependencies if needed (run the install command in the clone path).","4. Register it with `nomoreide_register_service` using the returned clone path as"," the cwd, then register it as a git repo with `nomoreide_git_register_repository`"," so it shows in the Git tab."," If the onboard result includes any `databases`, register each one with"," `nomoreide_register_database` (use its name, engine, and url) so it shows in the"," Database tab.","5. Start it with `nomoreide_start_service` and confirm it came up (check its logs).","","Keep me posted as you go, but keep decisions to yourself unless you're truly stuck.","When it's running, end your message with the service name in a fenced `service`","block so I get Start / Open buttons for it, e.g.:","```service","backend","```"].join(`
26
+ `)}function BH(e){return e.map(t=>`- ${t.name}: ${t.dataType}${t.primaryKey?" (PK)":""}${t.nullable?"":" NOT NULL"}`).join(`
27
+ `)}function D3(e){return e?.length?["## Table schema",BH(e),""].join(`
28
+ `):""}const L3="Your prompt: ";function PH(e,t,s,i,a){return[`I'm looking at a row in my ${t} database (connection "${e}", table \`${s.qualifiedName}\`).`,"",D3(i),"## Row","```json",JSON.stringify(a,null,2),"```","",L3].join(`
29
+ `)}function O2(e,t,s){const i=s?.engine?`my ${s.engine} database (connection "${e}")`:`my database (connection "${e}")`,a=[`I'm looking at the table \`${t.qualifiedName}\` in ${i}.`,""],l=D3(s?.columns);return l&&a.push(l),a.push(L3),a.join(`
30
+ `)}function IH(e,t,s){const i=s.engine?`${s.engine} `:"",a=(s.tables??[]).map(c=>c.qualifiedName).filter(Boolean),l=[`Write one ${i}SQL statement for the database connection "${e}".`,"","What it should do:",t.trim(),""];return a.length?(l.push("Tables in this database:"),l.push(a.map(c=>`- ${c}`).join(`
31
+ `)),l.push("Inspect a table's columns with the database tools if you need its exact schema.")):l.push("Use the database tools to inspect the available tables and columns before writing the query."),l.push(""),l.push("Rules:"),s.unlocked?l.push("- This connection is unlocked for writes, so INSERT/UPDATE/DELETE/DDL are allowed if that's what was asked for."):l.push("- This connection is read-only. Return a SELECT (or other read) statement only — never a write."),l.push("- Return exactly one statement."),l.push("- Output ONLY the statement inside a single ```sql code fence — no explanation before or after."),l.join(`
32
+ `)}function $H(e,t,s,i){return[`This ${t?`${t} `:""}query against the database connection "${e}" failed.`,"","Statement:","```sql",s.trim(),"```","","Error returned by the database:","```",i.trim(),"```","","Explain what's wrong and why, then give a corrected statement in a ```sql code fence.","Use the database tools to check the actual schema if the fix depends on it."].join(`
33
+ `)}function HH({absolutePath:e,lines:t,relativePath:s}){return[`Please structurally split this large file and preserve behavior: ${s}`,"",`Absolute path: ${e}`,`Current size: ${t.toLocaleString()} lines`,"","First read the file and nearby imports/tests, then propose the smallest safe decomposition.","Prefer extracting cohesive responsibilities into focused modules over mechanical slicing.","Keep public APIs stable where possible, update imports, and run the relevant tests after editing."].join(`
34
+ `)}function UH(e,t){return[`About commit \`${e.hash.slice(0,7)}\` — "${e.subject}" by ${e.author}:`,"",t,"",`Run \`git show ${e.hash}\` to see the diff if you need it.`].join(`
35
+ `)}function FH(e){const t=["Write a concise Git commit message for my currently staged changes.","","- Inspect the staged diff yourself (`git diff --cached` or the `nomoreide_git_staged_diff` tool).","- Use a conventional-commit style subject (≤ 72 chars), then a short body if it helps.","- Reply with ONLY the commit message in a code block so I can copy it — don't commit it yourself."];return e.branch&&t.push("",`Branch: \`${e.branch}\``),e.stagedFiles.length&&(t.push("","Staged files:",...e.stagedFiles.slice(0,40).map(s=>`- ${s}`)),e.stagedFiles.length>40&&t.push(`- …and ${e.stagedFiles.length-40} more`)),t.join(`
36
+ `)}function qH(e){return[`I have ${e.fileCount} uncommitted change${e.fileCount===1?"":"s"}${e.branch?` on \`${e.branch}\``:""}.`,"","Review the working tree (`git status` + `git diff`), stage the changes that belong together, and commit them with a clear conventional-commit message. Ask me before committing anything that looks unintended (secrets, debug code, unrelated files)."].join(`
37
+ `)}function GH(e){return[`My branch${e.branch?` \`${e.branch}\``:""} is ${e.behind} commit${e.behind===1?"":"s"} behind ${e.upstream??"its upstream"}.`,"","Pull and rebase onto the upstream. If there are conflicts, walk me through resolving them — don't force anything or discard my work."].join(`
38
+ `)}function VH(e){return[`The latest CI run (\`${e.runName}\`)${e.branch?` on \`${e.branch}\``:""} failed: ${e.url}`,"","Figure out why it failed (check the workflow logs / the relevant test or build step), then fix the underlying issue in the code. Explain what was wrong before you change anything."].join(`
39
+ `)}function WH(e){return["I have these ungrouped services in NoMoreIDE and I'd like to organise them into groups","(groups let me start/stop related services together):","",e.length?e.map(s=>{const i=[`- ${s.name}`];return s.command&&i.push(`command: \`${s.command}\``),s.cwd&&i.push(`cwd: \`${s.cwd}\``),typeof s.port=="number"&&i.push(`port: ${s.port}`),s.description&&i.push(s.description),i.join(" — ")}).join(`
40
+ `):"- (none — all services are already grouped)","","Look at their names, commands, directories and ports and propose how to group them —","for example a frontend + backend that share a repo, or services that boot together.","Group only the ones that genuinely belong together; it's fine to leave some ungrouped.","","Present your proposal as a short list of `group name → services` and end that message","with a fenced `options` block so I can confirm, e.g.:","```options","Yes, create these groups","Let me adjust them first","```","","Do NOT create anything until I confirm. Once I say yes, register each group by running:"," nomoreide add bundle <group-name> <service> <service> ...","Then tell me which groups you created."].join(`
41
+ `)}function O3(e){return`Pull request #${e.number} — "${e.title}" (${e.head.ref} → ${e.base.ref}, by ${e.user.login}):`}function KH(e,t){return[O3(e),"",t,"",`Pull the diff with \`gh pr diff ${e.number}\` (or your GitHub tools) if you need it.`].join(`
42
+ `)}function YH(e,t,s){return[O3(e),"",`Focus on the file \`${t}\`. ${s}`,"",`Pull the diff with \`gh pr diff ${e.number}\` (or your GitHub tools) to see its changes.`].join(`
43
+ `)}function XH(e,t){return[`GitHub issue #${e.number} — "${e.title}" (opened by ${e.user.login}):`,"",t,"",`Read the full thread with \`gh issue view ${e.number} --comments\` (or your GitHub tools) if you need it.`].join(`
44
+ `)}function ZH(e,t){const s=t?.trim()?t.trim():"Figure out why it failed (read the failing step's logs), then fix the underlying issue in the code. Explain what was wrong before you change anything.";return[`Workflow run "${e.name}" #${e.run_number} failed on \`${e.head_branch}\` (commit ${e.head_sha.slice(0,7)}): ${e.html_url}`,"",s,"",`Pull the failing logs with \`gh run view ${e.id} --log-failed\` (or your GitHub tools) to see the errors.`].join(`
45
+ `)}function QH({service:e,context:t}){return[`Here's the current debug context for my \`${e}\` service. Take a look at its`,"state and recent logs, tell me what stands out, and help me fix anything that's wrong.","",t].join(`
46
+ `)}function z2(){return{serviceNames:[],databaseNames:[],errorIds:[],repositoryPaths:[]}}function JH(e){return e.serviceNames.length>0||e.databaseNames.length>0||e.errorIds.length>0||e.repositoryPaths.length>0}function eU({dashboard:e,databases:t,incidents:s,note:i,selection:a}){const l=[sU(e,a.serviceNames),nU(t,a.databaseNames),iU(s,a.errorIds),rU(e,a.repositoryPaths)].filter(Boolean);return["Diagnose this NoMoreIDE workspace context.","Use the selected services, databases, incidents, and repositories together. Tell me what stands out, likely root causes, and the safest next steps.","",`Workspace: ${e.cwd}`,i?.trim()?`Extra user context:
47
+ ${i.trim()}`:null,"",l.join(`
48
+
49
+ ---
50
+
51
+ `)].filter(Boolean).join(`
52
+ `)}function tU({note:e,selection:t}){const s=[oh(t.serviceNames.length,"service"),oh(t.databaseNames.length,"database"),oh(t.errorIds.length,"error"),oh(t.repositoryPaths.length,"repo")].filter(Boolean),i=e?.trim().replace(/\s+/g," ");return i?`Diagnose: ${s.join(", ")}. Note: ${i.slice(0,80)}`:`Diagnose: ${s.join(", ")}`}function sU(e,t){return t.length?["Services",t.map(i=>{const a=e.config.services.find(f=>f.name===i),l=e.runtime.services[i],c=e.health[i],h=e.logs.filter(f=>f.service===i).slice(-8).map(f=>`${f.timestamp} ${f.stream}: ${f.text}`);return[`Service: ${i}`,a?.kind?`kind: ${a.kind}`:null,a?.command?`command: ${a.command}`:null,a?.cwd?`cwd: ${a.cwd}`:null,a?.port?`port: ${a.port}`:null,l?`state: ${l.state}`:"state: unknown",l?.pid?`pid: ${l.pid}`:null,l?.url?`url: ${l.url}`:null,l?.exitCode!==void 0&&l.exitCode!==null?`exitCode: ${l.exitCode}`:null,c?`health: ${c.status} - ${c.summary}`:null,c?.agentContext?`agent debug context:
53
+ ${c.agentContext}`:null,h.length?`recent logs:
54
+ ${h.join(`
55
+ `)}`:null].filter(Boolean).join(`
56
+ `)}).join(`
57
+
58
+ `)].join(`
59
+ `):null}function nU(e,t){return t.length?["Databases",t.map(i=>{const a=e.find(l=>l.name===i);return[`Database: ${i}`,a?.engine?`engine: ${a.engine}`:null,a?.url?`url: ${a.url}`:null].filter(Boolean).join(`
60
+ `)}).join(`
61
+
62
+ `)].join(`
63
+ `):null}function iU(e,t){return t.length?["Error Inbox",t.map(i=>{const a=e.find(l=>l.id===i);return a?[`Incident #${a.id}`,`service: ${a.service}`,`level: ${a.level}`,`title: ${a.title}`,a.file?`file: ${a.file}${a.line?`:${a.line}`:""}`:null,`count: ${a.count}`,`firstSeen: ${a.firstSeen}`,`lastSeen: ${a.lastSeen}`,a.logExcerpt.length?`log excerpt:
64
+ ${a.logExcerpt.join(`
65
+ `)}`:null].filter(Boolean).join(`
66
+ `):`Incident #${i}`}).join(`
67
+
68
+ `)].join(`
69
+ `):null}function rU(e,t){if(!t.length)return null;const s=aU(e),i=e.git.selectedRepository?.path??e.git.cwd,a=e.git.status?.files.map(c=>`${c.index}${c.workingTree}: ${c.path}`)??[];return["Git Repositories",t.map(c=>{const h=s.find(d=>d.path===c),f=c===i;return[`Repository: ${h?.name??c.split("/").pop()??c}`,`path: ${c}`,f?"current: yes":"current: no",f?a.length?`changed files:
70
+ ${a.join(`
71
+ `)}`:"changed files: none":"changed files: not loaded for this repository in the current dashboard view"].join(`
72
+ `)}).join(`
73
+
74
+ `)].join(`
75
+ `)}function aU(e){return e.config.gitRepositories.length?e.config.gitRepositories:e.git.selectedRepository?[e.git.selectedRepository]:[{name:e.git.cwd.split("/").pop()??"repository",path:e.git.cwd}]}function oh(e,t){return e?`${e} ${t}${e===1?"":"s"}`:null}function Wf(e){return e==="codex"?"Codex":"Claude Code"}function oU(e,t){const s=e==="codex"?"`~/.codex/skills/<name>/SKILL.md` (user) or `.codex/skills/<name>/SKILL.md` (project)":"`~/.claude/skills/<name>/SKILL.md` (user) or `.claude/skills/<name>/SKILL.md` (project)";return[`Add a new skill for ${Wf(e)} from this:`,"",t,"",`Scaffold it at ${s} with valid frontmatter (\`name\`, \`description\`) and a short body, then confirm it's discovered. If the input is a URL or repo, fetch and adapt it.`].join(`
76
+ `)}function lU(e){return[`Remove the ${e.scope} skill \`${e.name}\`${e.path?` (at \`${e.path}\`)`:""}.`,"","Delete its directory and confirm it's no longer registered. Check nothing else references it first."].join(`
77
+ `)}function cU(e){const t=[`I'm looking at the ${e.scope} skill \`${e.name}\`${e.path?` (at \`${e.path}\`)`:""}.`];return e.description&&t.push("",`Its description: ${e.description}`),t.push("","My question: "),t.join(`
78
+ `)}function uU(e,t){const s=e==="codex"?"by adding an `[mcp_servers.<name>]` section to `~/.codex/config.toml`":"with `claude mcp add` (or by editing `~/.claude.json`)";return[`Register a new MCP server for ${Wf(e)} from this:`,"",t,"",`Set it up ${s}, then verify it connects. Parse the name, command/URL, and any env/args from the input above.`].join(`
79
+ `)}function dU(e,t){const s=t==="codex"?`Remove the \`[mcp_servers.${e.name}]\` section from \`~/.codex/config.toml\`.`:`Run \`claude mcp remove ${e.name}\` (scope: ${e.scope}).`;return[`Remove the ${e.scope} MCP server \`${e.name}\`.`,"",`${s} Then confirm it no longer appears in the server list.`].join(`
80
+ `)}function hU(e){const t=[`I'm looking at the ${e.scope} MCP server \`${e.name}\`.`],s=e.command?[e.command,...e.args??[]].join(" "):e.url??e.type;return s&&t.push("",`It points at: \`${s}\``),t.push("","My question: "),t.join(`
81
+ `)}function fU(e,t){return[`Install a plugin for ${Wf(e)} from this:`,"",t,"","Use the `/plugin` command or `claude plugin install <name>@<marketplace>` (add the marketplace first if needed), then confirm its skills, commands, and MCP servers are available."].join(`
82
+ `)}function mU(e){const t=e.marketplace?` (from \`${e.marketplace}\`)`:"";return[`Uninstall the plugin \`${e.name}\`${t}.`,"","Use `claude plugin uninstall` or the `/plugin` command, then confirm its skills, commands, and MCP servers are gone."].join(`
83
+ `)}function pU(e){const t=[`I'm looking at the plugin \`${e.name}\`${e.marketplace?` from \`${e.marketplace}\``:""}${e.version?` (v${e.version})`:""}.`];e.description&&t.push("",e.description);const s=[];return e.skills.length&&s.push(`skills: ${e.skills.join(", ")}`),e.commands.length&&s.push(`commands: ${e.commands.join(", ")}`),e.agents.length&&s.push(`agents: ${e.agents.join(", ")}`),e.mcpServers.length&&s.push(`MCP servers: ${e.mcpServers.join(", ")}`),s.length&&(t.push("","It contributes —"),t.push(...s.map(i=>`- ${i}`))),t.push("","My question: "),t.join(`
84
+ `)}function gU(e,t){const s=e==="codex"?"`~/.codex/config.toml` if this Codex version supports hooks":"`~/.claude/settings.json` (user) or `.claude/settings.json` (project)";return[`Add a hook for ${Wf(e)} from this:`,"",t,"",`Configure it in ${s}. Pick the correct hook event, matcher, command, and scope from the request, then confirm it appears in the agent tools view.`].join(`
85
+ `)}function bU(e){const t=e.matcher?` with matcher \`${e.matcher}\``:"",s=e.command?` running \`${e.command}\``:"";return[`Remove the ${e.scope} \`${e.event}\` hook${t}${s}.`,"",`Edit \`${e.settingsPath}\`, remove only that hook entry, and confirm it no longer appears in the hooks list.`].join(`
86
+ `)}function xU(e){const t=[`I'm looking at the ${e.scope} \`${e.event}\` hook in \`${e.settingsPath}\`.`];return e.matcher&&t.push("",`Matcher: \`${e.matcher}\``),e.type&&t.push(`Type: \`${e.type}\``),e.command&&t.push(`Command: \`${e.command}\``),t.push("","My question: "),t.join(`
87
+ `)}function z3({id:e,className:t}){return e==="codex"?n.jsx(yo,{className:ae("text-foreground",t)}):e==="gemini"?n.jsx(tH,{className:ae("text-[#1A73E8]",t)}):n.jsx(ja,{className:ae("text-[#D97757]",t)})}function Yt({className:e}){const{provider:t}=Dt();return n.jsx(z3,{id:t?.id,className:e})}function er({onAsk:e,label:t,className:s}){const{provider:i}=Dt(),a=t??`Ask ${i?.label??"Claude"}`;return n.jsx("button",{"aria-label":a,className:ae("flex size-6 items-center justify-center rounded-md opacity-0 transition-all duration-150 hover:bg-muted group-hover:opacity-100",s),onClick:e,title:a,type:"button",children:n.jsx(z3,{id:i?.id,className:"size-3.5"})})}function Lr({placeholder:e,onSubmit:t,onCancel:s,className:i}){const[a,l]=y.useState(""),c=()=>{const f=a.trim();f&&t(f)},h=y.useCallback(f=>{f?.focus()},[]);return n.jsxs("form",{className:ae("flex items-center gap-1.5 rounded-md border border-primary/40 bg-primary/5 px-1.5 py-1",i),onSubmit:f=>{f.preventDefault(),c()},children:[n.jsx(er,{className:"size-5 opacity-100",label:"Send to the agent",onAsk:c}),n.jsx("input",{ref:h,className:"min-w-0 flex-1 bg-transparent text-xs outline-none placeholder:text-muted-foreground",onChange:f=>l(f.target.value),onKeyDown:f=>{f.key==="Escape"&&s()},placeholder:e,value:a}),n.jsx(Z,{type:"submit",size:"icon",className:"size-6",disabled:!a.trim(),title:"Send",children:n.jsx(Ws,{className:"size-3.5"})}),n.jsx(Z,{type:"button",size:"icon",variant:"ghost",className:"size-6",onClick:s,"aria-label":"Cancel",title:"Cancel",children:n.jsx(qt,{className:"size-3.5"})})]})}function Kf({label:e,onClick:t}){return n.jsxs(Z,{type:"button",variant:"ghost",size:"sm",className:"h-6 gap-1 px-1.5 text-[11px] font-medium",onClick:t,title:e,"aria-label":e,children:[n.jsx(ws,{className:"size-3.5"}),"Add"]})}function Yf({askLabel:e,removeLabel:t,onAsk:s,onRemove:i}){return n.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[n.jsx(er,{label:e,onAsk:s}),n.jsx(vU,{label:t,onConfirm:i})]})}function vU({label:e,onConfirm:t}){const[s,i]=y.useState(!1);return s?n.jsxs("span",{className:"flex items-center gap-0.5",children:[n.jsx("button",{type:"button","aria-label":e,title:e,onClick:()=>{i(!1),t()},className:"flex size-6 items-center justify-center rounded-md text-emerald-600 transition-colors hover:bg-emerald-500/10",children:n.jsx(Ws,{className:"size-3.5"})}),n.jsx("button",{type:"button","aria-label":"Cancel",title:"Cancel",onClick:()=>i(!1),className:"flex size-6 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted",children:n.jsx(qt,{className:"size-3.5"})})]}):n.jsx("button",{type:"button","aria-label":e,title:e,onClick:()=>i(!0),className:"flex size-6 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-all duration-150 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100",children:n.jsx(Oi,{className:"size-3.5"})})}function yU({agent:e,agentId:t,alternateHooks:s}){const{sendToAgent:i}=Dt(),[a,l]=y.useState(!1),c=e.hooks??[];function h(p){l(!1),i({prompt:gU(t,p),source:{type:"agent-hook",label:"New hook"},label:`Add hook: ${p}`})}function f(p){i({prompt:xU(p),source:{type:"agent-hook",label:`${p.event} hook`},mode:"draft"})}function d(p){i({prompt:bU(p),source:{type:"agent-hook",label:`Remove ${p.event}`},label:`Remove hook: ${p.event}`})}return n.jsxs(bi,{className:"min-w-0 rounded-none border-0 border-t border-border bg-transparent md:border-l lg:border-t-0",children:[n.jsxs(xi,{className:"border-b border-border px-3 py-2",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(B8,{className:"size-4 text-muted-foreground"}),n.jsx(vi,{children:"Hooks"})]}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(We,{variant:"outline",size:"small",children:c.length}),n.jsx(Kf,{label:"Add a hook with AI",onClick:()=>l(p=>!p)})]})]}),a?n.jsx(Lr,{className:"mt-1.5",placeholder:"Describe the event, matcher, and command…",onSubmit:h,onCancel:()=>l(!1)}):n.jsx(sr,{className:"text-xs",children:t==="codex"?"Codex hooks from ~/.codex/hooks.json, with state from ~/.codex/config.toml.":"PreToolUse, PostToolUse, and other Claude Code hooks from user and project settings."})]}),n.jsx(yi,{className:"p-0",children:c.length?n.jsx("ul",{className:"divide-y divide-border",children:c.map(p=>n.jsxs("li",{className:"group px-3 py-2 hover:bg-muted/40",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[n.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold",title:p.event,children:p.event}),n.jsx(Yf,{askLabel:`Ask AI about the ${p.event} hook`,removeLabel:`Remove the ${p.event} hook`,onAsk:()=>f(p),onRemove:()=>d(p)})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[n.jsx(wU,{hook:p}),n.jsx(SU,{hook:p}),n.jsx(We,{variant:"outline",size:"small",children:p.scope})]})]}),n.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted-foreground",title:B2(p),children:B2(p)})]},p.id))}):n.jsx(_U,{agentId:t,alternateHooks:s})})]})}function _U({agentId:e,alternateHooks:t}){const s=e==="codex"?"Codex":"Claude Code";return n.jsxs("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:["No ",s," hooks configured.",t?.count?n.jsxs(n.Fragment,{children:[" ",t.agentLabel," has ",t.count," hook",t.count===1?"":"s","; switch agents above to view them."]}):null]})}function wU({hook:e}){return e.status==="enabled"?n.jsx(We,{variant:"success",appearance:"subtle",size:"small",children:"Enabled"}):e.status==="disabled"?n.jsx(We,{variant:"error",appearance:"subtle",size:"small",children:"Disabled"}):n.jsx(We,{variant:"warning",appearance:"subtle",size:"small",children:"Default"})}function SU({hook:e}){return e.trusted===void 0?null:n.jsx(We,{variant:e.trusted?"success":"warning",appearance:"subtle",size:"small",children:e.trusted?"Trusted":"Untrusted"})}function kU(e){return e.command?e.command:e.type??e.settingsPath}function B2(e){return`${e.matcher?`matcher ${e.matcher} · `:""}${kU(e)}`}function NU({agent:e,agentId:t}){const{sendToAgent:s}=Dt(),[i,a]=y.useState([]),[l,c]=y.useState(!1),[h,f]=y.useState(!1),d=y.useCallback(async()=>{c(!0);try{a(await k7(t))}catch{a([])}finally{c(!1)}},[t]);y.useEffect(()=>{d()},[d]);const p=y.useMemo(()=>{const k={};for(const N of i)k[N.name]=N.state;return k},[i]),g=y.useMemo(()=>{const k=new Set(e.mcpServers.map(E=>E.name)),N=i.filter(E=>!k.has(E.name)).map(E=>({name:E.name,scope:"user",synthetic:!0}));return[...e.mcpServers,...N]},[e.mcpServers,i]);function b(k){f(!1),s({prompt:uU(t,k),source:{type:"agent-mcp",label:"New MCP server"},label:`Add MCP server: ${k}`})}function v(k){s({prompt:hU(k),source:{type:"agent-mcp",label:`${k.name} server`},mode:"draft"})}function w(k){s({prompt:dU(k,t),source:{type:"agent-mcp",label:`Remove ${k.name}`},label:`Remove MCP server: ${k.name}`})}return n.jsxs(bi,{className:"min-w-0 rounded-none border-0 bg-transparent md:border-l md:border-border",children:[n.jsxs(xi,{className:"border-b border-border px-3 py-2",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(KC,{className:"size-4 text-muted-foreground"}),n.jsx(vi,{children:"MCP Servers"})]}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(We,{variant:"outline",size:"small",children:g.length}),n.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"size-6",onClick:()=>{d()},disabled:l,title:"Re-check authentication status","aria-label":"Re-check authentication status",children:n.jsx(Dr,{className:l?"animate-spin":void 0})}),n.jsx(Kf,{label:"Register an MCP server with AI",onClick:()=>f(k=>!k)})]})]}),h?n.jsx(Lr,{className:"mt-1.5",placeholder:"Paste the MCP install command or URL…",onSubmit:b,onCancel:()=>f(!1)}):n.jsxs(sr,{className:"text-xs",children:["From"," ",n.jsx("code",{className:"font-mono",children:t==="codex"?"~/.codex/config.toml":"~/.claude.json"}),t==="codex"?"":" + claude.ai connectors",". Status via"," ",n.jsxs("code",{className:"font-mono",children:[t==="codex"?"codex":"claude"," mcp list"]})," ","(fresh health check)."]})]}),n.jsx(yi,{className:"p-0",children:g.length?n.jsx("ul",{className:"divide-y divide-border",children:g.map(k=>n.jsxs("li",{className:"group px-3 py-2 hover:bg-muted/40",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[n.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold",title:k.name,children:k.name}),n.jsx(Yf,{askLabel:`Ask AI about the ${k.name} server`,removeLabel:`Remove the ${k.name} server`,onAsk:()=>v(k),onRemove:()=>w(k)})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[n.jsx(EU,{state:p[k.name],loading:l}),n.jsx(We,{variant:"outline",size:"small",children:k.synthetic?"connector":k.scope})]})]}),n.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted-foreground",title:k.synthetic?"claude.ai managed connector":P2(k),children:k.synthetic?"claude.ai managed connector":P2(k)})]},`${k.scope}:${k.name}`))}):n.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No MCP servers configured."})})]})}const CU={connected:{label:"Connected",dot:"bg-emerald-500"},"needs-auth":{label:"Needs auth",dot:"bg-amber-500"},failed:{label:"Failed",dot:"bg-red-500"},"no-auth":{label:"local",dot:"bg-muted-foreground/50"}};function EU({state:e,loading:t}){if(!e)return t?n.jsx(Rt,{className:"size-3 animate-spin text-muted-foreground"}):null;const s=e==="unknown"?void 0:CU[e];return s?n.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[n.jsx("span",{className:ae("size-1.5 shrink-0 rounded-full",s.dot),"aria-hidden":!0}),s.label]}):null}function P2(e){return e.command?[e.command,...e.args??[]].join(" "):e.url??e.type??"-"}function jU({agent:e,agentId:t}){const{sendToAgent:s}=Dt(),[i,a]=y.useState(!1),l=e.plugins??[];function c(d){a(!1),s({prompt:fU(t,d),source:{type:"agent-plugin",label:"New plugin"},label:`Install plugin: ${d}`})}function h(d){s({prompt:pU(d),source:{type:"agent-plugin",label:`${d.name} plugin`},mode:"draft"})}function f(d){s({prompt:mU(d),source:{type:"agent-plugin",label:`Remove ${d.name}`},label:`Uninstall plugin: ${d.name}`})}return n.jsxs(bi,{className:"min-w-0 rounded-none border-0 border-t border-border bg-transparent lg:border-l lg:border-t-0",children:[n.jsxs(xi,{className:"border-b border-border px-3 py-2",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(jR,{className:"size-4 text-muted-foreground"}),n.jsx(vi,{children:"Plugins"})]}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(We,{variant:"outline",size:"small",children:l.length}),n.jsx(Kf,{label:"Install a plugin with AI",onClick:()=>a(d=>!d)})]})]}),i?n.jsx(Lr,{className:"mt-1.5",placeholder:"Paste a plugin name, marketplace, or install command…",onSubmit:c,onCancel:()=>a(!1)}):n.jsx(sr,{className:"text-xs",children:t==="codex"?"Codex doesn't expose an installed-plugin registry here yet.":"Installed from marketplaces (~/.claude/plugins). Each bundles skills, commands, agents, and MCP servers."})]}),n.jsx(yi,{className:"p-0",children:l.length?n.jsx("ul",{className:"divide-y divide-border",children:l.map(d=>n.jsxs("li",{className:"group px-3 py-2 hover:bg-muted/40",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[n.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold",title:d.name,children:d.name}),n.jsx(Yf,{askLabel:`Ask AI about the ${d.name} plugin`,removeLabel:`Uninstall the ${d.name} plugin`,onAsk:()=>h(d),onRemove:()=>f(d)})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[d.version&&d.version!=="unknown"?n.jsxs(We,{variant:"outline",size:"small",children:["v",d.version]}):null,d.marketplace?n.jsx(We,{variant:"outline",size:"small",children:d.marketplace}):null]})]}),d.description?n.jsx("p",{className:"mt-1 truncate text-[11px] text-muted-foreground",title:d.description,children:d.description}):null,n.jsx(AU,{plugin:d})]},`${d.name}@${d.marketplace??""}`))}):n.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No plugins installed."})})]})}function AU({plugin:e}){const t=[];return e.skills.length&&t.push(`${e.skills.length} skill${lh(e.skills.length)}`),e.commands.length&&t.push(`${e.commands.length} command${lh(e.commands.length)}`),e.agents.length&&t.push(`${e.agents.length} agent${lh(e.agents.length)}`),e.mcpServers.length&&t.push(`${e.mcpServers.length} MCP server${lh(e.mcpServers.length)}`),t.length?n.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:t.map(s=>n.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[10px] text-muted-foreground",children:s},s))}):null}function lh(e){return e===1?"":"s"}function TU({agent:e,agentId:t}){const{sendToAgent:s}=Dt(),[i,a]=y.useState(!1);function l(f){a(!1),s({prompt:oU(t,f),source:{type:"agent-skill",label:"New skill"},label:`Add skill: ${f}`})}function c(f){s({prompt:cU(f),source:{type:"agent-skill",label:`${f.name} skill`},mode:"draft"})}function h(f){s({prompt:lU(f),source:{type:"agent-skill",label:`Remove ${f.name}`},label:`Remove skill: ${f.name}`})}return n.jsxs(bi,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[n.jsxs(xi,{className:"border-b border-border px-3 py-2",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Li,{className:"size-4 text-muted-foreground"}),n.jsx(vi,{children:"Skills"})]}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(We,{variant:"outline",size:"small",children:e.skills.length}),n.jsx(Kf,{label:"Add a skill with AI",onClick:()=>a(f=>!f)})]})]}),i?n.jsx(Lr,{className:"mt-1.5",placeholder:"Paste a skill URL/repo, or describe the skill…",onSubmit:l,onCancel:()=>a(!1)}):n.jsx(sr,{className:"text-xs",children:t==="codex"?"User, project, and system skills discovered for Codex.":"User and project skills discovered for the active agent."})]}),n.jsx(yi,{className:"p-0",children:e.skills.length?n.jsx("ul",{className:"divide-y divide-border",children:e.skills.map(f=>n.jsxs("li",{className:"group px-3 py-2 hover:bg-muted/40",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[n.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold",title:f.name,children:f.name}),n.jsx(Yf,{askLabel:`Ask AI about the ${f.name} skill`,removeLabel:`Remove the ${f.name} skill`,onAsk:()=>c(f),onRemove:()=>h(f)})]}),n.jsx("div",{className:"flex shrink-0 items-center gap-1.5",children:n.jsx(We,{variant:"outline",size:"small",children:f.scope})})]}),f.description?n.jsx("p",{className:"mt-1 truncate text-[11px] text-muted-foreground",title:f.description,children:f.description}):null]},`${f.scope}:${f.name}`))}):n.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No skills found."})})]})}function RU({agent:e,agentId:t,alternateHooks:s,onOpenAgentEnv:i}){return n.jsxs("div",{children:[i?n.jsx("div",{className:"flex items-center justify-end border-b border-border/60 px-3 py-1.5",children:n.jsxs("button",{className:"flex items-center gap-1 text-[11px] text-muted-foreground transition-colors hover:text-foreground",onClick:i,type:"button",children:["Manage across agents in Environments",n.jsx(SR,{className:"size-3"})]})}):null,n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4",children:[n.jsx(TU,{agent:e,agentId:t}),n.jsx(NU,{agent:e,agentId:t}),n.jsx(jU,{agent:e,agentId:t}),n.jsx(yU,{agent:e,agentId:t,alternateHooks:s})]})]})}function MU(e=3e4){const[t,s]=y.useState(null),[i,a]=y.useState(null),[l,c]=y.useState(!0),h=y.useCallback(async()=>{try{s(await C7()),a(null)}catch(f){a(f instanceof Error?f.message:String(f))}finally{c(!1)}},[]);return y.useEffect(()=>{h();const f=window.setInterval(()=>{h()},e);return()=>window.clearInterval(f)},[h,e]),{data:t,error:i,loading:l,refresh:h}}function DU(){const{data:e,error:t,loading:s}=MU();if(s&&!e)return n.jsx(ch,{children:n.jsx(Je,{variant:"muted",children:"Loading usage history…"})});if(t)return n.jsx(ch,{children:n.jsxs(Je,{variant:"muted",className:"border-destructive/40 text-destructive",children:["Failed to load usage history: ",t]})});const i=e?.summary;return!i||i.runs===0&&i.codexTotalTokens===0?n.jsx(ch,{children:n.jsx(Je,{variant:"muted",children:"No usage recorded yet. History accrues as you run the in-dock agent — check back after a session."})}):n.jsxs(ch,{children:[n.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[n.jsx(uh,{label:"Total cost",value:`$${i.totalCostUSD.toFixed(2)}`,accent:!0}),n.jsx(uh,{label:"Agent runs",value:String(i.runs)}),n.jsx(uh,{label:"Tokens (in+out)",value:I2(i.totalTokens)}),n.jsx(uh,{label:"Codex tokens",value:I2(i.codexTotalTokens)})]}),i.byDay.length>0?n.jsxs("div",{className:"rounded-md border border-border p-3",children:[n.jsx("div",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Cost by day"}),n.jsx(LU,{days:i.byDay})]}):null,n.jsx(OU,{summary:i})]})}function LU({days:e}){const t=Math.max(...e.map(s=>s.costUSD),1e-4);return n.jsx("div",{className:"space-y-1.5",children:e.map(s=>n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsx("span",{className:"w-20 shrink-0 font-mono text-muted-foreground",children:s.date.slice(5)}),n.jsx("div",{className:"h-3.5 flex-1 overflow-hidden rounded bg-muted/50",children:n.jsx("div",{className:"h-full rounded bg-emerald-500/80",style:{width:`${Math.max(2,s.costUSD/t*100)}%`}})}),n.jsxs("span",{className:"w-14 shrink-0 text-right font-mono text-emerald-700",children:["$",s.costUSD.toFixed(2)]}),n.jsxs("span",{className:"w-12 shrink-0 text-right text-muted-foreground",children:[s.runs," run",s.runs===1?"":"s"]})]},s.date))})}function OU({summary:e}){if(!e.firstAt||!e.lastAt)return null;const t=e.firstAt.slice(0,10),s=e.lastAt.slice(0,10);return n.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[t===s?`Recorded on ${t}.`:`Recorded ${t} → ${s}.`," Costs are Claude per-session figures; Codex reports lifetime token totals only."]})}function ch({children:e}){return n.jsx("div",{className:"space-y-3 p-4",children:e})}function uh({label:e,value:t,accent:s}){return n.jsxs("div",{className:"rounded-md border border-border px-3 py-2",children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:e}),n.jsx("div",{className:s?"font-mono text-lg font-semibold text-emerald-700":"font-mono text-lg font-semibold",children:t})]})}function I2(e){return e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}const zU=[{id:"claude-code",chatId:"claude",label:"Claude Code",icon:n.jsx(ja,{className:"size-4"})},{id:"codex",chatId:"codex",label:"Codex",icon:n.jsx(yo,{className:"size-4"})}],BU=[{id:"overview",label:"Overview",icon:n.jsx(UC,{className:"size-3.5"})},{id:"memory",label:"Memory",icon:n.jsx(DC,{className:"size-3.5"})},{id:"tools",label:"Skills, MCPs, Plugins & Hooks",icon:n.jsx(KC,{className:"size-3.5"})},{id:"activity",label:"Activity",icon:n.jsx(oo,{className:"size-3.5"})},{id:"changes",label:"Changes",icon:n.jsx(IC,{className:"size-3.5"})},{id:"usage",label:"Usage",icon:n.jsx(d6,{className:"size-3.5"})}];function PU({focusChanges:e,onOpenAgentEnv:t}={}){const[s,i]=y.useState(null),[a,l]=y.useState(null),[c,h]=y.useState("claude-code"),[f,d]=y.useState("overview"),{provider:p,providers:g,selectProvider:b}=Dt();y.useEffect(()=>{e&&d("changes")},[e]);function v(N,E){h(N),p?.id!==E&&b(E)}if(y.useEffect(()=>{p&&h(p.id==="codex"?"codex":"claude-code")},[p]),y.useEffect(()=>{let N=!0;return cE().then(E=>{N&&i(E)}).catch(E=>{N&&l(E instanceof Error?E.message:String(E))}),()=>{N=!1}},[]),a)return n.jsx("div",{className:"h-full overflow-auto bg-card/85 p-4",children:n.jsxs(Je,{variant:"muted",className:"border-destructive/40 text-destructive",children:["Failed to load agent info: ",a]})});if(!s)return n.jsx("div",{className:"h-full overflow-auto bg-card/85 p-4",children:n.jsx(Je,{variant:"muted",children:"Loading agent info…"})});const w=s.agents?.[c]??s,k=c==="codex"?{agentLabel:"Claude Code",count:s.agents["claude-code"].hooks.length}:{agentLabel:"Codex",count:s.agents.codex.hooks.length};return n.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[n.jsx("div",{className:"flex shrink-0 items-center gap-2 border-b border-border bg-card/90 px-3 py-2",children:zU.map(N=>{const E=c===N.id,T=s.detected.name===N.id,A=p?.id===N.chatId,R=g.find(L=>L.id===N.chatId)?.configured??!0;return n.jsxs("button",{type:"button",onClick:()=>v(N.id,N.chatId),title:R?`Use ${N.label} for chat`:`${N.label} CLI isn't installed`,className:ae("flex items-center gap-2 rounded-lg border px-3 py-1.5 text-xs font-medium transition-colors",E?"border-border bg-background text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-muted/60 hover:text-foreground",!R&&"opacity-60"),children:[N.icon,N.label,A?n.jsx("span",{className:"rounded-full bg-primary/15 px-1.5 py-px text-[10px] font-medium text-primary",children:"In use"}):T?n.jsx("span",{className:"size-1.5 rounded-full bg-emerald-500",title:"Detected agent","aria-hidden":!0}):R?null:n.jsx("span",{className:"text-[10px] font-normal text-muted-foreground",children:"not installed"})]},N.id)})}),n.jsx("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card/90 px-3",children:BU.map(N=>n.jsxs("button",{type:"button",onClick:()=>d(N.id),className:ae("relative flex items-center gap-1.5 px-2.5 py-2 text-xs font-medium transition-colors",f===N.id?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[N.icon,N.label,f===N.id?n.jsx("span",{className:"absolute inset-x-1 -bottom-px h-0.5 bg-primary"}):null]},N.id))}),n.jsxs("div",{className:"min-h-0 flex-1 overflow-auto",children:[f==="overview"?n.jsx(DH,{agent:w,agentId:c,isDetected:s.detected.name===c}):null,f==="memory"?n.jsx(xH,{agent:w,agentId:c}):null,f==="tools"?n.jsx(RU,{agent:w,agentId:c,alternateHooks:k,onOpenAgentEnv:t}):null,f==="activity"?n.jsx(J$,{agent:w,agentId:c}):null,f==="changes"?n.jsx(fH,{}):null,f==="usage"?n.jsx(DU,{}):null]})]})}const B3=y.createContext(null);function IU(){const e=y.useRef(new Set),t=y.useCallback(i=>(e.current.add(i),()=>{e.current.delete(i)}),[]),s=y.useCallback(async()=>{await Promise.all([...e.current].map(i=>Promise.resolve().then(i)))},[]);return{register:t,runActive:s}}function $U({value:e,children:t}){return n.jsx(B3.Provider,{value:e,children:t})}function jl(e){const t=y.useContext(B3),s=y.useRef(e);s.current=e,y.useEffect(()=>{if(t)return t.register(()=>s.current())},[t])}var nr=AC();const $2=/token|key|secret|password|credential/i,H2="••••••••";function HU(e){return e.replace(/"([^"\n]+)"(\s*:\s*)"((?:[^"\\\n]|\\.)*)"/g,(t,s,i,a)=>$2.test(s)&&a?`"${s}"${i}"${H2}"`:t).replace(/^(\s*)([A-Za-z0-9_.-]+)(\s*=\s*)"((?:[^"\\\n]|\\.)*)"/gm,(t,s,i,a,l)=>$2.test(i)&&l?`${s}${i}${a}"${H2}"`:t)}const UU={claude:["opus","sonnet","haiku","opusplan"],codex:["gpt-5-codex","gpt-5"],antigravity:[]};function FU({agent:e,onClose:t}){const[s,i]=y.useState(null),[a,l]=y.useState(""),[c,h]=y.useState(""),[f,d]=y.useState(!1),[p,g]=y.useState(null),[b,v]=y.useState(!1);y.useEffect(()=>{let C=!1;return q7(e).then(R=>{C||!R||(i(R),l(R.content),h(R.model??""))}).catch(R=>{C||g(R instanceof Error?R.message:String(R))}),()=>{C=!0}},[e]),y.useEffect(()=>{function C(R){R.key==="Escape"&&!f&&t()}return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[t,f]);const w=s!==null&&a!==s.content,k=HU(a),N=!b&&k!==a,E=s!==null&&c.trim()!==(s.model??""),T=async()=>{d(!0),g(null);try{const{settings:C}=await V7(e,c);i(C),l(C.content),h(C.model??"")}catch(C){g(C instanceof Error?C.message:String(C))}finally{d(!1)}},A=async()=>{d(!0),g(null);try{await G7(e,a),t()}catch(C){g(C instanceof Error?C.message:String(C))}finally{d(!1)}};return nr.createPortal(n.jsx("div",{className:"fixed inset-0 z-[1000] grid place-items-center bg-black/35 px-4",onMouseDown:()=>!f&&t(),children:n.jsxs("div",{"aria-modal":"true",className:"flex w-full max-w-2xl flex-col overflow-hidden rounded-lg border border-border bg-card shadow-xl",onMouseDown:C=>C.stopPropagation(),role:"dialog",children:[n.jsxs("div",{className:"space-y-3 px-4 py-4",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-md border border-border bg-background text-foreground [&_svg]:size-4",children:n.jsx(z0,{})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("h2",{className:"text-sm font-semibold",children:[Zi[e]," settings"]}),n.jsx("p",{className:"truncate font-mono text-[11px] text-muted-foreground",title:s?.path,children:s?.path??"Loading..."})]})]}),s?.modelEditable?n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("label",{className:"text-xs font-medium",htmlFor:`model-${e}`,children:"Model"}),n.jsx("input",{className:"h-8 w-56 rounded-md border border-border bg-background px-2 font-mono text-xs",disabled:f||!s,id:`model-${e}`,list:`model-suggestions-${e}`,onChange:C=>h(C.target.value),placeholder:"default",value:c}),n.jsx("datalist",{id:`model-suggestions-${e}`,children:UU[e].map(C=>n.jsx("option",{value:C},C))}),n.jsx(Z,{disabled:f||!E||w,onClick:()=>{T()},size:"sm",title:w?"Save or revert the file edits below first":void 0,variant:"outline",children:"Apply"})]}):null,n.jsxs("div",{className:"relative",children:[n.jsx("textarea",{"aria-label":"Settings file content",className:"h-72 w-full resize-y rounded-md border border-border bg-background p-2 font-mono text-xs leading-relaxed focus:outline-none",disabled:f||!s,onChange:C=>!N&&l(C.target.value),placeholder:s&&!s.exists?"File doesn't exist yet — saving will create it.":void 0,readOnly:N,spellCheck:!1,value:N?k:a}),k!==a||b?n.jsxs(Z,{className:"absolute right-2 top-2 h-7 gap-1.5 px-2 text-[11px] text-muted-foreground",onClick:()=>v(C=>!C),size:"sm",title:N?"Secret-looking values are hidden; reveal to edit the file":"Hide secret-looking values",type:"button",variant:"ghost",children:[N?n.jsx(Lf,{className:"size-3.5"}):n.jsx(j0,{className:"size-3.5"}),N?"Reveal secrets":"Hide secrets"]}):null]}),p?n.jsx("p",{className:"text-xs text-destructive",children:p}):null,n.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Saves are validated (",s?.format==="toml"?"TOML":"JSON",") and a timestamped .bak backup of the current file is written first."]})]}),n.jsxs("div",{className:"flex justify-end gap-2 border-t border-border bg-muted/30 px-4 py-3",children:[n.jsx(Z,{disabled:f,onClick:t,size:"sm",type:"button",variant:"outline",children:"Close"}),n.jsx(Z,{disabled:f||!w,onClick:()=>{A()},size:"sm",type:"button",children:f?"Saving...":"Save file"})]})]})}),document.body)}function ju({items:e,label:t="More actions",className:s}){const[i,a]=y.useState(!1),[l,c]=y.useState({top:0,right:0}),h=y.useRef(null),f=y.useRef(null);function d(){const p=h.current?.getBoundingClientRect();p&&c({top:p.bottom+4,right:window.innerWidth-p.right}),a(g=>!g)}return y.useEffect(()=>{if(!i)return;function p(v){const w=v.target;h.current?.contains(w)||f.current?.contains(w)||a(!1)}function g(v){v.key==="Escape"&&a(!1)}const b=()=>a(!1);return document.addEventListener("mousedown",p),document.addEventListener("keydown",g),window.addEventListener("scroll",b,!0),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",g),window.removeEventListener("scroll",b,!0)}},[i]),n.jsxs(n.Fragment,{children:[n.jsx("button",{"aria-label":t,className:ae("flex size-6 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-all duration-150 hover:bg-muted hover:text-foreground group-hover:opacity-100",i&&"opacity-100",s),onClick:d,ref:h,title:t,type:"button",children:n.jsx(BC,{className:"size-3.5"})}),i?nr.createPortal(n.jsx("div",{className:"fixed z-50 min-w-44 overflow-hidden rounded-md border border-border bg-card p-1 shadow-md",ref:f,style:{top:l.top,right:l.right},children:e.map(p=>n.jsxs("button",{className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-foreground transition-colors hover:bg-muted",onClick:()=>{a(!1),p.onSelect()},type:"button",children:[p.icon?n.jsx("span",{className:"text-muted-foreground",children:p.icon}):null,p.label]},p.label))}),document.body):null]})}const Zi={claude:"Claude Code",codex:"Codex CLI",antigravity:"Antigravity"};function Sx({agent:e,className:t}){return e==="claude"?n.jsx(ja,{className:ae("text-[#D97757]",t)}):e==="codex"?n.jsx(yo,{className:t}):n.jsx(sH,{className:t})}const qU=["claude","codex","antigravity"];function GU({availability:e,config:t,onStage:s}){const[i,a]=y.useState(!1),l=[...Object.entries(t.mcpServers).map(([h,f])=>({name:h,detail:F2(f),remote:!1})),...Object.entries(t.remoteMcpServers).map(([h,f])=>({name:h,detail:q2(f),remote:!0}))],c=[...Object.entries(t.projectMcpServers).map(([h,f])=>({name:h,detail:F2(f),remote:!1})),...Object.entries(t.projectRemoteMcpServers).map(([h,f])=>({name:h,detail:q2(f),remote:!0}))];return n.jsxs(bi,{className:"flex min-h-0 flex-col",children:[n.jsxs(xi,{className:"shrink-0",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs(vi,{className:"flex items-center gap-1.5",children:[n.jsx(Sx,{agent:t.agent,className:"size-4"}),Zi[t.agent]]}),n.jsxs("span",{className:"flex items-center gap-1",children:[e?n.jsx(We,{size:"small",variant:e.available?"success":"warning",children:e.available?"installed":"not on PATH"}):null,n.jsx("button",{className:"rounded p-1 text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground",onClick:()=>a(!0),title:`${Zi[t.agent]} settings`,type:"button",children:n.jsx(z0,{className:"size-3.5"})})]})]}),i?n.jsx(FU,{agent:t.agent,onClose:()=>a(!1)}):null,n.jsx("p",{className:"truncate font-mono text-[11px] text-muted-foreground",title:t.configPath,children:t.exists?t.configPath:`no config — ${t.configPath}`})]}),n.jsxs(yi,{className:"min-h-0 flex-1 space-y-4 overflow-y-auto",children:[n.jsx(U2,{agent:t.agent,label:"MCP servers",mcps:l,onStage:s,scope:"user"}),c.length>0?n.jsx(U2,{agent:t.agent,label:"Project MCP servers",mcps:c,onStage:s,scope:"project"}):null,n.jsx(VU,{agent:t.agent,onStage:s,skills:t.skills})]})]})}function P3(e,t,s){const i=qU.filter(a=>a!==e.sourceAgent);return[...i.map(a=>({label:`Copy to ${Zi[a]}`,onSelect:()=>t({...e,action:"copy",targetAgent:a,targetScope:s(a)})})),...i.map(a=>({label:`Move to ${Zi[a]}`,onSelect:()=>t({...e,action:"move",targetAgent:a,targetScope:s(a)})})),{label:"Remove",onSelect:()=>t({...e,action:"remove"})}]}function U2({agent:e,label:t,mcps:s,scope:i,onStage:a}){return n.jsxs("section",{children:[n.jsx("h4",{className:"mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:t}),s.length===0?n.jsx("p",{className:"text-xs text-muted-foreground",children:"None configured."}):n.jsx("ul",{className:"space-y-1",children:s.map(l=>n.jsxs("li",{className:"group flex items-start gap-2 rounded-md border border-border/60 bg-background/60 px-2 py-1.5",children:[n.jsx("span",{className:"mt-0.5 text-muted-foreground [&_svg]:size-3.5",children:l.remote?n.jsx(M0,{}):n.jsx(_u,{})}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block text-xs font-medium",children:l.name}),n.jsx("span",{className:"block truncate font-mono text-[11px] text-muted-foreground",title:l.detail,children:l.detail})]}),a?n.jsx(ju,{items:P3({category:"mcp",name:l.name,sourceAgent:e,sourceScope:i},a,()=>i)}):null]},l.name))})]})}function VU({agent:e,skills:t,onStage:s}){return n.jsxs("section",{children:[n.jsx("h4",{className:"mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Skills & plugins"}),t.length===0?n.jsx("p",{className:"text-xs text-muted-foreground",children:"None installed."}):n.jsx("ul",{className:"space-y-1",children:t.map(i=>n.jsxs("li",{className:"group flex items-start gap-2 rounded-md border border-border/60 bg-background/60 px-2 py-1.5",children:[n.jsx("span",{className:"mt-0.5 text-muted-foreground [&_svg]:size-3.5",children:i.kind==="plugin"?n.jsx(PM,{}):n.jsx(Li,{})}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"truncate text-xs font-medium",children:i.name}),i.scope==="project"?n.jsx(We,{size:"small",variant:"outline",children:"project"}):null]}),i.kind==="plugin"&&i.pluginSkills?.length?n.jsxs("span",{className:"block truncate text-[11px] text-muted-foreground",title:i.pluginSkills.join(", "),children:[i.pluginSkills.length," skill",i.pluginSkills.length===1?"":"s",i.pluginMcps?.length?`, ${i.pluginMcps.length} MCP${i.pluginMcps.length===1?"":"s"}`:""]}):null]}),s&&i.kind!=="plugin"?n.jsx(ju,{items:P3({category:"skill",name:i.name,sourceAgent:e,sourceScope:i.scope},s,a=>a==="claude"?i.scope:"user")}):null]},`${i.scope}:${i.name}`))})]})}function F2(e){return[e.command,...e.args??[]].join(" ").trim()||"(no command)"}function q2(e){return`${e.transport} · ${e.url}`}function Al({title:e,message:t,confirmLabel:s="Confirm",cancelLabel:i="Cancel",tone:a="default",icon:l,loading:c=!1,onConfirm:h,onCancel:f}){y.useEffect(()=>{function p(g){g.key==="Escape"&&!c&&f()}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[f,c]);const d=a==="danger"?"destructive":a==="success"?"success":"default";return nr.createPortal(n.jsx("div",{className:"fixed inset-0 z-[1000] grid place-items-center bg-black/35 px-4",onMouseDown:()=>!c&&f(),children:n.jsxs("div",{"aria-modal":"true",className:"flex w-full max-w-md flex-col overflow-hidden rounded-lg border border-border bg-card shadow-xl",onMouseDown:p=>p.stopPropagation(),role:"dialog",children:[n.jsxs("div",{className:"flex items-start gap-3 px-4 py-4",children:[l?n.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-md border border-border bg-background text-foreground [&_svg]:size-4",children:l}):null,n.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[n.jsx("h2",{className:"text-sm font-semibold",children:e}),n.jsx("div",{className:"text-[13px] text-muted-foreground",children:t})]})]}),n.jsxs("div",{className:"flex justify-end gap-2 border-t border-border bg-muted/30 px-4 py-3",children:[n.jsx(Z,{disabled:c,onClick:f,size:"sm",type:"button",variant:"outline",children:i}),n.jsx(Z,{disabled:c,onClick:h,size:"sm",type:"button",variant:d,children:s})]})]})}),document.body)}function WU({pending:e,busy:t,onToggle:s,onConfirm:i,onCancel:a}){const{preview:l,skipped:c}=e,h=l.items.filter(f=>!c.has(`${f.category}:${f.name}`)).length;return n.jsx(Al,{confirmLabel:t?"Applying...":`Apply ${h} item${h===1?"":"s"}`,icon:n.jsx(cu,{}),loading:t,message:n.jsxs("div",{className:"space-y-2",children:[n.jsxs("p",{children:["Apply profile ",n.jsx("span",{className:"font-medium text-foreground",children:l.profile})," ","to ",Zi[l.agent],". A config backup is written first."]}),n.jsx("ul",{className:"max-h-56 space-y-1 overflow-y-auto",children:l.items.map(f=>{const d=`${f.category}:${f.name}`;return n.jsxs("li",{className:"flex items-start gap-2",children:[n.jsx("input",{checked:!c.has(d),className:"mt-0.5",disabled:t,id:`apply-${d}`,onChange:()=>s(d),type:"checkbox"}),n.jsxs("label",{className:"min-w-0 flex-1 cursor-pointer",htmlFor:`apply-${d}`,children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsxs("span",{className:"truncate text-xs text-foreground",children:[f.category==="mcp"?"MCP":"Skill"," ",f.name]}),n.jsx(We,{size:"small",variant:f.status==="conflict"?"warning":f.status==="identical"?"outline":"success",children:f.status==="conflict"?"overwrites existing":f.status==="identical"?"already identical":"new"})]}),f.warnings.map(p=>n.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-amber-600 dark:text-amber-500",children:[n.jsx(Rr,{className:"size-3 shrink-0"}),p]},p))]})]},d)})}),l.unresolvedCredentials.length>0?n.jsxs("p",{className:"flex items-center gap-1 text-[11px] text-amber-600 dark:text-amber-500",children:[n.jsx(Rr,{className:"size-3 shrink-0"}),"Unfilled credentials applied as placeholders:"," ",l.unresolvedCredentials.join(", ")]}):null]}),onCancel:a,onConfirm:i,title:`Apply profile to ${Zi[l.agent]}`,tone:"success"})}function G2(e){return e.trim().toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9.-]/g,"").replace(/-+/g,"-").replace(/^[-.]+|[-.]+$/g,"")}function KU({profileName:e,busy:t,onConfirm:s,onCancel:i}){const[a,l]=y.useState(G2(e)),[c,h]=y.useState(e),[f,d]=y.useState("1.0.0"),[p,g]=y.useState(""),b=a.trim().length>0&&c.trim().length>0,v="h-8 w-full rounded-md border border-border bg-background px-2 text-xs";return n.jsx(Al,{confirmLabel:t?"Publishing...":"Publish",icon:n.jsx(OC,{}),loading:t,message:n.jsxs("div",{className:"space-y-2",children:[n.jsxs("p",{children:["Publish ",n.jsx("span",{className:"font-medium text-foreground",children:e})," to the registry. The uploaded archive is credential-redacted — installers supply their own secrets."]}),n.jsxs("label",{className:"block space-y-1",children:[n.jsx("span",{className:"text-[11px] font-medium",children:"Slug"}),n.jsx("input",{className:v,onChange:w=>l(G2(w.target.value)),value:a})]}),n.jsxs("label",{className:"block space-y-1",children:[n.jsx("span",{className:"text-[11px] font-medium",children:"Title"}),n.jsx("input",{className:v,onChange:w=>h(w.target.value),value:c})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs("label",{className:"block w-24 space-y-1",children:[n.jsx("span",{className:"text-[11px] font-medium",children:"Version"}),n.jsx("input",{className:v,onChange:w=>d(w.target.value),value:f})]}),n.jsxs("label",{className:"block flex-1 space-y-1",children:[n.jsx("span",{className:"text-[11px] font-medium",children:"Summary (optional)"}),n.jsx("input",{className:v,onChange:w=>g(w.target.value),value:p})]})]})]}),onCancel:i,onConfirm:()=>{!b||t||s({name:e,slug:a.trim(),title:c.trim(),version:f.trim()||void 0,summary:p.trim()||void 0})},title:"Publish to registry",tone:"success"})}function YU({name:e,onChanged:t}){const[s,i]=y.useState(null),[a,l]=y.useState(null),[c,h]=y.useState(!1),[f,d]=y.useState("");y.useEffect(()=>{let k=!1;return K7(e).then(N=>{k||!N||(i(N),d(N.description??""))}).catch(N=>{k||l(N instanceof Error?N.message:String(N))}),()=>{k=!0}},[e]);const p=async k=>{h(!0),l(null);try{const N=await Y7(e,k);i(N),d(N.description??""),t()}catch(N){l(N instanceof Error?N.message:String(N))}finally{h(!1)}};if(!s)return n.jsx("p",{className:"px-3 pb-2 pl-9 text-[11px] text-muted-foreground",children:a??"Loading profile..."});const g=Object.entries(s.mcps),b=k=>{const{[k]:N,...E}=s.mcps;p({mcps:E})},v=k=>{p({skills:s.skills.filter(N=>N.name!==k)})},w=()=>{const k=f.trim();k!==(s.description??"")&&p({description:k})};return n.jsxs("div",{className:"space-y-2 border-t border-border/40 bg-muted/20 px-3 py-2 pl-9",children:[n.jsx("input",{"aria-label":"Profile description",className:"h-7 w-full rounded-md border border-transparent bg-transparent px-1.5 text-[11px] text-muted-foreground placeholder:text-muted-foreground/60 hover:border-border focus:border-border focus:bg-background focus:text-foreground focus:outline-none",disabled:c,onBlur:w,onChange:k=>d(k.target.value),onKeyDown:k=>{k.key==="Enter"&&k.currentTarget.blur()},placeholder:"Add a description...",value:f}),n.jsx(V2,{busy:c,items:g.map(([k,N])=>({key:k,name:k,detail:XU(N),icon:N.kind==="remote"?n.jsx(M0,{}):n.jsx(_u,{})})),label:"MCP servers",onRemove:b}),n.jsx(V2,{busy:c,items:s.skills.map(k=>({key:k.name,name:k.name,icon:n.jsx(Li,{})})),label:"Skills",onRemove:v}),a?n.jsx("p",{className:"text-[11px] text-destructive",children:a}):null]})}function V2({label:e,items:t,busy:s,onRemove:i}){return n.jsxs("section",{children:[n.jsx("h5",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:e}),t.length===0?n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"None."}):n.jsx("ul",{className:"space-y-1",children:t.map(a=>n.jsxs("li",{className:"group/item flex items-start gap-2 rounded-md border border-border/60 bg-background/60 px-2 py-1.5",children:[n.jsx("span",{className:"mt-0.5 text-muted-foreground [&_svg]:size-3.5",children:a.icon}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block text-xs font-medium",children:a.name}),a.detail?n.jsx("span",{className:"block truncate font-mono text-[11px] text-muted-foreground",title:a.detail,children:a.detail}):null]}),n.jsx("button",{className:"rounded p-0.5 text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover/item:opacity-100",disabled:s,onClick:()=>i(a.key),title:"Remove from profile",type:"button",children:n.jsx(qt,{className:"size-3.5"})})]},a.key))})]})}function XU(e){return e.kind==="local"?[e.command,...e.args??[]].join(" ").trim()||"(no command)":`${e.transport} · ${e.url}`}const W2=["claude","codex","antigravity"];function ZU({profiles:e,loading:t,busy:s,onSnapshot:i,onApply:a,onExport:l,onImport:c,onDelete:h,onPublish:f,onChanged:d}){const p=y.useRef(null),[g,b]=y.useState("claude"),[v,w]=y.useState(""),[k,N]=y.useState(null),[E,T]=y.useState(null),A=()=>{const C=v.trim();C&&(i(g,C),w(""))};return n.jsxs("div",{className:"flex min-h-0 min-w-0 flex-col",children:[n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border/60 px-3 py-2",children:[n.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-semibold",children:[n.jsx(zw,{className:"size-3.5 text-muted-foreground"}),"Profiles",e.length>0?n.jsx(We,{size:"small",variant:"outline",children:e.length}):null]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("div",{"aria-label":"Agent to snapshot",className:"flex h-8 items-center gap-0.5 rounded-md border border-border bg-muted/40 p-0.5",role:"radiogroup",children:W2.map(C=>n.jsx("button",{"aria-checked":g===C,className:ae("flex h-full w-8 items-center justify-center rounded transition-colors",g===C?"bg-background shadow-sm":"opacity-40 hover:bg-muted/60 hover:opacity-100"),onClick:()=>b(C),role:"radio",title:`Snapshot ${Zi[C]}`,type:"button",children:n.jsx(Sx,{agent:C,className:"size-4"})},C))}),n.jsx("input",{"aria-label":"New profile name",className:"h-8 w-36 rounded-md border border-border bg-background px-2 text-xs",onChange:C=>w(C.target.value),onKeyDown:C=>{C.key==="Enter"&&A()},placeholder:"profile name",value:v}),n.jsxs(Z,{disabled:s||v.trim().length===0,onClick:A,size:"sm",variant:"outline",children:[n.jsx(LC,{}),"Snapshot"]}),n.jsxs(Z,{disabled:s,onClick:()=>p.current?.click(),size:"sm",variant:"outline",children:[n.jsx(Pf,{}),"Import"]}),n.jsx("input",{accept:".tar.gz,.tgz,application/gzip",className:"hidden",onChange:C=>{const R=C.target.files?.[0];R&&c(R),C.target.value=""},ref:p,type:"file"})]})]}),t?n.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:"Loading profiles..."}):e.length===0?n.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No profiles yet. Snapshot an agent to capture its MCPs and skills as a reusable bundle, or import a shared .tar.gz."}):n.jsx("ul",{className:"min-h-0 flex-1 divide-y divide-border/60 overflow-y-auto",children:e.map(C=>n.jsxs("li",{className:"group",children:[n.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2",children:[n.jsxs("button",{"aria-expanded":E===C.name,className:"flex min-w-0 flex-1 items-center gap-2.5 text-left",onClick:()=>T(E===C.name?null:C.name),type:"button",children:[n.jsx("span",{className:"shrink-0",title:C.sourceAgent?`Snapshot of ${Zi[C.sourceAgent]}`:"Imported profile",children:C.sourceAgent?n.jsx(Sx,{agent:C.sourceAgent,className:"size-4"}):n.jsx(nH,{className:"size-4 text-muted-foreground"})}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"truncate text-xs font-medium",children:C.name}),n.jsxs(We,{size:"small",variant:"outline",children:[C.mcpCount," MCP",C.mcpCount===1?"":"s"]}),n.jsxs(We,{size:"small",variant:"outline",children:[C.skillCount," skill",C.skillCount===1?"":"s"]}),n.jsx(Dn,{className:ae("size-3.5 shrink-0 text-muted-foreground transition-transform",E===C.name?"rotate-90":"opacity-0 group-hover:opacity-100")})]}),C.description&&E!==C.name?n.jsx("span",{className:"block truncate text-[11px] text-muted-foreground",children:C.description}):null]})]}),n.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground",children:HE(C.updatedAt)}),n.jsx(ju,{className:"opacity-100",items:[...W2.map(R=>({label:`Apply to ${Zi[R]}`,onSelect:()=>a(C.name,R)})),{label:"Export .tar.gz",icon:n.jsx(zw,{className:"size-3.5"}),onSelect:()=>l(C.name)},{label:"Publish to registry...",icon:n.jsx(OC,{className:"size-3.5"}),onSelect:()=>f(C.name)},{label:"Delete",icon:n.jsx(Oi,{className:"size-3.5"}),onSelect:()=>N(C.name)}],label:`Actions for ${C.name}`})]}),E===C.name?n.jsx(YU,{name:C.name,onChanged:d}):null]},C.name))}),k?n.jsx(Al,{confirmLabel:"Delete",icon:n.jsx(Oi,{}),message:`Delete profile "${k}"? Agents' live configs are not touched.`,onCancel:()=>N(null),onConfirm:()=>{h(k),N(null)},title:"Delete profile",tone:"danger"}):null]})}function QU({status:e,busy:t,signingIn:s,onSignIn:i,onSignOut:a,onInstall:l}){const[c,h]=y.useState(""),f=()=>{const d=c.trim();d&&(l(d),h(""))};return n.jsxs("div",{className:"flex min-w-0 flex-wrap content-start items-center gap-2 px-3 py-2",children:[n.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-semibold",children:[n.jsx(M0,{className:"size-3.5 text-muted-foreground"}),"Registry"]}),e===null?n.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Checking sign-in..."}):e.signedIn?n.jsxs(n.Fragment,{children:[n.jsx(We,{size:"small",variant:"success",children:e.user?.displayName||e.user?.email||"signed in"}),e.source==="env"?n.jsx("span",{className:"text-[11px] text-muted-foreground",children:"token from environment"}):n.jsxs(Z,{disabled:t,onClick:a,size:"sm",variant:"ghost",children:[n.jsx(SM,{}),"Sign out"]})]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-[11px] text-muted-foreground",children:e.error?`Signed out (${e.error})`:"Signed out"}),n.jsxs(Z,{disabled:s,onClick:i,size:"sm",variant:"outline",children:[n.jsx(_M,{}),s?"Waiting for browser...":"Sign in"]})]}),e&&e.apiMode!=="prod"?n.jsx(We,{size:"small",variant:"warning",children:e.apiMode==="local"?"local registry":e.apiBaseUrl}):null,n.jsx("span",{className:"flex-1"}),n.jsx("input",{"aria-label":"Registry profile slug",className:"h-8 w-44 rounded-md border border-border bg-background px-2 text-xs",onChange:d=>h(d.target.value),onKeyDown:d=>{d.key==="Enter"&&f()},placeholder:"profile slug",value:c}),n.jsxs(Z,{disabled:t||c.trim().length===0,onClick:f,size:"sm",variant:"outline",children:[n.jsx(cu,{}),"Install"]})]})}function JU({count:e,preview:t,applying:s,onUnstage:i,onClear:a,onApply:l}){return e===0?null:n.jsxs("div",{className:"shrink-0 border-t border-border bg-card/95",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border/60 px-3 py-2",children:[n.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-semibold",children:[n.jsx(aM,{className:"size-3.5 text-muted-foreground"}),"Staged changes",n.jsx(We,{size:"small",variant:"outline",children:e})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Z,{disabled:s,onClick:a,size:"sm",variant:"ghost",children:"Clear"}),n.jsx(Z,{disabled:s||t!==null&&!t.valid,onClick:l,size:"sm",children:s?"Applying...":"Save & apply"})]})]}),t===null?n.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:"Validating staged changes..."}):null,n.jsx("ul",{className:"max-h-48 space-y-1 overflow-y-auto p-2",children:(t?.items??[]).map((c,h)=>n.jsxs("li",{className:"flex items-start gap-2 rounded-md border border-border/60 bg-background/60 px-2 py-1.5",children:[n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:`block text-xs ${c.ok?"":"text-destructive"}`,children:c.summary}),c.error?n.jsx("span",{className:"block text-[11px] text-destructive",children:c.error}):null,c.warnings.map(f=>n.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-amber-600 dark:text-amber-500",children:[n.jsx(Rr,{className:"size-3 shrink-0"}),f]},f))]}),n.jsx("button",{"aria-label":"Unstage change",className:"mt-0.5 text-muted-foreground transition-colors hover:text-foreground",disabled:s,onClick:()=>i(h),type:"button",children:n.jsx(qt,{className:"size-3.5"})})]},`${c.summary}-${h}`))}),t&&t.agents.length>0?n.jsx("div",{className:"flex flex-wrap gap-2 border-t border-border/60 px-3 py-2",children:t.agents.map(c=>n.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[n.jsx("span",{className:"font-medium text-foreground",children:c.agent}),c.add.length>0?` +${c.add.length}`:"",c.remove.length>0?` −${c.remove.length}`:""]},c.agent))}):null]})}function eF(){const[e,t]=y.useState([]),[s,i]=y.useState([]),[a,l]=y.useState(null),[c,h]=y.useState(!0),[f,d]=y.useState(null),p=y.useCallback(async()=>{h(!0),d(null);try{const[g,b,v]=await Promise.all([I7(),$7(),H7()]);t(g),i(b),l(v)}catch(g){d(g instanceof Error?g.message:String(g))}finally{h(!1)}},[]);return y.useEffect(()=>{p()},[p]),{agents:e,configs:s,doctor:a,loading:c,error:f,refresh:p}}function tF(e){const[t,s]=y.useState([]),[i,a]=y.useState(!0),[l,c]=y.useState(!1),[h,f]=y.useState(null),d=hs(),p=y.useCallback(async()=>{try{s(await W7())}catch{}finally{a(!1)}},[]);y.useEffect(()=>{p()},[p]);const g=y.useCallback(async A=>{if(!l){c(!0);try{await A()}catch(C){d.error(C instanceof Error?C.message:String(C))}finally{c(!1)}}},[l,d]),b=y.useCallback((A,C)=>g(async()=>{const R=await Z7({agent:A,name:C});d.success(`Snapshotted ${A} into "${R.name}" (${Object.keys(R.mcps).length} MCPs, ${R.skills.length} skills)`),await p()}),[p,g,d]),v=y.useCallback((A,C)=>g(async()=>{const R=await Q7(A,C),L=new Set(R.items.filter(H=>H.status==="conflict").map(H=>`${H.category}:${H.name}`));f({preview:R,skipped:L})}),[g]),w=y.useCallback(A=>{f(C=>{if(!C)return C;const R=new Set(C.skipped);return R.has(A)?R.delete(A):R.add(A),{...C,skipped:R}})},[]),k=y.useCallback(()=>g(async()=>{if(!h)return;const{preview:A,skipped:C}=h,R=await J7({name:A.profile,agent:A.agent,skip:{mcps:A.items.filter(L=>L.category==="mcp"&&C.has(`mcp:${L.name}`)).map(L=>L.name),skills:A.items.filter(L=>L.category==="skill"&&C.has(`skill:${L.name}`)).map(L=>L.name)}});f(null),d.success(`Applied "${R.profile}" to ${R.agent}: ${R.mcpsApplied.length} MCPs, ${R.skillsApplied.length} skills — ${R.backups.length} backup${R.backups.length===1?"":"s"} written`),e()}),[e,h,g,d]),N=y.useCallback(A=>g(async()=>{const{archivePath:C}=await eL(A);d.message({text:`Exported to ${C} (credentials redacted)`,preserve:!0})}),[g,d]),E=y.useCallback(A=>g(async()=>{try{const C=await Vw(A);d.success(K2(C.name,C.missingCredentials.length)),await p()}catch(C){if(!(C instanceof Error?C.message:String(C)).includes("already exists"))throw C;const L=await Vw(A,{force:!0});d.success(`${K2(L.name,L.missingCredentials.length)} (overwrote existing)`),await p()}}),[p,g,d]),T=y.useCallback(A=>g(async()=>{await X7(A),d.success(`Deleted profile "${A}"`),await p()}),[p,g,d]);return{profiles:t,loading:i,busy:l,pendingApply:h,refresh:p,snapshot:b,startApply:v,toggleSkip:w,confirmApply:k,cancelApply:()=>f(null),exportOne:N,importArchive:E,deleteOne:T}}function K2(e,t){return t>0?`Imported "${e}" — ${t} credential${t===1?"":"s"} still needed`:`Imported "${e}"`}const sF=1500,nF=300*1e3;function iF(e){const[t,s]=y.useState(null),[i,a]=y.useState(!1),[l,c]=y.useState(!1),h=y.useRef(!1),f=hs(),d=y.useCallback(async()=>{try{s(await tL())}catch{}},[]);y.useEffect(()=>(d(),()=>{h.current=!0}),[d]);const p=y.useCallback(async()=>{if(!l){c(!0);try{const{url:k,state:N}=await sL();window.open(k,"_blank","noopener");const E=Date.now()+nF;for(;Date.now()<E&&!h.current;){await new Promise(A=>setTimeout(A,sF));const T=await nL(N).catch(()=>null);if(!(!T||T.status==="pending")){T.status==="success"?f.success("Signed in to the profile registry"):f.error(T.message??"Registry sign-in failed"),await d();return}}h.current||f.error("Registry sign-in timed out")}catch(k){f.error(k instanceof Error?k.message:String(k))}finally{c(!1)}}},[d,l,f]),g=y.useCallback(async k=>{if(i)return!1;a(!0);try{return await k(),!0}catch(N){return f.error(N instanceof Error?N.message:String(N)),!1}finally{a(!1)}},[i,f]),b=y.useCallback(()=>g(async()=>{await iL(),f.success("Signed out of the profile registry"),await d()}),[d,g,f]),v=y.useCallback(k=>g(async()=>{try{const N=await Ww({slug:k});f.success(Y2(N.name,N.missingCredentials.length))}catch(N){if(!(N instanceof Error?N.message:String(N)).includes("already exists"))throw N;const T=await Ww({slug:k,force:!0});f.success(`${Y2(T.name,T.missingCredentials.length)} (overwrote existing)`)}e()}),[e,g,f]),w=y.useCallback(k=>g(async()=>{const N=await rL(k);f.message({text:`Published "${N.slug}" v${N.version} to the registry (credentials redacted)`,preserve:!0})}),[g,f]);return{status:t,busy:i,signingIn:l,refreshStatus:d,signIn:p,signOut:b,install:v,publish:w}}function Y2(e,t){return t>0?`Installed "${e}" — ${t} credential${t===1?"":"s"} still needed`:`Installed "${e}" from the registry`}function rF(e,t){return e.category===t.category&&e.action===t.action&&e.name===t.name&&e.sourceAgent===t.sourceAgent&&e.sourceScope===t.sourceScope&&e.targetAgent===t.targetAgent&&e.targetScope===t.targetScope}function aF(e){const[t,s]=y.useState([]),[i,a]=y.useState(null),[l,c]=y.useState(!1),h=hs(),f=y.useCallback(b=>{s(v=>v.some(w=>rF(w,b))?v:[...v,b])},[]),d=y.useCallback(b=>{s(v=>v.filter((w,k)=>k!==b))},[]),p=y.useCallback(()=>s([]),[]);y.useEffect(()=>{if(t.length===0){a(null);return}let b=!1;return U7(t).then(v=>{b||a(v)}).catch(v=>{b||a({valid:!1,agents:[],items:t.map(w=>({change:w,ok:!1,summary:`${w.action} ${w.category} "${w.name}"`,warnings:[],error:v instanceof Error?v.message:String(v)}))})}),()=>{b=!0}},[t]);const g=y.useCallback(async()=>{if(!(t.length===0||l)){c(!0);try{const b=await F7(t);if(b.ok)h.success(`Applied ${b.applied} change${b.applied===1?"":"s"} — ${b.backups.length} backup${b.backups.length===1?"":"s"} written`),s([]);else{const v=b.results.find(w=>w.error)?.error;h.error(`Applied ${b.applied} of ${t.length} changes${v?` — ${v}`:""}`),s(w=>w.slice(b.applied))}b.applied>0&&e()}catch(b){h.error(b instanceof Error?b.message:String(b))}finally{c(!1)}}},[l,e,t,h]);return{staged:t,preview:i,applying:l,stage:f,unstage:d,clear:p,apply:g}}function oF(){const{agents:e,configs:t,doctor:s,loading:i,error:a,refresh:l}=eF();jl(l);const{staged:c,preview:h,applying:f,stage:d,unstage:p,clear:g,apply:b}=aF(l),v=tF(l),w=iF(v.refresh),[k,N]=y.useState(null),[E,T]=y.useState("agents"),A=new Map(e.map(R=>[R.agent,R])),C=s?.checks.filter(R=>R.status!=="ok")??[];return n.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[n.jsxs("header",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b border-border px-3 py-2",children:[n.jsx(O0,{className:"size-4 text-muted-foreground"}),n.jsx("span",{className:"text-sm font-semibold",children:"Agent Environments"}),n.jsx("div",{className:"ml-2 flex items-center gap-0.5 rounded-md border border-border bg-muted/40 p-0.5",children:["agents","profiles"].map(R=>n.jsxs("button",{className:ae("flex h-6 items-center gap-1.5 rounded px-2.5 text-xs font-medium transition-colors",E===R?"bg-background shadow-sm":"text-muted-foreground hover:bg-muted/60 hover:text-foreground"),onClick:()=>T(R),type:"button",children:[R==="agents"?"Agents":"Profiles",R==="profiles"&&v.profiles.length>0?n.jsx("span",{className:"text-[10px] tabular-nums text-muted-foreground",children:v.profiles.length}):null]},R))}),C.length>0?n.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsxs("span",{className:"ml-2 flex items-center gap-1 text-xs font-medium text-muted-foreground",children:[n.jsx(k8,{className:"size-3.5"}),"Doctor"]}),C.map(R=>n.jsx(We,{size:"small",variant:"warning",children:R.message},R.message))]}):null]}),a?n.jsx(Je,{className:"m-3 shrink-0",variant:"muted",children:a}):null,E==="profiles"?n.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-1 divide-y divide-border lg:grid-cols-[minmax(0,3fr)_minmax(0,2fr)] lg:divide-x lg:divide-y-0",children:[n.jsx(ZU,{busy:v.busy,loading:v.loading,onApply:v.startApply,onChanged:v.refresh,onDelete:v.deleteOne,onExport:v.exportOne,onImport:v.importArchive,onPublish:N,onSnapshot:v.snapshot,profiles:v.profiles}),n.jsx(QU,{busy:w.busy,onInstall:w.install,onSignIn:()=>{w.signIn()},onSignOut:w.signOut,signingIn:w.signingIn,status:w.status})]}):t.length>0?n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-4",children:n.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:t.map(R=>n.jsx(GU,{availability:A.get(R.agent),config:R,onStage:d},R.agent))})}):n.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center p-8 text-center",children:n.jsx("p",{className:"max-w-sm text-xs text-muted-foreground",children:i?"Reading agent configurations...":a?null:"No agent configurations found. Agent Environments reads Claude Code, Codex CLI, and Antigravity configs from your home directory."})}),n.jsx(JU,{applying:f,count:c.length,onApply:()=>{b()},onClear:g,onUnstage:p,preview:h}),k?n.jsx(KU,{busy:w.busy,onCancel:()=>N(null),onConfirm:R=>{w.publish(R).then(L=>{L&&N(null)})},profileName:k}):null,v.pendingApply?n.jsx(WU,{busy:v.busy,onCancel:v.cancelApply,onConfirm:()=>{v.confirmApply()},onToggle:v.toggleSkip,pending:v.pendingApply}):null]})}function Zn({children:e,icon:t,onClose:s,title:i,size:a="md"}){return y.useEffect(()=>{function l(c){c.key==="Escape"&&s()}return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[s]),nr.createPortal(n.jsx("div",{className:"fixed inset-0 z-[1000] grid place-items-center bg-black/35 px-4",onMouseDown:s,children:n.jsxs("div",{"aria-modal":"true",className:`flex max-h-[min(820px,calc(100vh-2rem))] w-full flex-col overflow-hidden rounded-lg border border-border bg-card shadow-xl ${a==="xl"?"max-w-[min(1400px,calc(100vw-2rem))]":a==="lg"?"max-w-3xl":"max-w-lg"}`,onMouseDown:l=>l.stopPropagation(),role:"dialog",children:[n.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[n.jsx("div",{className:"flex size-8 items-center justify-center rounded-md border border-border bg-background text-foreground [&_svg]:size-4",children:t}),n.jsx("h2",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:i}),n.jsx(Z,{"aria-label":"Close dialog",onClick:s,size:"icon",type:"button",variant:"ghost",children:n.jsx(qt,{})})]}),n.jsx("div",{className:"min-h-0 overflow-auto p-4",children:e})]})}),document.body)}function ft({className:e,type:t,...s}){return n.jsx("input",{type:t,className:ae("flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),...s})}const lF={top:"bottom-full left-1/2 mb-1.5 -translate-x-1/2",bottom:"top-full left-1/2 mt-1.5 -translate-x-1/2",left:"right-full top-1/2 mr-1.5 -translate-y-1/2",right:"left-full top-1/2 ml-1.5 -translate-y-1/2"};function pl({label:e,children:t,side:s="bottom",className:i}){return n.jsxs("span",{className:ae("group/tt relative inline-flex",i),children:[t,n.jsx("span",{role:"tooltip",className:ae("pointer-events-none absolute z-[1100] whitespace-nowrap rounded-md bg-foreground px-2 py-1 text-xs font-medium text-background shadow-md","opacity-0 transition-opacity duration-150 group-hover/tt:opacity-100",lF[s]),children:e})]})}const cF="application/x-nomoreide-path";function Au(e,t){return`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`}function I3(e,t){e.setData(cF,t)}function $3(e){return{draggable:!0,onDragStart:t=>{I3(t.dataTransfer,e),t.dataTransfer.effectAllowed="copy"}}}const _i='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>',wi='</title><path d="',Si='"/></svg>',uF={title:".NET",slug:"dotnet",get svg(){return _i+".NET"+wi+this.path+Si},path:"M24 8.77h-2.468v7.565h-1.425V8.77h-2.462V7.53H24zm-6.852 7.565h-4.821V7.53h4.63v1.24h-3.205v2.494h2.953v1.234h-2.953v2.604h3.396zm-6.708 0H8.882L4.78 9.863a2.896 2.896 0 0 1-.258-.51h-.036c.032.189.048.592.048 1.21v5.772H3.157V7.53h1.659l3.965 6.32c.167.261.275.442.323.54h.024c-.04-.233-.06-.629-.06-1.185V7.529h1.372zm-8.703-.693a.868.829 0 0 1-.869.829.868.829 0 0 1-.868-.83.868.829 0 0 1 .868-.828.868.829 0 0 1 .869.829Z",source:"https://github.com/dotnet/brand/blob/c7d0f51b8ec59531332d05fb27a5b758a7a3d689/logo/dotnet-logo.svg",hex:"512BD4",guidelines:"https://github.com/dotnet/brand/blob/c7d0f51b8ec59531332d05fb27a5b758a7a3d689/dotnet-styleGuide-2024.pdf",license:{type:"CC0-1.0",url:"https://spdx.org/licenses/CC0-1.0"}},dF={title:"Bun",slug:"bun",get svg(){return _i+"Bun"+wi+this.path+Si},path:"M12 22.596c6.628 0 12-4.338 12-9.688 0-3.318-2.057-6.248-5.219-7.986-1.286-.715-2.297-1.357-3.139-1.89C14.058 2.025 13.08 1.404 12 1.404c-1.097 0-2.334.785-3.966 1.821a49.92 49.92 0 0 1-2.816 1.697C2.057 6.66 0 9.59 0 12.908c0 5.35 5.372 9.687 12 9.687v.001ZM10.599 4.715c.334-.759.503-1.58.498-2.409 0-.145.202-.187.23-.029.658 2.783-.902 4.162-2.057 4.624-.124.048-.199-.121-.103-.209a5.763 5.763 0 0 0 1.432-1.977Zm2.058-.102a5.82 5.82 0 0 0-.782-2.306v-.016c-.069-.123.086-.263.185-.172 1.962 2.111 1.307 4.067.556 5.051-.082.103-.23-.003-.189-.126a5.85 5.85 0 0 0 .23-2.431Zm1.776-.561a5.727 5.727 0 0 0-1.612-1.806v-.014c-.112-.085-.024-.274.114-.218 2.595 1.087 2.774 3.18 2.459 4.407a.116.116 0 0 1-.049.071.11.11 0 0 1-.153-.026.122.122 0 0 1-.022-.083 5.891 5.891 0 0 0-.737-2.331Zm-5.087.561c-.617.546-1.282.76-2.063 1-.117 0-.195-.078-.156-.181 1.752-.909 2.376-1.649 2.999-2.778 0 0 .155-.118.188.085 0 .304-.349 1.329-.968 1.874Zm4.945 11.237a2.957 2.957 0 0 1-.937 1.553c-.346.346-.8.565-1.286.62a2.178 2.178 0 0 1-1.327-.62 2.955 2.955 0 0 1-.925-1.553.244.244 0 0 1 .064-.198.234.234 0 0 1 .193-.069h3.965a.226.226 0 0 1 .19.07c.05.053.073.125.063.197Zm-5.458-2.176a1.862 1.862 0 0 1-2.384-.245 1.98 1.98 0 0 1-.233-2.447c.207-.319.503-.566.848-.713a1.84 1.84 0 0 1 1.092-.11c.366.075.703.261.967.531a1.98 1.98 0 0 1 .408 2.114 1.931 1.931 0 0 1-.698.869v.001Zm8.495.005a1.86 1.86 0 0 1-2.381-.253 1.964 1.964 0 0 1-.547-1.366c0-.384.11-.76.32-1.079.207-.319.503-.567.849-.713a1.844 1.844 0 0 1 1.093-.108c.367.076.704.262.968.534a1.98 1.98 0 0 1 .4 2.117 1.932 1.932 0 0 1-.702.868Z",source:"https://bun.sh/press-kit",hex:"000000"},hF={title:"Deno",slug:"deno",get svg(){return _i+"Deno"+wi+this.path+Si},path:"M1.105 18.02A11.9 11.9 0 0 1 0 12.985q0-.698.078-1.376a12 12 0 0 1 .231-1.34A12 12 0 0 1 4.025 4.02a12 12 0 0 1 5.46-2.771 12 12 0 0 1 3.428-.23c1.452.112 2.825.477 4.077 1.05a12 12 0 0 1 2.78 1.774 12.02 12.02 0 0 1 4.053 7.078A12 12 0 0 1 24 12.985q0 .454-.036.914a12 12 0 0 1-.728 3.305 12 12 0 0 1-2.38 3.875c-1.33 1.357-3.02 1.962-4.43 1.936a4.4 4.4 0 0 1-2.724-1.024c-.99-.853-1.391-1.83-1.53-2.919a5 5 0 0 1 .128-1.518c.105-.38.37-1.116.76-1.437-.455-.197-1.04-.624-1.226-.829-.045-.05-.04-.13 0-.183a.155.155 0 0 1 .177-.053c.392.134.869.267 1.372.35.66.111 1.484.25 2.317.292 2.03.1 4.153-.813 4.812-2.627s.403-3.609-1.96-4.685-3.454-2.356-5.363-3.128c-1.247-.505-2.636-.205-4.06.582-3.838 2.121-7.277 8.822-5.69 15.032a.191.191 0 0 1-.315.19 12 12 0 0 1-1.25-1.634 12 12 0 0 1-.769-1.404M11.57 6.087c.649-.051 1.214.501 1.31 1.236.13.979-.228 1.99-1.41 2.013-1.01.02-1.315-.997-1.248-1.614.066-.616.574-1.575 1.35-1.635",source:"https://github.com/denoland/docs/blob/5dee713844c7447f80acd4093caa9d350d80bf36/static/img/logo.svg",hex:"000000",guidelines:"https://deno.com/brand",license:{type:"MIT",url:"https://spdx.org/licenses/MIT"}},fF={title:"Docker",slug:"docker",get svg(){return _i+"Docker"+wi+this.path+Si},path:"M13.983 11.078h2.119a.186.186 0 00.186-.185V9.006a.186.186 0 00-.186-.186h-2.119a.185.185 0 00-.185.185v1.888c0 .102.083.185.185.185m-2.954-5.43h2.118a.186.186 0 00.186-.186V3.574a.186.186 0 00-.186-.185h-2.118a.185.185 0 00-.185.185v1.888c0 .102.082.185.185.185m0 2.716h2.118a.187.187 0 00.186-.186V6.29a.186.186 0 00-.186-.185h-2.118a.185.185 0 00-.185.185v1.887c0 .102.082.185.185.186m-2.93 0h2.12a.186.186 0 00.184-.186V6.29a.185.185 0 00-.185-.185H8.1a.185.185 0 00-.185.185v1.887c0 .102.083.185.185.186m-2.964 0h2.119a.186.186 0 00.185-.186V6.29a.185.185 0 00-.185-.185H5.136a.186.186 0 00-.186.185v1.887c0 .102.084.185.186.186m5.893 2.715h2.118a.186.186 0 00.186-.185V9.006a.186.186 0 00-.186-.186h-2.118a.185.185 0 00-.185.185v1.888c0 .102.082.185.185.185m-2.93 0h2.12a.185.185 0 00.184-.185V9.006a.185.185 0 00-.184-.186h-2.12a.185.185 0 00-.184.185v1.888c0 .102.083.185.185.185m-2.964 0h2.119a.185.185 0 00.185-.185V9.006a.185.185 0 00-.184-.186h-2.12a.186.186 0 00-.186.186v1.887c0 .102.084.185.186.185m-2.92 0h2.12a.185.185 0 00.184-.185V9.006a.185.185 0 00-.184-.186h-2.12a.185.185 0 00-.184.185v1.888c0 .102.082.185.185.185M23.763 9.89c-.065-.051-.672-.51-1.954-.51-.338.001-.676.03-1.01.087-.248-1.7-1.653-2.53-1.716-2.566l-.344-.199-.226.327c-.284.438-.49.922-.612 1.43-.23.97-.09 1.882.403 2.661-.595.332-1.55.413-1.744.42H.751a.751.751 0 00-.75.748 11.376 11.376 0 00.692 4.062c.545 1.428 1.355 2.48 2.41 3.124 1.18.723 3.1 1.137 5.275 1.137.983.003 1.963-.086 2.93-.266a12.248 12.248 0 003.823-1.389c.98-.567 1.86-1.288 2.61-2.136 1.252-1.418 1.998-2.997 2.553-4.4h.221c1.372 0 2.215-.549 2.68-1.009.309-.293.55-.65.707-1.046l.098-.288Z",source:"https://www.docker.com/company/newsroom/media-resources",hex:"2496ED"},mF={title:"Go",slug:"go",get svg(){return _i+"Go"+wi+this.path+Si},path:"M1.811 10.231c-.047 0-.058-.023-.035-.059l.246-.315c.023-.035.081-.058.128-.058h4.172c.046 0 .058.035.035.07l-.199.303c-.023.036-.082.07-.117.07zM.047 11.306c-.047 0-.059-.023-.035-.058l.245-.316c.023-.035.082-.058.129-.058h5.328c.047 0 .07.035.058.07l-.093.28c-.012.047-.058.07-.105.07zm2.828 1.075c-.047 0-.059-.035-.035-.07l.163-.292c.023-.035.07-.07.117-.07h2.337c.047 0 .07.035.07.082l-.023.28c0 .047-.047.082-.082.082zm12.129-2.36c-.736.187-1.239.327-1.963.514-.176.046-.187.058-.34-.117-.174-.199-.303-.327-.548-.444-.737-.362-1.45-.257-2.115.175-.795.514-1.204 1.274-1.192 2.22.011.935.654 1.706 1.577 1.835.795.105 1.46-.175 1.987-.77.105-.13.198-.27.315-.434H10.47c-.245 0-.304-.152-.222-.35.152-.362.432-.97.596-1.274a.315.315 0 01.292-.187h4.253c-.023.316-.023.631-.07.947a4.983 4.983 0 01-.958 2.29c-.841 1.11-1.94 1.8-3.33 1.986-1.145.152-2.209-.07-3.143-.77-.865-.655-1.356-1.52-1.484-2.595-.152-1.274.222-2.419.993-3.424.83-1.086 1.928-1.776 3.272-2.02 1.098-.2 2.15-.07 3.096.571.62.41 1.063.97 1.356 1.648.07.105.023.164-.117.2m3.868 6.461c-1.064-.024-2.034-.328-2.852-1.029a3.665 3.665 0 01-1.262-2.255c-.21-1.32.152-2.489.947-3.529.853-1.122 1.881-1.706 3.272-1.95 1.192-.21 2.314-.095 3.33.595.923.63 1.496 1.484 1.648 2.605.198 1.578-.257 2.863-1.344 3.962-.771.783-1.718 1.273-2.805 1.495-.315.06-.63.07-.934.106zm2.78-4.72c-.011-.153-.011-.27-.034-.387-.21-1.157-1.274-1.81-2.384-1.554-1.087.245-1.788.935-2.045 2.033-.21.912.234 1.835 1.075 2.21.643.28 1.285.244 1.905-.07.923-.48 1.425-1.228 1.484-2.233z",source:"https://blog.golang.org/go-brand",hex:"00ADD8",guidelines:"https://blog.golang.org/go-brand"},pF={title:"Node.js",slug:"nodedotjs",get svg(){return _i+"Node.js"+wi+this.path+Si},path:"M11.998,24c-0.321,0-0.641-0.084-0.922-0.247l-2.936-1.737c-0.438-0.245-0.224-0.332-0.08-0.383 c0.585-0.203,0.703-0.25,1.328-0.604c0.065-0.037,0.151-0.023,0.218,0.017l2.256,1.339c0.082,0.045,0.197,0.045,0.272,0l8.795-5.076 c0.082-0.047,0.134-0.141,0.134-0.238V6.921c0-0.099-0.053-0.192-0.137-0.242l-8.791-5.072c-0.081-0.047-0.189-0.047-0.271,0 L3.075,6.68C2.99,6.729,2.936,6.825,2.936,6.921v10.15c0,0.097,0.054,0.189,0.139,0.235l2.409,1.392 c1.307,0.654,2.108-0.116,2.108-0.89V7.787c0-0.142,0.114-0.253,0.256-0.253h1.115c0.139,0,0.255,0.112,0.255,0.253v10.021 c0,1.745-0.95,2.745-2.604,2.745c-0.508,0-0.909,0-2.026-0.551L2.28,18.675c-0.57-0.329-0.922-0.945-0.922-1.604V6.921 c0-0.659,0.353-1.275,0.922-1.603l8.795-5.082c0.557-0.315,1.296-0.315,1.848,0l8.794,5.082c0.57,0.329,0.924,0.944,0.924,1.603 v10.15c0,0.659-0.354,1.273-0.924,1.604l-8.794,5.078C12.643,23.916,12.324,24,11.998,24z M19.099,13.993 c0-1.9-1.284-2.406-3.987-2.763c-2.731-0.361-3.009-0.548-3.009-1.187c0-0.528,0.235-1.233,2.258-1.233 c1.807,0,2.473,0.389,2.747,1.607c0.024,0.115,0.129,0.199,0.247,0.199h1.141c0.071,0,0.138-0.031,0.186-0.081 c0.048-0.054,0.074-0.123,0.067-0.196c-0.177-2.098-1.571-3.076-4.388-3.076c-2.508,0-4.004,1.058-4.004,2.833 c0,1.925,1.488,2.457,3.895,2.695c2.88,0.282,3.103,0.703,3.103,1.269c0,0.983-0.789,1.402-2.642,1.402 c-2.327,0-2.839-0.584-3.011-1.742c-0.02-0.124-0.126-0.215-0.253-0.215h-1.137c-0.141,0-0.254,0.112-0.254,0.253 c0,1.482,0.806,3.248,4.655,3.248C17.501,17.007,19.099,15.91,19.099,13.993z",source:"https://nodejs.org/en/about/branding",hex:"5FA04E",guidelines:"https://nodejs.org/en/about/branding"},gF={title:"npm",slug:"npm",get svg(){return _i+"npm"+wi+this.path+Si},path:"M1.763 0C.786 0 0 .786 0 1.763v20.474C0 23.214.786 24 1.763 24h20.474c.977 0 1.763-.786 1.763-1.763V1.763C24 .786 23.214 0 22.237 0zM5.13 5.323l13.837.019-.009 13.836h-3.464l.01-10.382h-3.456L12.04 19.17H5.113z",source:"https://www.npmjs.com",hex:"CB3837",guidelines:"https://docs.npmjs.com/policies/logos-and-usage"},bF={title:"pnpm",slug:"pnpm",get svg(){return _i+"pnpm"+wi+this.path+Si},path:"M0 0v7.5h7.5V0zm8.25 0v7.5h7.498V0zm8.25 0v7.5H24V0zM2 2h3.5v3.5H2zm8.25 0h3.498v3.5H10.25zm8.25 0H22v3.5h-3.5zM8.25 8.25v7.5h7.498v-7.5zm8.25 0v7.5H24v-7.5zm2 2H22v3.5h-3.5zM0 16.5V24h7.5v-7.5zm8.25 0V24h7.498v-7.5zm8.25 0V24H24v-7.5z",source:"https://pnpm.io/logos",hex:"F69220"},xF={title:"Python",slug:"python",get svg(){return _i+"Python"+wi+this.path+Si},path:"M14.25.18l.9.2.73.26.59.3.45.32.34.34.25.34.16.33.1.3.04.26.02.2-.01.13V8.5l-.05.63-.13.55-.21.46-.26.38-.3.31-.33.25-.35.19-.35.14-.33.1-.3.07-.26.04-.21.02H8.77l-.69.05-.59.14-.5.22-.41.27-.33.32-.27.35-.2.36-.15.37-.1.35-.07.32-.04.27-.02.21v3.06H3.17l-.21-.03-.28-.07-.32-.12-.35-.18-.36-.26-.36-.36-.35-.46-.32-.59-.28-.73-.21-.88-.14-1.05-.05-1.23.06-1.22.16-1.04.24-.87.32-.71.36-.57.4-.44.42-.33.42-.24.4-.16.36-.1.32-.05.24-.01h.16l.06.01h8.16v-.83H6.18l-.01-2.75-.02-.37.05-.34.11-.31.17-.28.25-.26.31-.23.38-.2.44-.18.51-.15.58-.12.64-.1.71-.06.77-.04.84-.02 1.27.05zm-6.3 1.98l-.23.33-.08.41.08.41.23.34.33.22.41.09.41-.09.33-.22.23-.34.08-.41-.08-.41-.23-.33-.33-.22-.41-.09-.41.09zm13.09 3.95l.28.06.32.12.35.18.36.27.36.35.35.47.32.59.28.73.21.88.14 1.04.05 1.23-.06 1.23-.16 1.04-.24.86-.32.71-.36.57-.4.45-.42.33-.42.24-.4.16-.36.09-.32.05-.24.02-.16-.01h-8.22v.82h5.84l.01 2.76.02.36-.05.34-.11.31-.17.29-.25.25-.31.24-.38.2-.44.17-.51.15-.58.13-.64.09-.71.07-.77.04-.84.01-1.27-.04-1.07-.14-.9-.2-.73-.25-.59-.3-.45-.33-.34-.34-.25-.34-.16-.33-.1-.3-.04-.25-.02-.2.01-.13v-5.34l.05-.64.13-.54.21-.46.26-.38.3-.32.33-.24.35-.2.35-.14.33-.1.3-.06.26-.04.21-.02.13-.01h5.84l.69-.05.59-.14.5-.21.41-.28.33-.32.27-.35.2-.36.15-.36.1-.35.07-.32.04-.28.02-.21V6.07h2.09l.14.01zm-6.47 14.25l-.23.33-.08.41.08.41.23.33.33.23.41.08.41-.08.33-.23.23-.33.08-.41-.08-.41-.23-.33-.33-.23-.41-.08-.41.08z",source:"https://www.python.org/community/logos/",hex:"3776AB",guidelines:"https://www.python.org/community/logos/"},X2={title:"Rust",slug:"rust",get svg(){return _i+"Rust"+wi+this.path+Si},path:"M23.8346 11.7033l-1.0073-.6236a13.7268 13.7268 0 00-.0283-.2936l.8656-.8069a.3483.3483 0 00-.1154-.578l-1.1066-.414a8.4958 8.4958 0 00-.087-.2856l.6904-.9587a.3462.3462 0 00-.2257-.5446l-1.1663-.1894a9.3574 9.3574 0 00-.1407-.2622l.49-1.0761a.3437.3437 0 00-.0274-.3361.3486.3486 0 00-.3006-.154l-1.1845.0416a6.7444 6.7444 0 00-.1873-.2268l.2723-1.153a.3472.3472 0 00-.417-.4172l-1.1532.2724a14.0183 14.0183 0 00-.2278-.1873l.0415-1.1845a.3442.3442 0 00-.49-.328l-1.076.491c-.0872-.0476-.1742-.0952-.2623-.1407l-.1903-1.1673A.3483.3483 0 0016.256.955l-.9597.6905a8.4867 8.4867 0 00-.2855-.086l-.414-1.1066a.3483.3483 0 00-.5781-.1154l-.8069.8666a9.2936 9.2936 0 00-.2936-.0284L12.2946.1683a.3462.3462 0 00-.5892 0l-.6236 1.0073a13.7383 13.7383 0 00-.2936.0284L9.9803.3374a.3462.3462 0 00-.578.1154l-.4141 1.1065c-.0962.0274-.1903.0567-.2855.086L7.744.955a.3483.3483 0 00-.5447.2258L7.009 2.348a9.3574 9.3574 0 00-.2622.1407l-1.0762-.491a.3462.3462 0 00-.49.328l.0416 1.1845a7.9826 7.9826 0 00-.2278.1873L3.8413 3.425a.3472.3472 0 00-.4171.4171l.2713 1.1531c-.0628.075-.1255.1509-.1863.2268l-1.1845-.0415a.3462.3462 0 00-.328.49l.491 1.0761a9.167 9.167 0 00-.1407.2622l-1.1662.1894a.3483.3483 0 00-.2258.5446l.6904.9587a13.303 13.303 0 00-.087.2855l-1.1065.414a.3483.3483 0 00-.1155.5781l.8656.807a9.2936 9.2936 0 00-.0283.2935l-1.0073.6236a.3442.3442 0 000 .5892l1.0073.6236c.008.0982.0182.1964.0283.2936l-.8656.8079a.3462.3462 0 00.1155.578l1.1065.4141c.0273.0962.0567.1914.087.2855l-.6904.9587a.3452.3452 0 00.2268.5447l1.1662.1893c.0456.088.0922.1751.1408.2622l-.491 1.0762a.3462.3462 0 00.328.49l1.1834-.0415c.0618.0769.1235.1528.1873.2277l-.2713 1.1541a.3462.3462 0 00.4171.4161l1.153-.2713c.075.0638.151.1255.2279.1863l-.0415 1.1845a.3442.3442 0 00.49.327l1.0761-.49c.087.0486.1741.0951.2622.1407l.1903 1.1662a.3483.3483 0 00.5447.2268l.9587-.6904a9.299 9.299 0 00.2855.087l.414 1.1066a.3452.3452 0 00.5781.1154l.8079-.8656c.0972.0111.1954.0203.2936.0294l.6236 1.0073a.3472.3472 0 00.5892 0l.6236-1.0073c.0982-.0091.1964-.0183.2936-.0294l.8069.8656a.3483.3483 0 00.578-.1154l.4141-1.1066a8.4626 8.4626 0 00.2855-.087l.9587.6904a.3452.3452 0 00.5447-.2268l.1903-1.1662c.088-.0456.1751-.0931.2622-.1407l1.0762.49a.3472.3472 0 00.49-.327l-.0415-1.1845a6.7267 6.7267 0 00.2267-.1863l1.1531.2713a.3472.3472 0 00.4171-.416l-.2713-1.1542c.0628-.0749.1255-.1508.1863-.2278l1.1845.0415a.3442.3442 0 00.328-.49l-.49-1.076c.0475-.0872.0951-.1742.1407-.2623l1.1662-.1893a.3483.3483 0 00.2258-.5447l-.6904-.9587.087-.2855 1.1066-.414a.3462.3462 0 00.1154-.5781l-.8656-.8079c.0101-.0972.0202-.1954.0283-.2936l1.0073-.6236a.3442.3442 0 000-.5892zm-6.7413 8.3551a.7138.7138 0 01.2986-1.396.714.714 0 11-.2997 1.396zm-.3422-2.3142a.649.649 0 00-.7715.5l-.3573 1.6685c-1.1035.501-2.3285.7795-3.6193.7795a8.7368 8.7368 0 01-3.6951-.814l-.3574-1.6684a.648.648 0 00-.7714-.499l-1.473.3158a8.7216 8.7216 0 01-.7613-.898h7.1676c.081 0 .1356-.0141.1356-.088v-2.536c0-.074-.0536-.0881-.1356-.0881h-2.0966v-1.6077h2.2677c.2065 0 1.1065.0587 1.394 1.2088.0901.3533.2875 1.5044.4232 1.8729.1346.413.6833 1.2381 1.2685 1.2381h3.5716a.7492.7492 0 00.1296-.0131 8.7874 8.7874 0 01-.8119.9526zM6.8369 20.024a.714.714 0 11-.2997-1.396.714.714 0 01.2997 1.396zM4.1177 8.9972a.7137.7137 0 11-1.304.5791.7137.7137 0 011.304-.579zm-.8352 1.9813l1.5347-.6824a.65.65 0 00.33-.8585l-.3158-.7147h1.2432v5.6025H3.5669a8.7753 8.7753 0 01-.2834-3.348zm6.7343-.5437V8.7836h2.9601c.153 0 1.0792.1772 1.0792.8697 0 .575-.7107.7815-1.2948.7815zm10.7574 1.4862c0 .2187-.008.4363-.0243.651h-.9c-.09 0-.1265.0586-.1265.1477v.413c0 .973-.5487 1.1846-1.0296 1.2382-.4576.0517-.9648-.1913-1.0275-.4717-.2704-1.5186-.7198-1.8436-1.4305-2.4034.8817-.5599 1.799-1.386 1.799-2.4915 0-1.1936-.819-1.9458-1.3769-2.3153-.7825-.5163-1.6491-.6195-1.883-.6195H5.4682a8.7651 8.7651 0 014.907-2.7699l1.0974 1.151a.648.648 0 00.9182.0213l1.227-1.1743a8.7753 8.7753 0 016.0044 4.2762l-.8403 1.8982a.652.652 0 00.33.8585l1.6178.7188c.0283.2875.0425.577.0425.8717zm-9.3006-9.5993a.7128.7128 0 11.984 1.0316.7137.7137 0 01-.984-1.0316zm8.3389 6.71a.7107.7107 0 01.9395-.3625.7137.7137 0 11-.9405.3635z",source:"https://www.rust-lang.org",hex:"000000",guidelines:"https://www.rust-lang.org/policies/media-guide",license:{type:"CC-BY-SA-4.0",url:"https://spdx.org/licenses/CC-BY-SA-4.0"}},vF={title:"Vite",slug:"vite",get svg(){return _i+"Vite"+wi+this.path+Si},path:"M13.056 23.238a.57.57 0 0 1-1.02-.355v-5.202c0-.63-.512-1.143-1.144-1.143H5.148a.57.57 0 0 1-.464-.903l3.777-5.29c.54-.753 0-1.804-.93-1.804H.57a.574.574 0 0 1-.543-.746.6.6 0 0 1 .08-.157L5.008.78a.57.57 0 0 1 .467-.24h14.589a.57.57 0 0 1 .466.903l-3.778 5.29c-.54.755 0 1.806.93 1.806h5.745c.238 0 .424.138.513.322a.56.56 0 0 1-.063.603z",source:"https://github.com/voidzero-dev/community-design-resources/blob/55902097229cf01cf2a4ceb376f992f5cf306756/brand-assets/vite/vite-icon-color-bracketless.svg",hex:"9135FF"},yF={title:"Yarn",slug:"yarn",get svg(){return _i+"Yarn"+wi+this.path+Si},path:"M12 0C5.375 0 0 5.375 0 12s5.375 12 12 12 12-5.375 12-12S18.625 0 12 0zm.768 4.105c.183 0 .363.053.525.157.125.083.287.185.755 1.154.31-.088.468-.042.551-.019.204.056.366.19.463.375.477.917.542 2.553.334 3.605-.241 1.232-.755 2.029-1.131 2.576.324.329.778.899 1.117 1.825.278.774.31 1.478.273 2.015a5.51 5.51 0 0 0 .602-.329c.593-.366 1.487-.917 2.553-.931.714-.009 1.269.445 1.353 1.103a1.23 1.23 0 0 1-.945 1.362c-.649.158-.95.278-1.821.843-1.232.797-2.539 1.242-3.012 1.39a1.686 1.686 0 0 1-.704.343c-.737.181-3.266.315-3.466.315h-.046c-.783 0-1.214-.241-1.45-.491-.658.329-1.51.19-2.122-.134a1.078 1.078 0 0 1-.58-1.153 1.243 1.243 0 0 1-.153-.195c-.162-.25-.528-.936-.454-1.946.056-.723.556-1.367.88-1.71a5.522 5.522 0 0 1 .408-2.256c.306-.727.885-1.348 1.32-1.737-.32-.537-.644-1.367-.329-2.21.227-.602.412-.936.82-1.08h-.005c.199-.074.389-.153.486-.259a3.418 3.418 0 0 1 2.298-1.103c.037-.093.079-.185.125-.283.31-.658.639-1.029 1.024-1.168a.94.94 0 0 1 .328-.06zm.006.7c-.507.016-1.001 1.519-1.001 1.519s-1.27-.204-2.266.871c-.199.218-.468.334-.746.44-.079.028-.176.023-.417.672-.371.991.625 2.094.625 2.094s-1.186.839-1.626 1.881c-.486 1.144-.338 2.261-.338 2.261s-.843.732-.899 1.487c-.051.663.139 1.2.343 1.515.227.343.51.176.51.176s-.561.653-.037.931c.477.25 1.283.394 1.71-.037.31-.31.371-1.001.486-1.283.028-.065.12.111.209.199.097.093.264.195.264.195s-.755.324-.445 1.066c.102.246.468.403 1.066.398.222-.005 2.664-.139 3.313-.296.375-.088.505-.283.505-.283s1.566-.431 2.998-1.357c.917-.598 1.293-.76 2.034-.936.612-.148.57-1.098-.241-1.084-.839.009-1.575.44-2.196.825-1.163.718-1.742.672-1.742.672l-.018-.032c-.079-.13.371-1.293-.134-2.678-.547-1.515-1.413-1.881-1.344-1.997.297-.5 1.038-1.297 1.334-2.78.176-.899.13-2.377-.269-3.151-.074-.144-.732.241-.732.241s-.616-1.371-.788-1.483a.271.271 0 0 0-.157-.046z",source:"https://github.com/yarnpkg/assets/blob/76d30ca2aebed5b73ea8131d972218fb860bd32d/yarn-kitten-circle.svg",hex:"2C8EBB",guidelines:"https://github.com/yarnpkg/assets/tree/76d30ca2aebed5b73ea8131d972218fb860bd32d",license:{type:"CC-BY-4.0",url:"https://spdx.org/licenses/CC-BY-4.0"}};function _F(e){const t=e.toLowerCase();return/\bvite\b/.test(t)?Tn.vite:/\bcargo\s+/.test(t)?Tn.cargo:/\brustc\b/.test(t)?Tn.rust:/\bdotnet\b/.test(t)?Tn.dotnet:/\bdocker(?:\s+compose|-compose|\s+)/.test(t)?Tn.docker:/\bpython3?\b|\buvicorn\b|\bfastapi\b/.test(t)?Tn.python:/\bgo\s+(run|test|build)\b|\bair\b/.test(t)?Tn.go:/\bbun\b/.test(t)?Tn.bun:/\bdeno\b/.test(t)?Tn.deno:/\bpnpm\b/.test(t)?Tn.pnpm:/\byarn\b/.test(t)?Tn.yarn:/\bnpm\b/.test(t)?Tn.npm:/\bnode\b/.test(t)?Tn.node:Tn.generic}const Tn={bun:{kind:"bun",label:"Bun"},cargo:{kind:"cargo",label:"Cargo"},deno:{kind:"deno",label:"Deno"},dotnet:{kind:"dotnet",label:".NET"},docker:{kind:"docker",label:"Docker"},generic:{kind:"generic",label:"Process"},go:{kind:"go",label:"Go"},node:{kind:"node",label:"Node"},npm:{kind:"npm",label:"npm"},pnpm:{kind:"pnpm",label:"pnpm"},python:{kind:"python",label:"Python"},rust:{kind:"rust",label:"Rust"},vite:{kind:"vite",label:"Vite"},yarn:{kind:"yarn",label:"Yarn"}};function pv({command:e,compact:t}){const s=_F(e),i=wF[s.kind];return n.jsx("span",{"aria-label":`${s.label} process`,className:ae("inline-flex shrink-0 items-center justify-center rounded-md border bg-card shadow-sm dark:border-zinc-700/80 dark:bg-zinc-100",t?"size-6":"size-7",i?"border-border":"border-border bg-muted text-muted-foreground dark:bg-zinc-100 dark:text-zinc-700"),style:i?{color:`#${i.hex}`}:void 0,title:s.label,children:i?n.jsx("svg",{"aria-hidden":"true",className:t?"size-3.5":"size-4",fill:"currentColor",role:"img",viewBox:"0 0 24 24",children:n.jsx("path",{d:i.path})}):n.jsx(kl,{className:t?"size-3.5":"size-4"})})}const wF={bun:dF,cargo:X2,deno:hF,dotnet:uF,docker:fF,generic:null,go:mF,node:pF,npm:gF,pnpm:bF,python:xF,rust:X2,vite:vF,yarn:yF};function di({className:e,...t}){return n.jsx("label",{className:ae("grid gap-1.5 text-xs font-medium text-muted-foreground",e),...t})}const SF=[{label:"npm",command:"npm run dev",description:"Node dev server"},{label:"pnpm",command:"pnpm dev",description:"pnpm dev server"},{label:"yarn",command:"yarn dev",description:"Yarn dev server"},{label:"bun",command:"bun dev",description:"Bun dev server"},{label:"Deno",command:"deno task dev",description:"Deno dev task"},{label:"Vite",badgeCommand:"vite",command:"npm run dev -- --host 127.0.0.1",description:"Vite app"},{label:"Go",command:"go run .",description:"Go app"},{label:"Rust",command:"cargo run",description:"Rust app"},{label:".NET",command:"dotnet watch run",description:".NET app"},{label:"Python",command:"python manage.py runserver",description:"Python app"},{label:"Docker",command:"docker compose up",description:"Docker Compose stack"}],Z2=[{value:"local",label:"Local",hint:"Run a command in a local working directory."},{value:"docker-compose",label:"Docker Compose",hint:"Bring up a service defined in a docker-compose.yml file."},{value:"ssh",label:"SSH (remote)",hint:"Run a command on a remote host using your local ~/.ssh/config + ssh-agent."}];function kF({result:e}){const t=[...e.stdout,...e.stderr].slice(0,4);return n.jsxs(Je,{variant:e.ok?"default":"destructive",children:[n.jsx("div",{className:"font-medium",children:e.ok?"Command test passed":"Command test failed"}),n.jsx("div",{className:"mt-1 text-xs",children:e.message}),t.length?n.jsx("pre",{className:"mt-2 max-h-24 overflow-auto rounded-md bg-background/80 p-2 font-mono text-[11px] leading-4",children:t.join(`
88
+ `)}):null]})}async function NF(e,t,s,i){if(t==="bundle"){if(e==="start")return nS(s,()=>i?.());if(e==="stop")return tS(s);await tS(s),await nS(s,()=>i?.());return}return e==="start"?mO(s):e==="stop"?pO(s):yE(s)}function gv({active:e,baseUrl:t,compact:s=!1,onRefresh:i,onStarted:a,resourceKind:l,resourceName:c,solidStart:h=!1,targetLabel:f}){return e?n.jsxs(n.Fragment,{children:[n.jsx(Gg,{baseUrl:t,compact:s,intent:"restart",icon:n.jsx(zf,{}),label:"Restart",op:"restart",resourceKind:l,resourceName:c,targetLabel:f,onRefresh:i,onSuccess:a}),n.jsx(Gg,{baseUrl:t,compact:s,intent:"stop",icon:n.jsx(fo,{}),label:"Stop",op:"stop",resourceKind:l,resourceName:c,targetLabel:f,onRefresh:i})]}):n.jsx(Gg,{baseUrl:t,compact:s,intent:h?"startSolid":"start",icon:n.jsx(Mr,{}),label:"Start",op:"start",resourceKind:l,resourceName:c,targetLabel:f,onRefresh:i,onSuccess:a})}function hf(e,t,s){const i=s instanceof Error?s.message:String(s);return`${e} failed for ${t}: ${i}`}function Gg({baseUrl:e,compact:t=!1,intent:s="neutral",icon:i,label:a,op:l,resourceKind:c,resourceName:h,targetLabel:f,onRefresh:d,onSuccess:p}){const[g,b]=y.useState(!1),[v,w]=y.useState(null),{error:k,success:N}=hs();async function E(A=!1){b(!0);try{A?await Mi(`${e}/start`,{strategy:"killHolder"}):await NF(l,c,h,()=>d()),N(`${a} requested for ${f}.`),await d(),w(null),p?.()}catch(C){C instanceof iE?w(C.conflict):k(hf(a,f,C))}finally{b(!1)}}const T=n.jsxs(Z,{"aria-label":a,className:`${EF[s]} ${t?"size-7":""}`.trim(),disabled:g,onClick:()=>E(),size:t?"icon":"sm",variant:"outline",children:[i,t?null:a]});return n.jsxs(n.Fragment,{children:[t?n.jsx(pl,{label:a,children:T}):T,v?n.jsx(CF,{busy:g,conflict:v,onCancel:()=>w(null),onKillAndStart:()=>E(!0),targetLabel:f}):null]})}function CF({busy:e,conflict:t,onCancel:s,onKillAndStart:i,targetLabel:a}){const l=t.holder,c=`http://localhost:${t.port}/`;return n.jsx(Zn,{icon:n.jsx(nE,{}),onClose:e?()=>{}:s,title:`Port ${t.port} is already in use`,children:n.jsxs("div",{className:"space-y-3 p-4 text-sm",children:[n.jsxs("p",{children:[n.jsx("span",{className:"font-medium",children:a})," wants port"," ",n.jsx("span",{className:"font-mono",children:t.port}),", but it's already held by:"]}),n.jsx("pre",{className:"overflow-auto whitespace-pre-wrap rounded border border-border bg-background p-3 font-mono text-xs",children:l?`pid ${l.pid}${l.pgid?` (pgid ${l.pgid})`:""}
89
+ ${l.command}`:"unknown process"}),n.jsxs("div",{className:"flex flex-wrap justify-end gap-2 pt-2",children:[n.jsx(Z,{onClick:s,size:"sm",type:"button",variant:"outline",disabled:e,children:"Cancel"}),n.jsxs(Z,{onClick:()=>{$f(c)},size:"sm",type:"button",variant:"outline",disabled:e,children:[n.jsx(Sa,{}),"Open in browser"]}),n.jsx(Z,{className:"border-red-600 bg-red-600 text-white hover:bg-red-700",disabled:e||!l,onClick:i,size:"sm",type:"button",children:"Stop holder & start"})]})]})})}const EF={neutral:"",restart:"border-amber-600 bg-amber-600 text-white hover:bg-amber-700",start:"",startSolid:"border-emerald-600 bg-emerald-600 text-white hover:bg-emerald-700",stop:"border-red-600 bg-red-600 text-white hover:bg-red-700"};function jF({cwd:e,onRefresh:t,onSaved:s,initialService:i}){const{error:a,success:l}=hs(),c=!!i,[h,f]=y.useState(i?.kind??"local"),[d,p]=y.useState(i?.name??""),[g,b]=y.useState(i?.command??""),[v,w]=y.useState(i?.cwd??e),[k,N]=y.useState(i?.port?String(i.port):""),[E,T]=y.useState(i?.description??""),[A,C]=y.useState(i?.composeFile??""),[R,L]=y.useState(i?.composeService??""),[H,B]=y.useState(i?.host??""),[P,D]=y.useState(i?.dependsOn??[]),[G,$]=y.useState(null),[O,V]=y.useState(!1);y.useEffect(()=>{$(null)},[g,v,k,h]);function K(){p(""),b(""),w(e),N(""),T(""),C(""),L(""),B(""),D([]),$(null)}async function I(W){W.preventDefault();try{const le={name:d,kind:h,cwd:v,port:k,description:E};(h==="local"||h==="ssh")&&(le.command=g),h==="docker-compose"&&(le.composeFile=A,le.composeService=R),h==="ssh"&&(le.host=H),le.dependsOn=P.filter(J=>J!==d).join(","),await Mi("/api/services",le),c||K(),l(c?`${d} updated.`:`${d} added.`),await t(),s?.()}catch(le){a(hf(c?"Update service":"Add service",d||"service",le))}}async function Y(){if(!g.trim()){a("Test command failed for service: command is required.");return}V(!0);try{$(await SO({command:g,cwd:v,port:k}))}catch(W){a(hf("Test command",d||"service",W))}finally{V(!1)}}return{editing:c,kind:h,setKind:f,name:d,setName:p,command:g,setCommand:b,formCwd:v,setFormCwd:w,port:k,setPort:N,description:E,setDescription:T,composeFile:A,setComposeFile:C,composeService:R,setComposeService:L,host:H,setHost:B,dependsOn:P,setDependsOn:D,testResult:G,testing:O,submit:I,testCommand:Y}}function Q2({cwd:e,onRefresh:t,onSaved:s,initialService:i,availableServices:a=[]}){const{editing:l,kind:c,setKind:h,name:f,setName:d,command:p,setCommand:g,formCwd:b,setFormCwd:v,port:w,setPort:k,description:N,setDescription:E,composeFile:T,setComposeFile:A,composeService:C,setComposeService:R,host:L,setHost:H,dependsOn:B,setDependsOn:P,testResult:D,testing:G,submit:$,testCommand:O}=jF({cwd:e,onRefresh:t,onSaved:s,initialService:i}),V=Z2.find(J=>J.value===c),K=a.filter(J=>J!==f),I=J=>P(U=>U.includes(J)?U.filter(F=>F!==J):[...U,J]),Y=c==="local"&&p.trim().length>0&&b.trim().length>0,W="grid gap-2 rounded-md border border-border bg-muted/30 p-3",le="px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground";return n.jsxs("form",{className:"grid gap-3",onSubmit:$,children:[n.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[n.jsxs("fieldset",{className:`${W} sm:col-span-2`,children:[n.jsx("legend",{className:le,children:"Step 1 · Service kind"}),n.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:Z2.map(J=>n.jsx(Z,{className:"justify-center",disabled:l,onClick:()=>h(J.value),size:"sm",type:"button",variant:c===J.value?"default":"outline",children:J.label},J.value))}),n.jsx("p",{className:"text-[11px] text-muted-foreground",children:V.hint})]}),n.jsxs("div",{className:"grid gap-3 sm:col-start-1 sm:row-start-2 sm:self-start",children:[n.jsxs("fieldset",{className:W,children:[n.jsx("legend",{className:le,children:"Step 2 · Identity"}),n.jsxs(di,{children:["Name",n.jsx(ft,{className:"h-8 text-sm",name:"name",onChange:J=>d(J.target.value),placeholder:"backend",readOnly:l,required:!0,value:f}),l?n.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Name is the service key and can't be changed here."}):null]}),n.jsxs(di,{children:["Description",n.jsx(ft,{className:"h-8 text-sm",name:"description",onChange:J=>E(J.target.value),placeholder:"API server",value:N})]})]}),n.jsxs("fieldset",{className:W,children:[n.jsx("legend",{className:le,children:"Step 4 · Networking (optional)"}),n.jsxs(di,{children:["Port",n.jsx(ft,{className:"h-8 text-sm",inputMode:"numeric",name:"port",onChange:J=>k(J.target.value),placeholder:"3001",value:w})]})]})]}),c==="local"?n.jsxs("fieldset",{className:`${W} sm:col-start-2 sm:row-start-2 sm:self-start`,children:[n.jsx("legend",{className:le,children:"Step 3 · Local command"}),n.jsx("div",{className:"grid grid-cols-2 gap-1.5 sm:grid-cols-4",children:SF.map(J=>n.jsxs(Z,{className:"justify-start gap-1.5",onClick:()=>{g(J.command),E(J.description)},size:"sm",type:"button",variant:"outline",children:[n.jsx(pv,{command:J.badgeCommand??J.command,compact:!0}),n.jsx("span",{className:"truncate",children:J.label})]},J.label))}),n.jsxs(di,{children:["Command",n.jsx(ft,{className:"h-8 font-mono text-sm",name:"command",onChange:J=>g(J.target.value),placeholder:"npm run dev",required:!0,value:p})]}),n.jsxs(di,{children:["Working Directory",n.jsx(ft,{className:"h-8 font-mono text-sm",name:"cwd",onChange:J=>v(J.target.value),required:!0,value:b})]})]}):null,c==="docker-compose"?n.jsxs("fieldset",{className:`${W} sm:col-start-2 sm:row-start-2 sm:self-start`,children:[n.jsx("legend",{className:le,children:"Step 3 · Docker Compose target"}),n.jsxs(di,{children:["Compose Service",n.jsx(ft,{className:"h-8 font-mono text-sm",name:"composeService",onChange:J=>R(J.target.value),placeholder:"api",required:!0,value:C})]}),n.jsxs(di,{children:["Compose File (optional)",n.jsx(ft,{className:"h-8 font-mono text-sm",name:"composeFile",onChange:J=>A(J.target.value),placeholder:"docker-compose.yml",value:T})]}),n.jsxs(di,{children:["Working Directory (where compose file lives)",n.jsx(ft,{className:"h-8 font-mono text-sm",name:"cwd",onChange:J=>v(J.target.value),required:!0,value:b})]})]}):null,c==="ssh"?n.jsxs("fieldset",{className:`${W} sm:col-start-2 sm:row-start-2 sm:self-start`,children:[n.jsx("legend",{className:le,children:"Step 3 · SSH connection"}),n.jsxs(di,{children:["SSH Host (alias from ~/.ssh/config)",n.jsx(ft,{className:"h-8 font-mono text-sm",name:"host",onChange:J=>H(J.target.value),placeholder:"devbox",required:!0,value:L})]}),n.jsxs(di,{children:["Remote Command",n.jsx(ft,{className:"h-8 font-mono text-sm",name:"command",onChange:J=>g(J.target.value),placeholder:"npm run dev",required:!0,value:p})]}),n.jsxs(di,{children:["Remote Working Directory",n.jsx(ft,{className:"h-8 font-mono text-sm",name:"cwd",onChange:J=>v(J.target.value),placeholder:"/srv/app",required:!0,value:b})]}),n.jsxs(Je,{variant:"muted",children:[n.jsx("div",{className:"font-medium",children:"SSH key handling"}),n.jsxs("div",{className:"mt-1 text-xs",children:["NoMoreIDE never stores key files. Add a ",n.jsxs("code",{children:["Host ",L||"&lt;alias&gt;"]})," entry to",n.jsx("code",{children:" ~/.ssh/config"})," with ",n.jsx("code",{children:"HostName"}),", ",n.jsx("code",{children:"User"}),", and"," ",n.jsx("code",{children:"IdentityFile ~/.ssh/your-key.pem"})," (chmod 0600). Make sure"," ",n.jsx("code",{children:"ssh-agent"})," is running or your key is loaded (",n.jsx("code",{children:"ssh-add ~/.ssh/your-key.pem"}),"). NoMoreIDE will run"," ",n.jsxs("code",{children:["ssh ",L||"&lt;alias&gt;"]})," using that config."]})]})]}):null,K.length>0?n.jsxs("fieldset",{className:`${W} sm:col-span-2`,children:[n.jsx("legend",{className:le,children:"Step 5 · Dependencies (optional)"}),n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"When this service runs as part of a group, the selected services start first — and NoMoreIDE waits for each to come up before this one."}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:K.map(J=>n.jsx(Z,{className:"h-7 px-2.5 text-xs",onClick:()=>I(J),size:"sm",type:"button",variant:B.includes(J)?"default":"outline",children:J},J))})]}):null]}),D?n.jsx(kF,{result:D}):null,n.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[c==="local"?n.jsxs(Z,{disabled:G||!Y,onClick:O,type:"button",variant:"outline",children:[n.jsx(kl,{}),G?"Testing...":"Test Command"]}):null,n.jsx(Z,{type:"submit",children:l?"Save Service":"Add Service"})]})]})}function H3({initialName:e="",initialServices:t=[],onSaved:s,onRefresh:i,originalName:a,services:l,submitLabel:c="Save Group"}){const{error:h,success:f}=hs();async function d(p){p.preventDefault();const g=p.currentTarget,b=new FormData(g),v=String(b.get("name")??""),w=b.getAll("services").map(k=>String(k)).filter(Boolean);try{await Mi("/api/bundles",{name:v,originalName:a,services:w.join(",")}),g.reset(),f(`${v} group saved.`),await i(),s?.()}catch(k){h(hf("Save group",v||"group",k))}}return n.jsxs("form",{className:"grid gap-2.5",onSubmit:d,children:[n.jsxs(di,{children:["Group name",n.jsx(ft,{className:"h-8 text-sm",defaultValue:e,name:"name",placeholder:"full-stack",required:!0})]}),n.jsxs("fieldset",{className:"grid gap-1.5",children:[n.jsx("legend",{className:"text-xs font-medium",children:"Services"}),l.length?l.map(p=>n.jsxs("label",{className:"flex items-center gap-2 overflow-hidden rounded-md border border-border px-2.5 py-1.5 text-sm",children:[n.jsx("input",{className:"size-4 shrink-0 accent-primary",defaultChecked:t.includes(p.name),name:"services",type:"checkbox",value:p.name}),n.jsx(pv,{command:p.command??"",compact:!0}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-sm font-medium",children:p.name}),n.jsx("span",{className:"block truncate font-mono text-[11px] text-muted-foreground",children:p.command??p.kind??""})]})]},p.name)):n.jsx(Je,{variant:"muted",children:"All services are already grouped, or none registered."})]}),n.jsx(Z,{className:"h-8",disabled:!l.length,type:"submit",children:c})]})}function AF({allServices:e,group:t,onRefresh:s,ports:i,services:a,health:l,statuses:c,timeline:h,selectedService:f,onSelectService:d,onDropService:p}){const[g,b]=y.useState(!1),[v,w]=y.useState(!1),[k,N]=y.useState(!1),E=a.some(C=>iu(c[C.name]?.state));function T(C){!p||!C.dataTransfer.types.includes(gu)||(C.preventDefault(),C.dataTransfer.dropEffect="copy",N(!0))}function A(C){if(!p)return;C.preventDefault(),N(!1);const R=C.dataTransfer.getData(gu);R&&p(R)}return n.jsxs("section",{className:ae("transition-colors",k&&"bg-primary/5 outline-dashed outline-2 -outline-offset-2 outline-primary/60"),onDragOver:T,onDragLeave:()=>N(!1),onDrop:A,children:[n.jsxs("div",{className:"flex items-center gap-1.5 bg-muted/35 px-3 py-1.5",children:[n.jsxs("button",{"aria-expanded":!v,className:"flex min-w-0 flex-1 cursor-pointer items-center gap-1.5 text-left",onClick:()=>w(C=>!C),type:"button",children:[n.jsx(Jn,{className:ae("size-3.5 shrink-0 text-muted-foreground transition-transform",v&&"-rotate-90")}),n.jsx("span",{className:"truncate text-sm font-medium",children:t.name}),t.services.length?n.jsx(We,{size:"small",variant:"secondary",children:t.services.length}):null]}),n.jsx(pl,{label:"Edit group",children:n.jsx(Z,{"aria-expanded":g,"aria-label":`Edit ${t.name}`,className:"size-7",onClick:()=>b(C=>!C),size:"icon",type:"button",variant:"ghost",children:n.jsx(yl,{})})}),n.jsx(gv,{active:E,baseUrl:`/api/bundles/${encodeURIComponent(t.name)}`,compact:!0,resourceKind:"bundle",resourceName:t.name,solidStart:!0,targetLabel:`group ${t.name}`,onRefresh:s,onStarted:()=>{const C=a[0];C&&d(C.name)}})]}),g?n.jsx("div",{className:"border-t border-border bg-background/65 p-3",children:n.jsx(H3,{initialName:t.name,initialServices:t.services,onRefresh:s,onSaved:()=>b(!1),originalName:t.name,services:e,submitLabel:"Save Group"})}):null,v?null:n.jsx("div",{className:"divide-y divide-border border-t border-border bg-background/45",children:a.length?a.map(C=>n.jsx(U3,{service:C,status:c[C.name],health:l[C.name],ports:i,onRefresh:s,timeline:h,selected:f===C.name,onSelect:()=>d(C.name)},C.name)):n.jsx(Je,{variant:"muted",className:"m-4",children:"This group does not match any registered services."})})]})}function U3({service:e,status:t,onRefresh:s,selected:i=!1,onSelect:a}){const l=t?.state??"stopped",c=iu(l),[h,f]=y.useState(!1);return n.jsxs("div",{"aria-selected":i,draggable:!0,onDragStart:d=>{d.dataTransfer.setData(gu,e.name),e.cwd&&I3(d.dataTransfer,e.cwd),d.dataTransfer.effectAllowed="copyMove",f(!0)},onDragEnd:()=>f(!1),className:ae("group grid cursor-pointer grid-cols-[1.75rem_minmax(0,1fr)_auto_auto] items-center gap-2 border-l-2 px-3 py-1.5 transition-colors",h&&"opacity-50",i?"border-l-primary bg-primary/10":"border-l-transparent hover:bg-muted"),onClick:a,role:"option",children:[n.jsx(pv,{command:e.command??""}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-sm font-medium",children:e.name}),n.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[n.jsx(TF,{kind:e.kind}),e.port?n.jsxs("span",{children:[":",e.port]}):null]})]}),n.jsx(MF,{state:l}),n.jsx("span",{className:"flex items-center gap-1",onClick:d=>d.stopPropagation(),children:n.jsx(gv,{active:c,baseUrl:`/api/services/${encodeURIComponent(e.name)}`,compact:!0,resourceKind:"service",resourceName:e.name,targetLabel:e.name,onRefresh:s,onStarted:a})})]})}const gu="application/x-nomoreide-service",J2={local:{label:"local",className:"border-border bg-muted text-muted-foreground"},"docker-compose":{label:"docker",className:"border-sky-500/40 bg-sky-500/10 text-sky-700 dark:text-sky-300"},ssh:{label:"ssh",className:"border-violet-500/40 bg-violet-500/10 text-violet-700 dark:text-violet-300"}};function TF({kind:e}){const t=J2[e??"local"]??J2.local;return n.jsx("span",{className:ae("rounded border px-1 py-px text-[9px] font-semibold uppercase leading-none tracking-wide",t.className),children:t.label})}function iu(e){return e==="running"||e==="starting"}function RF(e){return`http://127.0.0.1:${e}`}const ek={running:{className:"bg-emerald-500"},starting:{className:"bg-amber-500",pulse:!0},exited:{className:"bg-red-500"},stopped:{className:"bg-muted-foreground/40"}};function MF({state:e}){const t=ek[e]??ek.stopped;return n.jsxs("span",{className:"relative flex size-2.5 items-center justify-center",title:e,children:[t.pulse&&n.jsx("span",{className:ae("absolute inline-flex size-full animate-ping rounded-full opacity-60",t.className)}),n.jsx("span",{className:ae("relative inline-flex size-2 rounded-full",t.className)})]})}function F3({state:e}){return n.jsx(We,{variant:e==="running"?"success":e==="exited"?"danger":e==="starting"?"warning":"outline",className:ae(e==="running"&&"font-mono"),children:e})}function DF({data:e}){const[t,s]=y.useState(!1),[i,a]=y.useState(()=>z2()),[l,c]=y.useState(""),[h,f]=y.useState([]),[d,p]=y.useState([]),[g,b]=y.useState(null),{sendToAgent:v}=Dt();y.useEffect(()=>{if(!t)return;let A=!0;return b(null),Promise.allSettled([uE(),fE(20)]).then(C=>{if(!A)return;const[R,L]=C;R.status==="fulfilled"&&f(R.value),L.status==="fulfilled"&&p(L.value),C.filter(B=>B.status==="rejected").length&&b("Some AI context could not be loaded. You can still send available context.")}),()=>{A=!1}},[t]);const w=y.useMemo(()=>LF(e),[e]),k=JH(i),N=y.useMemo(()=>i.serviceNames.length+i.databaseNames.length+i.errorIds.length+i.repositoryPaths.length,[i]);function E(A,C){a(R=>{const L=R[A],H=L.includes(C)?L.filter(B=>B!==C):[...L,C];return{...R,[A]:H}})}function T(){k&&(v({prompt:eU({dashboard:e,databases:h,incidents:d,note:l,selection:i}),source:{type:"workspace-context",label:"AI Diagnose"},label:tU({note:l,selection:i})}),s(!1),c(""),a(z2()))}return n.jsxs(n.Fragment,{children:[n.jsxs("button",{"aria-label":"Open AI Diagnose",className:lf(),onClick:()=>s(!0),title:"Open AI Diagnose",type:"button",children:[n.jsx("span",{className:cf(),children:n.jsx(Yt,{className:"size-4"})}),n.jsx("span",{className:uf(),children:"Diagnose"})]}),t?n.jsx(Zn,{icon:n.jsx(Yt,{}),onClose:()=>s(!1),size:"xl",title:"AI Diagnose",children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium",children:"Pick the context the agent should inspect"}),n.jsx("div",{className:"text-xs text-muted-foreground",children:"Combine services, databases, incidents, and repositories into one focused prompt."})]}),n.jsxs(We,{variant:N?"secondary":"outline",children:[N," selected"]})]}),g?n.jsx(Je,{variant:"muted",children:g}):null,n.jsxs("div",{className:"grid min-h-0 gap-3 overflow-hidden lg:grid-cols-4",children:[n.jsx(dh,{count:e.config.services.length,icon:n.jsx(Bf,{}),title:"Services",children:n.jsx("div",{className:"grid gap-2",children:e.config.services.map(A=>{const C=i.serviceNames.includes(A.name),R=e.runtime.services[A.name],L=e.health[A.name];return n.jsxs(hh,{selected:C,onClick:()=>E("serviceNames",A.name),children:[n.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[n.jsx("span",{className:"min-w-0 flex-1 truncate font-semibold",children:A.name}),n.jsx("span",{className:"shrink-0",children:n.jsx(F3,{state:R?.state??"stopped"})})]}),n.jsxs("span",{className:"mt-1 flex flex-wrap gap-1.5 text-[11px] text-muted-foreground",children:[A.kind?n.jsx("span",{children:A.kind}):null,A.port?n.jsxs("span",{children:[":",A.port]}):null,L?.status?n.jsx("span",{children:L.status}):null]})]},A.name)})})}),n.jsx(dh,{count:h.length,icon:n.jsx(Qn,{}),title:"Databases",children:h.length?n.jsx("div",{className:"grid gap-2",children:h.map(A=>n.jsxs(hh,{selected:i.databaseNames.includes(A.name),onClick:()=>E("databaseNames",A.name),children:[n.jsx("span",{className:"truncate font-semibold",children:A.name}),n.jsx("span",{className:"mt-1 block truncate text-[11px] text-muted-foreground",children:A.engine})]},A.name))}):n.jsx(tk,{text:"No database connections detected."})}),n.jsx(dh,{count:d.length,icon:n.jsx(uu,{}),title:"Error Inbox",children:d.length?n.jsx("div",{className:"grid gap-2",children:d.map(A=>n.jsxs(hh,{selected:i.errorIds.includes(A.id),onClick:()=>E("errorIds",A.id),children:[n.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[n.jsx("span",{className:"min-w-0 flex-1 truncate font-semibold",children:A.title}),n.jsx(We,{appearance:"subtle",size:"small",variant:A.level==="error"?"danger":"secondary",children:A.level})]}),n.jsxs("span",{className:"mt-1 block min-w-0 truncate font-mono text-[11px] text-muted-foreground",children:[A.service," x",A.count]})]},A.id))}):n.jsx(tk,{text:"No recent incidents."})}),n.jsx(dh,{count:w.length,icon:n.jsx(Mn,{}),title:"Git Repositories",children:n.jsx("div",{className:"grid gap-2",children:w.map(A=>{const C=i.repositoryPaths.includes(A.path),R=A.path===(e.git.selectedRepository?.path??e.git.cwd),L=R?e.git.status?.files.length??0:void 0;return n.jsxs(hh,{selected:C,onClick:()=>E("repositoryPaths",A.path),children:[n.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[n.jsx("span",{className:"min-w-0 flex-1 truncate font-semibold",children:A.name}),R?n.jsx(We,{className:"shrink-0",size:"small",variant:"outline",children:"current"}):null]}),n.jsx("span",{className:"mt-1 block min-w-0 truncate font-mono text-[11px] text-muted-foreground",children:A.path}),L!==void 0?n.jsx("span",{className:"mt-1 block truncate text-[11px] text-muted-foreground",children:L?`${L} changed file${L===1?"":"s"}`:"No changed files"}):null]},A.path)})})})]}),n.jsxs("label",{className:"block space-y-2",children:[n.jsx("span",{className:"text-sm font-medium",children:"Extra context"}),n.jsx("textarea",{className:"min-h-24 w-full resize-y rounded-md border border-border bg-background px-3 py-2 text-sm outline-none transition-colors placeholder:text-muted-foreground focus:border-foreground/40 focus:ring-2 focus:ring-ring",onChange:A=>c(A.target.value),placeholder:"Example: checkout is failing after login, API exits when DB is selected...",value:l})]}),n.jsxs("div",{className:"flex items-center justify-end gap-2",children:[n.jsx(Z,{onClick:()=>s(!1),type:"button",variant:"outline",children:"Cancel"}),n.jsxs(Z,{className:"gap-2",disabled:!k,onClick:T,type:"button",children:[n.jsx(d8,{className:"size-4"}),"Send"]})]})]})}):null]})}function dh({children:e,count:t,icon:s,title:i}){return n.jsxs("section",{className:"flex max-h-[min(520px,calc(100vh-18rem))] min-h-0 min-w-0 flex-col space-y-2 rounded-md border border-border bg-background/45 p-3",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-sm font-semibold",children:[n.jsx("span",{className:"flex size-6 items-center justify-center rounded-md border border-border bg-background text-muted-foreground [&_svg]:size-3.5",children:s}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:i}),n.jsx(We,{className:"shrink-0",size:"small",variant:"outline",children:t})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-auto pr-1",children:e})]})}function hh({children:e,onClick:t,selected:s}){return n.jsx("button",{"aria-pressed":s,className:ae("min-h-16 min-w-0 rounded-md border p-3 text-left text-sm transition-colors",s?"border-primary bg-primary/10 text-foreground":"border-border bg-background hover:border-foreground/30 hover:bg-muted/60"),onClick:t,type:"button",children:e})}function tk({text:e}){return n.jsx("div",{className:"rounded-md border border-dashed border-border bg-background/60 px-3 py-3 text-xs text-muted-foreground",children:e})}function LF(e){return e.config.gitRepositories.length?e.config.gitRepositories:e.git.selectedRepository?[e.git.selectedRepository]:[{name:e.git.cwd.split("/").pop()??"repository",path:e.git.cwd}]}async function bv({prompt:e,provider:t,autoApprove:s=!1,signal:i}){let a="",l,c,h,f=!1;const d=[],p=new AbortController,g=()=>p.abort(i?.reason);i?.aborted?g():i?.addEventListener("abort",g,{once:!0});const b=w=>{if(w.type==="session")l=w.sessionId;else if(w.type==="text")a+=w.text;else if(w.type==="error")c=new Error(w.message);else if(w.type==="approval_request"){const k=l?L7(l,w.requestId,s?"allow":"deny"):Promise.reject(new Error("Agent requested approval before starting a session"));d.push(k.catch(N=>{f||(f=!0,h=N),p.abort()}))}};let v;try{await O7(e,void 0,b,p.signal,s,t)}catch(w){v=w}finally{await Promise.allSettled(d),i?.removeEventListener("abort",g)}if(f)throw h;if(v)throw v;if(c)throw c;return a.trim()}function OF(e){const t=PF(e.capabilities);return t?`${e.prompt}
90
+
91
+ ${t}`:e.prompt}function zF({workflowName:e,step:t,status:s,error:i,previousOutput:a,output:l}){const c=["Debug this stuck NoMoreIDE workflow step.","",`Workflow: ${e}`,`Step: ${t.title}`,`Step id: ${t.id}`,`Kind: ${t.kind}`,`Status: ${s}`,"","Step instruction:",IF(t)];return i?.trim()&&c.push("","Runner error:",i.trim()),a?.trim()&&c.push("","Previous step output:",a.trim()),l?.trim()&&c.push("","This step output:",l.trim()),c.push("","Diagnose why the step is stuck, name the smallest safe next action, and tell me whether I should retry, edit the workflow, or stop."),c.join(`
92
+ `)}function BF({workflowName:e,error:t}){return["Recover this NoMoreIDE PR workflow from the default branch guard.","",`Workflow: ${e}`,t?.trim()?`Runner error: ${t.trim()}`:"","","The user approved reading the minimum file diffs needed by clicking the workflow recovery button.","First call `nomoreide_git_status` to see the changed files and current branch.","Inspect only the minimum needed with `nomoreide_git_diff` to understand the change.","Then recommend a concise branch name based on the changes.","Do not create the branch or ask the user to create it; the workflow panel will ask the user and run the branch creation.","Reply with a short rationale and this exact parseable line:","BRANCH_NAME: <branch-name>"].filter(Boolean).join(`
93
+ `)}function PF(e){if(!e)return"";const t=[fh("Skills",e.skills),fh("MCP servers",e.mcpServers),fh("Plugins",e.plugins),fh("Hooks/context",e.hooks)].filter(Boolean);return t.length?["Use these selected capabilities if they are available and relevant:",...t,"If a selected capability is unavailable, say so briefly and continue with the best fallback."].join(`
94
+ `):""}function fh(e,t){const s=Array.from(new Set((t??[]).map(i=>i.trim()).filter(Boolean)));return s.length?`- ${e}: ${s.join(", ")}`:""}function IF(e){return e.kind==="agent"?e.prompt:e.kind==="gate"?`Gate: ${e.message}`:`Action: ${e.op}`}const sk=/^[ \t>*_-]*WORKFLOW_STATUS:\s*(ok|blocked)\b[ \t]*[—–:-]?[ \t]*(.*)$/im,$F=/^[ \t>*_-]*BRANCH_NAME:\s*`?([A-Za-z0-9][A-Za-z0-9._/-]{0,127})`?\s*$/im,HF=/^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/;function UF(e){const t=e.match(sk);if(t){const s=t[1].toLowerCase()==="blocked",i=t[2]?.trim()||void 0;return{output:e.replace(sk,"").trim(),blocked:s,reason:s?i:void 0}}return{output:e,blocked:FF(e)}}function FF(e){return/\bi can'?t\b|\bcannot\b|\bunable\b|\bnot able\b|\bwon'?t\b|\bwant me to\b|\bdid you mean\b|\bshould i\b|\bneed (?:you|your|more)\b|\binstead of merging\b/i.test(e)}function qF(e){const t=e.match($F);if(t&&nk(t[1]))return t[1];const s=e.match(/^#+\s*Recommended branch name\b([\s\S]*)$/im)?.[1]??e;for(const i of s.matchAll(/`([^`\s]+)`/g)){const a=i[1].trim();if(nk(a))return a}return null}function nk(e){return!(!HF.test(e)||e==="main"||e==="master"||e.includes("..")||e.endsWith(".")||e.endsWith("/"))}const GF="\n\nWhen you're finished, end your reply with a line that's exactly `WORKFLOW_STATUS: ok` if you completed this step, or `WORKFLOW_STATUS: blocked` followed by a short reason if you could NOT complete it or you need my input. The workflow runner reads this line.";function VF(e){const{provider:t}=Dt(),[s,i]=y.useState(null),a=y.useRef(s);y.useEffect(()=>{a.current=s},[s]);const l=y.useRef(!1),c=y.useRef(!1),h=y.useRef(null),f=y.useRef(null),d=y.useRef(!0);y.useEffect(()=>(d.current=!0,c.current=!1,()=>{d.current=!1,c.current=!0,l.current=!1,f.current?.abort(),f.current=null,h.current?.("stop"),h.current=null}),[]);const p=y.useCallback(()=>new Promise(C=>{h.current=C}),[]),g=y.useCallback(async C=>{const R=await Ng();return C==="committed"?R.files.length===0:C==="pushed"?R.ahead===0:!0},[]),b=y.useCallback(async(C,R,L)=>{if(C.op==="assert-pr-branch"){YF(await Ng());return}if(C.op==="push"){await Hf();return}if(C.op==="checkout-default-and-pull"){await AL();return}if(C.op==="commit"){const H=await Ng();if(!H.files.length)throw new Error("Nothing to commit — the working tree is clean.");const B=KF(H.files);B.length&&await P0(B),await gE(WF(L,R,H.files));return}throw new Error(`Unknown action: ${C.op}`)},[]),v=y.useCallback(async(C,R,L)=>{if(l.current||!d.current)return;l.current=!0,c.current=!1;const H=L?.index??0,B=C.steps.map(($,O)=>L&&O<H?L.statuses[O]??"pending":"pending"),P=C.steps.map(($,O)=>L?.outputs[O]??""),D=($,O,V)=>{B[$]=O,d.current&&i(K=>K&&{...K,index:$,statuses:[...B],outputs:[...P],...V})};if(!d.current)return;i({workflow:C,startedAt:L?.startedAt??Date.now(),index:H,statuses:[...B],outputs:[...P],error:null,outcome:"running"});const G=$=>{l.current=!1,d.current&&i(O=>O&&{...O,outcome:$,endedAt:Date.now()})};for(let $=H;$<C.steps.length;$++){const O=C.steps[$];if(O.kind==="gate"){D($,"waiting");const Y=await p();if(h.current=null,Y==="stop"){D($,"skipped"),G("stopped");return}D($,Y==="skip"?"skipped":"done");continue}if(O.kind==="action"){D($,"running");try{await b(O,$,P),D($,"done"),d.current&&e?.()}catch(Y){if(O.op==="assert-pr-branch"){D($,"blocked",{error:Vg(Y)}),G("blocked");return}D($,"failed",{error:Vg(Y)}),G("failed");return}if(c.current)return G("stopped");continue}D($,"running");const V=new AbortController;f.current=V;let K;try{K=await bv({prompt:OF(O)+GF,provider:t?.id,autoApprove:R,signal:V.signal})}catch(Y){if(f.current=null,c.current||V.signal.aborted){G("stopped");return}D($,"failed",{error:Vg(Y)}),G("failed");return}if(f.current=null,!d.current)return G("stopped");e?.();const I=UF(K);if(P[$]=I.output||"(no reply from agent)",I.blocked){D($,"blocked",{error:I.reason?`Paused — ${I.reason} Fix it (Debug with AI in the dock if you like), then Resume workflow to retry this step.`:"Paused — this step needs your input. Fix it (Debug with AI in the dock if you like), then Resume workflow to retry this step."}),G("blocked");return}if(O.verify&&!await g(O.verify).catch(()=>!1)){D($,"failed",{error:O.verify==="committed"?"Expected the working tree to be clean after this step, but it isn't. Stopping before the next step.":"Expected the branch to be pushed (no commits ahead), but it isn't. Stopping."}),G("failed");return}if(D($,"done"),c.current)return G("stopped")}G("done")},[e,t?.id,b,g,p]),w=y.useCallback((C,R=!1)=>v(C,R),[v]),k=y.useCallback((C=!1)=>{const R=a.current;!R||R.outcome==="running"||l.current||v(R.workflow,C,{index:R.index,statuses:R.statuses,outputs:R.outputs,startedAt:R.startedAt})},[v]),N=y.useCallback(()=>h.current?.("approve"),[]),E=y.useCallback(()=>h.current?.("skip"),[]),T=y.useCallback(()=>{c.current=!0,f.current?.abort(),h.current?.("stop")},[]),A=y.useCallback(()=>{l.current||!d.current||i(null)},[]);return{run:s,start:w,resume:k,approve:N,skip:E,stop:T,dismiss:A,isRunning:!!s&&s.outcome==="running"}}function Vg(e){return e instanceof Error?e.message:String(e)}function WF(e,t,s){return e[t-1]?.trim()||ZF(s)}function KF(e){return e.some(s=>s.index.trim()&&s.index!=="?")?[]:e.map(s=>s.path)}function YF(e){const t=e.branch.trim();if(!t)throw new Error("Create or switch to a feature branch before opening a PR — detached HEAD cannot be used as a PR branch.");if(!XF(t))return;const i=e.files.length>0?"Create or switch to a feature branch before committing these changes.":"Pull the default branch if needed, then create or switch to a feature branch.";throw new Error(`Create or switch to a feature branch before opening a PR. Current branch is ${t}. ${i}`)}function XF(e){return e==="main"||e==="master"}function ZF(e){const t=e.map(s=>s.path.split("/").pop()||s.path);return t.length===1?`Update ${t[0]}`:t.length<=3?`Update ${t.join(", ")}`:`Update ${t.slice(0,3).join(", ")} +${t.length-3} more`}const q3=y.createContext(null);function QF({onRefresh:e,children:t}){const s=VF(e);return n.jsx(q3.Provider,{value:s,children:t})}function G3(){const e=y.useContext(q3);if(!e)throw new Error("useWorkflowRun must be used within a WorkflowRunProvider");return e}const V3=y.createContext(null);function JF({children:e}){const{start:t,isRunning:s}=G3(),[i,a]=y.useState([]),[l,c]=y.useState([]),[h,f]=y.useState([]),[d,p]=y.useState(null),g=y.useRef(new Set),b=y.useCallback(E=>{c(T=>[E,...T.filter(A=>A.id!==E.id)])},[]);y.useEffect(()=>{let E=!0;Promise.all([t9().catch(()=>[]),kE().catch(()=>[]),i9().catch(()=>[])]).then(([A,C,R])=>{E&&(a(Array.isArray(A)?A:[]),f(Array.isArray(C)?C:[]),c(Array.isArray(R)?R:[]))});const T=new EventSource("/api/workflow-triggers/pending/stream");return T.addEventListener("pending",A=>{try{b(JSON.parse(A.data))}catch{}}),()=>{E=!1,T.close()}},[b]);const v=y.useCallback(async E=>{c(T=>T.filter(A=>A.id!==E)),await r9(E).catch(()=>{})},[]),w=y.useCallback(E=>{const T=h.find(A=>A.id===E.workflowId);g.current.add(E.id),v(E.id),T?t(T,!0):p(`Trigger references a missing workflow: ${E.workflowId}`)},[h,t,v]);y.useEffect(()=>{if(s)return;const E=[...l].reverse().find(T=>T.autoRun&&!g.current.has(T.id));E&&w(E)},[l,s,w]);const k=y.useCallback(async E=>{try{a(await s9(E)),p(null)}catch(T){p(T instanceof Error?T.message:String(T))}},[]),N=y.useCallback(async E=>{try{a(await n9(E))}catch(T){p(T instanceof Error?T.message:String(T))}},[]);return n.jsx(V3.Provider,{value:{triggers:i,pending:l,workflows:h,error:d,saveTrigger:k,removeTrigger:N,runPending:w,dismissPending:v},children:e})}function eq(){const e=y.useContext(V3);if(!e)throw new Error("useWorkflowTriggers must be used within a WorkflowTriggerProvider");return e}function tq({git:e,onRefresh:t}){const{sendToAgent:s}=Dt(),[i,a]=y.useState(!1),[l,c]=y.useState(null),[h,f]=y.useState(null),d=e.status,p=d?.branch||void 0,g=d?.files.length??0,b=d?.ahead??0,v=d?.behind??0;y.useEffect(()=>{if(!p){f(null);return}let N=!0;return Th(p,1).then(E=>{if(!N)return;const T=E[0];f(T&&sq(T)?T:null)}).catch(()=>{N&&f(null)}),()=>{N=!1}},[p]);const w=y.useMemo(()=>g>0||b>0||v>0||!!h,[g,b,v,h]);if(!d||!w)return null;async function k(){a(!0),c(null);try{await Hf(),t?.()}catch(N){c(N instanceof Error?N.message:String(N))}finally{a(!1)}}return n.jsx("div",{className:"mx-auto mb-2 w-full max-w-4xl",children:n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 rounded-md border border-border bg-muted/40 px-2 py-1.5 text-[11px]",children:[n.jsxs("span",{className:"mr-0.5 inline-flex items-center gap-1 font-medium text-muted-foreground",children:[n.jsx(Yt,{className:"size-3.5"}),p??"git"]}),g>0?n.jsx(mh,{icon:n.jsx(z6,{className:"size-3"}),label:`Commit ${g} change${g===1?"":"s"}`,ai:!0,onClick:()=>s({prompt:qH({branch:p,fileCount:g}),source:{type:"git-situation",label:"uncommitted changes"},mode:"send",label:`Commit ${g} uncommitted change${g===1?"":"s"}`})}):null,v>0?n.jsx(mh,{icon:n.jsx(jf,{className:"size-3"}),label:`Pull ${v} behind`,ai:!0,onClick:()=>s({prompt:GH({branch:p,behind:v,upstream:d.upstream}),source:{type:"git-situation",label:"behind upstream"},mode:"send",label:`Pull & rebase (${v} behind)`})}):null,b>0?n.jsx(mh,{icon:i?n.jsx(Rt,{className:"size-3 animate-spin"}):n.jsx(Pf,{className:"size-3"}),label:`Push ${b}`,disabled:i,onClick:()=>{k()}}):null,h?n.jsx(mh,{danger:!0,icon:n.jsx(Rr,{className:"size-3"}),label:"Fix failing CI",ai:!0,onClick:()=>s({prompt:VH({branch:p,runName:h.name,url:h.html_url}),source:{type:"git-situation",label:"failing CI"},mode:"send",label:`Fix failing CI: ${h.name}`})}):null,l?n.jsx("span",{className:"text-destructive",children:l}):null]})})}function mh({ai:e,danger:t,disabled:s,icon:i,label:a,onClick:l}){return n.jsxs("button",{className:ae("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 font-medium transition-colors disabled:opacity-50",t?"border-destructive/40 bg-destructive/5 text-destructive hover:bg-destructive/10":"border-border bg-background text-foreground hover:bg-muted"),disabled:s,onClick:l,type:"button",children:[i,a,e?n.jsx(Yt,{className:"size-3 opacity-70"}):null]})}function sq(e){return e.status==="completed"&&e.conclusion!==null&&!["success","neutral","skipped"].includes(e.conclusion)}var nq=2,iq=1,rq=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,s=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(s.getPropertyValue("height")),a=Math.max(0,parseInt(s.getPropertyValue("width"))),l=window.getComputedStyle(this._terminal.element),c={top:parseInt(l.getPropertyValue("padding-top")),bottom:parseInt(l.getPropertyValue("padding-bottom")),right:parseInt(l.getPropertyValue("padding-right")),left:parseInt(l.getPropertyValue("padding-left"))},h=c.top+c.bottom,f=c.right+c.left,d=i-h,p=a-f-t;return{cols:Math.max(nq,Math.floor(p/e.css.cell.width)),rows:Math.max(iq,Math.floor(d/e.css.cell.height))}}};var W3=Object.defineProperty,aq=Object.getOwnPropertyDescriptor,oq=(e,t)=>{for(var s in t)W3(e,s,{get:t[s],enumerable:!0})},fs=(e,t,s,i)=>{for(var a=i>1?void 0:i?aq(t,s):t,l=e.length-1,c;l>=0;l--)(c=e[l])&&(a=(i?c(t,s,a):c(a))||a);return i&&a&&W3(t,s,a),a},Fe=(e,t)=>(s,i)=>t(s,i,e),ik="Terminal input",kx={get:()=>ik,set:e=>ik=e},rk="Too much output to announce, navigate to rows manually to read",Nx={get:()=>rk,set:e=>rk=e};function lq(e){return e.replace(/\r?\n/g,"\r")}function cq(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function uq(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function dq(e,t,s,i){if(e.stopPropagation(),e.clipboardData){let a=e.clipboardData.getData("text/plain");K3(a,t,s,i)}}function K3(e,t,s,i){e=lq(e),e=cq(e,s.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(e,!0),t.value=""}function Y3(e,t,s){let i=s.getBoundingClientRect(),a=e.clientX-i.left-10,l=e.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${a}px`,t.style.top=`${l}px`,t.style.zIndex="1000",t.focus()}function ak(e,t,s,i,a){Y3(e,t,s),a&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function va(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Xf(e,t=0,s=e.length){let i="";for(let a=t;a<s;++a){let l=e[a];l>65535?(l-=65536,i+=String.fromCharCode((l>>10)+55296)+String.fromCharCode(l%1024+56320)):i+=String.fromCharCode(l)}return i}var hq=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let s=e.length;if(!s)return 0;let i=0,a=0;if(this._interim){let l=e.charCodeAt(a++);56320<=l&&l<=57343?t[i++]=(this._interim-55296)*1024+l-56320+65536:(t[i++]=this._interim,t[i++]=l),this._interim=0}for(let l=a;l<s;++l){let c=e.charCodeAt(l);if(55296<=c&&c<=56319){if(++l>=s)return this._interim=c,i;let h=e.charCodeAt(l);56320<=h&&h<=57343?t[i++]=(c-55296)*1024+h-56320+65536:(t[i++]=c,t[i++]=h);continue}c!==65279&&(t[i++]=c)}return i}},fq=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let s=e.length;if(!s)return 0;let i=0,a,l,c,h,f=0,d=0;if(this.interim[0]){let b=!1,v=this.interim[0];v&=(v&224)===192?31:(v&240)===224?15:7;let w=0,k;for(;(k=this.interim[++w]&63)&&w<4;)v<<=6,v|=k;let N=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,E=N-w;for(;d<E;){if(d>=s)return 0;if(k=e[d++],(k&192)!==128){d--,b=!0;break}else this.interim[w++]=k,v<<=6,v|=k&63}b||(N===2?v<128?d--:t[i++]=v:N===3?v<2048||v>=55296&&v<=57343||v===65279||(t[i++]=v):v<65536||v>1114111||(t[i++]=v)),this.interim.fill(0)}let p=s-4,g=d;for(;g<s;){for(;g<p&&!((a=e[g])&128)&&!((l=e[g+1])&128)&&!((c=e[g+2])&128)&&!((h=e[g+3])&128);)t[i++]=a,t[i++]=l,t[i++]=c,t[i++]=h,g+=4;if(a=e[g++],a<128)t[i++]=a;else if((a&224)===192){if(g>=s)return this.interim[0]=a,i;if(l=e[g++],(l&192)!==128){g--;continue}if(f=(a&31)<<6|l&63,f<128){g--;continue}t[i++]=f}else if((a&240)===224){if(g>=s)return this.interim[0]=a,i;if(l=e[g++],(l&192)!==128){g--;continue}if(g>=s)return this.interim[0]=a,this.interim[1]=l,i;if(c=e[g++],(c&192)!==128){g--;continue}if(f=(a&15)<<12|(l&63)<<6|c&63,f<2048||f>=55296&&f<=57343||f===65279)continue;t[i++]=f}else if((a&248)===240){if(g>=s)return this.interim[0]=a,i;if(l=e[g++],(l&192)!==128){g--;continue}if(g>=s)return this.interim[0]=a,this.interim[1]=l,i;if(c=e[g++],(c&192)!==128){g--;continue}if(g>=s)return this.interim[0]=a,this.interim[1]=l,this.interim[2]=c,i;if(h=e[g++],(h&192)!==128){g--;continue}if(f=(a&7)<<18|(l&63)<<12|(c&63)<<6|h&63,f<65536||f>1114111)continue;t[i++]=f}}return i}},X3="",_a=" ",Tu=class Z3{constructor(){this.fg=0,this.bg=0,this.extended=new ff}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new Z3;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},ff=class Q3{constructor(t=0,s=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=s}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new Q3(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},gi=class J3 extends Tu{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ff,this.combinedData=""}static fromCharData(t){let s=new J3;return s.setFromCharData(t),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?va(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let s=!1;if(t[1].length>2)s=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let a=t[1].charCodeAt(1);56320<=a&&a<=57343?this.content=(i-55296)*1024+a-56320+65536|t[2]<<22:s=!0}else s=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;s&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ok="di$target",Cx="di$dependencies",Wg=new Map;function mq(e){return e[Cx]||[]}function Ks(e){if(Wg.has(e))return Wg.get(e);let t=function(s,i,a){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");pq(t,s,a)};return t._id=e,Wg.set(e,t),t}function pq(e,t,s){t[ok]===t?t[Cx].push({id:e,index:s}):(t[Cx]=[{id:e,index:s}],t[ok]=t)}var xn=Ks("BufferService"),e5=Ks("CoreMouseService"),_o=Ks("CoreService"),gq=Ks("CharsetService"),xv=Ks("InstantiationService"),t5=Ks("LogService"),vn=Ks("OptionsService"),s5=Ks("OscLinkService"),bq=Ks("UnicodeService"),Ru=Ks("DecorationService"),Ex=class{constructor(e,t,s){this._bufferService=e,this._optionsService=t,this._oscLinkService=s}provideLinks(e,t){let s=this._bufferService.buffer.lines.get(e-1);if(!s){t(void 0);return}let i=[],a=this._optionsService.rawOptions.linkHandler,l=new gi,c=s.getTrimmedLength(),h=-1,f=-1,d=!1;for(let p=0;p<c;p++)if(!(f===-1&&!s.hasContent(p))){if(s.loadCell(p,l),l.hasExtendedAttrs()&&l.extended.urlId)if(f===-1){f=p,h=l.extended.urlId;continue}else d=l.extended.urlId!==h;else f!==-1&&(d=!0);if(d||f!==-1&&p===c-1){let g=this._oscLinkService.getLinkData(h)?.uri;if(g){let b={start:{x:f+1,y:e},end:{x:p+(!d&&p===c-1?1:0),y:e}},v=!1;if(!a?.allowNonHttpProtocols)try{let w=new URL(g);["http:","https:"].includes(w.protocol)||(v=!0)}catch{v=!0}v||i.push({text:g,range:b,activate:(w,k)=>a?a.activate(w,k,b):xq(w,k),hover:(w,k)=>a?.hover?.(w,k,b),leave:(w,k)=>a?.leave?.(w,k,b)})}d=!1,l.hasExtendedAttrs()&&l.extended.urlId?(f=p,h=l.extended.urlId):(f=-1,h=-1)}}t(i)}};Ex=fs([Fe(0,xn),Fe(1,vn),Fe(2,s5)],Ex);function xq(e,t){if(confirm(`Do you want to navigate to ${t}?
95
+
96
+ WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Zf=Ks("CharSizeService"),Or=Ks("CoreBrowserService"),vv=Ks("MouseService"),zr=Ks("RenderService"),vq=Ks("SelectionService"),n5=Ks("CharacterJoinerService"),Tl=Ks("ThemeService"),i5=Ks("LinkProviderService"),yq=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?lk.isErrorNoTelemetry(e)?new lk(e.message+`
97
+
98
+ `+e.stack):new Error(e.message+`
99
+
100
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},_q=new yq;function $h(e){wq(e)||_q.onUnexpectedError(e)}var jx="Canceled";function wq(e){return e instanceof Sq?!0:e instanceof Error&&e.name===jx&&e.message===jx}var Sq=class extends Error{constructor(){super(jx),this.name=this.message}};function kq(e){return new Error(`Illegal argument: ${e}`)}var lk=class Ax extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Ax)return t;let s=new Ax;return s.message=t.message,s.stack=t.stack,s}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Tx=class r5 extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,r5.prototype)}};function Gn(e,t=0){return e[e.length-(1+t)]}var Nq;(e=>{function t(l){return l<0}e.isLessThan=t;function s(l){return l<=0}e.isLessThanOrEqual=s;function i(l){return l>0}e.isGreaterThan=i;function a(l){return l===0}e.isNeitherLessOrGreaterThan=a,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Nq||={});function Cq(e,t){let s=this,i=!1,a;return function(){return i||(i=!0,t||(a=e.apply(s,arguments))),a}}var a5;(e=>{function t(C){return C&&typeof C=="object"&&typeof C[Symbol.iterator]=="function"}e.is=t;let s=Object.freeze([]);function i(){return s}e.empty=i;function*a(C){yield C}e.single=a;function l(C){return t(C)?C:a(C)}e.wrap=l;function c(C){return C||s}e.from=c;function*h(C){for(let R=C.length-1;R>=0;R--)yield C[R]}e.reverse=h;function f(C){return!C||C[Symbol.iterator]().next().done===!0}e.isEmpty=f;function d(C){return C[Symbol.iterator]().next().value}e.first=d;function p(C,R){let L=0;for(let H of C)if(R(H,L++))return!0;return!1}e.some=p;function g(C,R){for(let L of C)if(R(L))return L}e.find=g;function*b(C,R){for(let L of C)R(L)&&(yield L)}e.filter=b;function*v(C,R){let L=0;for(let H of C)yield R(H,L++)}e.map=v;function*w(C,R){let L=0;for(let H of C)yield*R(H,L++)}e.flatMap=w;function*k(...C){for(let R of C)yield*R}e.concat=k;function N(C,R,L){let H=L;for(let B of C)H=R(H,B);return H}e.reduce=N;function*E(C,R,L=C.length){for(R<0&&(R+=C.length),L<0?L+=C.length:L>C.length&&(L=C.length);R<L;R++)yield C[R]}e.slice=E;function T(C,R=Number.POSITIVE_INFINITY){let L=[];if(R===0)return[L,C];let H=C[Symbol.iterator]();for(let B=0;B<R;B++){let P=H.next();if(P.done)return[L,e.empty()];L.push(P.value)}return[L,{[Symbol.iterator](){return H}}]}e.consume=T;async function A(C){let R=[];for await(let L of C)R.push(L);return Promise.resolve(R)}e.asyncToArray=A})(a5||={});function mo(e){if(a5.is(e)){let t=[];for(let s of e)if(s)try{s.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Eq(...e){return ns(()=>mo(e))}function ns(e){return{dispose:Cq(()=>{e()})}}var o5=class l5{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{mo(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?l5.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};o5.DISABLE_DISPOSED_WARNING=!1;var wa=o5,gt=class{constructor(){this._store=new wa,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};gt.None=Object.freeze({dispose(){}});var Sl=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},Ar=typeof window=="object"?window:globalThis,Rx=class Mx{constructor(t){this.element=t,this.next=Mx.Undefined,this.prev=Mx.Undefined}};Rx.Undefined=new Rx(void 0);var as=Rx,ck=class{constructor(){this._first=as.Undefined,this._last=as.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===as.Undefined}clear(){let e=this._first;for(;e!==as.Undefined;){let t=e.next;e.prev=as.Undefined,e.next=as.Undefined,e=t}this._first=as.Undefined,this._last=as.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let s=new as(e);if(this._first===as.Undefined)this._first=s,this._last=s;else if(t){let a=this._last;this._last=s,s.prev=a,a.next=s}else{let a=this._first;this._first=s,s.next=a,a.prev=s}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(s))}}shift(){if(this._first!==as.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==as.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==as.Undefined&&e.next!==as.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===as.Undefined&&e.next===as.Undefined?(this._first=as.Undefined,this._last=as.Undefined):e.next===as.Undefined?(this._last=this._last.prev,this._last.next=as.Undefined):e.prev===as.Undefined&&(this._first=this._first.next,this._first.prev=as.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==as.Undefined;)yield e.element,e=e.next}},jq=globalThis.performance&&typeof globalThis.performance.now=="function",Aq=class c5{static create(t){return new c5(t)}constructor(t){this._now=jq&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},tn;(e=>{e.None=()=>gt.None;function t($,O){return g($,()=>{},0,void 0,!0,void 0,O)}e.defer=t;function s($){return(O,V=null,K)=>{let I=!1,Y;return Y=$(W=>{if(!I)return Y?Y.dispose():I=!0,O.call(V,W)},null,K),I&&Y.dispose(),Y}}e.once=s;function i($,O,V){return d((K,I=null,Y)=>$(W=>K.call(I,O(W)),null,Y),V)}e.map=i;function a($,O,V){return d((K,I=null,Y)=>$(W=>{O(W),K.call(I,W)},null,Y),V)}e.forEach=a;function l($,O,V){return d((K,I=null,Y)=>$(W=>O(W)&&K.call(I,W),null,Y),V)}e.filter=l;function c($){return $}e.signal=c;function h(...$){return(O,V=null,K)=>{let I=Eq(...$.map(Y=>Y(W=>O.call(V,W))));return p(I,K)}}e.any=h;function f($,O,V,K){let I=V;return i($,Y=>(I=O(I,Y),I),K)}e.reduce=f;function d($,O){let V,K={onWillAddFirstListener(){V=$(I.fire,I)},onDidRemoveLastListener(){V?.dispose()}},I=new ze(K);return O?.add(I),I.event}function p($,O){return O instanceof Array?O.push($):O&&O.add($),$}function g($,O,V=100,K=!1,I=!1,Y,W){let le,J,U,F=0,re,fe={leakWarningThreshold:Y,onWillAddFirstListener(){le=$(te=>{F++,J=O(J,te),K&&!U&&(se.fire(J),J=void 0),re=()=>{let ye=J;J=void 0,U=void 0,(!K||F>1)&&se.fire(ye),F=0},typeof V=="number"?(clearTimeout(U),U=setTimeout(re,V)):U===void 0&&(U=0,queueMicrotask(re))})},onWillRemoveListener(){I&&F>0&&re?.()},onDidRemoveLastListener(){re=void 0,le.dispose()}},se=new ze(fe);return W?.add(se),se.event}e.debounce=g;function b($,O=0,V){return e.debounce($,(K,I)=>K?(K.push(I),K):[I],O,void 0,!0,void 0,V)}e.accumulate=b;function v($,O=(K,I)=>K===I,V){let K=!0,I;return l($,Y=>{let W=K||!O(Y,I);return K=!1,I=Y,W},V)}e.latch=v;function w($,O,V){return[e.filter($,O,V),e.filter($,K=>!O(K),V)]}e.split=w;function k($,O=!1,V=[],K){let I=V.slice(),Y=$(J=>{I?I.push(J):le.fire(J)});K&&K.add(Y);let W=()=>{I?.forEach(J=>le.fire(J)),I=null},le=new ze({onWillAddFirstListener(){Y||(Y=$(J=>le.fire(J)),K&&K.add(Y))},onDidAddFirstListener(){I&&(O?setTimeout(W):W())},onDidRemoveLastListener(){Y&&Y.dispose(),Y=null}});return K&&K.add(le),le.event}e.buffer=k;function N($,O){return(V,K,I)=>{let Y=O(new T);return $(function(W){let le=Y.evaluate(W);le!==E&&V.call(K,le)},void 0,I)}}e.chain=N;let E=Symbol("HaltChainable");class T{constructor(){this.steps=[]}map(O){return this.steps.push(O),this}forEach(O){return this.steps.push(V=>(O(V),V)),this}filter(O){return this.steps.push(V=>O(V)?V:E),this}reduce(O,V){let K=V;return this.steps.push(I=>(K=O(K,I),K)),this}latch(O=(V,K)=>V===K){let V=!0,K;return this.steps.push(I=>{let Y=V||!O(I,K);return V=!1,K=I,Y?I:E}),this}evaluate(O){for(let V of this.steps)if(O=V(O),O===E)break;return O}}function A($,O,V=K=>K){let K=(...le)=>W.fire(V(...le)),I=()=>$.on(O,K),Y=()=>$.removeListener(O,K),W=new ze({onWillAddFirstListener:I,onDidRemoveLastListener:Y});return W.event}e.fromNodeEventEmitter=A;function C($,O,V=K=>K){let K=(...le)=>W.fire(V(...le)),I=()=>$.addEventListener(O,K),Y=()=>$.removeEventListener(O,K),W=new ze({onWillAddFirstListener:I,onDidRemoveLastListener:Y});return W.event}e.fromDOMEventEmitter=C;function R($){return new Promise(O=>s($)(O))}e.toPromise=R;function L($){let O=new ze;return $.then(V=>{O.fire(V)},()=>{O.fire(void 0)}).finally(()=>{O.dispose()}),O.event}e.fromPromise=L;function H($,O){return $(V=>O.fire(V))}e.forward=H;function B($,O,V){return O(V),$(K=>O(K))}e.runAndSubscribe=B;class P{constructor(O,V){this._observable=O,this._counter=0,this._hasChanged=!1;let K={onWillAddFirstListener:()=>{O.addObserver(this)},onDidRemoveLastListener:()=>{O.removeObserver(this)}};this.emitter=new ze(K),V&&V.add(this.emitter)}beginUpdate(O){this._counter++}handlePossibleChange(O){}handleChange(O,V){this._hasChanged=!0}endUpdate(O){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function D($,O){return new P($,O).emitter.event}e.fromObservable=D;function G($){return(O,V,K)=>{let I=0,Y=!1,W={beginUpdate(){I++},endUpdate(){I--,I===0&&($.reportChanges(),Y&&(Y=!1,O.call(V)))},handlePossibleChange(){},handleChange(){Y=!0}};$.addObserver(W),$.reportChanges();let le={dispose(){$.removeObserver(W)}};return K instanceof wa?K.add(le):Array.isArray(K)&&K.push(le),le}}e.fromObservableLight=G})(tn||={});var Dx=class Lx{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Lx._idPool++}`,Lx.all.add(this)}start(t){this._stopWatch=new Aq,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Dx.all=new Set,Dx._idPool=0;var Tq=Dx,Rq=-1,u5=class d5{constructor(t,s,i=(d5._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=s,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,s){let i=this.threshold;if(i<=0||s<i)return;this._stacks||(this._stacks=new Map);let a=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,a+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[l,c]=this.getMostFrequentStack(),h=`[${this.name}] potential listener LEAK detected, having ${s} listeners already. MOST frequent listener (${c}):`;console.warn(h),console.warn(l);let f=new Lq(h,l);this._errorHandler(f)}return()=>{let l=this._stacks.get(t.value)||0;this._stacks.set(t.value,l-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,s=0;for(let[i,a]of this._stacks)(!t||s<a)&&(t=[i,a],s=a);return t}};u5._idPool=1;var Mq=u5,Dq=class h5{constructor(t){this.value=t}static create(){let t=new Error;return new h5(t.stack??"")}print(){console.warn(this.value.split(`
101
+ `).slice(2).join(`
102
+ `))}},Lq=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Oq=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},zq=0,Kg=class{constructor(e){this.value=e,this.id=zq++}},Bq=2,Pq,ze=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new Mq(t?.onListenerError??$h,this._options?.leakWarningThreshold??Rq):void 0,this._perfMon=this._options?._profName?new Tq(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,s,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],d=new Oq(`${h}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||$h)(d),gt.None}if(this._disposed)return gt.None;s&&(t=t.bind(s));let a=new Kg(t),l;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(a.stack=Dq.create(),l=this._leakageMon.check(a.stack,this._size+1)),this._listeners?this._listeners instanceof Kg?(this._deliveryQueue??=new Iq,this._listeners=[this._listeners,a]):this._listeners.push(a):(this._options?.onWillAddFirstListener?.(this),this._listeners=a,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=ns(()=>{l?.(),this._removeListener(a)});return i instanceof wa?i.add(c):Array.isArray(i)&&i.push(c),c},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let s=this._listeners,i=s.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,s[i]=void 0;let a=this._deliveryQueue.current===this;if(this._size*Bq<=s.length){let l=0;for(let c=0;c<s.length;c++)s[c]?s[l++]=s[c]:a&&(this._deliveryQueue.end--,l<this._deliveryQueue.i&&this._deliveryQueue.i--);s.length=l}}_deliver(t,s){if(!t)return;let i=this._options?.onListenerError||$h;if(!i){t.value(s);return}try{t.value(s)}catch(a){i(a)}}_deliverQueue(t){let s=t.current._listeners;for(;t.i<t.end;)this._deliver(s[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Kg)this._deliver(this._listeners,t);else{let s=this._deliveryQueue;s.enqueue(this,t,this._listeners.length),this._deliverQueue(s)}this._perfMon?.stop()}hasListeners(){return this._size>0}},Iq=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,s){this.i=0,this.end=s,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Ox=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ze,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ze,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,s){if(this.getZoomLevel(s)===t)return;let i=this.getWindowId(s);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,s){this.mapWindowIdToZoomFactor.set(this.getWindowId(s),t)}setFullscreen(t,s){if(this.isFullscreen(s)===t)return;let i=this.getWindowId(s);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Ox.INSTANCE=new Ox;var yv=Ox;function $q(e,t,s){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",s)}yv.INSTANCE.onDidChangeZoomLevel;function Hq(e){return yv.INSTANCE.getZoomFactor(e)}yv.INSTANCE.onDidChangeFullscreen;var Rl=typeof navigator=="object"?navigator.userAgent:"",zx=Rl.indexOf("Firefox")>=0,Uq=Rl.indexOf("AppleWebKit")>=0,_v=Rl.indexOf("Chrome")>=0,Fq=!_v&&Rl.indexOf("Safari")>=0;Rl.indexOf("Electron/")>=0;Rl.indexOf("Android")>=0;var Yg=!1;if(typeof Ar.matchMedia=="function"){let e=Ar.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Ar.matchMedia("(display-mode: fullscreen)");Yg=e.matches,$q(Ar,e,({matches:s})=>{Yg&&t.matches||(Yg=s)})}var ml="en",Bx=!1,Px=!1,Hh=!1,f5=!1,ph,Uh=ml,uk=ml,qq,Er,uo=globalThis,Kn;typeof uo.vscode<"u"&&typeof uo.vscode.process<"u"?Kn=uo.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Kn=process);var Gq=typeof Kn?.versions?.electron=="string",Vq=Gq&&Kn?.type==="renderer";if(typeof Kn=="object"){Bx=Kn.platform==="win32",Px=Kn.platform==="darwin",Hh=Kn.platform==="linux",Hh&&Kn.env.SNAP&&Kn.env.SNAP_REVISION,Kn.env.CI||Kn.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ph=ml,Uh=ml;let e=Kn.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);ph=t.userLocale,uk=t.osLocale,Uh=t.resolvedLanguage||ml,qq=t.languagePack?.translationsConfigFile}catch{}f5=!0}else typeof navigator=="object"&&!Vq?(Er=navigator.userAgent,Bx=Er.indexOf("Windows")>=0,Px=Er.indexOf("Macintosh")>=0,(Er.indexOf("Macintosh")>=0||Er.indexOf("iPad")>=0||Er.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Hh=Er.indexOf("Linux")>=0,Er?.indexOf("Mobi")>=0,Uh=globalThis._VSCODE_NLS_LANGUAGE||ml,ph=navigator.language.toLowerCase(),uk=ph):console.error("Unable to resolve platform.");var m5=Bx,Qi=Px,Wq=Hh,dk=f5,tr=Er,ha=Uh,Kq;(e=>{function t(){return ha}e.value=t;function s(){return ha.length===2?ha==="en":ha.length>=3?ha[0]==="e"&&ha[1]==="n"&&ha[2]==="-":!1}e.isDefaultVariant=s;function i(){return ha==="en"}e.isDefault=i})(Kq||={});var Yq=typeof uo.postMessage=="function"&&!uo.importScripts;(()=>{if(Yq){let e=[];uo.addEventListener("message",s=>{if(s.data&&s.data.vscodeScheduleAsyncWork)for(let i=0,a=e.length;i<a;i++){let l=e[i];if(l.id===s.data.vscodeScheduleAsyncWork){e.splice(i,1),l.callback();return}}});let t=0;return s=>{let i=++t;e.push({id:i,callback:s}),uo.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var Xq=!!(tr&&tr.indexOf("Chrome")>=0);tr&&tr.indexOf("Firefox")>=0;!Xq&&tr&&tr.indexOf("Safari")>=0;tr&&tr.indexOf("Edg/")>=0;tr&&tr.indexOf("Android")>=0;var rl=typeof navigator=="object"?navigator:{};dk||document.queryCommandSupported&&document.queryCommandSupported("copy")||rl&&rl.clipboard&&rl.clipboard.writeText,dk||rl&&rl.clipboard&&rl.clipboard.readText;var wv=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Xg=new wv,hk=new wv,fk=new wv,Zq=new Array(230),p5;(e=>{function t(h){return Xg.keyCodeToStr(h)}e.toString=t;function s(h){return Xg.strToKeyCode(h)}e.fromString=s;function i(h){return hk.keyCodeToStr(h)}e.toUserSettingsUS=i;function a(h){return fk.keyCodeToStr(h)}e.toUserSettingsGeneral=a;function l(h){return hk.strToKeyCode(h)||fk.strToKeyCode(h)}e.fromUserSettings=l;function c(h){if(h>=98&&h<=113)return null;switch(h){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Xg.keyCodeToStr(h)}e.toElectronAccelerator=c})(p5||={});var Qq=class g5{constructor(t,s,i,a,l){this.ctrlKey=t,this.shiftKey=s,this.altKey=i,this.metaKey=a,this.keyCode=l}equals(t){return t instanceof g5&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",s=this.shiftKey?"1":"0",i=this.altKey?"1":"0",a=this.metaKey?"1":"0";return`K${t}${s}${i}${a}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new Jq([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},Jq=class{constructor(e){if(e.length===0)throw kq("chords");this.chords=e}getHashCode(){let e="";for(let t=0,s=this.chords.length;t<s;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function eG(e){if(e.charCode){let s=String.fromCharCode(e.charCode).toUpperCase();return p5.fromString(s)}let t=e.keyCode;if(t===3)return 7;if(zx)switch(t){case 59:return 85;case 60:if(Wq)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Qi)return 57;break}else if(Uq&&(Qi&&t===93||!Qi&&t===92))return 57;return Zq[t]||0}var tG=Qi?256:2048,sG=512,nG=1024,iG=Qi?2048:256,mk=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.("AltGraph"),this.keyCode=eG(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=tG),this.altKey&&(t|=sG),this.shiftKey&&(t|=nG),this.metaKey&&(t|=iG),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Qq(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},pk=new WeakMap;function rG(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,s=e.parent.location;if(t.origin!=="null"&&s.origin!=="null"&&t.origin!==s.origin)return null}catch{return null}return e.parent}var aG=class{static getSameOriginWindowChain(e){let t=pk.get(e);if(!t){t=[],pk.set(e,t);let s=e,i;do i=rG(s),i?t.push({window:new WeakRef(s),iframeElement:s.frameElement||null}):t.push({window:new WeakRef(s),iframeElement:null}),s=i;while(s)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let s=0,i=0,a=this.getSameOriginWindowChain(e);for(let l of a){let c=l.window.deref();if(s+=c?.scrollY??0,i+=c?.scrollX??0,c===t||!l.iframeElement)break;let h=l.iframeElement.getBoundingClientRect();s+=h.top,i+=h.left}return{top:s,left:i}}},gh=class{constructor(t,s){this.timestamp=Date.now(),this.browserEvent=s,this.leftButton=s.button===0,this.middleButton=s.button===1,this.rightButton=s.button===2,this.buttons=s.buttons,this.target=s.target,this.detail=s.detail||1,s.type==="dblclick"&&(this.detail=2),this.ctrlKey=s.ctrlKey,this.shiftKey=s.shiftKey,this.altKey=s.altKey,this.metaKey=s.metaKey,typeof s.pageX=="number"?(this.posx=s.pageX,this.posy=s.pageY):(this.posx=s.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=s.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let i=aG.getPositionOfChildWindowRelativeToAncestorWindow(t,s.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},gk=class{constructor(e,t=0,s=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=s,this.deltaX=t;let i=!1;if(_v){let a=navigator.userAgent.match(/Chrome\/(\d+)/);i=(a?parseInt(a[1]):123)<=122}if(e){let a=e,l=e,c=e.view?.devicePixelRatio||1;if(typeof a.wheelDeltaY<"u")i?this.deltaY=a.wheelDeltaY/(120*c):this.deltaY=a.wheelDeltaY/120;else if(typeof l.VERTICAL_AXIS<"u"&&l.axis===l.VERTICAL_AXIS)this.deltaY=-l.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?zx&&!Qi?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof a.wheelDeltaX<"u")Fq&&m5?this.deltaX=-(a.wheelDeltaX/120):i?this.deltaX=a.wheelDeltaX/(120*c):this.deltaX=a.wheelDeltaX/120;else if(typeof l.HORIZONTAL_AXIS<"u"&&l.axis===l.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?zx&&!Qi?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(i?this.deltaY=e.wheelDelta/(120*c):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},b5=Object.freeze(function(e,t){let s=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(s)}}}),oG;(e=>{function t(s){return s===e.None||s===e.Cancelled||s instanceof lG?!0:!s||typeof s!="object"?!1:typeof s.isCancellationRequested=="boolean"&&typeof s.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:tn.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:b5})})(oG||={});var lG=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?b5:(this._emitter||(this._emitter=new ze),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Sv=class{constructor(t,s){this._isDisposed=!1,this._token=-1,typeof t=="function"&&typeof s=="number"&&this.setIfNotSet(t,s)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(t,s){if(this._isDisposed)throw new Tx("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,t()},s)}setIfNotSet(t,s){if(this._isDisposed)throw new Tx("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,t()},s))}},cG=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,s=globalThis){if(this.isDisposed)throw new Tx("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=s.setInterval(()=>{e()},t);this.disposable=ns(()=>{s.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},uG;(e=>{async function t(i){let a,l=await Promise.all(i.map(c=>c.then(h=>h,h=>{a||(a=h)})));if(typeof a<"u")throw a;return l}e.settled=t;function s(i){return new Promise(async(a,l)=>{try{await i(a,l)}catch(c){l(c)}})}e.withAsyncBody=s})(uG||={});var bk=class hi{static fromArray(t){return new hi(s=>{s.emitMany(t)})}static fromPromise(t){return new hi(async s=>{s.emitMany(await t)})}static fromPromises(t){return new hi(async s=>{await Promise.all(t.map(async i=>s.emitOne(await i)))})}static merge(t){return new hi(async s=>{await Promise.all(t.map(async i=>{for await(let a of i)s.emitOne(a)}))})}constructor(t,s){this._state=0,this._results=[],this._error=null,this._onReturn=s,this._onStateChanged=new ze,queueMicrotask(async()=>{let i={emitOne:a=>this.emitOne(a),emitMany:a=>this.emitMany(a),reject:a=>this.reject(a)};try{await Promise.resolve(t(i)),this.resolve()}catch(a){this.reject(a)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await tn.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,s){return new hi(async i=>{for await(let a of t)i.emitOne(s(a))})}map(t){return hi.map(this,t)}static filter(t,s){return new hi(async i=>{for await(let a of t)s(a)&&i.emitOne(a)})}filter(t){return hi.filter(this,t)}static coalesce(t){return hi.filter(t,s=>!!s)}coalesce(){return hi.coalesce(this)}static async toPromise(t){let s=[];for await(let i of t)s.push(i);return s}toPromise(){return hi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};bk.EMPTY=bk.fromArray([]);var{getWindow:Yi,getWindowId:dG,onDidRegisterWindow:hG}=(function(){let e=new Map,t={window:Ar,disposables:new wa};e.set(Ar.vscodeWindowId,t);let s=new ze,i=new ze,a=new ze;function l(c,h){return(typeof c=="number"?e.get(c):void 0)??(h?t:void 0)}return{onDidRegisterWindow:s.event,onWillUnregisterWindow:a.event,onDidUnregisterWindow:i.event,registerWindow(c){if(e.has(c.vscodeWindowId))return gt.None;let h=new wa,f={window:c,disposables:h.add(new wa)};return e.set(c.vscodeWindowId,f),h.add(ns(()=>{e.delete(c.vscodeWindowId),i.fire(c)})),h.add(lt(c,Fs.BEFORE_UNLOAD,()=>{a.fire(c)})),s.fire(f),h},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(c){return c.vscodeWindowId},hasWindow(c){return e.has(c)},getWindowById:l,getWindow(c){let h=c;if(h?.ownerDocument?.defaultView)return h.ownerDocument.defaultView.window;let f=c;return f?.view?f.view.window:Ar},getDocument(c){return Yi(c).document}}})(),fG=class{constructor(e,t,s,i){this._node=e,this._type=t,this._handler=s,this._options=i||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function lt(e,t,s,i){return new fG(e,t,s,i)}var xk=function(e,t,s,i){return lt(e,t,s,i)},kv,mG=class extends cG{constructor(e){super(),this.defaultTarget=e&&Yi(e)}cancelAndSet(e,t,s){return super.cancelAndSet(e,t,s??this.defaultTarget)}},vk=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){$h(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,s=new Map,i=new Map,a=l=>{s.set(l,!1);let c=e.get(l)??[];for(t.set(l,c),e.set(l,[]),i.set(l,!0);c.length>0;)c.sort(vk.sort),c.shift().execute();i.set(l,!1)};kv=(l,c,h=0)=>{let f=dG(l),d=new vk(c,h),p=e.get(f);return p||(p=[],e.set(f,p)),p.push(d),s.get(f)||(s.set(f,!0),l.requestAnimationFrame(()=>a(f))),d}})();function pG(e){let t=e.getBoundingClientRect(),s=Yi(e);return{left:t.left+s.scrollX,top:t.top+s.scrollY,width:t.width,height:t.height}}var Fs={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},gG=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=Rn(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Rn(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Rn(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Rn(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Rn(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Rn(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Rn(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Rn(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Rn(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Rn(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Rn(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Rn(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Rn(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Rn(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Rn(e){return typeof e=="number"?`${e}px`:e}function ru(e){return new gG(e)}var x5=class{constructor(){this._hooks=new wa,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let s=this._onStopCallback;this._onStopCallback=null,e&&s&&s(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,s,i,a){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=i,this._onStopCallback=a;let l=e;try{e.setPointerCapture(t),this._hooks.add(ns(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{l=Yi(e)}this._hooks.add(lt(l,Fs.POINTER_MOVE,c=>{if(c.buttons!==s){this.stopMonitoring(!0);return}c.preventDefault(),this._pointerMoveCallback(c)})),this._hooks.add(lt(l,Fs.POINTER_UP,c=>this.stopMonitoring(!0)))}};function bG(e,t,s){let i=null,a=null;if(typeof s.value=="function"?(i="value",a=s.value,a.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof s.get=="function"&&(i="get",a=s.get),!a)throw new Error("not supported");let l=`$memoize$${t}`;s[i]=function(...c){return this.hasOwnProperty(l)||Object.defineProperty(this,l,{configurable:!1,enumerable:!1,writable:!1,value:a.apply(this,c)}),this[l]}}var qi;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(qi||={});var Gc=class on extends gt{constructor(){super(),this.dispatched=!1,this.targets=new ck,this.ignoreTargets=new ck,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(tn.runAndSubscribe(hG,({window:t,disposables:s})=>{s.add(lt(t.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),s.add(lt(t.document,"touchend",i=>this.onTouchEnd(t,i))),s.add(lt(t.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:Ar,disposables:this._store}))}static addTarget(t){if(!on.isTouchDevice())return gt.None;on.INSTANCE||(on.INSTANCE=new on);let s=on.INSTANCE.targets.push(t);return ns(s)}static ignoreTarget(t){if(!on.isTouchDevice())return gt.None;on.INSTANCE||(on.INSTANCE=new on);let s=on.INSTANCE.ignoreTargets.push(t);return ns(s)}static isTouchDevice(){return"ontouchstart"in Ar||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let s=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,a=t.targetTouches.length;i<a;i++){let l=t.targetTouches.item(i);this.activeTouches[l.identifier]={id:l.identifier,initialTarget:l.target,initialTimeStamp:s,initialPageX:l.pageX,initialPageY:l.pageY,rollingTimestamps:[s],rollingPageX:[l.pageX],rollingPageY:[l.pageY]};let c=this.newGestureEvent(qi.Start,l.target);c.pageX=l.pageX,c.pageY=l.pageY,this.dispatchEvent(c)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,s){let i=Date.now(),a=Object.keys(this.activeTouches).length;for(let l=0,c=s.changedTouches.length;l<c;l++){let h=s.changedTouches.item(l);if(!this.activeTouches.hasOwnProperty(String(h.identifier))){console.warn("move of an UNKNOWN touch",h);continue}let f=this.activeTouches[h.identifier],d=Date.now()-f.initialTimeStamp;if(d<on.HOLD_DELAY&&Math.abs(f.initialPageX-Gn(f.rollingPageX))<30&&Math.abs(f.initialPageY-Gn(f.rollingPageY))<30){let p=this.newGestureEvent(qi.Tap,f.initialTarget);p.pageX=Gn(f.rollingPageX),p.pageY=Gn(f.rollingPageY),this.dispatchEvent(p)}else if(d>=on.HOLD_DELAY&&Math.abs(f.initialPageX-Gn(f.rollingPageX))<30&&Math.abs(f.initialPageY-Gn(f.rollingPageY))<30){let p=this.newGestureEvent(qi.Contextmenu,f.initialTarget);p.pageX=Gn(f.rollingPageX),p.pageY=Gn(f.rollingPageY),this.dispatchEvent(p)}else if(a===1){let p=Gn(f.rollingPageX),g=Gn(f.rollingPageY),b=Gn(f.rollingTimestamps)-f.rollingTimestamps[0],v=p-f.rollingPageX[0],w=g-f.rollingPageY[0],k=[...this.targets].filter(N=>f.initialTarget instanceof Node&&N.contains(f.initialTarget));this.inertia(t,k,i,Math.abs(v)/b,v>0?1:-1,p,Math.abs(w)/b,w>0?1:-1,g)}this.dispatchEvent(this.newGestureEvent(qi.End,f.initialTarget)),delete this.activeTouches[h.identifier]}this.dispatched&&(s.preventDefault(),s.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,s){let i=document.createEvent("CustomEvent");return i.initEvent(t,!1,!0),i.initialTarget=s,i.tapCount=0,i}dispatchEvent(t){if(t.type===qi.Tap){let s=new Date().getTime(),i=0;s-this._lastSetTapCountTime>on.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=s,t.tapCount=i}else(t.type===qi.Change||t.type===qi.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let i of this.ignoreTargets)if(i.contains(t.initialTarget))return;let s=[];for(let i of this.targets)if(i.contains(t.initialTarget)){let a=0,l=t.initialTarget;for(;l&&l!==i;)a++,l=l.parentElement;s.push([a,i])}s.sort((i,a)=>i[0]-a[0]);for(let[i,a]of s)a.dispatchEvent(t),this.dispatched=!0}}inertia(t,s,i,a,l,c,h,f,d){this.handle=kv(t,()=>{let p=Date.now(),g=p-i,b=0,v=0,w=!0;a+=on.SCROLL_FRICTION*g,h+=on.SCROLL_FRICTION*g,a>0&&(w=!1,b=l*a*g),h>0&&(w=!1,v=f*h*g);let k=this.newGestureEvent(qi.Change);k.translationX=b,k.translationY=v,s.forEach(N=>N.dispatchEvent(k)),w||this.inertia(t,s,p,a,l,c+b,h,f,d+v)})}onTouchMove(t){let s=Date.now();for(let i=0,a=t.changedTouches.length;i<a;i++){let l=t.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("end of an UNKNOWN touch",l);continue}let c=this.activeTouches[l.identifier],h=this.newGestureEvent(qi.Change,c.initialTarget);h.translationX=l.pageX-Gn(c.rollingPageX),h.translationY=l.pageY-Gn(c.rollingPageY),h.pageX=l.pageX,h.pageY=l.pageY,this.dispatchEvent(h),c.rollingPageX.length>3&&(c.rollingPageX.shift(),c.rollingPageY.shift(),c.rollingTimestamps.shift()),c.rollingPageX.push(l.pageX),c.rollingPageY.push(l.pageY),c.rollingTimestamps.push(s)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Gc.SCROLL_FRICTION=-.005,Gc.HOLD_DELAY=700,Gc.CLEAR_TAP_COUNT_TIME=400,fs([bG],Gc,"isTouchDevice",1);var xG=Gc,Nv=class extends gt{onclick(e,t){this._register(lt(e,Fs.CLICK,s=>t(new gh(Yi(e),s))))}onmousedown(e,t){this._register(lt(e,Fs.MOUSE_DOWN,s=>t(new gh(Yi(e),s))))}onmouseover(e,t){this._register(lt(e,Fs.MOUSE_OVER,s=>t(new gh(Yi(e),s))))}onmouseleave(e,t){this._register(lt(e,Fs.MOUSE_LEAVE,s=>t(new gh(Yi(e),s))))}onkeydown(e,t){this._register(lt(e,Fs.KEY_DOWN,s=>t(new mk(s))))}onkeyup(e,t){this._register(lt(e,Fs.KEY_UP,s=>t(new mk(s))))}oninput(e,t){this._register(lt(e,Fs.INPUT,t))}onblur(e,t){this._register(lt(e,Fs.BLUR,t))}onfocus(e,t){this._register(lt(e,Fs.FOCUS,t))}onchange(e,t){this._register(lt(e,Fs.CHANGE,t))}ignoreGesture(e){return xG.ignoreTarget(e)}},yk=11,vG=class extends Nv{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=yk+"px",this.domNode.style.height=yk+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new x5),this._register(xk(this.bgDomNode,Fs.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(xk(this.domNode,Fs.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new mG),this._pointerdownScheduleRepeatTimer=this._register(new Sv)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Yi(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},yG=class Ix{constructor(t,s,i,a,l,c,h){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(s=s|0,i=i|0,a=a|0,l=l|0,c=c|0,h=h|0),this.rawScrollLeft=a,this.rawScrollTop=h,s<0&&(s=0),a+s>i&&(a=i-s),a<0&&(a=0),l<0&&(l=0),h+l>c&&(h=c-l),h<0&&(h=0),this.width=s,this.scrollWidth=i,this.scrollLeft=a,this.height=l,this.scrollHeight=c,this.scrollTop=h}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,s){return new Ix(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,s?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,s?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Ix(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,s){let i=this.width!==t.width,a=this.scrollWidth!==t.scrollWidth,l=this.scrollLeft!==t.scrollLeft,c=this.height!==t.height,h=this.scrollHeight!==t.scrollHeight,f=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:s,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:a,scrollLeftChanged:l,heightChanged:c,scrollHeightChanged:h,scrollTopChanged:f}}},_G=class extends gt{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ze),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new yG(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let s=this._state.withScrollDimensions(e,t);this._setState(s,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let s=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===s.scrollLeft&&this._smoothScrolling.to.scrollTop===s.scrollTop)return;let i;t?i=new wk(this._smoothScrolling.from,s,this._smoothScrolling.startTime,this._smoothScrolling.duration):i=this._smoothScrolling.combine(this._state,s,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=i}else{let s=this._state.withScrollPosition(e);this._smoothScrolling=wk.start(this._state,s,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let s=this._state;s.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(s,t)))}},_k=class{constructor(e,t,s){this.scrollLeft=e,this.scrollTop=t,this.isDone=s}};function Zg(e,t){let s=t-e;return function(i){return e+s*kG(i)}}function wG(e,t,s){return function(i){return i<s?e(i/s):t((i-s)/(1-s))}}var wk=class $x{constructor(t,s,i,a){this.from=t,this.to=s,this.duration=a,this.startTime=i,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,s,i){if(Math.abs(t-s)>2.5*i){let a,l;return t<s?(a=t+.75*i,l=s-.75*i):(a=t-.75*i,l=s+.75*i),wG(Zg(t,a),Zg(l,s),.33)}return Zg(t,s)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let s=(t-this.startTime)/this.duration;if(s<1){let i=this.scrollLeft(s),a=this.scrollTop(s);return new _k(i,a,!1)}return new _k(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,s,i){return $x.start(t,s,i)}static start(t,s,i){i=i+10;let a=Date.now()-10;return new $x(t,s,a,i)}};function SG(e){return Math.pow(e,3)}function kG(e){return 1-SG(1-e)}var NG=class extends gt{constructor(e,t,s){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=s,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Sv)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},CG=140,v5=class extends Nv{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new NG(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new x5),this._shouldRender=!0,this.domNode=ru(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(lt(this.domNode.domNode,Fs.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new vG(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,s,i){this.slider=ru(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof s=="number"&&this.slider.setWidth(s),typeof i=="number"&&this.slider.setHeight(i),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(lt(this.slider.domNode,Fs.POINTER_DOWN,a=>{a.button===0&&(a.preventDefault(),this._sliderPointerDown(a))})),this.onclick(this.slider.domNode,a=>{a.leftButton&&a.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,s=t+this._scrollbarState.getSliderPosition(),i=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),a=this._sliderPointerPosition(e);s<=a&&a<=i?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,s;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,s=e.offsetY;else{let a=pG(this.domNode.domNode);t=e.pageX-a.left,s=e.pageY-a.top}let i=this._pointerDownRelativePosition(t,s);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(i):this._scrollbarState.getDesiredScrollPositionFromOffset(i)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),s=this._sliderOrthogonalPointerPosition(e),i=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,a=>{let l=this._sliderOrthogonalPointerPosition(a),c=Math.abs(l-s);if(m5&&c>CG){this._setDesiredScrollPositionNow(i.getScrollPosition());return}let h=this._sliderPointerPosition(a)-t;this._setDesiredScrollPositionNow(i.getDesiredScrollPositionFromDelta(h))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},y5=class Hx{constructor(t,s,i,a,l,c){this._scrollbarSize=Math.round(s),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(t),this._visibleSize=a,this._scrollSize=l,this._scrollPosition=c,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Hx(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let s=Math.round(t);return this._visibleSize!==s?(this._visibleSize=s,this._refreshComputedValues(),!0):!1}setScrollSize(t){let s=Math.round(t);return this._scrollSize!==s?(this._scrollSize=s,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let s=Math.round(t);return this._scrollPosition!==s?(this._scrollPosition=s,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,s,i,a,l){let c=Math.max(0,i-t),h=Math.max(0,c-2*s),f=a>0&&a>i;if(!f)return{computedAvailableSize:Math.round(c),computedIsNeeded:f,computedSliderSize:Math.round(h),computedSliderRatio:0,computedSliderPosition:0};let d=Math.round(Math.max(20,Math.floor(i*h/a))),p=(h-d)/(a-i),g=l*p;return{computedAvailableSize:Math.round(c),computedIsNeeded:f,computedSliderSize:Math.round(d),computedSliderRatio:p,computedSliderPosition:Math.round(g)}}_refreshComputedValues(){let t=Hx._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let s=t-this._arrowSize-this._computedSliderSize/2;return Math.round(s/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let s=t-this._arrowSize,i=this._scrollPosition;return s<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let s=this._computedSliderPosition+t;return Math.round(s/this._computedSliderRatio)}},EG=class extends v5{constructor(e,t,s){let i=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new y5(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,i.width,i.scrollWidth,a.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},jG=class extends v5{constructor(e,t,s){let i=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new y5(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,i.height,i.scrollHeight,a.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},AG=500,Sk=50,TG=class{constructor(e,t,s){this.timestamp=e,this.deltaX=t,this.deltaY=s,this.score=0}},Ux=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,s=0,i=1,a=this._rear;do{let l=a===this._front?t:Math.pow(2,-i);if(t-=l,s+=this._memory[a].score*l,a===this._front)break;a=(this._capacity+a-1)%this._capacity,i++}while(!0);return s<=.5}acceptStandardWheelEvent(t){if(_v){let s=Yi(t.browserEvent),i=Hq(s);this.accept(Date.now(),t.deltaX*i,t.deltaY*i)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,s,i){let a=null,l=new TG(t,s,i);this._front===-1&&this._rear===-1?(this._memory[0]=l,this._front=0,this._rear=0):(a=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=l),l.score=this._computeScore(l,a)}_computeScore(t,s){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(i+=.25),s){let a=Math.abs(t.deltaX),l=Math.abs(t.deltaY),c=Math.abs(s.deltaX),h=Math.abs(s.deltaY),f=Math.max(Math.min(a,c),1),d=Math.max(Math.min(l,h),1),p=Math.max(a,c),g=Math.max(l,h);p%f===0&&g%d===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Ux.INSTANCE=new Ux;var RG=Ux,MG=class extends Nv{constructor(e,t,s){super(),this._onScroll=this._register(new ze),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ze),this.onWillScroll=this._onWillScroll.event,this._options=LG(t),this._scrollable=s,this._register(this._scrollable.onScroll(a=>{this._onWillScroll.fire(a),this._onDidScroll(a),this._onScroll.fire(a)}));let i={onMouseWheel:a=>this._onMouseWheel(a),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new jG(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new EG(this._scrollable,this._options,i)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=ru(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=ru(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=ru(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,a=>this._onMouseOver(a)),this.onmouseleave(this._listenOnDomNode,a=>this._onMouseLeave(a)),this._hideTimeout=this._register(new Sv),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=mo(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Qi&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new gk(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=mo(this._mouseWheelToDispose),e)){let t=s=>{this._onMouseWheel(new gk(s))};this._mouseWheelToDispose.push(lt(this._listenOnDomNode,Fs.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=RG.INSTANCE;t.acceptStandardWheelEvent(e);let s=!1;if(e.deltaY||e.deltaX){let a=e.deltaY*this._options.mouseWheelScrollSensitivity,l=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&l+a===0?l=a=0:Math.abs(a)>=Math.abs(l)?l=0:a=0),this._options.flipAxes&&([a,l]=[l,a]);let c=!Qi&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||c)&&!l&&(l=a,a=0),e.browserEvent&&e.browserEvent.altKey&&(l=l*this._options.fastScrollSensitivity,a=a*this._options.fastScrollSensitivity);let h=this._scrollable.getFutureScrollPosition(),f={};if(a){let d=Sk*a,p=h.scrollTop-(d<0?Math.floor(d):Math.ceil(d));this._verticalScrollbar.writeScrollPosition(f,p)}if(l){let d=Sk*l,p=h.scrollLeft-(d<0?Math.floor(d):Math.ceil(d));this._horizontalScrollbar.writeScrollPosition(f,p)}f=this._scrollable.validateScrollPosition(f),(h.scrollLeft!==f.scrollLeft||h.scrollTop!==f.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(f):this._scrollable.setScrollPositionNow(f),s=!0)}let i=s;!i&&this._options.alwaysConsumeMouseWheel&&(i=!0),!i&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(i=!0),i&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,s=e.scrollLeft>0,i=s?" left":"",a=t?" top":"",l=s||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${i}`),this._topShadowDomNode.setClassName(`shadow${a}`),this._topLeftShadowDomNode.setClassName(`shadow${l}${a}${i}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),AG)}},DG=class extends MG{constructor(e,t,s){super(e,t,s)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function LG(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,Qi&&(t.className+=" mac"),t}var Fx=class extends gt{constructor(e,t,s,i,a,l,c,h){super(),this._bufferService=s,this._optionsService=c,this._renderService=h,this._onRequestScrollLines=this._register(new ze),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let f=this._register(new _G({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:d=>kv(i.window,d)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{f.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new DG(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},f)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(a.onProtocolChange(d=>{this._scrollableElement.updateOptions({handleMouseWheel:!(d&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(tn.runAndSubscribe(l.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=l.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(ns(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(ns(()=>this._styleElement.remove())),this._register(tn.runAndSubscribe(l.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${l.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${l.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${l.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
103
+ `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(d=>this._handleScroll(d)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),s=t-this._bufferService.buffer.ydisp;s!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(s)),this._isHandlingScroll=!1}};Fx=fs([Fe(2,xn),Fe(3,Or),Fe(4,e5),Fe(5,Tl),Fe(6,vn),Fe(7,zr)],Fx);var qx=class extends gt{constructor(e,t,s,i,a){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=s,this._decorationService=i,this._renderService=a,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(l=>this._removeDecoration(l))),this._register(ns(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let s=e.options.x??0;return s&&s>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let s=this._decorationElements.get(e);s||(s=this._createElement(e),e.element=s,this._decorationElements.set(e,s),this._container.appendChild(s),e.onDispose(()=>{this._decorationElements.delete(e),s.remove()})),s.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(s.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,s.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,s.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,s.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(s)}}_refreshXPosition(e,t=e.element){if(!t)return;let s=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=s?`${s*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=s?`${s*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};qx=fs([Fe(1,xn),Fe(2,Or),Fe(3,Ru),Fe(4,zr)],qx);var OG=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,s){return t>=e.startBufferLine-this._linePadding[s||"full"]&&t<=e.endBufferLine+this._linePadding[s||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Ui={full:0,left:0,center:0,right:0},fa={full:0,left:0,center:0,right:0},Rc={full:0,left:0,center:0,right:0},mf=class extends gt{constructor(e,t,s,i,a,l,c,h){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=s,this._decorationService=i,this._renderService=a,this._optionsService=l,this._themeService=c,this._coreBrowserService=h,this._colorZoneStore=new OG,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(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(ns(()=>this._canvas?.remove()));let f=this._canvas.getContext("2d");if(f)this._ctx=f;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);fa.full=this._canvas.width,fa.left=e,fa.center=t,fa.right=e,this._refreshDrawHeightConstants(),Rc.full=1,Rc.left=1,Rc.center=1+fa.left,Rc.right=1+fa.left+fa.center}_refreshDrawHeightConstants(){Ui.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Ui.left=t,Ui.center=t,Ui.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ui.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ui.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ui.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ui.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Rc[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Ui[e.position||"full"]/2),fa[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Ui[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};mf=fs([Fe(2,xn),Fe(3,Ru),Fe(4,zr),Fe(5,vn),Fe(6,Tl),Fe(7,Or)],mf);var je;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
104
+ `,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(je||={});var Fh;(e=>(e.PAD="€",e.HOP="",e.BPH="‚",e.NBH="ƒ",e.IND="„",e.NEL="…",e.SSA="†",e.ESA="‡",e.HTS="ˆ",e.HTJ="‰",e.VTS="Š",e.PLD="‹",e.PLU="Œ",e.RI="",e.SS2="Ž",e.SS3="",e.DCS="",e.PU1="‘",e.PU2="’",e.STS="“",e.CCH="”",e.MW="•",e.SPA="–",e.EPA="—",e.SOS="˜",e.SGCI="™",e.SCI="š",e.CSI="›",e.ST="œ",e.OSC="",e.PM="ž",e.APC="Ÿ"))(Fh||={});var _5;(e=>e.ST=`${je.ESC}\\`)(_5||={});var Gx=class{constructor(e,t,s,i,a,l){this._textarea=e,this._compositionView=t,this._bufferService=s,this._optionsService=i,this._coreService=a,this._renderService=l,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let s;t.start+=this._dataAlreadySent.length,this._isComposing?s=this._textarea.value.substring(t.start,this._compositionPosition.start):s=this._textarea.value.substring(t.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,s=t.replace(e,"");this._dataAlreadySent=s,t.length>e.length?this._coreService.triggerDataEvent(s,!0):t.length<e.length?this._coreService.triggerDataEvent(`${je.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),s=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,a=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=a+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let l=this._compositionView.getBoundingClientRect();this._textarea.style.left=a+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(l.width,1)+"px",this._textarea.style.height=Math.max(l.height,1)+"px",this._textarea.style.lineHeight=l.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Gx=fs([Fe(2,xn),Fe(3,vn),Fe(4,_o),Fe(5,zr)],Gx);var qs=0,Gs=0,Vs=0,ds=0,kk={css:"#00000000",rgba:0},Ms;(e=>{function t(a,l,c,h){return h!==void 0?`#${Xa(a)}${Xa(l)}${Xa(c)}${Xa(h)}`:`#${Xa(a)}${Xa(l)}${Xa(c)}`}e.toCss=t;function s(a,l,c,h=255){return(a<<24|l<<16|c<<8|h)>>>0}e.toRgba=s;function i(a,l,c,h){return{css:e.toCss(a,l,c,h),rgba:e.toRgba(a,l,c,h)}}e.toColor=i})(Ms||={});var Qt;(e=>{function t(f,d){if(ds=(d.rgba&255)/255,ds===1)return{css:d.css,rgba:d.rgba};let p=d.rgba>>24&255,g=d.rgba>>16&255,b=d.rgba>>8&255,v=f.rgba>>24&255,w=f.rgba>>16&255,k=f.rgba>>8&255;qs=v+Math.round((p-v)*ds),Gs=w+Math.round((g-w)*ds),Vs=k+Math.round((b-k)*ds);let N=Ms.toCss(qs,Gs,Vs),E=Ms.toRgba(qs,Gs,Vs);return{css:N,rgba:E}}e.blend=t;function s(f){return(f.rgba&255)===255}e.isOpaque=s;function i(f,d,p){let g=qh.ensureContrastRatio(f.rgba,d.rgba,p);if(g)return Ms.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=i;function a(f){let d=(f.rgba|255)>>>0;return[qs,Gs,Vs]=qh.toChannels(d),{css:Ms.toCss(qs,Gs,Vs),rgba:d}}e.opaque=a;function l(f,d){return ds=Math.round(d*255),[qs,Gs,Vs]=qh.toChannels(f.rgba),{css:Ms.toCss(qs,Gs,Vs,ds),rgba:Ms.toRgba(qs,Gs,Vs,ds)}}e.opacity=l;function c(f,d){return ds=f.rgba&255,l(f,ds*d/255)}e.multiplyOpacity=c;function h(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}e.toColorRGB=h})(Qt||={});var os;(e=>{let t,s;try{let a=document.createElement("canvas");a.width=1,a.height=1;let l=a.getContext("2d",{willReadFrequently:!0});l&&(t=l,t.globalCompositeOperation="copy",s=t.createLinearGradient(0,0,1,1))}catch{}function i(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return qs=parseInt(a.slice(1,2).repeat(2),16),Gs=parseInt(a.slice(2,3).repeat(2),16),Vs=parseInt(a.slice(3,4).repeat(2),16),Ms.toColor(qs,Gs,Vs);case 5:return qs=parseInt(a.slice(1,2).repeat(2),16),Gs=parseInt(a.slice(2,3).repeat(2),16),Vs=parseInt(a.slice(3,4).repeat(2),16),ds=parseInt(a.slice(4,5).repeat(2),16),Ms.toColor(qs,Gs,Vs,ds);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let l=a.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(l)return qs=parseInt(l[1]),Gs=parseInt(l[2]),Vs=parseInt(l[3]),ds=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),Ms.toColor(qs,Gs,Vs,ds);if(!t||!s)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=s,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[qs,Gs,Vs,ds]=t.getImageData(0,0,1,1).data,ds!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ms.toRgba(qs,Gs,Vs,ds),css:a}}e.toColor=i})(os||={});var mn;(e=>{function t(i){return s(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function s(i,a,l){let c=i/255,h=a/255,f=l/255,d=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),p=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),g=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4);return d*.2126+p*.7152+g*.0722}e.relativeLuminance2=s})(mn||={});var qh;(e=>{function t(c,h){if(ds=(h&255)/255,ds===1)return h;let f=h>>24&255,d=h>>16&255,p=h>>8&255,g=c>>24&255,b=c>>16&255,v=c>>8&255;return qs=g+Math.round((f-g)*ds),Gs=b+Math.round((d-b)*ds),Vs=v+Math.round((p-v)*ds),Ms.toRgba(qs,Gs,Vs)}e.blend=t;function s(c,h,f){let d=mn.relativeLuminance(c>>8),p=mn.relativeLuminance(h>>8);if(Nr(d,p)<f){if(p<d){let v=i(c,h,f),w=Nr(d,mn.relativeLuminance(v>>8));if(w<f){let k=a(c,h,f),N=Nr(d,mn.relativeLuminance(k>>8));return w>N?v:k}return v}let g=a(c,h,f),b=Nr(d,mn.relativeLuminance(g>>8));if(b<f){let v=i(c,h,f),w=Nr(d,mn.relativeLuminance(v>>8));return b>w?g:v}return g}}e.ensureContrastRatio=s;function i(c,h,f){let d=c>>24&255,p=c>>16&255,g=c>>8&255,b=h>>24&255,v=h>>16&255,w=h>>8&255,k=Nr(mn.relativeLuminance2(b,v,w),mn.relativeLuminance2(d,p,g));for(;k<f&&(b>0||v>0||w>0);)b-=Math.max(0,Math.ceil(b*.1)),v-=Math.max(0,Math.ceil(v*.1)),w-=Math.max(0,Math.ceil(w*.1)),k=Nr(mn.relativeLuminance2(b,v,w),mn.relativeLuminance2(d,p,g));return(b<<24|v<<16|w<<8|255)>>>0}e.reduceLuminance=i;function a(c,h,f){let d=c>>24&255,p=c>>16&255,g=c>>8&255,b=h>>24&255,v=h>>16&255,w=h>>8&255,k=Nr(mn.relativeLuminance2(b,v,w),mn.relativeLuminance2(d,p,g));for(;k<f&&(b<255||v<255||w<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),v=Math.min(255,v+Math.ceil((255-v)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),k=Nr(mn.relativeLuminance2(b,v,w),mn.relativeLuminance2(d,p,g));return(b<<24|v<<16|w<<8|255)>>>0}e.increaseLuminance=a;function l(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=l})(qh||={});function Xa(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Nr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var zG=class extends Tu{constructor(e,t,s){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=s}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},pf=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new gi}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let s=[],i=t.translateToString(!0),a=0,l=0,c=0,h=t.getFg(0),f=t.getBg(0);for(let d=0;d<t.getTrimmedLength();d++)if(t.loadCell(d,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==h||this._workCell.bg!==f){if(d-a>1){let p=this._getJoinedRanges(i,c,l,t,a);for(let g=0;g<p.length;g++)s.push(p[g])}a=d,c=l,h=this._workCell.fg,f=this._workCell.bg}l+=this._workCell.getChars().length||_a.length}if(this._bufferService.cols-a>1){let d=this._getJoinedRanges(i,c,l,t,a);for(let p=0;p<d.length;p++)s.push(d[p])}return s}_getJoinedRanges(e,t,s,i,a){let l=e.substring(t,s),c=[];try{c=this._characterJoiners[0].handler(l)}catch(h){console.error(h)}for(let h=1;h<this._characterJoiners.length;h++)try{let f=this._characterJoiners[h].handler(l);for(let d=0;d<f.length;d++)pf._mergeRanges(c,f[d])}catch(f){console.error(f)}return this._stringRangesToCellRanges(c,i,a),c}_stringRangesToCellRanges(e,t,s){let i=0,a=!1,l=0,c=e[i];if(c){for(let h=s;h<this._bufferService.cols;h++){let f=t.getWidth(h),d=t.getString(h).length||_a.length;if(f!==0){if(!a&&c[0]<=l&&(c[0]=h,a=!0),c[1]<=l){if(c[1]=h,c=e[++i],!c)break;c[0]<=l?(c[0]=h,a=!0):a=!1}l+=d}}c&&(c[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let s=!1;for(let i=0;i<e.length;i++){let a=e[i];if(s){if(t[1]<=a[0])return e[i-1][1]=t[1],e;if(t[1]<=a[1])return e[i-1][1]=Math.max(t[1],a[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(t[1]<=a[0])return e.splice(i,0,t),e;if(t[1]<=a[1])return a[0]=Math.min(t[0],a[0]),e;t[0]<a[1]&&(a[0]=Math.min(t[0],a[0]),s=!0);continue}}return s?e[e.length-1][1]=t[1]:e.push(t),e}};pf=fs([Fe(0,xn)],pf);function BG(e){return 57508<=e&&e<=57558}function PG(e){return 9472<=e&&e<=9631}function IG(e){return BG(e)||PG(e)}function $G(){return{css:{canvas:bh(),cell:bh()},device:{canvas:bh(),cell:bh(),char:{width:0,height:0,left:0,top:0}}}}function bh(){return{width:0,height:0}}var Vx=class{constructor(e,t,s,i,a,l,c){this._document=e,this._characterJoinerService=t,this._optionsService=s,this._coreBrowserService=i,this._coreService=a,this._decorationService=l,this._themeService=c,this._workCell=new gi,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,s){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=s}createRow(e,t,s,i,a,l,c,h,f,d,p){let g=[],b=this._characterJoinerService.getJoinedCharacters(t),v=this._themeService.colors,w=e.getNoBgTrimmedLength();s&&w<l+1&&(w=l+1);let k,N=0,E="",T=0,A=0,C=0,R=0,L=!1,H=0,B=!1,P=0,D=0,G=[],$=d!==-1&&p!==-1;for(let O=0;O<w;O++){e.loadCell(O,this._workCell);let V=this._workCell.getWidth();if(V===0)continue;let K=!1,I=O>=D,Y=O,W=this._workCell;if(b.length>0&&O===b[0][0]&&I){let $e=b.shift(),St=this._isCellInSelection($e[0],t);for(T=$e[0]+1;T<$e[1];T++)I&&=St===this._isCellInSelection(T,t);I&&=!s||l<$e[0]||l>=$e[1],I?(K=!0,W=new zG(this._workCell,e.translateToString(!0,$e[0],$e[1]),$e[1]-$e[0]),Y=$e[1]-1,V=W.getWidth()):D=$e[1]}let le=this._isCellInSelection(O,t),J=s&&O===l,U=$&&O>=d&&O<=p,F=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,$e=>{F=!0});let re=W.getChars()||_a;if(re===" "&&(W.isUnderline()||W.isOverline())&&(re=" "),P=V*h-f.get(re,W.isBold(),W.isItalic()),!k)k=this._document.createElement("span");else if(N&&(le&&B||!le&&!B&&W.bg===A)&&(le&&B&&v.selectionForeground||W.fg===C)&&W.extended.ext===R&&U===L&&P===H&&!J&&!K&&!F&&I){W.isInvisible()?E+=_a:E+=re,N++;continue}else N&&(k.textContent=E),k=this._document.createElement("span"),N=0,E="";if(A=W.bg,C=W.fg,R=W.extended.ext,L=U,H=P,B=le,K&&l>=O&&l<=Y&&(l=O),!this._coreService.isCursorHidden&&J&&this._coreService.isCursorInitialized){if(G.push("xterm-cursor"),this._coreBrowserService.isFocused)c&&G.push("xterm-cursor-blink"),G.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(a)switch(a){case"outline":G.push("xterm-cursor-outline");break;case"block":G.push("xterm-cursor-block");break;case"bar":G.push("xterm-cursor-bar");break;case"underline":G.push("xterm-cursor-underline");break}}if(W.isBold()&&G.push("xterm-bold"),W.isItalic()&&G.push("xterm-italic"),W.isDim()&&G.push("xterm-dim"),W.isInvisible()?E=_a:E=W.getChars()||_a,W.isUnderline()&&(G.push(`xterm-underline-${W.extended.underlineStyle}`),E===" "&&(E=" "),!W.isUnderlineColorDefault()))if(W.isUnderlineColorRGB())k.style.textDecorationColor=`rgb(${Tu.toColorRGB(W.getUnderlineColor()).join(",")})`;else{let $e=W.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&W.isBold()&&$e<8&&($e+=8),k.style.textDecorationColor=v.ansi[$e].css}W.isOverline()&&(G.push("xterm-overline"),E===" "&&(E=" ")),W.isStrikethrough()&&G.push("xterm-strikethrough"),U&&(k.style.textDecoration="underline");let fe=W.getFgColor(),se=W.getFgColorMode(),te=W.getBgColor(),ye=W.getBgColorMode(),Ee=!!W.isInverse();if(Ee){let $e=fe;fe=te,te=$e;let St=se;se=ye,ye=St}let De,Ye,we=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,$e=>{$e.options.layer!=="top"&&we||($e.backgroundColorRGB&&(ye=50331648,te=$e.backgroundColorRGB.rgba>>8&16777215,De=$e.backgroundColorRGB),$e.foregroundColorRGB&&(se=50331648,fe=$e.foregroundColorRGB.rgba>>8&16777215,Ye=$e.foregroundColorRGB),we=$e.options.layer==="top")}),!we&&le&&(De=this._coreBrowserService.isFocused?v.selectionBackgroundOpaque:v.selectionInactiveBackgroundOpaque,te=De.rgba>>8&16777215,ye=50331648,we=!0,v.selectionForeground&&(se=50331648,fe=v.selectionForeground.rgba>>8&16777215,Ye=v.selectionForeground)),we&&G.push("xterm-decoration-top");let He;switch(ye){case 16777216:case 33554432:He=v.ansi[te],G.push(`xterm-bg-${te}`);break;case 50331648:He=Ms.toColor(te>>16,te>>8&255,te&255),this._addStyle(k,`background-color:#${Nk((te>>>0).toString(16),"0",6)}`);break;default:Ee?(He=v.foreground,G.push("xterm-bg-257")):He=v.background}switch(De||W.isDim()&&(De=Qt.multiplyOpacity(He,.5)),se){case 16777216:case 33554432:W.isBold()&&fe<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(fe+=8),this._applyMinimumContrast(k,He,v.ansi[fe],W,De,void 0)||G.push(`xterm-fg-${fe}`);break;case 50331648:let $e=Ms.toColor(fe>>16&255,fe>>8&255,fe&255);this._applyMinimumContrast(k,He,$e,W,De,Ye)||this._addStyle(k,`color:#${Nk(fe.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(k,He,v.foreground,W,De,Ye)||Ee&&G.push("xterm-fg-257")}G.length&&(k.className=G.join(" "),G.length=0),!J&&!K&&!F&&I?N++:k.textContent=E,P!==this.defaultSpacing&&(k.style.letterSpacing=`${P}px`),g.push(k),O=Y}return k&&N&&(k.textContent=E),g}_applyMinimumContrast(e,t,s,i,a,l){if(this._optionsService.rawOptions.minimumContrastRatio===1||IG(i.getCode()))return!1;let c=this._getContrastCache(i),h;if(!a&&!l&&(h=c.getColor(t.rgba,s.rgba)),h===void 0){let f=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);h=Qt.ensureContrastRatio(a||t,l||s,f),c.setColor((a||t).rgba,(l||s).rgba,h??null)}return h?(this._addStyle(e,`color:${h.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let s=this._selectionStart,i=this._selectionEnd;return!s||!i?!1:this._columnSelectMode?s[0]<=i[0]?e>=s[0]&&t>=s[1]&&e<i[0]&&t<=i[1]:e<s[0]&&t>=s[1]&&e>=i[0]&&t<=i[1]:t>s[1]&&t<i[1]||s[1]===i[1]&&t===s[1]&&e>=s[0]&&e<i[0]||s[1]<i[1]&&t===i[1]&&e<i[0]||s[1]<i[1]&&t===s[1]&&e>=s[0]}};Vx=fs([Fe(1,n5),Fe(2,vn),Fe(3,Or),Fe(4,_o),Fe(5,Ru),Fe(6,Tl)],Vx);function Nk(e,t,s){for(;e.length<s;)e=t+e;return e}var HG=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let s=e.createElement("span");s.classList.add("xterm-char-measure-element");let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontWeight="bold";let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontStyle="italic";let l=e.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontWeight="bold",l.style.fontStyle="italic",this._measureElements=[s,i,a,l],this._container.appendChild(s),this._container.appendChild(i),this._container.appendChild(a),this._container.appendChild(l),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,s,i){e===this._font&&t===this._fontSize&&s===this._weight&&i===this._weightBold||(this._font=e,this._fontSize=t,this._weight=s,this._weightBold=i,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${s}`,this._measureElements[1].style.fontWeight=`${i}`,this._measureElements[2].style.fontWeight=`${s}`,this._measureElements[3].style.fontWeight=`${i}`,this.clear())}get(e,t,s){let i=0;if(!t&&!s&&e.length===1&&(i=e.charCodeAt(0))<256){if(this._flat[i]!==-9999)return this._flat[i];let c=this._measure(e,0);return c>0&&(this._flat[i]=c),c}let a=e;t&&(a+="B"),s&&(a+="I");let l=this._holey.get(a);if(l===void 0){let c=0;t&&(c|=1),s&&(c|=2),l=this._measure(e,c),l>0&&this._holey.set(a,l)}return l}_measure(e,t){let s=this._measureElements[t];return s.textContent=e.repeat(32),s.offsetWidth/32}},UG=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,s,i=!1){if(this.selectionStart=t,this.selectionEnd=s,!t||!s||t[0]===s[0]&&t[1]===s[1]){this.clear();return}let a=e.buffers.active.ydisp,l=t[1]-a,c=s[1]-a,h=Math.max(l,0),f=Math.min(c,e.rows-1);if(h>=e.rows||f<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=l,this.viewportEndRow=c,this.viewportCappedStartRow=h,this.viewportCappedEndRow=f,this.startCol=t[0],this.endCol=s[0]}isCellSelected(e,t,s){return this.hasSelection?(s-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&s>=this.viewportCappedStartRow&&t<this.endCol&&s<=this.viewportCappedEndRow:t<this.startCol&&s>=this.viewportCappedStartRow&&t>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol):!1}};function FG(){return new UG}var Qg="xterm-dom-renderer-owner-",ui="xterm-rows",xh="xterm-fg-",Ck="xterm-bg-",Mc="xterm-focus",vh="xterm-selection",qG=1,Wx=class extends gt{constructor(e,t,s,i,a,l,c,h,f,d,p,g,b,v){super(),this._terminal=e,this._document=t,this._element=s,this._screenElement=i,this._viewportElement=a,this._helperContainer=l,this._linkifier2=c,this._charSizeService=f,this._optionsService=d,this._bufferService=p,this._coreService=g,this._coreBrowserService=b,this._themeService=v,this._terminalClass=qG++,this._rowElements=[],this._selectionRenderModel=FG(),this.onRequestRedraw=this._register(new ze).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(ui),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(vh),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=$G(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(w=>this._injectCss(w))),this._injectCss(this._themeService.colors),this._rowFactory=h.createInstance(Vx,document),this._element.classList.add(Qg+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(w=>this._handleLinkHover(w))),this._register(this._linkifier2.onHideLinkUnderline(w=>this._handleLinkLeave(w))),this._register(ns(()=>{this._element.classList.remove(Qg+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new HG(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let s of this._rowElements)s.style.width=`${this.dimensions.css.canvas.width}px`,s.style.height=`${this.dimensions.css.cell.height}px`,s.style.lineHeight=`${this.dimensions.css.cell.height}px`,s.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${ui} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${ui} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${ui} .xterm-dim { color: ${Qt.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let s=`blink_underline_${this._terminalClass}`,i=`blink_bar_${this._terminalClass}`,a=`blink_block_${this._terminalClass}`;t+=`@keyframes ${s} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${i} { 50% { box-shadow: none; }}`,t+=`@keyframes ${a} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${ui}.${Mc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${ui}.${Mc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${ui}.${Mc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${ui} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${ui} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${ui} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${ui} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${ui} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${vh} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${vh} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${vh} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[l,c]of e.ansi.entries())t+=`${this._terminalSelector} .${xh}${l} { color: ${c.css}; }${this._terminalSelector} .${xh}${l}.xterm-dim { color: ${Qt.multiplyOpacity(c,.5).css}; }${this._terminalSelector} .${Ck}${l} { background-color: ${c.css}; }`;t+=`${this._terminalSelector} .${xh}257 { color: ${Qt.opaque(e.background).css}; }${this._terminalSelector} .${xh}257.xterm-dim { color: ${Qt.multiplyOpacity(Qt.opaque(e.background),.5).css}; }${this._terminalSelector} .${Ck}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let s=this._rowElements.length;s<=t;s++){let i=this._document.createElement("div");this._rowContainer.appendChild(i),this._rowElements.push(i)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Mc),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Mc),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,s){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,s),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,s),!this._selectionRenderModel.hasSelection))return;let i=this._selectionRenderModel.viewportStartRow,a=this._selectionRenderModel.viewportEndRow,l=this._selectionRenderModel.viewportCappedStartRow,c=this._selectionRenderModel.viewportCappedEndRow,h=this._document.createDocumentFragment();if(s){let f=e[0]>t[0];h.appendChild(this._createSelectionElement(l,f?t[0]:e[0],f?e[0]:t[0],c-l+1))}else{let f=i===l?e[0]:0,d=l===a?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(l,f,d));let p=c-l-1;if(h.appendChild(this._createSelectionElement(l+1,0,this._bufferService.cols,p)),l!==c){let g=a===c?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(c,0,g))}}this._selectionContainer.appendChild(h)}_createSelectionElement(e,t,s,i=1){let a=this._document.createElement("div"),l=t*this.dimensions.css.cell.width,c=this.dimensions.css.cell.width*(s-t);return l+c>this.dimensions.css.canvas.width&&(c=this.dimensions.css.canvas.width-l),a.style.height=`${i*this.dimensions.css.cell.height}px`,a.style.top=`${e*this.dimensions.css.cell.height}px`,a.style.left=`${l}px`,a.style.width=`${c}px`,a}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let s=this._bufferService.buffer,i=s.ybase+s.y,a=Math.min(s.x,this._bufferService.cols-1),l=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,c=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,h=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=e;f<=t;f++){let d=f+s.ydisp,p=this._rowElements[f],g=s.lines.get(d);if(!p||!g)break;p.replaceChildren(...this._rowFactory.createRow(g,d,d===i,c,h,a,l,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Qg}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,s,i,a,l){s<0&&(e=0),i<0&&(t=0);let c=this._bufferService.rows-1;s=Math.max(Math.min(s,c),0),i=Math.max(Math.min(i,c),0),a=Math.min(a,this._bufferService.cols);let h=this._bufferService.buffer,f=h.ybase+h.y,d=Math.min(h.x,a-1),p=this._optionsService.rawOptions.cursorBlink,g=this._optionsService.rawOptions.cursorStyle,b=this._optionsService.rawOptions.cursorInactiveStyle;for(let v=s;v<=i;++v){let w=v+h.ydisp,k=this._rowElements[v],N=h.lines.get(w);if(!k||!N)break;k.replaceChildren(...this._rowFactory.createRow(N,w,w===f,g,b,d,p,this.dimensions.css.cell.width,this._widthCache,l?v===s?e:0:-1,l?(v===i?t:a)-1:-1))}}};Wx=fs([Fe(7,xv),Fe(8,Zf),Fe(9,vn),Fe(10,xn),Fe(11,_o),Fe(12,Or),Fe(13,Tl)],Wx);var Kx=class extends gt{constructor(e,t,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ze),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new VG(this._optionsService))}catch{this._measureStrategy=this._register(new GG(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Kx=fs([Fe(2,vn)],Kx);var w5=class extends gt{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},GG=class extends w5{constructor(e,t,s){super(),this._document=e,this._parentElement=t,this._optionsService=s,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}},VG=class extends w5{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},WG=class extends gt{constructor(e,t,s){super(),this._textarea=e,this._window=t,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new KG(this._window)),this._onDprChange=this._register(new ze),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ze),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(tn.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(lt(this._textarea,"focus",()=>this._isFocused=!0)),this._register(lt(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},KG=class extends gt{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Sl),this._onDprChange=this._register(new ze),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(ns(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=lt(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.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)}},YG=class extends gt{constructor(){super(),this.linkProviders=[],this._register(ns(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Cv(e,t,s){let i=s.getBoundingClientRect(),a=e.getComputedStyle(s),l=parseInt(a.getPropertyValue("padding-left")),c=parseInt(a.getPropertyValue("padding-top"));return[t.clientX-i.left-l,t.clientY-i.top-c]}function XG(e,t,s,i,a,l,c,h,f){if(!l)return;let d=Cv(e,t,s);if(d)return d[0]=Math.ceil((d[0]+(f?c/2:0))/c),d[1]=Math.ceil(d[1]/h),d[0]=Math.min(Math.max(d[0],1),i+(f?1:0)),d[1]=Math.min(Math.max(d[1],1),a),d}var Yx=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,s,i,a){return XG(window,e,t,s,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,a)}getMouseReportCoords(e,t){let s=Cv(window,e,t);if(this._charSizeService.hasValidSize)return s[0]=Math.min(Math.max(s[0],0),this._renderService.dimensions.css.canvas.width-1),s[1]=Math.min(Math.max(s[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(s[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(s[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(s[0]),y:Math.floor(s[1])}}};Yx=fs([Fe(0,zr),Fe(1,Zf)],Yx);var ZG=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,s){this._rowCount=s,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},S5={};oq(S5,{getSafariVersion:()=>JG,isChromeOS:()=>E5,isFirefox:()=>k5,isIpad:()=>eV,isIphone:()=>tV,isLegacyEdge:()=>QG,isLinux:()=>Ev,isMac:()=>gf,isNode:()=>Qf,isSafari:()=>N5,isWindows:()=>C5});var Qf=typeof process<"u"&&"title"in process,Mu=Qf?"node":navigator.userAgent,Du=Qf?"node":navigator.platform,k5=Mu.includes("Firefox"),QG=Mu.includes("Edge"),N5=/^((?!chrome|android).)*safari/i.test(Mu);function JG(){if(!N5)return 0;let e=Mu.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var gf=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Du),eV=Du==="iPad",tV=Du==="iPhone",C5=["Windows","Win16","Win32","WinCE"].includes(Du),Ev=Du.indexOf("Linux")>=0,E5=/\bCrOS\b/.test(Mu),j5=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,s=0,i=e.timeRemaining(),a=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),s=Math.max(t,s),a=e.timeRemaining(),s*1.5>a){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=a}this.clear()}},sV=class extends j5{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},nV=class extends j5{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},bf=!Qf&&"requestIdleCallback"in window?nV:sV,iV=class{constructor(){this._queue=new bf}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Xx=class extends gt{constructor(e,t,s,i,a,l,c,h,f){super(),this._rowCount=e,this._optionsService=s,this._charSizeService=i,this._coreService=a,this._coreBrowserService=h,this._renderer=this._register(new Sl),this._pausedResizeTask=new iV,this._observerDisposable=this._register(new Sl),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 ze),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ze),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ze),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ze),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new ZG((d,p)=>this._renderRows(d,p),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new rV(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(ns(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(c.onResize(()=>this._fullRefresh())),this._register(c.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(l.onDecorationRegistered(()=>this._fullRefresh())),this._register(l.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(c.cols,c.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(c.buffer.y,c.buffer.y,!0))),this._register(f.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(d=>this._registerIntersectionObserver(d,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let s=new e.IntersectionObserver(i=>this._handleIntersectionChange(i[i.length-1]),{threshold:0});s.observe(t),this._observerDisposable.value=ns(()=>s.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,s=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let i=this._syncOutputHandler.flush();i&&(e=Math.min(e,i.start),t=Math.max(t,i.end)),s||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,s){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=s,this._renderer.value?.handleSelectionChanged(e,t,s)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Xx=fs([Fe(2,vn),Fe(3,Zf),Fe(4,_o),Fe(5,Ru),Fe(6,xn),Fe(7,Or),Fe(8,Tl)],Xx);var rV=class{constructor(e,t,s){this._coreBrowserService=e,this._coreService=t,this._onTimeout=s,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function aV(e,t,s,i){let a=s.buffer.x,l=s.buffer.y;if(!s.buffer.hasScrollback)return cV(a,l,e,t,s,i)+Jf(l,t,s,i)+uV(a,l,e,t,s,i);let c;if(l===t)return c=a>e?"D":"C",xu(Math.abs(a-e),bu(c,i));c=l>t?"D":"C";let h=Math.abs(l-t),f=lV(l>t?e:a,s)+(h-1)*s.cols+1+oV(l>t?a:e);return xu(f,bu(c,i))}function oV(e,t){return e-1}function lV(e,t){return t.cols-e}function cV(e,t,s,i,a,l){return Jf(t,i,a,l).length===0?"":xu(T5(e,t,e,t-po(t,a),!1,a).length,bu("D",l))}function Jf(e,t,s,i){let a=e-po(e,s),l=t-po(t,s),c=Math.abs(a-l)-dV(e,t,s);return xu(c,bu(A5(e,t),i))}function uV(e,t,s,i,a,l){let c;Jf(t,i,a,l).length>0?c=i-po(i,a):c=t;let h=i,f=hV(e,t,s,i,a,l);return xu(T5(e,c,s,h,f==="C",a).length,bu(f,l))}function dV(e,t,s){let i=0,a=e-po(e,s),l=t-po(t,s);for(let c=0;c<Math.abs(a-l);c++){let h=A5(e,t)==="A"?-1:1;s.buffer.lines.get(a+h*c)?.isWrapped&&i++}return i}function po(e,t){let s=0,i=t.buffer.lines.get(e),a=i?.isWrapped;for(;a&&e>=0&&e<t.rows;)s++,i=t.buffer.lines.get(--e),a=i?.isWrapped;return s}function hV(e,t,s,i,a,l){let c;return Jf(s,i,a,l).length>0?c=i-po(i,a):c=t,e<s&&c<=i||e>=s&&c<i?"C":"D"}function A5(e,t){return e>t?"A":"B"}function T5(e,t,s,i,a,l){let c=e,h=t,f="";for(;(c!==s||h!==i)&&h>=0&&h<l.buffer.lines.length;)c+=a?1:-1,a&&c>l.cols-1?(f+=l.buffer.translateBufferLineToString(h,!1,e,c),c=0,e=0,h++):!a&&c<0&&(f+=l.buffer.translateBufferLineToString(h,!1,0,e+1),c=l.cols-1,e=c,h--);return f+l.buffer.translateBufferLineToString(h,!1,e,c)}function bu(e,t){let s=t?"O":"[";return je.ESC+s+e}function xu(e,t){e=Math.floor(e);let s="";for(let i=0;i<e;i++)s+=t;return s}var fV=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Ek(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var Jg=50,mV=15,pV=50,gV=500,bV=" ",xV=new RegExp(bV,"g"),Zx=class extends gt{constructor(e,t,s,i,a,l,c,h,f){super(),this._element=e,this._screenElement=t,this._linkifier=s,this._bufferService=i,this._coreService=a,this._mouseService=l,this._optionsService=c,this._renderService=h,this._coreBrowserService=f,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new gi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ze),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ze),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ze),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ze),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=d=>this._handleMouseMove(d),this._mouseUpListener=d=>this._handleMouseUp(d),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(d=>this._handleTrim(d)),this._register(this._bufferService.buffers.onBufferActivate(d=>this._handleBufferActivate(d))),this.enable(),this._model=new fV(this._bufferService),this._activeSelectionMode=0,this._register(ns(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(d=>{d.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let s=this._bufferService.buffer,i=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let a=e[0]<t[0]?e[0]:t[0],l=e[0]<t[0]?t[0]:e[0];for(let c=e[1];c<=t[1];c++){let h=s.translateBufferLineToString(c,!0,a,l);i.push(h)}}else{let a=e[1]===t[1]?t[0]:void 0;i.push(s.translateBufferLineToString(e[1],!0,e[0],a));for(let l=e[1]+1;l<=t[1]-1;l++){let c=s.lines.get(l),h=s.translateBufferLineToString(l,!0);c?.isWrapped?i[i.length-1]+=h:i.push(h)}if(e[1]!==t[1]){let l=s.lines.get(t[1]),c=s.translateBufferLineToString(t[1],!0,0,t[0]);l&&l.isWrapped?i[i.length-1]+=c:i.push(c)}}return i.map(a=>a.replace(xV," ")).join(C5?`\r
105
+ `:`
106
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Ev&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),s=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!s||!i||!t?!1:this._areCoordsInSelection(t,s,i)}isCellInSelection(e,t){let s=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!s||!i?!1:this._areCoordsInSelection([e,t],s,i)}_areCoordsInSelection(e,t,s){return e[1]>t[1]&&e[1]<s[1]||t[1]===s[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<s[0]||t[1]<s[1]&&e[1]===s[1]&&e[0]<s[0]||t[1]<s[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let s=this._linkifier.currentLink?.link?.range;if(s)return this._model.selectionStart=[s.start.x-1,s.start.y-1],this._model.selectionStartLength=Ek(s,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let i=this._getMouseBufferCoords(e);return i?(this._selectWordAt(i,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=Cv(this._coreBrowserService.window,e,this._screenElement)[1],s=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=s?0:(t>s&&(t-=s),t=Math.min(Math.max(t,-Jg),Jg),t/=Jg,t/Math.abs(t)+Math.round(t*(mV-1)))}shouldForceSelection(e){return gf?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),pV)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(gf&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let s=this._bufferService.buffer;if(this._model.selectionEnd[1]<s.lines.length){let i=s.lines.get(this._model.selectionEnd[1]);i&&i.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<gV&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let s=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(s&&s[0]!==void 0&&s[1]!==void 0){let i=aV(s[0]-1,s[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(i,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,s=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!s){this._oldHasSelection&&this._fireOnSelectionChange(e,t,s);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,s)}_fireOnSelectionChange(e,t,s){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=s,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let s=t;for(let i=0;t>=i;i++){let a=e.loadCell(i,this._workCell).getChars().length;this._workCell.getWidth()===0?s--:a>1&&t!==i&&(s+=a-1)}return s}setSelection(e,t,s){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=s,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,s=!0,i=!0){if(e[0]>=this._bufferService.cols)return;let a=this._bufferService.buffer,l=a.lines.get(e[1]);if(!l)return;let c=a.translateBufferLineToString(e[1],!1),h=this._convertViewportColToCharacterIndex(l,e[0]),f=h,d=e[0]-h,p=0,g=0,b=0,v=0;if(c.charAt(h)===" "){for(;h>0&&c.charAt(h-1)===" ";)h--;for(;f<c.length&&c.charAt(f+1)===" ";)f++}else{let N=e[0],E=e[0];l.getWidth(N)===0&&(p++,N--),l.getWidth(E)===2&&(g++,E++);let T=l.getString(E).length;for(T>1&&(v+=T-1,f+=T-1);N>0&&h>0&&!this._isCharWordSeparator(l.loadCell(N-1,this._workCell));){l.loadCell(N-1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===0?(p++,N--):A>1&&(b+=A-1,h-=A-1),h--,N--}for(;E<l.length&&f+1<c.length&&!this._isCharWordSeparator(l.loadCell(E+1,this._workCell));){l.loadCell(E+1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===2?(g++,E++):A>1&&(v+=A-1,f+=A-1),f++,E++}}f++;let w=h+d-p+b,k=Math.min(this._bufferService.cols,f-h+p+g-b-v);if(!(!t&&c.slice(h,f).trim()==="")){if(s&&w===0&&l.getCodePoint(0)!==32){let N=a.lines.get(e[1]-1);if(N&&l.isWrapped&&N.getCodePoint(this._bufferService.cols-1)!==32){let E=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(E){let T=this._bufferService.cols-E.start;w-=T,k+=T}}}if(i&&w+k===this._bufferService.cols&&l.getCodePoint(this._bufferService.cols-1)!==32){let N=a.lines.get(e[1]+1);if(N?.isWrapped&&N.getCodePoint(0)!==32){let E=this._getWordAt([0,e[1]+1],!1,!1,!0);E&&(k+=E.length)}}return{start:w,length:k}}}_selectWordAt(e,t){let s=this._getWordAt(e,t);if(s){for(;s.start<0;)s.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[s.start,e[1]],this._model.selectionStartLength=s.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let s=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,s--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,s++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,s]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),s={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Ek(s,this._bufferService.cols)}};Zx=fs([Fe(3,xn),Fe(4,_o),Fe(5,vv),Fe(6,vn),Fe(7,zr),Fe(8,Or)],Zx);var jk=class{constructor(){this._data={}}set(e,t,s){this._data[e]||(this._data[e]={}),this._data[e][t]=s}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Ak=class{constructor(){this._color=new jk,this._css=new jk}setCss(e,t,s){this._css.set(e,t,s)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,s){this._color.set(e,t,s)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},zs=Object.freeze((()=>{let e=[os.toColor("#2e3436"),os.toColor("#cc0000"),os.toColor("#4e9a06"),os.toColor("#c4a000"),os.toColor("#3465a4"),os.toColor("#75507b"),os.toColor("#06989a"),os.toColor("#d3d7cf"),os.toColor("#555753"),os.toColor("#ef2929"),os.toColor("#8ae234"),os.toColor("#fce94f"),os.toColor("#729fcf"),os.toColor("#ad7fa8"),os.toColor("#34e2e2"),os.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let s=0;s<216;s++){let i=t[s/36%6|0],a=t[s/6%6|0],l=t[s%6];e.push({css:Ms.toCss(i,a,l),rgba:Ms.toRgba(i,a,l)})}for(let s=0;s<24;s++){let i=8+s*10;e.push({css:Ms.toCss(i,i,i),rgba:Ms.toRgba(i,i,i)})}return e})()),eo=os.toColor("#ffffff"),Vc=os.toColor("#000000"),Tk=os.toColor("#ffffff"),Rk=Vc,Dc={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},vV=eo,Qx=class extends gt{constructor(e){super(),this._optionsService=e,this._contrastCache=new Ak,this._halfContrastCache=new Ak,this._onChangeColors=this._register(new ze),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:eo,background:Vc,cursor:Tk,cursorAccent:Rk,selectionForeground:void 0,selectionBackgroundTransparent:Dc,selectionBackgroundOpaque:Qt.blend(Vc,Dc),selectionInactiveBackgroundTransparent:Dc,selectionInactiveBackgroundOpaque:Qt.blend(Vc,Dc),scrollbarSliderBackground:Qt.opacity(eo,.2),scrollbarSliderHoverBackground:Qt.opacity(eo,.4),scrollbarSliderActiveBackground:Qt.opacity(eo,.5),overviewRulerBorder:eo,ansi:zs.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=Ft(e.foreground,eo),t.background=Ft(e.background,Vc),t.cursor=Qt.blend(t.background,Ft(e.cursor,Tk)),t.cursorAccent=Qt.blend(t.background,Ft(e.cursorAccent,Rk)),t.selectionBackgroundTransparent=Ft(e.selectionBackground,Dc),t.selectionBackgroundOpaque=Qt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Ft(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Qt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Ft(e.selectionForeground,kk):void 0,t.selectionForeground===kk&&(t.selectionForeground=void 0),Qt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Qt.opacity(t.selectionBackgroundTransparent,.3)),Qt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Qt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Ft(e.scrollbarSliderBackground,Qt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Ft(e.scrollbarSliderHoverBackground,Qt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Ft(e.scrollbarSliderActiveBackground,Qt.opacity(t.foreground,.5)),t.overviewRulerBorder=Ft(e.overviewRulerBorder,vV),t.ansi=zs.slice(),t.ansi[0]=Ft(e.black,zs[0]),t.ansi[1]=Ft(e.red,zs[1]),t.ansi[2]=Ft(e.green,zs[2]),t.ansi[3]=Ft(e.yellow,zs[3]),t.ansi[4]=Ft(e.blue,zs[4]),t.ansi[5]=Ft(e.magenta,zs[5]),t.ansi[6]=Ft(e.cyan,zs[6]),t.ansi[7]=Ft(e.white,zs[7]),t.ansi[8]=Ft(e.brightBlack,zs[8]),t.ansi[9]=Ft(e.brightRed,zs[9]),t.ansi[10]=Ft(e.brightGreen,zs[10]),t.ansi[11]=Ft(e.brightYellow,zs[11]),t.ansi[12]=Ft(e.brightBlue,zs[12]),t.ansi[13]=Ft(e.brightMagenta,zs[13]),t.ansi[14]=Ft(e.brightCyan,zs[14]),t.ansi[15]=Ft(e.brightWhite,zs[15]),e.extendedAnsi){let s=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<s;i++)t.ansi[i+16]=Ft(e.extendedAnsi[i],zs[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};Qx=fs([Fe(0,vn)],Qx);function Ft(e,t){if(e!==void 0)try{return os.toColor(e)}catch{}return t}var yV=class{constructor(...e){this._entries=new Map;for(let[t,s]of e)this.set(t,s)}set(e,t){let s=this._entries.get(e);return this._entries.set(e,t),s}forEach(e){for(let[t,s]of this._entries.entries())e(t,s)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},_V=class{constructor(){this._services=new yV,this._services.set(xv,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let s=mq(e).sort((l,c)=>l.index-c.index),i=[];for(let l of s){let c=this._services.get(l.id);if(!c)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${l.id._id}.`);i.push(c)}let a=s.length>0?s[0].index:t.length;if(t.length!==a)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${a+1} conflicts with ${t.length} static arguments`);return new e(...t,...i)}},wV={trace:0,debug:1,info:2,warn:3,error:4,off:5},SV="xterm.js: ",Jx=class extends gt{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=wV[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":SV)+t,...s)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};Jx=fs([Fe(0,vn)],Jx);var Mk=class extends gt{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ze),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ze),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ze),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let s=0;s<Math.min(e,this.length);s++)t[s]=this._array[this._getCyclicIndex(s)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...s){if(t){for(let i=e;i<this._length-t;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+s.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<s.length;i++)this._array[this._getCyclicIndex(e+i)]=s[i];if(s.length&&this.onInsertEmitter.fire({index:e,amount:s.length}),this._length+s.length>this._maxLength){let i=this._length+s.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=s.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,s){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+s<0)throw new Error("Cannot shift elements in list beyond index 0");if(s>0){for(let a=t-1;a>=0;a--)this.set(e+a+s,this.get(e+a));let i=e+t+s-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<t;i++)this.set(e+i+s,this.get(e+i))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},mt=3,As=Object.freeze(new Tu),yh=0,eb=2,Wc=class R5{constructor(t,s,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*mt);let a=s||gi.fromCharData([0,X3,1,0]);for(let l=0;l<t;++l)this.setCell(l,a);this.length=t}get(t){let s=this._data[t*mt+0],i=s&2097151;return[this._data[t*mt+1],s&2097152?this._combined[t]:i?va(i):"",s>>22,s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,s){this._data[t*mt+1]=s[0],s[1].length>1?(this._combined[t]=s[1],this._data[t*mt+0]=t|2097152|s[2]<<22):this._data[t*mt+0]=s[1].charCodeAt(0)|s[2]<<22}getWidth(t){return this._data[t*mt+0]>>22}hasWidth(t){return this._data[t*mt+0]&12582912}getFg(t){return this._data[t*mt+1]}getBg(t){return this._data[t*mt+2]}hasContent(t){return this._data[t*mt+0]&4194303}getCodePoint(t){let s=this._data[t*mt+0];return s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s&2097151}isCombined(t){return this._data[t*mt+0]&2097152}getString(t){let s=this._data[t*mt+0];return s&2097152?this._combined[t]:s&2097151?va(s&2097151):""}isProtected(t){return this._data[t*mt+2]&536870912}loadCell(t,s){return yh=t*mt,s.content=this._data[yh+0],s.fg=this._data[yh+1],s.bg=this._data[yh+2],s.content&2097152&&(s.combinedData=this._combined[t]),s.bg&268435456&&(s.extended=this._extendedAttrs[t]),s}setCell(t,s){s.content&2097152&&(this._combined[t]=s.combinedData),s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*mt+0]=s.content,this._data[t*mt+1]=s.fg,this._data[t*mt+2]=s.bg}setCellFromCodepoint(t,s,i,a){a.bg&268435456&&(this._extendedAttrs[t]=a.extended),this._data[t*mt+0]=s|i<<22,this._data[t*mt+1]=a.fg,this._data[t*mt+2]=a.bg}addCodepointToCell(t,s,i){let a=this._data[t*mt+0];a&2097152?this._combined[t]+=va(s):a&2097151?(this._combined[t]=va(a&2097151)+va(s),a&=-2097152,a|=2097152):a=s|1<<22,i&&(a&=-12582913,a|=i<<22),this._data[t*mt+0]=a}insertCells(t,s,i){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),s<this.length-t){let a=new gi;for(let l=this.length-t-s-1;l>=0;--l)this.setCell(t+s+l,this.loadCell(t+l,a));for(let l=0;l<s;++l)this.setCell(t+l,i)}else for(let a=t;a<this.length;++a)this.setCell(a,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(t,s,i){if(t%=this.length,s<this.length-t){let a=new gi;for(let l=0;l<this.length-t-s;++l)this.setCell(t+l,this.loadCell(t+s+l,a));for(let l=this.length-s;l<this.length;++l)this.setCell(l,i)}else for(let a=t;a<this.length;++a)this.setCell(a,i);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,i)}replaceCells(t,s,i,a=!1){if(a){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,i),s<this.length&&this.getWidth(s-1)===2&&!this.isProtected(s)&&this.setCellFromCodepoint(s,0,1,i);t<s&&t<this.length;)this.isProtected(t)||this.setCell(t,i),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s,0,1,i);t<s&&t<this.length;)this.setCell(t++,i)}resize(t,s){if(t===this.length)return this._data.length*4*eb<this._data.buffer.byteLength;let i=t*mt;if(t>this.length){if(this._data.buffer.byteLength>=i*4)this._data=new Uint32Array(this._data.buffer,0,i);else{let a=new Uint32Array(i);a.set(this._data),this._data=a}for(let a=this.length;a<t;++a)this.setCell(a,s)}else{this._data=this._data.subarray(0,i);let a=Object.keys(this._combined);for(let c=0;c<a.length;c++){let h=parseInt(a[c],10);h>=t&&delete this._combined[h]}let l=Object.keys(this._extendedAttrs);for(let c=0;c<l.length;c++){let h=parseInt(l[c],10);h>=t&&delete this._extendedAttrs[h]}}return this.length=t,i*4*eb<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*eb<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,s=!1){if(s){for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,t);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let s in t._combined)this._combined[s]=t._combined[s];this._extendedAttrs={};for(let s in t._extendedAttrs)this._extendedAttrs[s]=t._extendedAttrs[s];this.isWrapped=t.isWrapped}clone(){let t=new R5(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let s in this._combined)t._combined[s]=this._combined[s];for(let s in this._extendedAttrs)t._extendedAttrs[s]=this._extendedAttrs[s];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*mt+0]&4194303)return t+(this._data[t*mt+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*mt+0]&4194303||this._data[t*mt+2]&50331648)return t+(this._data[t*mt+0]>>22);return 0}copyCellsFrom(t,s,i,a,l){let c=t._data;if(l)for(let f=a-1;f>=0;f--){for(let d=0;d<mt;d++)this._data[(i+f)*mt+d]=c[(s+f)*mt+d];c[(s+f)*mt+2]&268435456&&(this._extendedAttrs[i+f]=t._extendedAttrs[s+f])}else for(let f=0;f<a;f++){for(let d=0;d<mt;d++)this._data[(i+f)*mt+d]=c[(s+f)*mt+d];c[(s+f)*mt+2]&268435456&&(this._extendedAttrs[i+f]=t._extendedAttrs[s+f])}let h=Object.keys(t._combined);for(let f=0;f<h.length;f++){let d=parseInt(h[f],10);d>=s&&(this._combined[d-s+i]=t._combined[d])}}translateToString(t,s,i,a){s=s??0,i=i??this.length,t&&(i=Math.min(i,this.getTrimmedLength())),a&&(a.length=0);let l="";for(;s<i;){let c=this._data[s*mt+0],h=c&2097151,f=c&2097152?this._combined[s]:h?va(h):_a;if(l+=f,a)for(let d=0;d<f.length;++d)a.push(s);s+=c>>22||1}return a&&a.push(s),l}};function kV(e,t,s,i,a,l){let c=[];for(let h=0;h<e.length-1;h++){let f=h,d=e.get(++f);if(!d.isWrapped)continue;let p=[e.get(h)];for(;f<e.length&&d.isWrapped;)p.push(d),d=e.get(++f);if(!l&&i>=h&&i<f){h+=p.length-1;continue}let g=0,b=vu(p,g,t),v=1,w=0;for(;v<p.length;){let N=vu(p,v,t),E=N-w,T=s-b,A=Math.min(E,T);p[g].copyCellsFrom(p[v],w,b,A,!1),b+=A,b===s&&(g++,b=0),w+=A,w===N&&(v++,w=0),b===0&&g!==0&&p[g-1].getWidth(s-1)===2&&(p[g].copyCellsFrom(p[g-1],s-1,b++,1,!1),p[g-1].setCell(s-1,a))}p[g].replaceCells(b,s,a);let k=0;for(let N=p.length-1;N>0&&(N>g||p[N].getTrimmedLength()===0);N--)k++;k>0&&(c.push(h+p.length-k),c.push(k)),h+=p.length-1}return c}function NV(e,t){let s=[],i=0,a=t[i],l=0;for(let c=0;c<e.length;c++)if(a===c){let h=t[++i];e.onDeleteEmitter.fire({index:c-l,amount:h}),c+=h-1,l+=h,a=t[++i]}else s.push(c);return{layout:s,countRemoved:l}}function CV(e,t){let s=[];for(let i=0;i<t.length;i++)s.push(e.get(t[i]));for(let i=0;i<s.length;i++)e.set(i,s[i]);e.length=t.length}function EV(e,t,s){let i=[],a=e.map((f,d)=>vu(e,d,t)).reduce((f,d)=>f+d),l=0,c=0,h=0;for(;h<a;){if(a-h<s){i.push(a-h);break}l+=s;let f=vu(e,c,t);l>f&&(l-=f,c++);let d=e[c].getWidth(l-1)===2;d&&l--;let p=d?s-1:s;i.push(p),h+=p}return i}function vu(e,t,s){if(t===e.length-1)return e[t].getTrimmedLength();let i=!e[t].hasContent(s-1)&&e[t].getWidth(s-1)===1,a=e[t+1].getWidth(0)===2;return i&&a?s-1:s}var M5=class D5{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=D5._nextId++,this._onDispose=this.register(new ze),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),mo(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};M5._nextId=1;var jV=M5,Is={},to=Is.B;Is[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Is.A={"#":"£"};Is.B=void 0;Is[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Is.C=Is[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Is.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Is.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Is.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Is.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Is.E=Is[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Is.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Is.H=Is[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Is["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Dk=4294967295,Lk=class{constructor(e,t,s){this._hasScrollback=e,this._optionsService=t,this._bufferService=s,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=As.clone(),this.savedCharset=to,this.markers=[],this._nullCell=gi.fromCharData([0,X3,1,0]),this._whitespaceCell=gi.fromCharData([0,_a,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new bf,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Mk(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new ff),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new ff),this._whitespaceCell}getBlankLine(e,t){return new Wc(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>Dk?Dk:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=As);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Mk(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let s=this.getNullCell(As),i=0,a=this._getCorrectBufferLength(t);if(a>this.lines.maxLength&&(this.lines.maxLength=a),this.lines.length>0){if(this._cols<e)for(let c=0;c<this.lines.length;c++)i+=+this.lines.get(c).resize(e,s);let l=0;if(this._rows<t)for(let c=this._rows;c<t;c++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Wc(e,s)):this.ybase>0&&this.lines.length<=this.ybase+this.y+l+1?(this.ybase--,l++,this.ydisp>0&&this.ydisp--):this.lines.push(new Wc(e,s)));else for(let c=this._rows;c>t;c--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(a<this.lines.maxLength){let c=this.lines.length-a;c>0&&(this.lines.trimStart(c),this.ybase=Math.max(this.ybase-c,0),this.ydisp=Math.max(this.ydisp-c,0),this.savedY=Math.max(this.savedY-c,0)),this.lines.maxLength=a}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),l&&(this.y+=l),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let l=0;l<this.lines.length;l++)i+=+this.lines.get(l).resize(e,s);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),i>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let s=this._optionsService.rawOptions.reflowCursorLine,i=kV(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(As),s);if(i.length>0){let a=NV(this.lines,i);CV(this.lines,a.layout),this._reflowLargerAdjustViewport(e,t,a.countRemoved)}}_reflowLargerAdjustViewport(e,t,s){let i=this.getNullCell(As),a=s;for(;a-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Wc(e,i))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-s,0)}_reflowSmaller(e,t){let s=this._optionsService.rawOptions.reflowCursorLine,i=this.getNullCell(As),a=[],l=0;for(let c=this.lines.length-1;c>=0;c--){let h=this.lines.get(c);if(!h||!h.isWrapped&&h.getTrimmedLength()<=e)continue;let f=[h];for(;h.isWrapped&&c>0;)h=this.lines.get(--c),f.unshift(h);if(!s){let A=this.ybase+this.y;if(A>=c&&A<c+f.length)continue}let d=f[f.length-1].getTrimmedLength(),p=EV(f,this._cols,e),g=p.length-f.length,b;this.ybase===0&&this.y!==this.lines.length-1?b=Math.max(0,this.y-this.lines.maxLength+g):b=Math.max(0,this.lines.length-this.lines.maxLength+g);let v=[];for(let A=0;A<g;A++){let C=this.getBlankLine(As,!0);v.push(C)}v.length>0&&(a.push({start:c+f.length+l,newLines:v}),l+=v.length),f.push(...v);let w=p.length-1,k=p[w];k===0&&(w--,k=p[w]);let N=f.length-g-1,E=d;for(;N>=0;){let A=Math.min(E,k);if(f[w]===void 0)break;if(f[w].copyCellsFrom(f[N],E-A,k-A,A,!0),k-=A,k===0&&(w--,k=p[w]),E-=A,E===0){N--;let C=Math.max(N,0);E=vu(f,C,this._cols)}}for(let A=0;A<f.length;A++)p[A]<e&&f[A].setCell(p[A],i);let T=g-b;for(;T-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+l)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+g,this.ybase+t-1)}if(a.length>0){let c=[],h=[];for(let k=0;k<this.lines.length;k++)h.push(this.lines.get(k));let f=this.lines.length,d=f-1,p=0,g=a[p];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+l);let b=0;for(let k=Math.min(this.lines.maxLength-1,f+l-1);k>=0;k--)if(g&&g.start>d+b){for(let N=g.newLines.length-1;N>=0;N--)this.lines.set(k--,g.newLines[N]);k++,c.push({index:d+1,amount:g.newLines.length}),b+=g.newLines.length,g=a[++p]}else this.lines.set(k,h[d--]);let v=0;for(let k=c.length-1;k>=0;k--)c[k].index+=v,this.lines.onInsertEmitter.fire(c[k]),v+=c[k].amount;let w=Math.max(0,f+l-this.lines.maxLength);w>0&&this.lines.onTrimEmitter.fire(w)}}translateBufferLineToString(e,t,s=0,i){let a=this.lines.get(e);return a?a.translateToString(t,s,i):""}getWrappedRangeForLine(e){let t=e,s=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;s+1<this.lines.length&&this.lines.get(s+1).isWrapped;)s++;return{first:t,last:s}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new jV(e);return this.markers.push(t),t.register(this.lines.onTrim(s=>{t.line-=s,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(s=>{t.line>=s.index&&(t.line+=s.amount)})),t.register(this.lines.onDelete(s=>{t.line>=s.index&&t.line<s.index+s.amount&&t.dispose(),t.line>s.index&&(t.line-=s.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},AV=class extends gt{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ze),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 Lk(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Lk(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},L5=2,O5=1,e0=class extends gt{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ze),this.onResize=this._onResize.event,this._onScroll=this._register(new ze),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,L5),this.rows=Math.max(e.rawOptions.rows||0,O5),this.buffers=this._register(new AV(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let s=this.cols!==e,i=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:s,rowsChanged:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let s=this.buffer,i;i=this._cachedBlankLine,(!i||i.length!==this.cols||i.getFg(0)!==e.fg||i.getBg(0)!==e.bg)&&(i=s.getBlankLine(e,t),this._cachedBlankLine=i),i.isWrapped=t;let a=s.ybase+s.scrollTop,l=s.ybase+s.scrollBottom;if(s.scrollTop===0){let c=s.lines.isFull;l===s.lines.length-1?c?s.lines.recycle().copyFrom(i):s.lines.push(i.clone()):s.lines.splice(l+1,0,i.clone()),c?this.isUserScrolling&&(s.ydisp=Math.max(s.ydisp-1,0)):(s.ybase++,this.isUserScrolling||s.ydisp++)}else{let c=l-a+1;s.lines.shiftElements(a+1,c-1,-1),s.lines.set(l,i.clone())}this.isUserScrolling||(s.ydisp=s.ybase),this._onScroll.fire(s.ydisp)}scrollLines(e,t){let s=this.buffer;if(e<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else e+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);let i=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+e,s.ybase),0),i!==s.ydisp&&(t||this._onScroll.fire(s.ydisp))}};e0=fs([Fe(0,vn)],e0);var al={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:gf,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},TV=["normal","bold","100","200","300","400","500","600","700","800","900"],RV=class extends gt{constructor(e){super(),this._onOptionChange=this._register(new ze),this.onOptionChange=this._onOptionChange.event;let t={...al};for(let s in e)if(s in t)try{let i=e[s];t[s]=this._sanitizeAndValidateOption(s,i)}catch(i){console.error(i)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(ns(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(s=>{s===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(s=>{e.indexOf(s)!==-1&&t()})}_setupOptions(){let e=s=>{if(!(s in al))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},t=(s,i)=>{if(!(s in al))throw new Error(`No option with key "${s}"`);i=this._sanitizeAndValidateOption(s,i),this.rawOptions[s]!==i&&(this.rawOptions[s]=i,this._onOptionChange.fire(s))};for(let s in this.rawOptions){let i={get:e.bind(this,s),set:t.bind(this,s)};Object.defineProperty(this.options,s,i)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=al[e]),!MV(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=al[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=TV.includes(t)?t:al[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function MV(e){return e==="block"||e==="underline"||e==="bar"}function Kc(e,t=5){if(typeof e!="object")return e;let s=Array.isArray(e)?[]:{};for(let i in e)s[i]=t<=1?e[i]:e[i]&&Kc(e[i],t-1);return s}var Ok=Object.freeze({insertMode:!1}),zk=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),t0=class extends gt{constructor(e,t,s){super(),this._bufferService=e,this._logService=t,this._optionsService=s,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new ze),this.onData=this._onData.event,this._onUserInput=this._register(new ze),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ze),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ze),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Kc(Ok),this.decPrivateModes=Kc(zk)}reset(){this.modes=Kc(Ok),this.decPrivateModes=Kc(zk)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let s=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&s.ybase!==s.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(i=>i.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};t0=fs([Fe(0,xn),Fe(1,t5),Fe(2,vn)],t0);var Bk={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function tb(e,t){let s=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(s|=64,s|=e.action):(s|=e.button&3,e.button&4&&(s|=64),e.button&8&&(s|=128),e.action===32?s|=32:e.action===0&&!t&&(s|=3)),s}var sb=String.fromCharCode,Pk={DEFAULT:e=>{let t=[tb(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${sb(t[0])}${sb(t[1])}${sb(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${tb(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${tb(e,!0)};${e.x};${e.y}${t}`}},s0=class extends gt{constructor(e,t,s){super(),this._bufferService=e,this._coreService=t,this._optionsService=s,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new ze),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(Bk))this.addProtocol(i,Bk[i]);for(let i of Object.keys(Pk))this.addEncoding(i,Pk[i]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,s){if(e.deltaY===0||e.shiftKey||t===void 0||s===void 0)return 0;let i=t/s,a=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(a/=i+0,Math.abs(e.deltaY)<50&&(a*=.3),this._wheelPartialScroll+=a,a=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(a*=this._bufferService.rows),a}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,s){if(s){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};s0=fs([Fe(0,xn),Fe(1,_o),Fe(2,vn)],s0);var nb=[[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]],DV=[[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]],Bs;function LV(e,t){let s=0,i=t.length-1,a;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=s;)if(a=s+i>>1,e>t[a][1])s=a+1;else if(e<t[a][0])i=a-1;else return!0;return!1}var OV=class{constructor(){if(this.version="6",!Bs){Bs=new Uint8Array(65536),Bs.fill(1),Bs[0]=0,Bs.fill(0,1,32),Bs.fill(0,127,160),Bs.fill(2,4352,4448),Bs[9001]=2,Bs[9002]=2,Bs.fill(2,11904,42192),Bs[12351]=1,Bs.fill(2,44032,55204),Bs.fill(2,63744,64256),Bs.fill(2,65040,65050),Bs.fill(2,65072,65136),Bs.fill(2,65280,65377),Bs.fill(2,65504,65511);for(let e=0;e<nb.length;++e)Bs.fill(0,nb[e][0],nb[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Bs[e]:LV(e,DV)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let s=this.wcwidth(e),i=s===0&&t!==0;if(i){let a=ro.extractWidth(t);a===0?i=!1:a>s&&(s=a)}return ro.createPropertyValue(0,s,i)}},ro=class Gh{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ze,this.onChange=this._onChange.event;let t=new OV;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,s,i=!1){return(t&16777215)<<3|(s&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let s=0,i=0,a=t.length;for(let l=0;l<a;++l){let c=t.charCodeAt(l);if(55296<=c&&c<=56319){if(++l>=a)return s+this.wcwidth(c);let d=t.charCodeAt(l);56320<=d&&d<=57343?c=(c-55296)*1024+d-56320+65536:s+=this.wcwidth(d)}let h=this.charProperties(c,i),f=Gh.extractWidth(h);Gh.extractShouldJoin(h)&&(f-=Gh.extractWidth(i)),s+=f,i=h}return s}charProperties(t,s){return this._activeProvider.charProperties(t,s)}},zV=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function Ik(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);s&&t&&(s.isWrapped=t[3]!==0&&t[3]!==32)}var Lc=2147483647,BV=256,z5=class n0{constructor(t=32,s=32){if(this.maxLength=t,this.maxSubParamsLength=s,s>BV)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(s),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let s=new n0;if(!t.length)return s;for(let i=Array.isArray(t[0])?1:0;i<t.length;++i){let a=t[i];if(Array.isArray(a))for(let l=0;l<a.length;++l)s.addSubParam(a[l]);else s.addParam(a)}return s}clone(){let t=new n0(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let s=0;s<this.length;++s){t.push(this.params[s]);let i=this._subParamsIdx[s]>>8,a=this._subParamsIdx[s]&255;a-i>0&&t.push(Array.prototype.slice.call(this._subParams,i,a))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Lc?Lc:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Lc?Lc:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let s=this._subParamsIdx[t]>>8,i=this._subParamsIdx[t]&255;return i-s>0?this._subParams.subarray(s,i):null}getSubParamsAll(){let t={};for(let s=0;s<this.length;++s){let i=this._subParamsIdx[s]>>8,a=this._subParamsIdx[s]&255;a-i>0&&(t[s]=this._subParams.slice(i,a))}return t}addDigit(t){let s;if(this._rejectDigits||!(s=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,a=i[s-1];i[s-1]=~a?Math.min(a*10+t,Lc):t}},Oc=[],PV=class{constructor(){this._state=0,this._active=Oc,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let i=s.indexOf(t);i!==-1&&s.splice(i,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Oc}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=Oc,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Oc,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,s){if(!this._active.length)this._handlerFb(this._id,"PUT",Xf(e,t,s));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,s)}start(){this.reset(),this._state=1}put(e,t,s){if(this._state!==3){if(this._state===1)for(;t<s;){let i=e[t++];if(i===59){this._state=2,this._start();break}if(i<48||57<i){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+i-48}this._state===2&&s-t>0&&this._put(e,t,s)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let s=!1,i=this._active.length-1,a=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,s=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&s===!1){for(;i>=0&&(s=this._active[i].end(e),s!==!0);i--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,s;i--}for(;i>=0;i--)if(s=this._active[i].end(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,s}this._active=Oc,this._id=-1,this._state=0}}},Vn=class{constructor(t){this._handler=t,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,s,i){this._hitLimit||(this._data+=Xf(t,s,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(t){let s=!1;if(this._hitLimit)s=!1;else if(t&&(s=this._handler(this._data),s instanceof Promise))return s.then(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,s}},zc=[],IV=class{constructor(){this._handlers=Object.create(null),this._active=zc,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=zc}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let i=s.indexOf(t);i!==-1&&s.splice(i,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=zc,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||zc,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let s=this._active.length-1;s>=0;s--)this._active[s].hook(t)}put(e,t,s){if(!this._active.length)this._handlerFb(this._ident,"PUT",Xf(e,t,s));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,s)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let s=!1,i=this._active.length-1,a=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,s=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&s===!1){for(;i>=0&&(s=this._active[i].unhook(e),s!==!0);i--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,s;i--}for(;i>=0;i--)if(s=this._active[i].unhook(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,s}this._active=zc,this._ident=0}},Yc=new z5;Yc.addParam(0);var $k=class{constructor(e){this._handler=e,this._data="",this._params=Yc,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Yc,this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=Xf(e,t,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(s=>(this._params=Yc,this._data="",this._hitLimit=!1,s));return this._params=Yc,this._data="",this._hitLimit=!1,t}},$V=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,s,i){this.table[t<<8|e]=s<<4|i}addMany(e,t,s,i){for(let a=0;a<e.length;a++)this.table[t<<8|e[a]]=s<<4|i}},fi=160,HV=(function(){let e=new $V(4095),t=Array.apply(null,Array(256)).map((h,f)=>f),s=(h,f)=>t.slice(h,f),i=s(32,127),a=s(0,24);a.push(25),a.push.apply(a,s(28,32));let l=s(0,14),c;e.setDefault(1,0),e.addMany(i,0,2,0);for(c in l)e.addMany([24,26,153,154],c,3,0),e.addMany(s(128,144),c,3,0),e.addMany(s(144,152),c,3,0),e.add(156,c,0,0),e.add(27,c,11,1),e.add(157,c,4,8),e.addMany([152,158,159],c,0,7),e.add(155,c,11,3),e.add(144,c,11,9);return e.addMany(a,0,3,0),e.addMany(a,1,3,1),e.add(127,1,0,1),e.addMany(a,8,0,8),e.addMany(a,3,3,3),e.add(127,3,0,3),e.addMany(a,4,3,4),e.add(127,4,0,4),e.addMany(a,6,3,6),e.addMany(a,5,3,5),e.add(127,5,0,5),e.addMany(a,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(s(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,7,0,7),e.addMany(a,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(s(64,127),3,7,0),e.addMany(s(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(s(48,60),4,8,4),e.addMany(s(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(s(32,64),6,0,6),e.add(127,6,0,6),e.addMany(s(64,127),6,0,0),e.addMany(s(32,48),3,9,5),e.addMany(s(32,48),5,9,5),e.addMany(s(48,64),5,0,6),e.addMany(s(64,127),5,7,0),e.addMany(s(32,48),4,9,5),e.addMany(s(32,48),1,9,2),e.addMany(s(32,48),2,9,2),e.addMany(s(48,127),2,10,0),e.addMany(s(48,80),1,10,0),e.addMany(s(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(s(96,127),1,10,0),e.add(80,1,11,9),e.addMany(a,9,0,9),e.add(127,9,0,9),e.addMany(s(28,32),9,0,9),e.addMany(s(32,48),9,9,12),e.addMany(s(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(a,11,0,11),e.addMany(s(32,128),11,0,11),e.addMany(s(28,32),11,0,11),e.addMany(a,10,0,10),e.add(127,10,0,10),e.addMany(s(28,32),10,0,10),e.addMany(s(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(s(32,48),10,9,12),e.addMany(a,12,0,12),e.add(127,12,0,12),e.addMany(s(28,32),12,0,12),e.addMany(s(32,48),12,9,12),e.addMany(s(48,64),12,0,11),e.addMany(s(64,127),12,12,13),e.addMany(s(64,127),10,12,13),e.addMany(s(64,127),9,12,13),e.addMany(a,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(fi,0,2,0),e.add(fi,8,5,8),e.add(fi,6,0,6),e.add(fi,11,0,11),e.add(fi,13,13,13),e})(),UV=class extends gt{constructor(e=HV){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new z5,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,s,i)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,s)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(ns(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new PV),this._dcsParser=this._register(new IV),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let s=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=e.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let a=0;a<e.intermediates.length;++a){let l=e.intermediates.charCodeAt(a);if(32>l||l>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=l}}if(e.final.length!==1)throw new Error("final must be a single byte");let i=e.final.charCodeAt(0);if(t[0]>i||i>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return s<<=8,s|=i,s}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let s=this._identifier(e,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);let i=this._escHandlers[s];return i.push(t),{dispose:()=>{let a=i.indexOf(t);a!==-1&&i.splice(a,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let s=this._identifier(e);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);let i=this._csiHandlers[s];return i.push(t),{dispose:()=>{let a=i.indexOf(t);a!==-1&&i.splice(a,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,s,i,a){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=s,this._parseStack.transition=i,this._parseStack.chunkPos=a}parse(e,t,s){let i=0,a=0,l=0,c;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,l=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let h=this._parseStack.handlers,f=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&f>-1){for(;f>=0&&(c=h[f](this._params),c!==!0);f--)if(c instanceof Promise)return this._parseStack.handlerPos=f,c}this._parseStack.handlers=[];break;case 4:if(s===!1&&f>-1){for(;f>=0&&(c=h[f](),c!==!0);f--)if(c instanceof Promise)return this._parseStack.handlerPos=f,c}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],c=this._dcsParser.unhook(i!==24&&i!==26,s),c)return c;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],c=this._oscParser.end(i!==24&&i!==26,s),c)return c;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,l=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let h=l;h<t;++h){switch(i=e[h],a=this._transitions.table[this.currentState<<8|(i<160?i:fi)],a>>4){case 2:for(let b=h+1;;++b){if(b>=t||(i=e[b])<32||i>126&&i<fi){this._printHandler(e,h,b),h=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<fi){this._printHandler(e,h,b),h=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<fi){this._printHandler(e,h,b),h=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<fi){this._printHandler(e,h,b),h=b-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:h,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let f=this._csiHandlers[this._collect<<8|i],d=f?f.length-1:-1;for(;d>=0&&(c=f[d](this._params),c!==!0);d--)if(c instanceof Promise)return this._preserveStack(3,f,d,a,h),c;d<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++h<t&&(i=e[h])>47&&i<60);h--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let p=this._escHandlers[this._collect<<8|i],g=p?p.length-1:-1;for(;g>=0&&(c=p[g](),c!==!0);g--)if(c instanceof Promise)return this._preserveStack(4,p,g,a,h),c;g<0&&this._escHandlerFb(this._collect<<8|i),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let b=h+1;;++b)if(b>=t||(i=e[b])===24||i===26||i===27||i>127&&i<fi){this._dcsParser.put(e,h,b),h=b-1;break}break;case 14:if(c=this._dcsParser.unhook(i!==24&&i!==26),c)return this._preserveStack(6,[],0,a,h),c;i===27&&(a|=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 b=h+1;;b++)if(b>=t||(i=e[b])<32||i>127&&i<fi){this._oscParser.put(e,h,b),h=b-1;break}break;case 6:if(c=this._oscParser.end(i!==24&&i!==26),c)return this._preserveStack(5,[],0,a,h),c;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=a&15}}},FV=/^([\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})$/,qV=/^[\da-f]+$/;function Hk(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let s=FV.exec(t);if(s){let i=s[1]?15:s[4]?255:s[7]?4095:65535;return[Math.round(parseInt(s[1]||s[4]||s[7]||s[10],16)/i*255),Math.round(parseInt(s[2]||s[5]||s[8]||s[11],16)/i*255),Math.round(parseInt(s[3]||s[6]||s[9]||s[12],16)/i*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),qV.exec(t)&&[3,6,9,12].includes(t.length))){let s=t.length/3,i=[0,0,0];for(let a=0;a<3;++a){let l=parseInt(t.slice(s*a,s*a+s),16);i[a]=s===1?l<<4:s===2?l:s===3?l>>4:l>>8}return i}}function ib(e,t){let s=e.toString(16),i=s.length<2?"0"+s:s;switch(t){case 4:return s[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}function GV(e,t=16){let[s,i,a]=e;return`rgb:${ib(s,t)}/${ib(i,t)}/${ib(a,t)}`}var VV={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ma=131072,Uk=10;function Fk(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var qk=5e3,Gk=0,WV=class extends gt{constructor(e,t,s,i,a,l,c,h,f=new UV){super(),this._bufferService=e,this._charsetService=t,this._coreService=s,this._logService=i,this._optionsService=a,this._oscLinkService=l,this._coreMouseService=c,this._unicodeService=h,this._parser=f,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new hq,this._utf8Decoder=new fq,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=As.clone(),this._eraseAttrDataInternal=As.clone(),this._onRequestBell=this._register(new ze),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ze),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ze),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ze),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ze),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ze),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ze),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ze),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ze),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ze),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ze),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ze),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ze),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 i0(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(d=>this._activeBuffer=d.activeBuffer)),this._parser.setCsiHandlerFallback((d,p)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(d),params:p.toArray()})}),this._parser.setEscHandlerFallback(d=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(d)})}),this._parser.setExecuteHandlerFallback(d=>{this._logService.debug("Unknown EXECUTE code: ",{code:d})}),this._parser.setOscHandlerFallback((d,p,g)=>{this._logService.debug("Unknown OSC code: ",{identifier:d,action:p,data:g})}),this._parser.setDcsHandlerFallback((d,p,g)=>{p==="HOOK"&&(g=g.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(d),action:p,payload:g})}),this._parser.setPrintHandler((d,p,g)=>this.print(d,p,g)),this._parser.registerCsiHandler({final:"@"},d=>this.insertChars(d)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},d=>this.scrollLeft(d)),this._parser.registerCsiHandler({final:"A"},d=>this.cursorUp(d)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},d=>this.scrollRight(d)),this._parser.registerCsiHandler({final:"B"},d=>this.cursorDown(d)),this._parser.registerCsiHandler({final:"C"},d=>this.cursorForward(d)),this._parser.registerCsiHandler({final:"D"},d=>this.cursorBackward(d)),this._parser.registerCsiHandler({final:"E"},d=>this.cursorNextLine(d)),this._parser.registerCsiHandler({final:"F"},d=>this.cursorPrecedingLine(d)),this._parser.registerCsiHandler({final:"G"},d=>this.cursorCharAbsolute(d)),this._parser.registerCsiHandler({final:"H"},d=>this.cursorPosition(d)),this._parser.registerCsiHandler({final:"I"},d=>this.cursorForwardTab(d)),this._parser.registerCsiHandler({final:"J"},d=>this.eraseInDisplay(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},d=>this.eraseInDisplay(d,!0)),this._parser.registerCsiHandler({final:"K"},d=>this.eraseInLine(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},d=>this.eraseInLine(d,!0)),this._parser.registerCsiHandler({final:"L"},d=>this.insertLines(d)),this._parser.registerCsiHandler({final:"M"},d=>this.deleteLines(d)),this._parser.registerCsiHandler({final:"P"},d=>this.deleteChars(d)),this._parser.registerCsiHandler({final:"S"},d=>this.scrollUp(d)),this._parser.registerCsiHandler({final:"T"},d=>this.scrollDown(d)),this._parser.registerCsiHandler({final:"X"},d=>this.eraseChars(d)),this._parser.registerCsiHandler({final:"Z"},d=>this.cursorBackwardTab(d)),this._parser.registerCsiHandler({final:"`"},d=>this.charPosAbsolute(d)),this._parser.registerCsiHandler({final:"a"},d=>this.hPositionRelative(d)),this._parser.registerCsiHandler({final:"b"},d=>this.repeatPrecedingCharacter(d)),this._parser.registerCsiHandler({final:"c"},d=>this.sendDeviceAttributesPrimary(d)),this._parser.registerCsiHandler({prefix:">",final:"c"},d=>this.sendDeviceAttributesSecondary(d)),this._parser.registerCsiHandler({final:"d"},d=>this.linePosAbsolute(d)),this._parser.registerCsiHandler({final:"e"},d=>this.vPositionRelative(d)),this._parser.registerCsiHandler({final:"f"},d=>this.hVPosition(d)),this._parser.registerCsiHandler({final:"g"},d=>this.tabClear(d)),this._parser.registerCsiHandler({final:"h"},d=>this.setMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"h"},d=>this.setModePrivate(d)),this._parser.registerCsiHandler({final:"l"},d=>this.resetMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"l"},d=>this.resetModePrivate(d)),this._parser.registerCsiHandler({final:"m"},d=>this.charAttributes(d)),this._parser.registerCsiHandler({final:"n"},d=>this.deviceStatus(d)),this._parser.registerCsiHandler({prefix:"?",final:"n"},d=>this.deviceStatusPrivate(d)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},d=>this.softReset(d)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},d=>this.setCursorStyle(d)),this._parser.registerCsiHandler({final:"r"},d=>this.setScrollRegion(d)),this._parser.registerCsiHandler({final:"s"},d=>this.saveCursor(d)),this._parser.registerCsiHandler({final:"t"},d=>this.windowOptions(d)),this._parser.registerCsiHandler({final:"u"},d=>this.restoreCursor(d)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},d=>this.insertColumns(d)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},d=>this.deleteColumns(d)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},d=>this.selectProtected(d)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},d=>this.requestMode(d,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},d=>this.requestMode(d,!1)),this._parser.setExecuteHandler(je.BEL,()=>this.bell()),this._parser.setExecuteHandler(je.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(je.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(je.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(je.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(je.BS,()=>this.backspace()),this._parser.setExecuteHandler(je.HT,()=>this.tab()),this._parser.setExecuteHandler(je.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(je.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Fh.IND,()=>this.index()),this._parser.setExecuteHandler(Fh.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Fh.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Vn(d=>(this.setTitle(d),this.setIconName(d),!0))),this._parser.registerOscHandler(1,new Vn(d=>this.setIconName(d))),this._parser.registerOscHandler(2,new Vn(d=>this.setTitle(d))),this._parser.registerOscHandler(4,new Vn(d=>this.setOrReportIndexedColor(d))),this._parser.registerOscHandler(8,new Vn(d=>this.setHyperlink(d))),this._parser.registerOscHandler(10,new Vn(d=>this.setOrReportFgColor(d))),this._parser.registerOscHandler(11,new Vn(d=>this.setOrReportBgColor(d))),this._parser.registerOscHandler(12,new Vn(d=>this.setOrReportCursorColor(d))),this._parser.registerOscHandler(104,new Vn(d=>this.restoreIndexedColor(d))),this._parser.registerOscHandler(110,new Vn(d=>this.restoreFgColor(d))),this._parser.registerOscHandler(111,new Vn(d=>this.restoreBgColor(d))),this._parser.registerOscHandler(112,new Vn(d=>this.restoreCursorColor(d))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let d in Is)this._parser.registerEscHandler({intermediates:"(",final:d},()=>this.selectCharset("("+d)),this._parser.registerEscHandler({intermediates:")",final:d},()=>this.selectCharset(")"+d)),this._parser.registerEscHandler({intermediates:"*",final:d},()=>this.selectCharset("*"+d)),this._parser.registerEscHandler({intermediates:"+",final:d},()=>this.selectCharset("+"+d)),this._parser.registerEscHandler({intermediates:"-",final:d},()=>this.selectCharset("-"+d)),this._parser.registerEscHandler({intermediates:".",final:d},()=>this.selectCharset("."+d)),this._parser.registerEscHandler({intermediates:"/",final:d},()=>this.selectCharset("/"+d));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(d=>(this._logService.error("Parsing error: ",d),d)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new $k((d,p)=>this.requestStatusString(d,p)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,s,i){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=s,this._parseStack.position=i}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,s)=>setTimeout(()=>s("#SLOW_TIMEOUT"),qk))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${qk} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let s,i=this._activeBuffer.x,a=this._activeBuffer.y,l=0,c=this._parseStack.paused;if(c){if(s=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(s),s;i=this._parseStack.cursorStartX,a=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>ma&&(l=this._parseStack.position+ma)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,d=>String.fromCharCode(d)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(d=>d.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<ma&&(this._parseBuffer=new Uint32Array(Math.min(e.length,ma))),c||this._dirtyRowTracker.clearRange(),e.length>ma)for(let d=l;d<e.length;d+=ma){let p=d+ma<e.length?d+ma:e.length,g=typeof e=="string"?this._stringDecoder.decode(e.substring(d,p),this._parseBuffer):this._utf8Decoder.decode(e.subarray(d,p),this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,g))return this._preserveStack(i,a,g,d),this._logSlowResolvingAsync(s),s}else if(!c){let d=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,d))return this._preserveStack(i,a,d,0),this._logSlowResolvingAsync(s),s}(this._activeBuffer.x!==i||this._activeBuffer.y!==a)&&this._onCursorMove.fire();let h=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),f=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);f<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(f,this._bufferService.rows-1),end:Math.min(h,this._bufferService.rows-1)})}print(e,t,s){let i,a,l=this._charsetService.charset,c=this._optionsService.rawOptions.screenReaderMode,h=this._bufferService.cols,f=this._coreService.decPrivateModes.wraparound,d=this._coreService.modes.insertMode,p=this._curAttrData,g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&s-t>0&&g.getWidth(this._activeBuffer.x-1)===2&&g.setCellFromCodepoint(this._activeBuffer.x-1,0,1,p);let b=this._parser.precedingJoinState;for(let v=t;v<s;++v){if(i=e[v],i<127&&l){let E=l[String.fromCharCode(i)];E&&(i=E.charCodeAt(0))}let w=this._unicodeService.charProperties(i,b);a=ro.extractWidth(w);let k=ro.extractShouldJoin(w),N=k?ro.extractWidth(b):0;if(b=w,c&&this._onA11yChar.fire(va(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+a-N>h){if(f){let E=g,T=this._activeBuffer.x-N;for(this._activeBuffer.x=N,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),g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),N>0&&g instanceof Wc&&g.copyCellsFrom(E,T,0,N,!1);T<h;)E.setCellFromCodepoint(T++,0,1,p)}else if(this._activeBuffer.x=h-1,a===2)continue}if(k&&this._activeBuffer.x){let E=g.getWidth(this._activeBuffer.x-1)?1:2;g.addCodepointToCell(this._activeBuffer.x-E,i,a);for(let T=a-N;--T>=0;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,p);continue}if(d&&(g.insertCells(this._activeBuffer.x,a-N,this._activeBuffer.getNullCell(p)),g.getWidth(h-1)===2&&g.setCellFromCodepoint(h-1,0,1,p)),g.setCellFromCodepoint(this._activeBuffer.x++,i,a,p),a>0)for(;--a;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,p)}this._parser.precedingJoinState=b,this._activeBuffer.x<h&&s-t>0&&g.getWidth(this._activeBuffer.x)===0&&!g.hasContent(this._activeBuffer.x)&&g.setCellFromCodepoint(this._activeBuffer.x,0,1,p),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,s=>Fk(s.params[0],this._optionsService.rawOptions.windowOptions)?t(s):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new $k(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Vn(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){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&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,s,i=!1,a=!1){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);l.replaceCells(t,s,this._activeBuffer.getNullCell(this._eraseAttrData()),a),i&&(l.isWrapped=!1)}_resetBufferLine(e,t=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s&&(s.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),s.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let s;switch(e.params[0]){case 0:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);s<this._bufferService.rows;s++)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(s);break;case 1:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(s+1).isWrapped=!1);s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(s=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,s-1);s--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+s)?.getTrimmedLength(););for(;s>=0;s--)this._bufferService.scroll(this._eraseAttrData())}else{for(s=this._bufferService.rows,this._dirtyRowTracker.markDirty(s-1);s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,a=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;t--;)this._activeBuffer.lines.splice(a-1,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=this._activeBuffer.ybase+this._activeBuffer.y,i;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;t--;)this._activeBuffer.lines.splice(s,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(As));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);i.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);i.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);i.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);i.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let s=e.params[0]||1,i=ro.extractWidth(t),a=this._activeBuffer.x-i,l=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(a),c=new Uint32Array(l.length*s),h=0;for(let d=0;d<l.length;){let p=l.codePointAt(d)||0;c[h++]=p,d+=p>65535?2:1}let f=h;for(let d=1;d<s;++d)c.copyWithin(f,0,h),f+=h;return this.print(c,0,f),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(je.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(je.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(je.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(je.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(je.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,to),this._charsetService.setgCharset(1,to),this._charsetService.setgCharset(2,to),this._charsetService.setgCharset(3,to);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let s;(k=>(k[k.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",k[k.SET=1]="SET",k[k.RESET=2]="RESET",k[k.PERMANENTLY_SET=3]="PERMANENTLY_SET",k[k.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(s||={});let i=this._coreService.decPrivateModes,{activeProtocol:a,activeEncoding:l}=this._coreMouseService,c=this._coreService,{buffers:h,cols:f}=this._bufferService,{active:d,alt:p}=h,g=this._optionsService.rawOptions,b=(k,N)=>(c.triggerDataEvent(`${je.ESC}[${t?"":"?"}${k};${N}$y`),!0),v=k=>k?1:2,w=e.params[0];return t?w===2?b(w,4):w===4?b(w,v(c.modes.insertMode)):w===12?b(w,3):w===20?b(w,v(g.convertEol)):b(w,0):w===1?b(w,v(i.applicationCursorKeys)):w===3?b(w,g.windowOptions.setWinLines?f===80?2:f===132?1:0:0):w===6?b(w,v(i.origin)):w===7?b(w,v(i.wraparound)):w===8?b(w,3):w===9?b(w,v(a==="X10")):w===12?b(w,v(g.cursorBlink)):w===25?b(w,v(!c.isCursorHidden)):w===45?b(w,v(i.reverseWraparound)):w===66?b(w,v(i.applicationKeypad)):w===67?b(w,4):w===1e3?b(w,v(a==="VT200")):w===1002?b(w,v(a==="DRAG")):w===1003?b(w,v(a==="ANY")):w===1004?b(w,v(i.sendFocus)):w===1005?b(w,4):w===1006?b(w,v(l==="SGR")):w===1015?b(w,4):w===1016?b(w,v(l==="SGR_PIXELS")):w===1048?b(w,1):w===47||w===1047||w===1049?b(w,v(d===p)):w===2004?b(w,v(i.bracketedPasteMode)):w===2026?b(w,v(i.synchronizedOutput)):b(w,0)}_updateAttrColor(e,t,s,i,a){return t===2?(e|=50331648,e&=-16777216,e|=Tu.fromColorRGB([s,i,a])):t===5&&(e&=-50331904,e|=33554432|s&255),e}_extractColor(e,t,s){let i=[0,0,-1,0,0,0],a=0,l=0;do{if(i[l+a]=e.params[t+l],e.hasSubParams(t+l)){let c=e.getSubParams(t+l),h=0;do i[1]===5&&(a=1),i[l+h+1+a]=c[h];while(++h<c.length&&h+l+1+a<i.length);break}if(i[1]===5&&l+a>=2||i[1]===2&&l+a>=5)break;i[1]&&(a=1)}while(++l+t<e.length&&l+a<i.length);for(let c=2;c<i.length;++c)i[c]===-1&&(i[c]=0);switch(i[0]){case 38:s.fg=this._updateAttrColor(s.fg,i[1],i[3],i[4],i[5]);break;case 48:s.bg=this._updateAttrColor(s.bg,i[1],i[3],i[4],i[5]);break;case 58:s.extended=s.extended.clone(),s.extended.underlineColor=this._updateAttrColor(s.extended.underlineColor,i[1],i[3],i[4],i[5])}return l}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=As.fg,e.bg=As.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,s,i=this._curAttrData;for(let a=0;a<t;a++)s=e.params[a],s>=30&&s<=37?(i.fg&=-50331904,i.fg|=16777216|s-30):s>=40&&s<=47?(i.bg&=-50331904,i.bg|=16777216|s-40):s>=90&&s<=97?(i.fg&=-50331904,i.fg|=16777216|s-90|8):s>=100&&s<=107?(i.bg&=-50331904,i.bg|=16777216|s-100|8):s===0?this._processSGR0(i):s===1?i.fg|=134217728:s===3?i.bg|=67108864:s===4?(i.fg|=268435456,this._processUnderline(e.hasSubParams(a)?e.getSubParams(a)[0]:1,i)):s===5?i.fg|=536870912:s===7?i.fg|=67108864:s===8?i.fg|=1073741824:s===9?i.fg|=2147483648:s===2?i.bg|=134217728:s===21?this._processUnderline(2,i):s===22?(i.fg&=-134217729,i.bg&=-134217729):s===23?i.bg&=-67108865:s===24?(i.fg&=-268435457,this._processUnderline(0,i)):s===25?i.fg&=-536870913:s===27?i.fg&=-67108865:s===28?i.fg&=-1073741825:s===29?i.fg&=2147483647:s===39?(i.fg&=-67108864,i.fg|=As.fg&16777215):s===49?(i.bg&=-67108864,i.bg|=As.bg&16777215):s===38||s===48||s===58?a+=this._extractColor(e,a,i):s===53?i.bg|=1073741824:s===55?i.bg&=-1073741825:s===59?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):s===100?(i.fg&=-67108864,i.fg|=As.fg&16777215,i.bg&=-67108864,i.bg|=As.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",s);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${je.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${je.ESC}[${t};${s}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${je.ESC}[?${t};${s}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=As.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let s=t%2===1;this._coreService.decPrivateModes.cursorBlink=s}return!0}setScrollRegion(e){let t=e.params[0]||1,s;return(e.length<2||(s=e.params[1])>this._bufferService.rows||s===0)&&(s=this._bufferService.rows),s>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=s-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Fk(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${je.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Uk&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Uk&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],s=e.split(";");for(;s.length>1;){let i=s.shift(),a=s.shift();if(/^\d+$/.exec(i)){let l=parseInt(i);if(Vk(l))if(a==="?")t.push({type:0,index:l});else{let c=Hk(a);c&&t.push({type:1,index:l,color:c})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let s=e.slice(0,t).trim(),i=e.slice(t+1);return i?this._createHyperlink(s,i):s.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let s=e.split(":"),i,a=s.findIndex(l=>l.startsWith("id="));return a!==-1&&(i=s[a].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:i,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let s=e.split(";");for(let i=0;i<s.length&&!(t>=this._specialColors.length);++i,++t)if(s[i]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let a=Hk(s[i]);a&&this._onColor.fire([{type:1,index:this._specialColors[t],color:a}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],s=e.split(";");for(let i=0;i<s.length;++i)if(/^\d+$/.exec(s[i])){let a=parseInt(s[i]);Vk(a)&&t.push({type:2,index:a})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,to),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(VV[e[0]],Is[e[1]]||to),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=As.clone(),this._eraseAttrDataInternal=As.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new gi;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let s=this._activeBuffer.ybase+this._activeBuffer.y+t,i=this._activeBuffer.lines.get(s);i&&(i.fill(e),i.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let s=c=>(this._coreService.triggerDataEvent(`${je.ESC}${c}${je.ESC}\\`),!0),i=this._bufferService.buffer,a=this._optionsService.rawOptions;return s(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[a.cursorStyle]-(a.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},i0=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(Gk=e,e=t,t=Gk),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};i0=fs([Fe(0,xn)],i0);function Vk(e){return 0<=e&&e<256}var KV=5e7,Wk=12,YV=50,XV=class extends gt{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new ze),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let s;for(;s=this._writeBuffer.shift();){this._action(s);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>KV)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let s=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],a=this._action(i,t);if(a){let c=h=>performance.now()-s>=Wk?setTimeout(()=>this._innerWrite(0,h)):this._innerWrite(s,h);a.catch(h=>(queueMicrotask(()=>{throw h}),Promise.resolve(!1))).then(c);return}let l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-s>=Wk)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>YV&&(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()}},r0=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let h=t.addMarker(t.ybase+t.y),f={data:e,id:this._nextId++,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(f,h)),this._dataByLinkId.set(f.id,f),f.id}let s=e,i=this._getEntryIdKey(s),a=this._entriesWithId.get(i);if(a)return this.addLineToLink(a.id,t.ybase+t.y),a.id;let l=t.addMarker(t.ybase+t.y),c={id:this._nextId++,key:this._getEntryIdKey(s),data:s,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(c,l)),this._entriesWithId.set(c.key,c),this._dataByLinkId.set(c.id,c),c.id}addLineToLink(e,t){let s=this._dataByLinkId.get(e);if(s&&s.lines.every(i=>i.line!==t)){let i=this._bufferService.buffer.addMarker(t);s.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(s,i))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let s=e.lines.indexOf(t);s!==-1&&(e.lines.splice(s,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};r0=fs([Fe(0,xn)],r0);var Kk=!1,ZV=class extends gt{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Sl),this._onBinary=this._register(new ze),this.onBinary=this._onBinary.event,this._onData=this._register(new ze),this.onData=this._onData.event,this._onLineFeed=this._register(new ze),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ze),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ze),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ze),this._instantiationService=new _V,this.optionsService=this._register(new RV(e)),this._instantiationService.setService(vn,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(e0)),this._instantiationService.setService(xn,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Jx)),this._instantiationService.setService(t5,this._logService),this.coreService=this._register(this._instantiationService.createInstance(t0)),this._instantiationService.setService(_o,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(s0)),this._instantiationService.setService(e5,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(ro)),this._instantiationService.setService(bq,this.unicodeService),this._charsetService=this._instantiationService.createInstance(zV),this._instantiationService.setService(gq,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(r0),this._instantiationService.setService(s5,this._oscLinkService),this._inputHandler=this._register(new WV(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(tn.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(tn.forward(this._bufferService.onResize,this._onResize)),this._register(tn.forward(this.coreService.onData,this._onData)),this._register(tn.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new XV((t,s)=>this._inputHandler.parse(t,s))),this._register(tn.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ze),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!Kk&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Kk=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,L5),t=Math.max(t,O5),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(Ik.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Ik(this._bufferService),!1))),this._windowsWrappingHeuristics.value=ns(()=>{for(let t of e)t.dispose()})}}},QV={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function JV(e,t,s,i){let a={type:0,cancel:!1,key:void 0},l=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?a.key=je.ESC+"OA":a.key=je.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?a.key=je.ESC+"OD":a.key=je.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?a.key=je.ESC+"OC":a.key=je.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?a.key=je.ESC+"OB":a.key=je.ESC+"[B");break;case 8:a.key=e.ctrlKey?"\b":je.DEL,e.altKey&&(a.key=je.ESC+a.key);break;case 9:if(e.shiftKey){a.key=je.ESC+"[Z";break}a.key=je.HT,a.cancel=!0;break;case 13:a.key=e.altKey?je.ESC+je.CR:je.CR,a.cancel=!0;break;case 27:a.key=je.ESC,e.altKey&&(a.key=je.ESC+je.ESC),a.cancel=!0;break;case 37:if(e.metaKey)break;l?a.key=je.ESC+"[1;"+(l+1)+"D":t?a.key=je.ESC+"OD":a.key=je.ESC+"[D";break;case 39:if(e.metaKey)break;l?a.key=je.ESC+"[1;"+(l+1)+"C":t?a.key=je.ESC+"OC":a.key=je.ESC+"[C";break;case 38:if(e.metaKey)break;l?a.key=je.ESC+"[1;"+(l+1)+"A":t?a.key=je.ESC+"OA":a.key=je.ESC+"[A";break;case 40:if(e.metaKey)break;l?a.key=je.ESC+"[1;"+(l+1)+"B":t?a.key=je.ESC+"OB":a.key=je.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(a.key=je.ESC+"[2~");break;case 46:l?a.key=je.ESC+"[3;"+(l+1)+"~":a.key=je.ESC+"[3~";break;case 36:l?a.key=je.ESC+"[1;"+(l+1)+"H":t?a.key=je.ESC+"OH":a.key=je.ESC+"[H";break;case 35:l?a.key=je.ESC+"[1;"+(l+1)+"F":t?a.key=je.ESC+"OF":a.key=je.ESC+"[F";break;case 33:e.shiftKey?a.type=2:e.ctrlKey?a.key=je.ESC+"[5;"+(l+1)+"~":a.key=je.ESC+"[5~";break;case 34:e.shiftKey?a.type=3:e.ctrlKey?a.key=je.ESC+"[6;"+(l+1)+"~":a.key=je.ESC+"[6~";break;case 112:l?a.key=je.ESC+"[1;"+(l+1)+"P":a.key=je.ESC+"OP";break;case 113:l?a.key=je.ESC+"[1;"+(l+1)+"Q":a.key=je.ESC+"OQ";break;case 114:l?a.key=je.ESC+"[1;"+(l+1)+"R":a.key=je.ESC+"OR";break;case 115:l?a.key=je.ESC+"[1;"+(l+1)+"S":a.key=je.ESC+"OS";break;case 116:l?a.key=je.ESC+"[15;"+(l+1)+"~":a.key=je.ESC+"[15~";break;case 117:l?a.key=je.ESC+"[17;"+(l+1)+"~":a.key=je.ESC+"[17~";break;case 118:l?a.key=je.ESC+"[18;"+(l+1)+"~":a.key=je.ESC+"[18~";break;case 119:l?a.key=je.ESC+"[19;"+(l+1)+"~":a.key=je.ESC+"[19~";break;case 120:l?a.key=je.ESC+"[20;"+(l+1)+"~":a.key=je.ESC+"[20~";break;case 121:l?a.key=je.ESC+"[21;"+(l+1)+"~":a.key=je.ESC+"[21~";break;case 122:l?a.key=je.ESC+"[23;"+(l+1)+"~":a.key=je.ESC+"[23~";break;case 123:l?a.key=je.ESC+"[24;"+(l+1)+"~":a.key=je.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?a.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?a.key=je.NUL:e.keyCode>=51&&e.keyCode<=55?a.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?a.key=je.DEL:e.keyCode===219?a.key=je.ESC:e.keyCode===220?a.key=je.FS:e.keyCode===221&&(a.key=je.GS);else if((!s||i)&&e.altKey&&!e.metaKey){let c=QV[e.keyCode]?.[e.shiftKey?1:0];if(c)a.key=je.ESC+c;else if(e.keyCode>=65&&e.keyCode<=90){let h=e.ctrlKey?e.keyCode-64:e.keyCode+32,f=String.fromCharCode(h);e.shiftKey&&(f=f.toUpperCase()),a.key=je.ESC+f}else if(e.keyCode===32)a.key=je.ESC+(e.ctrlKey?je.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let h=e.code.slice(3,4);e.shiftKey||(h=h.toLowerCase()),a.key=je.ESC+h,a.cancel=!0}}else s&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(a.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?a.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(a.key=je.US),e.key==="@"&&(a.key=je.NUL));break}return a}var _s=0,eW=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new bf,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new bf,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((a,l)=>this._getKey(a)-this._getKey(l)),t=0,s=0,i=new Array(this._array.length+this._insertedValues.length);for(let a=0;a<i.length;a++)s>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[s])?(i[a]=e[t],t++):i[a]=this._array[s++];this._array=i,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(_s=this._search(t),_s===-1)||this._getKey(this._array[_s])!==t)return!1;do if(this._array[_s]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(_s),!0;while(++_s<this._array.length&&this._getKey(this._array[_s])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((a,l)=>a-l),t=0,s=new Array(this._array.length-e.length),i=0;for(let a=0;a<this._array.length;a++)e[t]===a?t++:s[i++]=this._array[a];this._array=s,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(_s=this._search(e),!(_s<0||_s>=this._array.length)&&this._getKey(this._array[_s])===e))do yield this._array[_s];while(++_s<this._array.length&&this._getKey(this._array[_s])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(_s=this._search(e),!(_s<0||_s>=this._array.length)&&this._getKey(this._array[_s])===e))do t(this._array[_s]);while(++_s<this._array.length&&this._getKey(this._array[_s])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,s=this._array.length-1;for(;s>=t;){let i=t+s>>1,a=this._getKey(this._array[i]);if(a>e)s=i-1;else if(a<e)t=i+1;else{for(;i>0&&this._getKey(this._array[i-1])===e;)i--;return i}}return t}},rb=0,Yk=0,tW=class extends gt{constructor(){super(),this._decorations=new eW(e=>e?.marker.line),this._onDecorationRegistered=this._register(new ze),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ze),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(ns(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new sW(e);if(t){let s=t.marker.onDispose(()=>t.dispose()),i=t.onDispose(()=>{i.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),s.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,s){let i=0,a=0;for(let l of this._decorations.getKeyIterator(t))i=l.options.x??0,a=i+(l.options.width??1),e>=i&&e<a&&(!s||(l.options.layer??"bottom")===s)&&(yield l)}forEachDecorationAtCell(e,t,s,i){this._decorations.forEachByKey(t,a=>{rb=a.options.x??0,Yk=rb+(a.options.width??1),e>=rb&&e<Yk&&(!s||(a.options.layer??"bottom")===s)&&i(a)})}},sW=class extends wa{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new ze),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ze),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=os.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=os.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},nW=1e3,iW=class{constructor(e,t=nW){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,s){this._rowCount=s,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let i=performance.now();if(i-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=i,this._innerRefresh();else if(!this._additionalRefreshRequested){let a=i-this._lastRefreshMs,l=this._debounceThresholdMS-a;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},l)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},Xk=20,xf=class extends gt{constructor(e,t,s,i){super(),this._terminal=e,this._coreBrowserService=s,this._renderService=i,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let a=this._coreBrowserService.mainDocument;this._accessibilityContainer=a.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=a.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let l=0;l<this._terminal.rows;l++)this._rowElements[l]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[l]);if(this._topBoundaryFocusListener=l=>this._handleBoundaryFocus(l,0),this._bottomBoundaryFocusListener=l=>this._handleBoundaryFocus(l,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=a.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new iW(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(l=>this._handleResize(l.rows))),this._register(this._terminal.onRender(l=>this._refreshRows(l.start,l.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(l=>this._handleChar(l))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
107
+ `))),this._register(this._terminal.onA11yTab(l=>this._handleTab(l))),this._register(this._terminal.onKey(l=>this._handleKey(l.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(lt(a,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(ns(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<Xk+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
108
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===Xk+1&&(this._liveRegion.textContent+=Nx.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let s=this._terminal.buffer,i=s.lines.length.toString();for(let a=e;a<=t;a++){let l=s.lines.get(s.ydisp+a),c=[],h=l?.translateToString(!0,void 0,void 0,c)||"",f=(s.ydisp+a+1).toString(),d=this._rowElements[a];d&&(h.length===0?(d.textContent=" ",this._rowColumns.set(d,[0,1])):(d.textContent=h,this._rowColumns.set(d,c)),d.setAttribute("aria-posinset",f),d.setAttribute("aria-setsize",i),this._alignRowWidth(d))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let s=e.target,i=this._rowElements[t===0?1:this._rowElements.length-2],a=s.getAttribute("aria-posinset"),l=t===0?"1":`${this._terminal.buffer.lines.length}`;if(a===l||e.relatedTarget!==i)return;let c,h;if(t===0?(c=s,h=this._rowElements.pop(),this._rowContainer.removeChild(h)):(c=this._rowElements.shift(),h=s,this._rowContainer.removeChild(c)),c.removeEventListener("focus",this._topBoundaryFocusListener),h.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let f=this._createAccessibilityTreeNode();this._rowElements.unshift(f),this._rowContainer.insertAdjacentElement("afterbegin",f)}else{let f=this._createAccessibilityTreeNode();this._rowElements.push(f),this._rowContainer.appendChild(f)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},s={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(s.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===s.node&&t.offset>s.offset)&&([t,s]=[s,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let i=this._rowElements.slice(-1)[0];if(s.node.compareDocumentPosition(i)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(s={node:i,offset:i.textContent?.length??0}),!this._rowContainer.contains(s.node))return;let a=({node:h,offset:f})=>{let d=h instanceof Text?h.parentNode:h,p=parseInt(d?.getAttribute("aria-posinset"),10)-1;if(isNaN(p))return console.warn("row is invalid. Race condition?"),null;let g=this._rowColumns.get(d);if(!g)return console.warn("columns is null. Race condition?"),null;let b=f<g.length?g[f]:g.slice(-1)[0]+1;return b>=this._terminal.cols&&(++p,b=0),{row:p,column:b}},l=a(t),c=a(s);if(!(!l||!c)){if(l.row>c.row||l.row===c.row&&l.column>=c.column)throw new Error("invalid range");this._terminal.select(l.column,l.row,(c.row-l.row)*this._terminal.cols-l.column+c.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let t=e.getBoundingClientRect().width,s=this._rowColumns.get(e)?.slice(-1)?.[0];if(!s)return;let i=s*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${i/t})`}};xf=fs([Fe(1,xv),Fe(2,Or),Fe(3,zr)],xf);var a0=class extends gt{constructor(e,t,s,i,a){super(),this._element=e,this._mouseService=t,this._renderService=s,this._bufferService=i,this._linkProviderService=a,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new ze),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ze),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(ns(()=>{mo(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(lt(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(lt(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(lt(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(lt(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let s=e.composedPath();for(let i=0;i<s.length;i++){let a=s[i];if(a.classList.contains("xterm"))break;if(a.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(i=>{i?.forEach(a=>{a.link.dispose&&a.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let s=!1;for(let[i,a]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(i)&&(s=this._checkLinkProviderResult(i,e,s)):a.provideLinks(e.y,l=>{if(this._isMouseOut)return;let c=l?.map(h=>({link:h}));this._activeProviderReplies?.set(i,c),s=this._checkLinkProviderResult(i,e,s),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let s=new Set;for(let i=0;i<t.size;i++){let a=t.get(i);if(a)for(let l=0;l<a.length;l++){let c=a[l],h=c.link.range.start.y<e?0:c.link.range.start.x,f=c.link.range.end.y>e?this._bufferService.cols:c.link.range.end.x;for(let d=h;d<=f;d++){if(s.has(d)){a.splice(l--,1);break}s.add(d)}}}}_checkLinkProviderResult(e,t,s){if(!this._activeProviderReplies)return s;let i=this._activeProviderReplies.get(e),a=!1;for(let l=0;l<e;l++)(!this._activeProviderReplies.has(l)||this._activeProviderReplies.get(l))&&(a=!0);if(!a&&i){let l=i.find(c=>this._linkAtPosition(c.link,t));l&&(s=!0,this._handleNewLink(l))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let l=0;l<this._activeProviderReplies.size;l++){let c=this._activeProviderReplies.get(l)?.find(h=>this._linkAtPosition(h.link,t));if(c){s=!0,this._handleNewLink(c);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&rW(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,mo(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:s=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==s&&(this._currentLink.state.decorations.pointerCursor=s,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",s))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:s=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==s&&(this._currentLink.state.decorations.underline=s,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,s))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(s=>{if(!this._currentLink)return;let i=s.start===0?0:s.start+1+this._bufferService.buffer.ydisp,a=this._bufferService.buffer.ydisp+1+s.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=a&&(this._clearCurrentLink(i,a),this._lastMouseEvent)){let l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._askForLink(l,!1)}})))}_linkHover(e,t,s){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(s,t.text)}_fireUnderlineEvent(e,t){let s=e.range,i=this._bufferService.buffer.ydisp,a=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-i-1,s.end.x,s.end.y-i-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(a)}_linkLeave(e,t,s){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(s,t.text)}_linkAtPosition(e,t){let s=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,a=t.y*this._bufferService.cols+t.x;return s<=a&&a<=i}_positionFromMouseEvent(e,t,s){let i=s.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,s,i,a){return{x1:e,y1:t,x2:s,y2:i,cols:this._bufferService.cols,fg:a}}};a0=fs([Fe(1,vv),Fe(2,zr),Fe(3,xn),Fe(4,i5)],a0);function rW(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var aW=class extends ZV{constructor(e={}){super(e),this._linkifier=this._register(new Sl),this.browser=S5,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Sl),this._onCursorMove=this._register(new ze),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ze),this.onKey=this._onKey.event,this._onRender=this._register(new ze),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ze),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ze),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ze),this.onBell=this._onBell.event,this._onFocus=this._register(new ze),this._onBlur=this._register(new ze),this._onA11yCharEmitter=this._register(new ze),this._onA11yTabEmitter=this._register(new ze),this._onWillOpen=this._register(new ze),this._setup(),this._decorationService=this._instantiationService.createInstance(tW),this._instantiationService.setService(Ru,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(YG),this._instantiationService.setService(i5,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Ex)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh(t?.start??0,t?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(tn.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(tn.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(tn.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(tn.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(ns(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let s,i="";switch(t.index){case 256:s="foreground",i="10";break;case 257:s="background",i="11";break;case 258:s="cursor",i="12";break;default:s="ansi",i="4;"+t.index}switch(t.type){case 0:let a=Qt.toColorRGB(s==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[s]);this.coreService.triggerDataEvent(`${je.ESC}]${i};${GV(a)}${_5.ST}`);break;case 1:if(s==="ansi")this._themeService.modifyColors(l=>l.ansi[t.index]=Ms.toColor(...t.color));else{let l=s;this._themeService.modifyColors(c=>c[l]=Ms.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(xf,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(je.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(je.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let s=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.css.cell.height,a=t.getWidth(s),l=this._renderService.dimensions.css.cell.width*a,c=this.buffer.y*this._renderService.dimensions.css.cell.height,h=s*this._renderService.dimensions.css.cell.width;this.textarea.style.left=h+"px",this.textarea.style.top=c+"px",this.textarea.style.width=l+"px",this.textarea.style.height=i+"px",this.textarea.style.lineHeight=i+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(lt(this.element,"copy",t=>{this.hasSelection()&&uq(t,this._selectionService)}));let e=t=>dq(t,this.textarea,this.coreService,this.optionsService);this._register(lt(this.textarea,"paste",e)),this._register(lt(this.element,"paste",e)),k5?this._register(lt(this.element,"mousedown",t=>{t.button===2&&ak(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(lt(this.element,"contextmenu",t=>{ak(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Ev&&this._register(lt(this.element,"auxclick",t=>{t.button===1&&Y3(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(lt(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(lt(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(lt(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(lt(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(lt(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(lt(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(lt(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(lt(this.screenElement,"mousemove",a=>this.updateCursorStyle(a))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let s=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",kx.get()),E5||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>s.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(WG,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Or,this._coreBrowserService),this._register(lt(this.textarea,"focus",a=>this._handleTextAreaFocus(a))),this._register(lt(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Kx,this._document,this._helperContainer),this._instantiationService.setService(Zf,this._charSizeService),this._themeService=this._instantiationService.createInstance(Qx),this._instantiationService.setService(Tl,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(pf),this._instantiationService.setService(n5,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Xx,this.rows,this.screenElement)),this._instantiationService.setService(zr,this._renderService),this._register(this._renderService.onRenderedViewportChange(a=>this._onRender.fire(a))),this.onResize(a=>this._renderService.resize(a.cols,a.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Gx,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Yx),this._instantiationService.setService(vv,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(a0,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(Fx,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(a=>{super.scrollLines(a,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Zx,this.element,this.screenElement,i)),this._instantiationService.setService(vq,this._selectionService),this._register(this._selectionService.onRequestScrollLines(a=>this.scrollLines(a.amount,a.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(a=>this._renderService.handleSelectionChanged(a.start,a.end,a.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(a=>{this.textarea.value=a,this.textarea.focus(),this.textarea.select()})),this._register(tn.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(qx,this.screenElement)),this._register(lt(this.element,"mousedown",a=>this._selectionService.handleMouseDown(a))),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(xf,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",a=>this._handleScreenReaderModeOptionChange(a))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(mf,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",a=>{!this._overviewRulerRenderer&&a&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(mf,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Wx,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function s(l){let c=e._mouseService.getMouseReportCoords(l,e.screenElement);if(!c)return!1;let h,f;switch(l.overrideType||l.type){case"mousemove":f=32,l.buttons===void 0?(h=3,l.button!==void 0&&(h=l.button<3?l.button:3)):h=l.buttons&1?0:l.buttons&4?1:l.buttons&2?2:3;break;case"mouseup":f=0,h=l.button<3?l.button:3;break;case"mousedown":f=1,h=l.button<3?l.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(l)===!1)return!1;let d=l.deltaY;if(d===0||e.coreMouseService.consumeWheelEvent(l,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;f=d<0?0:1,h=4;break;default:return!1}return f===void 0||h===void 0||h>4?!1:e.coreMouseService.triggerMouseEvent({col:c.col,row:c.row,x:c.x,y:c.y,button:h,action:f,ctrl:l.ctrlKey,alt:l.altKey,shift:l.shiftKey})}let i={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:l=>(s(l),l.buttons||(this._document.removeEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.removeEventListener("mousemove",i.mousedrag)),this.cancel(l)),wheel:l=>(s(l),this.cancel(l,!0)),mousedrag:l=>{l.buttons&&s(l)},mousemove:l=>{l.buttons||s(l)}};this._register(this.coreMouseService.onProtocolChange(l=>{l?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(l)),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()),l&8?i.mousemove||(t.addEventListener("mousemove",a.mousemove),i.mousemove=a.mousemove):(t.removeEventListener("mousemove",i.mousemove),i.mousemove=null),l&16?i.wheel||(t.addEventListener("wheel",a.wheel,{passive:!1}),i.wheel=a.wheel):(t.removeEventListener("wheel",i.wheel),i.wheel=null),l&2?i.mouseup||(i.mouseup=a.mouseup):(this._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),l&4?i.mousedrag||(i.mousedrag=a.mousedrag):(this._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(lt(t,"mousedown",l=>{if(l.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(l)))return s(l),i.mouseup&&this._document.addEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.addEventListener("mousemove",i.mousedrag),this.cancel(l)})),this._register(lt(t,"wheel",l=>{if(!i.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(l)===!1)return!1;if(!this.buffer.hasScrollback){if(l.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(l,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(l,!0);let c=je.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(l.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(c,!0),this.cancel(l,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){K3(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,s){this._selectionService.setSelection(e,t,s)}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(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let s=JV(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),s.type===3||s.type===2){let i=this.rows-1;return this.scrollLines(s.type===2?-i:i),this.cancel(e,!0)}if(s.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(s.cancel&&this.cancel(e,!0),!s.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((s.key===je.ETX||s.key===je.CR)&&(this.textarea.value=""),this._onKey.fire({key:s.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(s.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let s=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?s:s&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(oW(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(As));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(je.ESC+"[I"):this.coreService.triggerDataEvent(je.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),s=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${je.ESC}[4;${s};${t}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),a=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${je.ESC}[6;${a};${i}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function oW(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var lW=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let s={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(s),t.dispose=()=>this._wrappedAddonDispose(s),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let s=0;s<this._addons.length;s++)if(this._addons[s]===e){t=s;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},cW=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new gi)}translateToString(e,t,s){return this._line.translateToString(e,t,s)}},Zk=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new cW(t)}getNullCell(){return new gi}},uW=class extends gt{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ze),this.onBufferChange=this._onBufferChange.event,this._normal=new Zk(this._core.buffers.normal,"normal"),this._alternate=new Zk(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)}},dW=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,s=>t(s.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(s,i)=>t(s,i.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},hW=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},fW=["cols","rows"],Fi=0,mW=class extends gt{constructor(e){super(),this._core=this._register(new aW(e)),this._addonManager=this._register(new lW),this._publicOptions={...this._core.options};let t=i=>this._core.options[i],s=(i,a)=>{this._checkReadonlyOptions(i),this._core.options[i]=a};for(let i in this._core.options){let a={get:t.bind(this,i),set:s.bind(this,i)};Object.defineProperty(this._publicOptions,i,a)}}_checkReadonlyOptions(e){if(fW.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new dW(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new hW(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 uW(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,s){this._verifyIntegers(e,t,s),this._core.select(e,t,s)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
109
+ `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return kx.get()},set promptLabel(e){kx.set(e)},get tooMuchOutput(){return Nx.get()},set tooMuchOutput(e){Nx.set(e)}}}_verifyIntegers(...e){for(Fi of e)if(Fi===1/0||isNaN(Fi)||Fi%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Fi of e)if(Fi&&(Fi===1/0||isNaN(Fi)||Fi%1!==0||Fi<0))throw new Error("This API only accepts positive integers")}};const pW={fontSize:13,cursorStyle:"block",scrollback:5e3,copyOnSelect:!1},ab={state:"connecting",cwd:"Local workspace",detail:"Opening shell"},jv=1;function gW(e){return{focus:e.focus,refit:e.refit,restart:()=>e.sendControl("restart"),stop:()=>e.sendControl("stop")}}function bW(e,t,s){if(!e||e.readyState!==jv)return;const i=t?.proposeDimensions();e.send(JSON.stringify({cols:i?.cols,rows:i?.rows,type:s}))}function xW(e,t){if(!e)return;const s=t.schedule(()=>{t.refit(),t.focus()});return()=>t.cancel(s)}function vW(e){const t=e.location??window.location,s=e.createSocket??(p=>new WebSocket(p));e.reportStatus(e.initialStatus);const i=s(yW(e.sessionId,t));let a=!1,l;const c=[],h=e.scheduleInitialInput??(p=>{const g=window.setTimeout(p,200);return()=>window.clearTimeout(g)}),f=()=>{l?.(),l=h(()=>{l=void 0,(e.claimInitialInput?.()??[]).forEach((g,b)=>{const v=()=>i.send(JSON.stringify({data:g,type:"input"}));if(b===0)v();else{const w=e.scheduleInput??((k,N)=>{const E=window.setTimeout(k,N);return()=>window.clearTimeout(E)});c.push(w(v,b*(e.initialInputIntervalMs??75)))}})})},d=e.terminal.onData(p=>{a||i.readyState===jv&&i.send(JSON.stringify({data:p,type:"input"}))});return i.addEventListener("open",()=>{a||(e.reportStatus(p=>({...p,state:"running",detail:"Shell connected"})),e.sendResize())}),i.addEventListener("message",p=>{if(a)return;const g=_W(p.data);if(g){if(g.type==="output"){e.terminal.write(g.data),f();return}if(g.type==="error"){e.reportStatus(b=>({...b,state:"error",detail:g.error}));return}e.reportStatus(b=>({state:g.state==="idle"?"connecting":g.state,cwd:g.cwd??b.cwd,detail:g.error??g.shell??"Shell connected"}))}}),i.addEventListener("close",()=>{a||e.reportStatus(p=>({...p,state:p.state==="exited"?p.state:"exited",detail:"Socket closed"}))}),i.addEventListener("error",()=>{a||e.reportStatus(p=>({...p,state:"error",detail:"Terminal socket error"}))}),{socket:i,dispose:()=>{a||(a=!0,l?.(),c.forEach(p=>{p()}),d.dispose(),i.close())}}}const B5=y.forwardRef(function({sessionId:t,active:s,claimInitialInput:i,initialInputIntervalMs:a,onStatusChange:l,displaySettings:c=pW},h){const f=y.useRef(null),d=y.useRef(null),p=y.useRef(null),g=y.useRef(null),b=y.useRef(l),v=y.useRef(c),w=y.useRef(ab),k=$s();y.useEffect(()=>{b.current=l},[l]);const N=y.useCallback(A=>{const C=typeof A=="function"?A(w.current):A;w.current=C,b.current?.(C)},[]),E=y.useCallback(()=>{const A=p.current;if(!A)return;A.fit();const C=A.proposeDimensions();if(!C)return;if(k){x7(t,C.cols,C.rows);return}const R=g.current;R?.readyState===jv&&R.send(JSON.stringify({cols:C.cols,rows:C.rows,type:"resize"}))},[k,t]);y.useEffect(()=>{v.current=c;const A=d.current;A&&(A.options.fontSize=c.fontSize,A.options.cursorStyle=c.cursorStyle,A.options.scrollback=c.scrollback,E())},[c.copyOnSelect,c.cursorStyle,c.fontSize,c.scrollback,E]);const T=y.useCallback(A=>{k||bW(g.current,p.current,A)},[k]);return y.useImperativeHandle(h,()=>gW({focus:()=>d.current?.focus(),refit:E,sendControl:T}),[T,E]),y.useEffect(()=>{const A=f.current;if(!A)return;const C=new mW({allowProposedApi:!0,cursorBlink:!0,cursorStyle:v.current.cursorStyle,fontFamily:'"SF Mono", "JetBrains Mono", ui-monospace, Menlo, monospace',fontSize:v.current.fontSize,lineHeight:1.25,scrollback:v.current.scrollback,theme:{background:"#090909",black:"#090909",blue:"#69a7ff",brightBlack:"#5f6368",brightBlue:"#8ab4f8",brightCyan:"#7ddfd7",brightGreen:"#8fdc8a",brightMagenta:"#d7a2ff",brightRed:"#ff8a80",brightWhite:"#ffffff",brightYellow:"#ffd166",cyan:"#62d0c8",foreground:"#f2f2f2",green:"#7ac77f",magenta:"#c792ea",red:"#ff6b6b",selectionBackground:"#ffffff33",white:"#e8eaed",yellow:"#f7c948"}}),R=new rq;C.loadAddon(R),C.open(A),d.current=C,p.current=R;const L=C.onSelectionChange(()=>{if(!v.current.copyOnSelect)return;const D=C.getSelection();if(D)try{navigator.clipboard?.writeText(D).catch(()=>{})}catch{}});let H;if(k){N(ab);let D=null,G=!1,$;const O=C.onData(V=>{Gw(t,V)});y7(t,V=>{C.write(V),$!==void 0&&window.clearTimeout($),$=window.setTimeout(()=>{$=void 0,(async()=>{const K=i?.()??[];for(let I=0;I<K.length;I+=1)I>0&&await new Promise(Y=>window.setTimeout(Y,a??75)),await Gw(t,K[I])})()},200)}).then(V=>{if(G){V();return}D=V,N(K=>({...K,state:"running",detail:"Shell connected"})),b7(t),E()},V=>{G||N(K=>({...K,state:"error",detail:V instanceof Error?V.message:String(V)}))}),H=()=>{G=!0,$!==void 0&&window.clearTimeout($),O.dispose(),D?.()}}else{const D=vW({claimInitialInput:i,initialInputIntervalMs:a,initialStatus:ab,reportStatus:N,sendResize:E,sessionId:t,terminal:C});g.current=D.socket,H=()=>{D.dispose(),g.current=null}}window.addEventListener("resize",E);const B=window.setTimeout(E,0),P=new ResizeObserver(()=>E());return P.observe(A),()=>{window.removeEventListener("resize",E),window.clearTimeout(B),P.disconnect(),H(),L.dispose(),C.dispose(),d.current=null,p.current=null}},[N,t,E,k]),y.useEffect(()=>xW(s,{cancel:A=>window.clearTimeout(A),focus:()=>d.current?.focus(),refit:E,schedule:A=>window.setTimeout(A,0)}),[s,E]),n.jsx("section",{"aria-label":"terminal viewport",className:ae("h-full min-h-0 overflow-hidden bg-[#090909] px-3 py-0.5",!s&&"hidden"),children:n.jsx("div",{className:"h-full w-full",ref:f})})});function yW(e,t){const s=t.protocol==="https:"?"wss:":"ws:",i=encodeURIComponent(e);return`${s}//${t.host}/api/terminal/socket?id=${i}`}function _W(e){if(typeof e!="string")return null;try{const t=JSON.parse(e);return typeof t?.type=="string"?t:null}catch{return null}}const wW=new Set(["c","cpp","cs","go","java","js","jsx","kt","mjs","py","rs","swift","ts","tsx"]),SW=new Set([".env",".gitignore","components.json","dockerfile","package.json","tsconfig.json","vite.config.ts"]),kW=new Set(["conf","config","ini","toml","yaml","yml"]),NW=new Set(["csv","json","sql","xml"]),CW=new Set(["md","mdx","rst","txt"]),EW=new Set(["gif","jpeg","jpg","png","svg","webp"]),jW=new Set(["package-lock.json","pnpm-lock.yaml","yarn.lock"]),AW=new Set(["css","less","sass","scss"]);function TW(e){const t=e.split("/").pop()?.toLowerCase()??e.toLowerCase(),s=t.includes(".")?t.split(".").pop()??"":"";return jW.has(t)||t.endsWith(".lock")?"lock":RW(t)?"test":SW.has(t)||kW.has(s)?"config":AW.has(s)?"style":EW.has(s)?"image":CW.has(s)?"document":NW.has(s)?"data":wW.has(s)?"code":"generic"}function RW(e){return e.includes(".test.")||e.includes(".spec.")||e.endsWith("_test.go")}function Av({path:e,className:t}){const s=TW(e),i=MW[s];return n.jsx(i,{"aria-label":`${s} file`,className:ae("size-3.5 shrink-0",DW[s],t)})}const MW={code:PC,config:z0,data:Qn,document:A0,generic:HC,image:Q6,lock:gM,style:WC,test:C6},DW={code:"text-sky-600",config:"text-zinc-600",data:"text-emerald-700",document:"text-blue-700",generic:"text-muted-foreground",image:"text-fuchsia-700",lock:"text-amber-700",style:"text-rose-700",test:"text-violet-700"};function LW(e){const t=e.lastIndexOf(".");return t>0?e.slice(t):""}function OW({onPick:e,onClose:t}){const[s,i]=y.useState(""),[a,l]=y.useState(null),[c,h]=y.useState(null),[f,d]=y.useState(!1),p=y.useRef(null),g=a?a.parent!==a.path:!1;return y.useEffect(()=>{function b(v){p.current&&!p.current.contains(v.target)&&t()}return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[t]),y.useEffect(()=>{let b=!0;return d(!0),h(null),wE(s,{files:!0}).then(v=>b&&l(v)).catch(v=>b&&h(v instanceof Error?v.message:String(v))).finally(()=>b&&d(!1)),()=>{b=!1}},[s]),n.jsxs("div",{ref:p,className:"absolute bottom-full left-2 z-10 mb-2 w-[22rem] max-w-[calc(100vw-1rem)] overflow-hidden rounded-md border border-border bg-card shadow-lg",children:[n.jsxs("div",{className:"flex items-center gap-1 border-b border-border px-2 py-1.5",children:[n.jsx(Z,{"aria-label":"Parent folder",className:"size-7",disabled:!g,onClick:()=>a&&i(a.parent),size:"icon",type:"button",variant:"ghost",children:n.jsx(Rf,{})}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",title:a?.path,children:a?.path??"…"}),f?n.jsx(Rt,{className:"size-3.5 animate-spin text-muted-foreground"}):null,a?n.jsxs(Z,{className:"h-7 px-2 text-[11px]",onClick:()=>e(a.path),size:"sm",title:"Attach this folder",type:"button",variant:"outline",children:[n.jsx(a6,{})," This folder"]}):null,n.jsx(Z,{"aria-label":"Close",className:"size-7",onClick:t,size:"icon",type:"button",variant:"ghost",children:n.jsx(qt,{})})]}),n.jsx("div",{className:"max-h-64 overflow-auto p-1",children:c?n.jsx(Je,{variant:"destructive",className:"m-1",children:c}):a&&a.entries.length===0?n.jsx(Je,{variant:"muted",className:"m-1 text-center",children:"Empty folder."}):a?.entries.map(b=>{const v=b.isDir?"":LW(b.name);return n.jsxs("button",{className:"flex w-full items-center gap-1.5 rounded-sm px-2 py-1 text-left text-[12px] hover:bg-muted",onClick:()=>b.isDir?i(b.path):e(b.path),title:b.path,type:"button",children:[b.isDir?n.jsx(xo,{className:"size-3.5 shrink-0 text-amber-600"}):n.jsx(Av,{path:b.path}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:b.name}),v?n.jsx("span",{className:"shrink-0 rounded bg-muted px-1 font-mono text-[10px] text-muted-foreground",children:v}):null]},b.path)})})]})}function zW(e,t){const s=t?.trim()||e.split(/\r?\n/).find(i=>i.trim())?.trim()||"Agent task";return s.length>60?`${s.slice(0,57).trimEnd()}…`:s}function BW({onSubmitted:e}){const{activeSource:t,clearSource:s,configured:i,createTask:a,creating:l,draft:c,focusNonce:h,insertPath:f,onboarding:d,provider:p,setDraft:g,setOnboarding:b}=Dt(),[v,w]=y.useState(!1),[k,N]=y.useState(""),E=y.useRef(null);y.useEffect(()=>{const R=requestAnimationFrame(()=>{const L=E.current;if(!L)return;L.focus();const H=L.value.length;L.setSelectionRange(H,H)});return()=>cancelAnimationFrame(R)},[h]),y.useLayoutEffect(()=>{E.current&&(E.current.style.height="auto",E.current.style.height=`${E.current.scrollHeight}px`)},[c]);async function T(R=c,L){!R.trim()||l||i!==!0||!await a({prompt:R,label:zW(R,L??t?.label),source:t??void 0})||(g(""),s(),b(!1),N(""),e?.())}function A(R){R.key==="Enter"&&!R.shiftKey&&(R.preventDefault(),T())}const C=p?.id==="codex"?n.jsx(yo,{className:"size-4"}):n.jsx(ja,{className:"size-4"});return n.jsx("div",{className:"flex h-full items-center justify-center overflow-auto p-6",children:n.jsxs("div",{className:"w-full max-w-3xl",children:[i===null?n.jsxs("div",{className:"mb-3 border-l-2 border-border pl-3 text-xs text-muted-foreground",children:["Checking ",p?.label??"agent"," availability…"]}):null,i===!1?n.jsxs("div",{className:"mb-3 border-l-2 border-amber-500/70 pl-3 text-xs text-muted-foreground",children:[n.jsxs("span",{className:"font-medium text-foreground",children:[p?.label??"Agent"," is not installed."]})," ",p?.installHint]}):null,t?n.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[n.jsx("span",{className:"font-mono uppercase tracking-wide",children:"Source"}),n.jsx("span",{className:"rounded-sm bg-muted px-1.5 py-0.5 text-foreground",children:t.label}),n.jsx("button",{"aria-label":"Clear source",onClick:s,type:"button",children:n.jsx(qt,{className:"size-3"})})]}):null,n.jsxs("div",{className:"border border-border bg-card shadow-sm",children:[d?n.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[n.jsx(lM,{className:"size-4 text-muted-foreground"}),n.jsx("input",{"aria-label":"Repository URL",className:"min-w-0 flex-1 bg-transparent text-sm outline-none",disabled:i!==!0,onChange:R=>N(R.target.value),placeholder:"https://github.com/owner/repository",value:k}),n.jsx(Z,{disabled:i!==!0||!k.trim()||!!l,onClick:()=>{T(zH(k),`Onboard ${k}`)},size:"sm",children:"Onboard"})]}):null,n.jsx("textarea",{"aria-label":"Agent task prompt",className:"block max-h-40 min-h-20 w-full resize-none bg-transparent px-3 py-3 text-sm leading-relaxed outline-none placeholder:text-muted-foreground",disabled:i!==!0,onChange:R=>g(R.target.value),onKeyDown:A,placeholder:"Describe the complete task…",ref:E,rows:2,value:c}),n.jsxs("div",{className:"flex h-10 items-center gap-1 border-t border-border px-2",children:[n.jsxs("span",{className:"flex items-center gap-1.5 px-1 text-xs font-medium",children:[C,p?.label??"Agent"]}),n.jsx("button",{"aria-label":"Attach file or folder",className:"grid size-7 place-items-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>w(R=>!R),type:"button",children:n.jsx(WM,{className:"size-3.5"})}),n.jsx("button",{className:"px-2 text-[11px] text-muted-foreground hover:text-foreground",onClick:()=>b(!d),type:"button",children:"Repository URL"}),n.jsx("span",{className:"flex-1"}),n.jsx("span",{className:"hidden text-[10px] text-muted-foreground sm:inline",children:"Shift+Enter for newline"}),n.jsx(Z,{"aria-label":"Run agent task",className:"size-7",disabled:i!==!0||!c.trim()||!!l,onClick:()=>{T()},size:"icon",children:n.jsx(Af,{})})]})]}),v?n.jsx("div",{className:"relative mt-2",children:n.jsx(OW,{onClose:()=>w(!1),onPick:R=>{f(R),w(!1)}})}):null]})})}function PW(e){return e==="running"?"fill-emerald-500 text-emerald-500":e==="error"?"fill-destructive text-destructive":"fill-muted-foreground/50 text-muted-foreground/50"}function IW({tasks:e,activeTaskId:t,onActivate:s,onClose:i,pendingTaskIds:a}){return n.jsx("div",{"aria-label":"Agent tasks",className:"flex min-w-0 flex-1 items-stretch gap-px overflow-x-auto",role:"tablist",children:e.map(l=>{const c=l.label||`${l.provider==="codex"?"Codex":"Claude"} task`,h=l.id===t;return n.jsxs("div",{className:ae("group/tab flex h-9 shrink-0 items-center border-x border-transparent",h&&"border-border bg-background"),children:[n.jsxs("button",{"aria-controls":`agent-panel-${l.id}`,"aria-label":`Open task ${c}`,"aria-selected":h,className:"flex h-full max-w-56 items-center gap-2 px-3 text-xs",id:`agent-tab-${l.id}`,onClick:()=>s(l.id),role:"tab",type:"button",children:[n.jsx(vl,{"aria-hidden":!0,className:ae("size-2",PW(l.state))}),n.jsx("span",{className:ae("truncate font-mono text-[11px]",h?"text-foreground":"text-muted-foreground"),children:c})]}),n.jsx("button",{"aria-label":`Close task ${c}`,className:"mr-1 grid size-6 place-items-center rounded-sm text-muted-foreground opacity-50 hover:bg-muted hover:text-foreground group-hover/tab:opacity-100 disabled:pointer-events-none disabled:opacity-25",disabled:a?.has(l.id),onClick:()=>i(l.id),type:"button",children:n.jsx(qt,{className:"size-3"})})]},l.id)})})}function $W(e){return[`\x1B[200~${e}\x1B[201~`,"\r"]}function HW(e){return e==="claude"?500:75}function em({className:e}){return n.jsx("svg",{className:ae("size-3.5",e),viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:n.jsx("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})})}const P5="nomoreide-language-choice",UW=[{value:"en",nativeLabel:"English",englishLabel:"English",available:!0},{value:"zh",nativeLabel:"简体中文",englishLabel:"Chinese (Simplified)",available:!1}];function FW(){if(typeof window>"u")return"en";try{const e=window.localStorage.getItem(P5);if(e==="en"||e==="zh")return e}catch{}return"en"}let o0=FW();const l0=new Set;function qW(){return o0}function c0(e){if(e!==o0){o0=e;try{window.localStorage.setItem(P5,e)}catch{}for(const t of l0)t()}}function GW(e){return l0.add(e),()=>l0.delete(e)}function VW(){return[y.useSyncExternalStore(GW,qW,()=>"en"),c0]}const I5="nomoreide-theme-choice",WW="nomoreide:ui-preferences";function KW(){if(typeof window>"u")return"system";try{const e=window.localStorage.getItem(WW),t=e?JSON.parse(e):null;if(t?.version===1&&(t.theme==="light"||t.theme==="dark"||t.theme==="system"))return t.theme}catch{}try{const e=window.localStorage.getItem(I5);if(e==="light"||e==="dark"||e==="system")return e}catch{}return"system"}function Tv(e){return e!=="system"?e:typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function u0(e){if(typeof document>"u")return;const t=document.documentElement;t.classList.toggle("dark",e==="dark"),t.style.colorScheme=e}let go=KW(),ao=Tv(go);const Vh=new Set;let ho=null;function $5(){for(const e of Vh)e()}function vf(){if(ho?.(),ho=null,ao=Tv(go),u0(ao),go!=="system"||typeof window>"u"||typeof window.matchMedia!="function")return;const e=window.matchMedia("(prefers-color-scheme: dark)"),t=s=>{ao=s.matches?"dark":"light",u0(ao),$5()};e.addEventListener("change",t),ho=()=>e.removeEventListener("change",t)}vf();function YW(){return go}function XW(){return ao}function d0(e){if(!(e!==go)){e==="system"&&!ho?vf():(ao=Tv(e),u0(ao));return}go=e,vf();try{window.localStorage.setItem(I5,e)}catch{}$5()}function H5(e){return Vh.add(e),go==="system"&&!ho&&vf(),()=>{Vh.delete(e),Vh.size===0&&(ho?.(),ho=null)}}function U5(){return[y.useSyncExternalStore(H5,YW,()=>"system"),d0]}function ZW(){return y.useSyncExternalStore(H5,XW,()=>"dark")}const F5="nomoreide:ui-preferences";function QW(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function q5(){return{version:1,theme:"system",language:"en",density:"comfortable",codeFontSize:12,reducedMotion:QW(),sidebarDocked:!1,projectScope:"all"}}function JW(){if(typeof window>"u")return{};const e=ul("nomoreide-theme-choice"),t=ul("nomoreide-language")??ul("nomoreide-language-choice"),s=ul("nomoreide:sidebar-docked"),i=ul("nomoreide:project-scope");return{...e==="light"||e==="dark"||e==="system"?{theme:e}:{},...t==="en"||t==="zh"?{language:t}:{},...s==="true"||s==="false"?{sidebarDocked:s==="true"}:{},...i==="all"||i==="project"?{projectScope:i}:{}}}function ul(e){try{return window.localStorage.getItem(e)}catch{return null}}function tm(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return t.version!==1||!["light","dark","system"].includes(String(t.theme))||!["en","zh"].includes(String(t.language))||!["comfortable","compact"].includes(String(t.density))||typeof t.codeFontSize!="number"||!Number.isInteger(t.codeFontSize)||t.codeFontSize<10||t.codeFontSize>18||typeof t.reducedMotion!="boolean"||typeof t.sidebarDocked!="boolean"||!["all","project"].includes(String(t.projectScope))?null:t}function eK(e,t){return tm({...e,...t})}function au(e){const t=tm(e);if(!t)return!1;try{return window.localStorage.setItem(F5,JSON.stringify(t)),!0}catch{return!1}}function tK(){let e=null;try{const s=ul(F5);e=s?tm(JSON.parse(s)):null}catch{e=null}const t=e??{...q5(),...JW()};return au(t),t}function sK(){const e=q5();return au(e),e}function Qk(e){if(typeof document>"u")return;const t=document.documentElement;t.dataset.density=e.density,t.dataset.reducedMotion=String(e.reducedMotion),t.style.setProperty("--code-font-size",`${e.codeFontSize}px`)}const Jk={version:1,terminal:{fontSize:13,cursorStyle:"block",scrollback:5e3,copyOnSelect:!1,confirmTerminate:!0}},_h={logs:{showTimestamps:!0,wrapLines:!0},database:{confirmWrites:!0,resultLimit:100}},G5=y.createContext(null);function pa(e){return e instanceof Error?e.message:String(e)}function nK(e,t){return{...e,terminal:{...e.terminal,...t.terminal}}}function iK(e,t){return{...e,logs:{...e.logs,...t.logs},database:{...e.database,...t.database}}}function rK({children:e}){const[t,s]=y.useState(Jk),[i,a]=y.useState(Jk),[l,c]=y.useState(_h),[h,f]=y.useState(_h),[d,p]=y.useState(()=>tK()),[g,b]=y.useState(!0),[v,w]=y.useState(null),[k,N]=y.useState(!1),[E,T]=y.useState(null),[A,C]=y.useState(null),[R,L]=y.useState("idle"),[H,B]=y.useState(null),[P]=U5(),[D]=VW(),G=y.useRef(!0),$=y.useRef(!1),O=y.useRef(0),V=y.useRef(0),K=y.useRef(0),I=y.useRef(0),Y=y.useRef(Promise.resolve()),W=y.useRef(Promise.resolve()),le=y.useRef(t),J=y.useRef(l),U=y.useRef(null),F=y.useRef(null),re=y.useRef(d),fe=y.useRef(i),se=y.useRef(h),te=y.useRef(null),ye=y.useRef(0),Ee=y.useRef(null),De=y.useRef(null),Ye=y.useRef(!1),we=y.useRef(null),He=y.useRef(d.language),$e=y.useCallback(()=>{te.current!==null&&(window.clearTimeout(te.current),te.current=null)},[]),St=y.useCallback(()=>{$e(),L("saved"),te.current=window.setTimeout(()=>{G.current&&L("idle")},1500)},[$e]),Gt=y.useCallback(()=>{$e(),ye.current===0&&(Ee.current=null,B(null)),ye.current+=1,L("saving")},[$e]),At=y.useCallback(et=>{if(et&&!Ee.current&&(Ee.current=et),ye.current=Math.max(0,ye.current-1),ye.current>0){L("saving"),Ee.current&&B(Ee.current);return}if(Ee.current){B(Ee.current),L("error");return}St()},[St]),Ln=y.useCallback(et=>{if(U.current===et)return F.current??Promise.resolve();const tt=++V.current;if(++I.current,U.current=et,w(et),C(null),J.current=structuredClone(_h),se.current=structuredClone(_h),c(J.current),f(se.current),et===null)return N(!1),F.current=null,Promise.resolve();N(!0);const S=W.current.then(()=>kg(et)).then(ee=>{!G.current||tt!==V.current||U.current!==et||(J.current=ee.project,se.current=ee.project,c(ee.project),f(ee.project))}).catch(ee=>{G.current&&tt===V.current&&U.current===et&&C(`Could not load project settings: ${pa(ee)}`)}).finally(()=>{G.current&&tt===V.current&&U.current===et&&(N(!1),F.current=null)});return F.current=S,S},[]),_n=y.useCallback(async()=>{const et=U.current;if(!et)return;const tt=++V.current;++I.current;const Ct=W.current;N(!0),C(null);const S=Ct.then(()=>kg(et)).then(ee=>{!G.current||tt!==V.current||U.current!==et||(J.current=ee.project,se.current=ee.project,c(ee.project),f(ee.project))}).catch(ee=>{G.current&&tt===V.current&&U.current===et&&C(`Could not load project settings: ${pa(ee)}`)}).finally(()=>{G.current&&tt===V.current&&U.current===et&&(N(!1),F.current=null)});return F.current=S,S},[]),ms=y.useCallback(async()=>{const et=++O.current,tt=U.current,Ct=tt?++V.current:V.current,S=K.current,ee=I.current,ge=Y.current,_e=W.current;b(!0),tt&&N(!0),T(null),tt&&C(null);try{await Promise.all([ge,_e]);const oe=await kg(tt??void 0);if(!G.current||et!==O.current)return;S===K.current&&(le.current=oe.global,fe.current=oe.global,s(oe.global),a(oe.global)),ee===I.current&&tt===U.current&&Ct===V.current&&(J.current=oe.project,se.current=oe.project,c(oe.project),f(oe.project))}catch(oe){const Re=tt===null||tt===U.current&&Ct===V.current;G.current&&et===O.current&&Re&&(tt?C(`Could not load project settings: ${pa(oe)}`):T(pa(oe)))}finally{G.current&&et===O.current&&(b(!1),tt===U.current&&N(!1))}},[]);y.useEffect(()=>(G.current=!0,$.current||($.current=!0,ms()),De.current=window.setTimeout(()=>{Ye.current=!0},0),()=>{G.current=!1,$e(),De.current!==null&&(window.clearTimeout(De.current),De.current=null)}),[$e,ms]);const Hs=y.useCallback(et=>{const tt=tm(et);return tt?(au(tt),re.current=tt,Qk(tt),p(tt),we.current=tt.theme,d0(tt.theme),He.current=tt.language,c0(tt.language),!0):!1},[]);y.useEffect(()=>{Qk(d),we.current=d.theme,d0(d.theme),He.current=d.language,c0(d.language)},[]),y.useEffect(()=>{if(Ye.current&&we.current!==null&&P!==we.current){const et={...d,theme:P};re.current=et,au(et),p(et),we.current=P}},[P,d]),y.useEffect(()=>{if(Ye.current&&D!==He.current){const et={...d,language:D};re.current=et,au(et),p(et),He.current=D}},[D,d]);const un=y.useCallback(et=>{const tt=eK(re.current,et);return tt?Hs(tt):!1},[Hs]),ei=y.useCallback(()=>{Hs(sK())},[Hs]),On=y.useCallback(async et=>{const tt=++K.current,Ct=nK(le.current,et);le.current=Ct,s(Ct),Gt();const S=Y.current.then(()=>AO(et));Y.current=S.then(()=>{},()=>{});try{const ee=await S;if(!G.current)return;fe.current=ee,a(ee),tt===K.current&&(le.current=ee,s(ee)),At()}catch(ee){if(!G.current)return;tt===K.current&&(le.current=fe.current,s(fe.current)),At(`Could not save global settings: ${pa(ee)}`)}},[Gt,At]),Lt=y.useCallback(async et=>{const tt=U.current;if(!tt){B("Select a project before changing project settings."),L("error");return}const Ct=++I.current,S=iK(J.current,et);J.current=S,c(S),Gt();const ee=W.current.then(()=>TO(tt,et));W.current=ee.then(()=>{},()=>{});try{const ge=await ee;if(!G.current)return;tt===U.current&&(se.current=ge,f(ge),Ct===I.current&&(J.current=ge,c(ge))),At()}catch(ge){if(!G.current)return;tt===U.current&&Ct===I.current&&(J.current=se.current,c(se.current)),At(`Could not save project settings: ${pa(ge)}`)}},[Gt,At]),ps=y.useCallback(async()=>{const et=++K.current;Gt();const tt=Y.current.then(RO);Y.current=tt.then(()=>{},()=>{});try{const Ct=await tt;if(!G.current)return;fe.current=Ct,a(Ct),et===K.current&&(le.current=Ct,s(Ct)),At()}catch(Ct){if(!G.current)return;At(`Could not reset global settings: ${pa(Ct)}`)}},[Gt,At]),is=y.useCallback(async()=>{const et=U.current;if(!et){B("Select a project before resetting project settings."),L("error");return}const tt=++I.current;Gt();const Ct=W.current.then(()=>MO(et));W.current=Ct.then(()=>{},()=>{});try{const S=await Ct;if(!G.current)return;et===U.current&&(se.current=S,f(S),tt===I.current&&(J.current=S,c(S))),At()}catch(S){if(!G.current)return;At(`Could not reset project settings: ${pa(S)}`)}},[Gt,At]);return n.jsx(G5.Provider,{value:{loading:g,loadError:E,retry:ms,activeProjectPath:v,projectLoading:k,projectLoadError:A,selectProject:Ln,retryProject:_n,saveState:R,saveError:H,global:t,confirmedGlobal:i,project:l,confirmedProject:h,ui:d,updateGlobal:On,updateProject:Lt,updateUi:un,resetGlobal:ps,resetProject:is,resetUi:ei},children:e})}function sm(){const e=nm();if(!e)throw new Error("useSettings must be used within SettingsProvider");return e}function nm(){return y.useContext(G5)}const aK=[{page:"services",label:"Services",icon:n.jsx(Bf,{})},{page:"git",label:"Git Review",icon:n.jsx(Mn,{})},{page:"github",label:"GitHub",icon:n.jsx(em,{})},{page:"workflows",label:"Workflows",icon:n.jsx(Xh,{})},{page:"errors",label:"Error Inbox",icon:n.jsx(uu,{})},{page:"database",label:"Database",icon:n.jsx(Qn,{})},{page:"terminal",label:"Terminal",icon:n.jsx(_u,{})},{page:"agent",label:"Agent",icon:n.jsx(C0,{})},{page:"agent-env",label:"Agent Env",icon:n.jsx(O0,{})}];function oK(e,t){const s=Math.max(0,t-48),i=Math.min(180,s);return Math.max(i,Math.min(s,e))}function lK(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function cK({currentPage:e="services",git:t,onGitRefresh:s,onNavigate:i}){const a=nm(),{activeTaskId:l,claimInitialPrompt:c,closeTask:h,draft:f,focusNonce:d,onboarding:p,open:g,pendingTaskIds:b,provider:v,providers:w,selectProvider:k,setActiveTaskId:N,setOpen:E,stopTask:T,tasks:A,terminalError:C,updateTaskStatus:R}=Dt(),[L,H]=y.useState(()=>!!(f||d||p||A.length===0)),[B,P]=y.useState(null),[D,G]=y.useState(!1),[$,O]=y.useState(!1),V=y.useRef(null),K=y.useRef(d),I=y.useRef(p),Y=y.useRef(A.length),W=A.find(se=>se.id===l)??null;y.useEffect(()=>{A.length===0?H(!0):Y.current===0&&!f&&H(!1),Y.current=A.length},[f,A.length]),y.useEffect(()=>{d!==K.current&&H(!0),K.current=d},[d]),y.useEffect(()=>{p&&!I.current&&H(!0),I.current=p},[p]),y.useEffect(()=>()=>V.current?.(),[]),y.useEffect(()=>{if(!$)return;const se=te=>{te.key==="Escape"&&O(!1)};return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[$]),y.useEffect(()=>{g||O(!1)},[g]);const le=()=>{O(!1),E(!1)},J=se=>{i?.(se),le()};function U(se){se.preventDefault(),se.currentTarget.setPointerCapture?.(se.pointerId),G(!0);const te=De=>P(oK(window.innerHeight-De.clientY,window.innerHeight)),ye=()=>{window.removeEventListener("pointermove",te),window.removeEventListener("pointerup",Ee),V.current=null},Ee=()=>{G(!1),ye()};V.current?.(),V.current=ye,window.addEventListener("pointermove",te),window.addEventListener("pointerup",Ee)}const re=(W?.provider??v?.id)==="codex"?yo:ja,fe=W?W.provider==="codex"?"Codex":"Claude Code":v?.label??"Agent";return n.jsxs(n.Fragment,{children:[g?null:n.jsxs("button",{"aria-label":"Open agent terminal",className:"fixed inset-x-0 bottom-0 z-50 flex h-9 w-full items-center gap-2 border-t border-border bg-card/95 px-3 text-left shadow-[0_-4px_18px_-14px_rgba(0,0,0,.45)] backdrop-blur",onClick:()=>E(!0),type:"button",children:[n.jsx(re,{className:"size-3.5 text-primary"}),n.jsx("span",{className:"text-xs font-medium",children:fe}),n.jsx("span",{className:"h-3 w-px bg-border"}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",children:W?.label??"New agent task"}),W?n.jsxs("span",{className:ae("font-mono text-[10px] text-muted-foreground",W.state==="running"&&"text-emerald-600",W.state==="error"&&"text-destructive"),children:[n.jsx("span",{className:"sr-only",children:"Active task status: "}),lK(W.state)]}):null,A.length>1?n.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:A.length}):null,n.jsx(Rf,{className:"size-3.5 text-muted-foreground"})]}),n.jsxs("div",{"aria-hidden":!g||void 0,className:ae("fixed inset-x-0 bottom-0 z-50 flex flex-col overflow-hidden border-t border-border bg-card shadow-[0_-12px_30px_-20px_rgba(0,0,0,.5)]",!$&&(D||"transition-[height] duration-150"),!g&&"invisible pointer-events-none border-transparent shadow-none"),inert:!g||void 0,style:$?{height:"auto",top:$s()?32:0}:{height:g?B??"50vh":0},children:[$?n.jsx("nav",{"aria-label":"Full-screen navigation",className:"flex h-11 shrink-0 items-center gap-1 overflow-x-auto border-b border-border bg-background px-2",children:aK.map(se=>n.jsxs("button",{"aria-current":e===se.page?"page":void 0,"aria-label":se.label,className:ae("flex h-8 shrink-0 items-center gap-2 rounded-md px-3 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground [&_svg]:size-4",e===se.page&&"bg-primary text-primary-foreground hover:bg-primary/90 hover:text-primary-foreground"),onClick:()=>J(se.page),type:"button",children:[se.icon,n.jsx("span",{children:se.label})]},se.page))}):null,n.jsx("div",{"aria-hidden":!0,className:ae("absolute inset-x-0 -top-1 z-20 h-2 cursor-ns-resize",$&&"hidden"),"data-agent-resize-grip":!0,onDoubleClick:()=>P(null),onPointerDown:U}),n.jsxs("div",{className:"flex h-9 shrink-0 items-stretch border-b border-border bg-muted/25",children:[n.jsx("select",{"aria-label":"Agent provider",className:"h-9 max-w-36 border-r border-border bg-transparent px-2 text-xs font-medium outline-none",disabled:w.length<2,onChange:se=>{k(se.target.value)},value:v?.id??"claude",children:w.map(se=>n.jsxs("option",{disabled:!se.configured,title:se.configured?void 0:se.installHint,value:se.id,children:[se.label,se.configured?"":" · not installed"]},se.id))}),n.jsx(IW,{activeTaskId:l,onActivate:se=>{N(se),H(!1)},onClose:se=>{h(se)},pendingTaskIds:b,tasks:A}),n.jsxs("div",{className:"flex shrink-0 items-center border-l border-border px-1",children:[n.jsx("button",{"aria-label":"New agent task",className:"grid size-7 place-items-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>H(!0),type:"button",children:n.jsx(ws,{className:"size-3.5"})}),W?.state==="running"?n.jsx("button",{"aria-label":`Stop task ${W.label??"Agent task"}`,className:"grid size-7 place-items-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-35",disabled:b.has(W.id),onClick:()=>{T(W.id)},type:"button",children:n.jsx(fo,{className:"size-3"})}):null,n.jsx("button",{"aria-label":$?"Restore terminal dock":"Enter full-screen terminal",className:"grid size-7 place-items-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>O(se=>!se),type:"button",children:$?n.jsx(L0,{className:"size-3.5"}):n.jsx(D0,{className:"size-3.5"})}),n.jsx("button",{"aria-label":"Collapse agent terminal",className:"grid size-7 place-items-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground",onClick:le,type:"button",children:n.jsx(Jn,{className:"size-3.5"})})]})]}),C?n.jsx("div",{role:"alert",className:"border-b border-destructive/30 bg-destructive/5 px-3 py-1 font-mono text-[11px] text-destructive",children:C}):null,t&&(L||A.length===0)?n.jsx("div",{className:"shrink-0 px-3 pt-2",children:n.jsx(tq,{git:t,onRefresh:s})}):null,n.jsxs("div",{className:"relative min-h-0 flex-1 bg-[#101214]",children:[A.map(se=>n.jsx("div",{"aria-labelledby":`agent-tab-${se.id}`,className:ae("absolute inset-0",(!g||L||se.id!==l)&&"invisible pointer-events-none"),id:`agent-panel-${se.id}`,role:"tabpanel",children:n.jsx(B5,{active:g&&!L&&se.id===l,claimInitialInput:()=>{const te=c(se.id);return te?$W(te):void 0},displaySettings:a?.confirmedGlobal.terminal,initialInputIntervalMs:HW(se.provider??"claude"),onStatusChange:te=>R(se.id,{state:te.state==="connecting"?"idle":te.state,cwd:te.cwd,error:te.state==="error"?te.detail:void 0}),sessionId:se.id})},se.id)),g&&(L||A.length===0)?n.jsx("div",{className:"absolute inset-0 bg-background",children:n.jsx(BW,{onSubmitted:()=>H(!1)})}):null]})]})]})}function gl(e,t){const s=`nomoreide:${e}`,[i,a]=y.useState(()=>{try{const c=window.localStorage.getItem(s);return c===null?t:JSON.parse(c)}catch{return t}}),l=y.useCallback(c=>{a(c);try{window.localStorage.setItem(s,JSON.stringify(c))}catch{}},[s]);return[i,l]}function im(e,t){if(!e)return!1;const s=t.endsWith("/")?t.slice(0,-1):t;return e===s||e.startsWith(`${s}/`)}function uK(e,t){return!t||!e?!0:im(e,t)}function dK(e,t){const s=e.config.services.filter(h=>im(h.cwd,t.path)),i=new Set(s.map(h=>h.name)),a=e.config.bundles.map(h=>({...h,services:h.services.filter(f=>i.has(f))})).filter(h=>h.services.length>0),l=Object.fromEntries(Object.entries(e.runtime.services).filter(([h])=>i.has(h))),c=Object.fromEntries(Object.entries(e.health).filter(([h])=>i.has(h)));return{...e,config:{...e.config,services:s,bundles:a},runtime:{services:l},health:c,ports:e.ports.filter(h=>h.services.some(f=>i.has(f))),logs:e.logs.filter(h=>i.has(h.service)),timeline:e.timeline.filter(h=>!h.service||i.has(h.service))}}const ob={host:"",port:"",user:"",password:"",database:"",ssl:!1},hK="localhost";function h0(e,t,{includePassword:s=!0}={}){const i=e==="mysql"?"mysql":"postgres",a=t.host.trim()||hK,l=t.port.trim(),c=t.database.trim().replace(/^\//,""),h=t.user.trim(),f=s&&t.password,d=h?`${encodeURIComponent(h)}${f?`:${encodeURIComponent(t.password)}`:""}@`:"",p=l?`:${l}`:"",g=e==="postgres"&&t.ssl?"?sslmode=require":"";return`${i}://${d}${a}${p}/${c}${g}`}function f0(e){if(!e.trim())return null;let t;try{t=new URL(e.trim())}catch{return null}return{host:t.hostname,port:t.port,user:eN(t.username),password:eN(t.password),database:t.pathname.replace(/^\//,""),ssl:t.searchParams.get("sslmode")==="require"||t.searchParams.has("ssl")}}function fK(e){const t=/^([a-z0-9+]+):\/\//i.exec(e.trim());if(!t)return null;const s=t[1].toLowerCase();return s.startsWith("postgres")?"postgres":s.startsWith("mysql")?"mysql":s.startsWith("sqlite")||s==="file"?"sqlite":null}function eN(e){try{return decodeURIComponent(e)}catch{return e}}const mK=[{value:"postgres",label:"Postgres"},{value:"mysql",label:"MySQL"},{value:"sqlite",label:"SQLite"}];function pK({onClose:e,onSaved:t,initial:s,projects:i=[]}){const{error:a,success:l}=hs(),c=!!s,h=y.useMemo(()=>gK(s),[s]),[f,d]=y.useState(h.engine),[p,g]=y.useState(h.name),[b,v]=y.useState(h.url),[w,k]=y.useState(h.fields),[N,E]=y.useState([]),[T,A]=y.useState(s?.projectPath??""),[C,R]=y.useState({status:"idle"}),[L,H]=y.useState(!1),[B,P]=y.useState(!1);y.useEffect(()=>{c||cL().then(E).catch(()=>E([]))},[c]);const D=f==="sqlite",G=D?b.trim():h0(f,w),$=D?!!b.trim():!!(w.host.trim()&&w.database.trim());function O(){R({status:"idle"})}function V(F,re){return h0(F,re,{includePassword:!1})}function K(F){d(F),O(),F!=="sqlite"&&v(V(F,w))}function I(F){const re={...w,...F};k(re),v(V(f,re)),O()}function Y(F){O();const re=fK(F),fe=re??f;re&&re!==f&&d(re);const se=re==="sqlite"?null:f0(F);if(!se){v(F);return}se.password?(k(se),v(V(fe,se))):(k({...se,password:w.password}),v(F))}function W(F){d(F.engine);const re=F.engine==="sqlite"?null:f0(F.url);re?(k(re),v(V(F.engine,re))):v(F.url),O(),p.trim()||g(bK(F));const fe=F.cwd?i.find(se=>im(F.cwd,se.path)):void 0;fe&&A(fe.path)}function le(){return p.trim()?D?b.trim()?null:"Database file path is required.":w.host.trim()?w.database.trim()?null:"Database name is required.":"Host is required.":"Name is required."}async function J(){if($){H(!0),O();try{const F=await dL({engine:f,url:G});R(F.ok?{status:"ok",message:"Connected"}:{status:"fail",message:F.error??"Connection failed"})}catch(F){R({status:"fail",message:F instanceof Error?F.message:String(F)})}finally{H(!1)}}}async function U(){const F=le();if(F){a(F);return}P(!0);try{await uL({name:p.trim(),engine:f,url:G,projectPath:T}),l(`Saved connection "${p.trim()}".`),t(),e()}catch(re){a(re instanceof Error?re.message:String(re))}finally{P(!1)}}return n.jsx(Zn,{icon:n.jsx(Qn,{}),onClose:e,title:c?"Edit database connection":"Add database connection",children:n.jsxs("div",{className:"flex flex-col gap-4",children:[N.length>0?n.jsxs("section",{children:[n.jsxs("p",{className:"mb-1.5 flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[n.jsx(O8,{className:"size-3.5"}),"Found in your services"]}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:N.map(F=>n.jsxs("button",{type:"button",onClick:()=>W(F),className:"group flex items-center gap-1.5 rounded-md border border-border bg-background px-2 py-1 text-left text-xs transition-colors hover:border-primary hover:bg-muted",title:F.maskedUrl,children:[n.jsx(We,{variant:"outline",size:"small",children:F.engine}),n.jsx("span",{className:"font-mono",children:F.service}),n.jsxs("span",{className:"font-mono text-muted-foreground",children:["·",F.key]})]},`${F.service}:${F.key}`))})]}):null,n.jsxs("section",{children:[n.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Engine"}),n.jsx("div",{className:"flex gap-1.5",children:mK.map(F=>n.jsx(Z,{size:"sm",variant:f===F.value?"default":"outline",onClick:()=>K(F.value),disabled:c,type:"button",children:F.label},F.value))})]}),n.jsxs("label",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Name"}),n.jsx(ft,{value:p,onChange:F=>g(F.target.value),placeholder:"e.g. shop-db",disabled:c}),c?n.jsx("span",{className:"text-[11px] text-muted-foreground",children:"The name identifies the connection and can't be changed here."}):null]}),i.length>0?n.jsxs("label",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Project"}),n.jsxs("select",{className:"h-9 rounded-md border border-border bg-background px-2 text-sm",onChange:F=>A(F.target.value),value:T,children:[n.jsx("option",{value:"",children:"No project (shared)"}),T&&!i.some(F=>F.path===T)?n.jsx("option",{value:T,children:T}):null,i.map(F=>n.jsx("option",{value:F.path,children:F.name},F.path))]}),n.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Classifies the connection under a project; shared connections show in every project scope."})]}):null,D?null:n.jsxs("section",{className:"flex flex-col gap-3",children:[n.jsxs("div",{className:"flex gap-3",children:[n.jsxs("label",{className:"flex flex-1 flex-col gap-1.5",children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Host"}),n.jsx(ft,{value:w.host,onChange:F=>I({host:F.target.value}),placeholder:"localhost",className:"font-mono text-xs"})]}),n.jsxs("label",{className:"flex w-24 flex-col gap-1.5",children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Port"}),n.jsx(ft,{value:w.port,onChange:F=>I({port:F.target.value}),placeholder:f==="mysql"?"3306":"5432",className:"font-mono text-xs"})]})]}),n.jsxs("div",{className:"flex gap-3",children:[n.jsxs("label",{className:"flex flex-1 flex-col gap-1.5",children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"User"}),n.jsx(ft,{value:w.user,onChange:F=>I({user:F.target.value}),placeholder:"postgres",className:"font-mono text-xs"})]}),n.jsxs("label",{className:"flex flex-1 flex-col gap-1.5",children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Password"}),n.jsx(ft,{type:"password",value:w.password,onChange:F=>I({password:F.target.value}),placeholder:c?"leave blank to keep current":"••••••••",className:"font-mono text-xs"})]})]}),n.jsxs("label",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Database"}),n.jsx(ft,{value:w.database,onChange:F=>I({database:F.target.value}),placeholder:"app",className:"font-mono text-xs"})]}),f==="postgres"?n.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[n.jsx("input",{type:"checkbox",checked:w.ssl,onChange:F=>I({ssl:F.target.checked}),className:"size-3.5 accent-primary"}),"Require SSL (adds ",n.jsx("span",{className:"font-mono",children:"?sslmode=require"}),")"]}):null]}),n.jsxs("label",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:D?"Database file path":"Connection URL"}),n.jsx(ft,{value:b,onChange:F=>Y(F.target.value),placeholder:D?"/abs/path/to/app.db":f==="mysql"?"mysql://user:pass@host:3306/db":"postgres://user:pass@host:5432/db",className:"font-mono text-xs"}),n.jsx("span",{className:"text-[11px] text-muted-foreground",children:D?"Read-only. Stored like a secret and masked in the UI and API.":"Synced with the fields above; the password stays in its field and is never shown here. Stored like a secret and masked in the UI and API."})]}),C.status!=="idle"?n.jsxs("div",{className:`flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-xs ${C.status==="ok"?"border-emerald-500/40 text-emerald-600 dark:text-emerald-400":"border-destructive/40 text-destructive"}`,children:[C.status==="ok"?n.jsx(Ws,{className:"size-3.5"}):n.jsx(qt,{className:"size-3.5"}),n.jsx("span",{className:"break-all font-mono",children:C.message})]}):null,n.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-3",children:[n.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>{J()},disabled:L||!$,type:"button",children:[L?n.jsx(Rt,{className:"animate-spin"}):null,"Test connection"]}),n.jsxs(Z,{size:"sm",onClick:()=>{U()},disabled:B,type:"button",children:[B?n.jsx(Rt,{className:"animate-spin"}):null,c?"Save changes":"Save"]})]})]})})}function gK(e){if(!e)return{engine:"postgres",name:"",fields:ob,url:""};if(e.engine==="sqlite")return{engine:"sqlite",name:e.name,fields:ob,url:e.url};const t=f0(e.url),s=t?{...t,password:""}:ob;return{engine:e.engine,name:e.name,fields:s,url:h0(e.engine,s,{includePassword:!1})}}function bK(e){try{const s=new URL(e.url).pathname.replace(/^\//,"");if(s)return`${e.service}-${s}`}catch{}return`${e.service}-${e.engine}`}function xK({connections:e,projectLabel:t,selected:s,onSelect:i,onAdd:a,onEdit:l,onRemove:c}){const[h,f]=y.useState(!1),d=y.useRef(null),p=e.find(g=>g.name===s);return y.useEffect(()=>{if(!h)return;function g(b){d.current&&b.target instanceof Node&&!d.current.contains(b.target)&&f(!1)}return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[h]),n.jsxs("div",{className:"relative z-50 flex items-center gap-2",ref:d,children:[n.jsxs(Z,{className:"max-w-[240px] justify-start gap-2 rounded-md border-border bg-card",onClick:()=>f(g=>!g),size:"sm",type:"button",variant:"outline",children:[n.jsx(Qn,{className:"text-muted-foreground"}),n.jsx("span",{className:"truncate",children:p?.name??"Select connection"}),p?n.jsx(We,{variant:"outline",size:"small",children:p.engine}):null,n.jsx(Jn,{className:ae("ml-auto transition-transform",h&&"rotate-180")})]}),h?n.jsxs("div",{className:"absolute right-0 top-10 z-50 w-[min(420px,calc(100vw-2rem))] overflow-hidden rounded-lg border border-border bg-card shadow-lg",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[n.jsx(Qn,{className:"size-3.5 text-muted-foreground"}),n.jsx("div",{className:"text-xs font-semibold",children:"Connections"}),n.jsx(We,{className:"ml-auto",variant:"outline",size:"small",children:e.length})]}),n.jsx("div",{className:"max-h-72 overflow-auto",children:e.length?n.jsx("div",{className:"divide-y divide-border",children:e.map(g=>{const b=g.name===s;return n.jsxs("div",{className:ae("group grid w-full grid-cols-[1fr_auto_auto_auto] items-center gap-2 px-3 py-1.5 text-left transition-colors hover:bg-muted",b&&"bg-muted/70"),children:[n.jsxs("button",{className:"min-w-0 text-left",onClick:()=>{i(g.name),f(!1)},type:"button",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"truncate text-sm font-medium leading-tight",children:g.name}),t?n.jsx(We,{className:"shrink-0",size:"small",variant:"outline",children:t(g)??"unassigned"}):null]}),n.jsx("span",{className:"block truncate font-mono text-[10px] leading-tight text-muted-foreground",children:g.url})]}),b?n.jsx(Ws,{className:"size-3.5"}):n.jsx("span",{className:"size-3.5"}),n.jsx(Z,{"aria-label":`Edit ${g.name}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>{l(g),f(!1)},size:"icon",title:`Edit ${g.name}`,type:"button",variant:"ghost",children:n.jsx(yl,{className:"size-3.5"})}),n.jsx(Z,{"aria-label":`Remove ${g.name}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>c(g.name),size:"icon",title:`Remove ${g.name}`,type:"button",variant:"ghost",children:n.jsx(Oi,{className:"size-3.5 text-destructive"})})]},g.name)})}):n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No saved connections yet."})}),n.jsx("div",{className:"border-t border-border bg-muted/20 p-2",children:n.jsxs(Z,{className:"w-full",onClick:()=>{a(),f(!1)},size:"sm",type:"button",children:[n.jsx(ws,{className:"size-3"}),"Add connection"]})})]}):null]})}function vK({onAddManual:e,onAddWithAi:t}){const[s,i]=y.useState(!1),a=y.useRef(null);y.useEffect(()=>{if(!s)return;function c(h){a.current&&h.target instanceof Node&&!a.current.contains(h.target)&&i(!1)}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);function l(c){i(!1),c()}return n.jsxs("div",{className:"relative",ref:a,children:[n.jsxs(Z,{"aria-label":"Add database connection",onClick:()=>i(c=>!c),size:"sm",type:"button",children:[n.jsx(ws,{className:"size-3.5"}),"Add"]}),s?n.jsxs("div",{className:"absolute right-0 top-9 z-50 w-56 overflow-hidden rounded-lg border border-border bg-card shadow-lg",children:[n.jsxs("button",{className:"flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors hover:bg-muted",onClick:()=>l(e),type:"button",children:[n.jsx(Qn,{className:"size-3.5 text-muted-foreground"}),"Add connection"]}),n.jsxs("button",{className:"flex w-full items-center gap-2 border-t border-border px-3 py-2 text-left text-sm transition-colors hover:bg-muted",onClick:()=>l(t),type:"button",children:[n.jsx(Li,{className:"size-3.5 text-muted-foreground"}),"Add with AI"]})]}):null]})}function yK(){const[e,t]=y.useState([]),[s,i]=y.useState(!0),[a,l]=y.useState(null),c=y.useCallback(async()=>{i(!0),l(null);try{t(await uE())}catch(h){l(h instanceof Error?h.message:String(h))}finally{i(!1)}},[]);return y.useEffect(()=>{c()},[c]),{connections:e,loading:s,error:a,refresh:c}}const _K=[50,100,500,1e3];function V5(e){return[...new Set([..._K,e])].sort((t,s)=>t-s)}function wK(e){const[t,s]=y.useState(null),[i,a]=y.useState(null),[l,c]=y.useState(!1);y.useEffect(()=>{s(null),a(null)},[e]);const h=y.useCallback(async(d,p)=>{if(!(!e||!d.trim())){c(!0),a(null);try{s(await fL(e,d,p))}catch(g){s(null),a(g instanceof Error?g.message:String(g))}finally{c(!1)}}},[e]),f=y.useCallback(()=>{s(null),a(null)},[]);return{result:t,error:i,running:l,run:h,reset:f}}const SK=["select","show","explain","pragma","describe","desc"];function kK(e){const t=/^\s*([a-z]+)/i.exec(e)?.[1]?.toLowerCase()??"";return SK.includes(t)}function NK(e){const[t,s]=y.useState(null),[i,a]=y.useState(null),[l,c]=y.useState(null),[h,f]=y.useState(!1),[d,p]=y.useState(!1);y.useEffect(()=>{s(null),a(null),c(null)},[e]);const g=y.useCallback(async k=>{if(!(!e||!k.trim())){f(!0),c(null),a(null);try{const N=await Yw(e,k,"preview");s({sql:k,preview:N})}catch(N){c(N instanceof Error?N.message:String(N))}finally{f(!1)}}},[e]),b=y.useCallback(async k=>{const N=k??t?.sql;if(!e||!N)return null;p(!0),c(null);try{const E=await Yw(e,N,"commit");return a(E),s(null),E}catch(E){return s(null),c(E instanceof Error?E.message:String(E)),null}finally{p(!1)}},[e,t]),v=y.useCallback(()=>s(null),[]),w=y.useCallback(()=>{s(null),a(null),c(null)},[]);return{pending:t,committed:i,error:l,previewing:h,committing:d,preview:g,commit:b,cancel:v,reset:w}}function CK(e,t){const[s,i]=y.useState(!1),a=y.useCallback(async l=>{if(e){i(!0);try{await mL(e,l),t()}finally{i(!1)}}},[e,t]);return{updating:s,setUnlocked:a}}function EK(e,t=100){const[s,i]=y.useState([]),[a,l]=y.useState(null),[c,h]=y.useState(null),[f,d]=y.useState(null),[p,g]=y.useState(null),[b,v]=y.useState(!1),[w,k]=y.useState(!1),[N,E]=y.useState(()=>t),T=y.useRef(!1),[A,C]=y.useState(0);y.useEffect(()=>{T.current||E(t)},[t]),y.useEffect(()=>{C(0)},[e,a]),y.useEffect(()=>{if(i([]),l(null),h(null),d(null),g(null),!e)return;let D=!1;return v(!0),dE(e).then(G=>{D||(i(G),l(G[0]?.qualifiedName??null))}).catch(G=>{D||d(G instanceof Error?G.message:String(G))}).finally(()=>{D||v(!1)}),()=>{D=!0}},[e]),y.useEffect(()=>{if(h(null),g(null),!e||!a)return;let D=!1;return k(!0),pL(e,a,N,A).then(G=>{D||h(G)}).catch(G=>{D||g(G instanceof Error?G.message:String(G))}).finally(()=>{D||k(!1)}),()=>{D=!0}},[e,a,N,A]);const R=A>0,L=c?c.rowCount===N:!1;function H(D){T.current=!0,E(D),C(0)}function B(){L&&C(D=>D+N)}function P(){C(D=>Math.max(0,D-N))}return{tables:s,selectedTable:a,setSelectedTable:l,sample:c,tablesError:f,rowsError:p,loadingTables:b,loadingRows:w,limit:N,offset:A,canPrev:R,canNext:L,changePageSize:H,nextPage:B,prevPage:P}}function jK(e,t,s,i){const{provider:a}=Dt(),[l,c]=y.useState(!1),[h,f]=y.useState(null),d=y.useRef(null),p=y.useRef(!0);return y.useEffect(()=>(p.current=!0,()=>{p.current=!1,d.current?.abort()}),[]),{generate:y.useCallback(async b=>{if(!e||!b.trim()||l)return;c(!0),f(null);const v=new AbortController;d.current=v;try{let w=[];try{w=await dE(e)}catch{w=[]}if(!p.current||v.signal.aborted)return;const k=await bv({prompt:IH(e,b,{engine:t,tables:w,unlocked:s}),provider:a?.id,signal:v.signal});if(!p.current)return;const N=AK(k);N?i(N):f("The agent didn't return a SQL block.")}catch(w){p.current&&!v.signal.aborted&&f(w instanceof Error?w.message:String(w))}finally{d.current===v&&(d.current=null),p.current&&c(!1)}},[e,t,s,l,i,a?.id]),generating:l,error:h}}function AK(e){if(!e)return null;const s=/```(?:sql)?\s*\n?([\s\S]*?)```/i.exec(e)?.[1]?.trim();return s||null}function TK({connection:e,sample:t}){const{sendToAgent:s}=Dt(),{success:i,error:a}=hs(),l=t.columns.map(p=>p.name);function c(p){s({prompt:PH(e,t.engine,t.table,t.columns,p),source:{type:"database-row",label:`${t.table} row`},mode:"draft"})}async function h(p,g){try{await navigator.clipboard.writeText(p),i(`Copied ${g}.`)}catch(b){a(b instanceof Error?b.message:String(b))}}function f(p){const g=b=>{const v=ou(b);return/[",\n]/.test(v)?`"${v.replace(/"/g,'""')}"`:v};return`${l.join(",")}
110
+ ${l.map(b=>g(p[b])).join(",")}`}function d(p){const g=v=>v==null?"NULL":typeof v=="number"||typeof v=="boolean"?String(v):`'${(typeof v=="object"?JSON.stringify(v):String(v)).replace(/'/g,"''")}'`,b=l.map(v=>g(p[v])).join(", ");return`INSERT INTO ${t.table} (${l.join(", ")}) VALUES (${b});`}return t.columns.length===0?n.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"This table has no columns."}):n.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:n.jsxs("table",{className:"code-font-size w-max min-w-full border-collapse text-left font-mono",children:[n.jsx("thead",{className:"sticky top-0 z-10 bg-card",children:n.jsxs("tr",{className:"border-b border-border",children:[t.columns.map(p=>n.jsxs("th",{className:"whitespace-nowrap px-3 py-2 font-semibold text-foreground",children:[n.jsxs("span",{className:"flex items-center gap-1",children:[p.primaryKey?n.jsx(qC,{className:"size-3 text-amber-500"}):null,p.name]}),n.jsx("span",{className:"block font-normal text-muted-foreground",children:p.dataType})]},p.name)),n.jsx("th",{className:"sticky right-0 z-20 w-16 border-l border-border bg-card px-2 py-2"})]})}),n.jsxs("tbody",{children:[t.rows.map((p,g)=>n.jsxs("tr",{className:"group border-b border-border/60 hover:bg-muted/40",children:[t.columns.map(b=>n.jsx("td",{className:"max-w-[320px] truncate px-3 py-1 align-top text-muted-foreground",title:ou(p[b.name]),children:ou(p[b.name])},b.name)),n.jsx("td",{className:"sticky right-0 z-[1] border-l border-border/60 bg-card px-2 py-1 align-top before:pointer-events-none before:absolute before:inset-0 before:bg-muted/40 before:opacity-0 group-hover:before:opacity-100",children:n.jsxs("div",{className:"relative z-[1] flex items-center justify-end gap-0.5",children:[n.jsx(er,{label:"Ask AI about this row",onAsk:()=>c(p)}),n.jsx(ju,{label:"Row actions",items:[{label:"Copy as JSON",icon:n.jsx(DR,{className:"size-3.5"}),onSelect:()=>{h(JSON.stringify(p,null,2),"row as JSON")}},{label:"Copy as CSV",icon:n.jsx(w6,{className:"size-3.5"}),onSelect:()=>{h(f(p),"row as CSV")}},{label:"Copy as SQL INSERT",icon:n.jsx(Qn,{className:"size-3.5"}),onSelect:()=>{h(d(p),"INSERT statement")}}]})]})})]},g)),t.rows.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:t.columns.length+1,className:"px-3 py-6 text-center text-muted-foreground",children:"No rows."})}):null]})]})})}function ou(e){return e==null?"NULL":typeof e=="object"?JSON.stringify(e):String(e)}function RK({connection:e,busy:t,onConfirm:s,onClose:i}){return n.jsx(Zn,{icon:n.jsx(g8,{className:"text-amber-500"}),onClose:i,title:`Unlock writes on "${e}"?`,children:n.jsxs("div",{className:"flex flex-col gap-4 text-sm",children:[n.jsxs("p",{className:"text-muted-foreground",children:["This lets the SQL console run statements that ",n.jsx("strong",{children:"change data"})," ","— ",n.jsx("span",{className:"font-mono",children:"INSERT"}),","," ",n.jsx("span",{className:"font-mono",children:"UPDATE"}),","," ",n.jsx("span",{className:"font-mono",children:"DELETE"}),", and DDL like"," ",n.jsx("span",{className:"font-mono",children:"DROP"}),". Writes still preview their affected rows before they commit, but an unlocked connection can modify or destroy real data."]}),n.jsx("p",{className:"text-muted-foreground",children:"The lock stays open for this connection until you re-lock it. It is never shared with the AI agent."}),n.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-3",children:[n.jsx(Z,{variant:"outline",size:"sm",onClick:i,type:"button",children:"Cancel"}),n.jsxs(Z,{size:"sm",onClick:s,disabled:t,type:"button",children:[t?n.jsx(Rt,{className:"animate-spin"}):n.jsx(GC,{}),"Unlock writes"]})]})]})})}function MK({sql:e,preview:t,busy:s,onConfirm:i,onClose:a}){return n.jsx(Zn,{icon:n.jsx(Rr,{className:"text-amber-500"}),onClose:a,title:"Confirm write",children:n.jsxs("div",{className:"flex flex-col gap-4 text-sm",children:[n.jsx("pre",{className:"max-h-40 overflow-auto rounded-md border border-border bg-muted/40 px-3 py-2 font-mono text-[11px] whitespace-pre-wrap",children:e}),t.previewUnavailable?n.jsx("p",{className:"rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-[13px] text-amber-700 dark:text-amber-300",children:"This statement can’t be previewed — DDL commits immediately on this engine and cannot be rolled back. Running it applies the change at once."}):n.jsxs("p",{className:"text-muted-foreground",children:["This will affect"," ",n.jsx("strong",{className:"text-foreground tabular-nums",children:t.affectedRows??0})," ","row",t.affectedRows===1?"":"s",". The preview ran in a transaction that was rolled back — nothing has changed yet."]}),n.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-3",children:[n.jsx(Z,{variant:"outline",size:"sm",onClick:a,type:"button",children:"Cancel"}),n.jsxs(Z,{size:"sm",className:"bg-amber-600 text-white hover:bg-amber-600/90",onClick:i,disabled:s,type:"button",children:[s?n.jsx(Rt,{className:"animate-spin"}):null,"Run & commit"]})]})]})})}function DK({connection:e,engine:t,unlocked:s,seed:i,onWriteAccessChange:a,preferences:l={confirmWrites:!0,resultLimit:100}}){const{success:c}=hs(),{sendToAgent:h}=Dt(),f=wK(e),d=NK(e),p=CK(e,a),[g,b]=y.useState(i?.sql??""),[v,w]=y.useState(()=>l.resultLimit),k=y.useRef(!1);y.useEffect(()=>{k.current||w(l.resultLimit)},[l.resultLimit]);const N=i?.nonce;y.useEffect(()=>{i&&b(i.sql)},[N]);const[E,T]=y.useState(!1),A=jK(e,t,s,b),C=g.trim().length>0&&!kK(g),R=s&&C,L=C&&!s,H=f.running||d.previewing||d.committing;function B(){if(g.trim()){if(L){T(!0);return}R?(f.reset(),l.confirmWrites?d.preview(g):G(g)):(d.reset(),f.run(g,v))}}function P($){($.metaKey||$.ctrlKey)&&$.key==="Enter"&&($.preventDefault(),B())}function D($){h({prompt:$H(e,t,g,$),source:{type:"database-sql-debug",label:"Debug SQL"},label:"Debug this SQL error"})}async function G($){const O=await d.commit($);if(O?.committed){const V=O.affectedRows??0;c(`Committed — ${V} row${V===1?"":"s"} affected.`)}}return n.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[n.jsxs("div",{className:"shrink-0 border-b border-border p-2",children:[n.jsx(LK,{generate:A}),n.jsx("textarea",{value:g,onChange:$=>b($.target.value),onKeyDown:P,spellCheck:!1,placeholder:s?"SELECT … / INSERT … / UPDATE … (Cmd/Ctrl+Enter to run)":"SELECT * FROM … (read-only — Cmd/Ctrl+Enter to run)",className:"code-font-size h-24 w-full resize-y rounded-md border border-border bg-background px-2 py-1.5 font-mono outline-none focus:border-ring"}),n.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[n.jsx(OK,{unlocked:s,updating:p.updating,onUnlock:()=>T(!0),onLock:()=>{p.setUnlocked(!1)}}),n.jsxs("div",{className:"flex items-center gap-2",children:[R?null:n.jsx("select",{"aria-label":"Max rows",className:"rounded-md border border-border bg-background px-1.5 py-1 text-[11px]",value:v,onChange:$=>{k.current=!0,w(Number($.target.value))},children:V5(l.resultLimit).map($=>n.jsxs("option",{value:$,children:[$," rows"]},$))}),n.jsxs(Z,{size:"sm",className:ae("h-7 px-3",R&&"bg-amber-600 text-white hover:bg-amber-600/90"),onClick:B,disabled:H||!g.trim(),type:"button",children:[H?n.jsx(Rt,{className:"size-3.5 animate-spin"}):n.jsx(Mr,{className:"size-3.5"}),R?l.confirmWrites?"Preview write":"Run write":"Run"]})]})]})]}),n.jsx(zK,{read:f,write:d,onDebug:D}),E?n.jsx(RK,{connection:e,busy:p.updating,onConfirm:async()=>{await p.setUnlocked(!0),T(!1)},onClose:()=>T(!1)}):null,d.pending?n.jsx(MK,{sql:d.pending.sql,preview:d.pending.preview,busy:d.committing,onConfirm:()=>{G()},onClose:d.cancel}):null]})}function LK({generate:e}){const[t,s]=y.useState("");function i(){const l=t.trim();!l||e.generating||e.generate(l)}function a(l){l.key==="Enter"&&(l.preventDefault(),i())}return n.jsxs("div",{className:"mb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx(Yt,{className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2"}),n.jsx("input",{value:t,onChange:l=>s(l.target.value),onKeyDown:a,disabled:e.generating,placeholder:"Describe the query in plain English — AI writes the SQL below",className:"h-8 w-full rounded-md border border-border bg-background pl-7 pr-2 text-[12px] outline-none focus:border-ring disabled:opacity-60"})]}),n.jsxs(Z,{size:"sm",variant:"outline",className:"h-8 px-3",onClick:i,disabled:e.generating||!t.trim(),type:"button",children:[e.generating?n.jsx(Rt,{className:"size-3.5 animate-spin"}):n.jsx(Yt,{className:"size-3.5"}),e.generating?"Generating…":"Ask AI"]})]}),e.error?n.jsx("p",{className:"mt-1 text-[11px] text-amber-600 dark:text-amber-400",children:e.error}):null]})}function OK({unlocked:e,updating:t,onUnlock:s,onLock:i}){return n.jsxs("button",{type:"button",onClick:e?i:s,disabled:t,className:ae("flex items-center gap-1.5 rounded-md border px-2 py-1 text-[11px] font-medium transition-colors",e?"border-amber-500/50 text-amber-600 hover:bg-amber-500/10 dark:text-amber-400":"border-border text-muted-foreground hover:text-foreground"),title:e?"Writes unlocked — click to lock":"Read-only — click to unlock writes",children:[t?n.jsx(Rt,{className:"size-3.5 animate-spin"}):e?n.jsx(GC,{className:"size-3.5"}):n.jsx(vM,{className:"size-3.5"}),e?"Writes unlocked":"Read-only"]})}function zK({read:e,write:t,onDebug:s}){const i=t.error??e.error;return n.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:i?n.jsxs("div",{className:"space-y-3 p-4",children:[n.jsx("p",{className:"code-font-size whitespace-pre-wrap font-mono text-destructive",children:i}),n.jsxs(Z,{size:"sm",variant:"outline",className:"h-7 px-3",onClick:()=>s(i),type:"button",children:[n.jsx(Yt,{className:"size-3.5"}),"Debug with AI"]})]}):t.committed?n.jsx(BK,{outcome:t.committed}):e.result?n.jsx(W5,{columns:e.result.columns,rows:e.result.rows,truncated:e.result.truncated}):n.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center text-sm text-muted-foreground",children:"Write a query and run it to see results here."})})}function BK({outcome:e}){if(!e)return null;const t=e.affectedRows??0;return n.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[n.jsxs("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-border bg-emerald-500/10 px-3 py-1.5 text-[12px] text-emerald-700 dark:text-emerald-400",children:[n.jsx(Ws,{className:"size-3.5"}),"Committed — ",t," row",t===1?"":"s"," affected."]}),e.rows&&e.rows.length>0&&e.columns?n.jsx(W5,{columns:e.columns,rows:e.rows}):null]})}function W5({columns:e,rows:t,truncated:s=!1}){return e.length===0?n.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Query ran successfully — no columns returned."}):n.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[s?n.jsxs("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-border bg-amber-500/10 px-3 py-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[n.jsx(Rr,{className:"size-3.5"}),"Showing the first ",t.length," rows — add a LIMIT to narrow the result."]}):null,n.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:n.jsxs("table",{className:"code-font-size w-max min-w-full border-collapse text-left font-mono",children:[n.jsx("thead",{className:"sticky top-0 z-10 bg-card",children:n.jsx("tr",{className:"border-b border-border",children:e.map(i=>n.jsx("th",{className:"whitespace-nowrap px-3 py-2 font-semibold text-foreground",children:i.name},i.name))})}),n.jsxs("tbody",{children:[t.map((i,a)=>n.jsx("tr",{className:"border-b border-border/60 hover:bg-muted/40",children:e.map(l=>n.jsx("td",{className:"max-w-[320px] truncate px-3 py-1 align-top text-muted-foreground",title:ou(i[l.name]),children:ou(i[l.name])},l.name))},a)),t.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:e.length,className:"px-3 py-6 text-center text-muted-foreground",children:"No rows."})}):null]})]})})]})}function PK({staged:e,onStageConsumed:t,projects:s=[],scopePath:i=null}={}){const l=nm()?.confirmedProject.database??{confirmWrites:!0,resultLimit:100},{connections:c,loading:h,error:f,refresh:d}=yK(),p=y.useMemo(()=>c.filter(D=>uK(D.projectPath,i)),[c,i]),g=D=>D.projectPath?s.find($=>im(D.projectPath,$.path))?.name??D.projectPath.split("/").pop()??null:null;jl(d);const{error:b,success:v}=hs(),{sendToAgent:w}=Dt(),[k,N]=gl("database:selected",null),[E,T]=gl("database:mode","browse"),[A,C]=y.useState(null),[R,L]=y.useState(null);y.useEffect(()=>{e&&(e.connection&&N(e.connection),T("query"),L({sql:e.sql,nonce:e.nonce}),t?.())},[e?.nonce]);function H(){w({prompt:OH,source:{type:"database-setup",label:"Add a database"},label:"Help me connect a database, one step at a time."})}y.useEffect(()=>{if(p.length===0){k!==null&&N(null);return}(!k||!p.some(D=>D.name===k))&&N(p[0].name)},[p,k,N]);async function B(D){try{await hL(D),v(`Removed connection "${D}".`),await d()}catch(G){b(G instanceof Error?G.message:String(G))}}function P(D){C({mode:"edit",target:D})}return n.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[n.jsxs("header",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Qn,{className:"size-4 text-muted-foreground"}),n.jsx("span",{className:"text-sm font-semibold",children:"Databases"}),h&&p.length===0?n.jsx(Rt,{className:"size-3.5 animate-spin text-muted-foreground"}):null]}),n.jsxs("div",{className:"flex items-center gap-2",children:[k?n.jsx(IK,{mode:E,onChange:T}):null,n.jsx(xK,{connections:p,projectLabel:g,selected:k,onSelect:N,onAdd:()=>C({mode:"add"}),onEdit:P,onRemove:D=>{B(D)}}),n.jsx(vK,{onAddManual:()=>C({mode:"add"}),onAddWithAi:H})]})]}),n.jsx("div",{className:"min-h-0 flex-1",children:f?n.jsx("div",{className:"p-4",children:n.jsx(Je,{variant:"muted",className:"border-destructive/40 text-destructive",children:f})}):k?E==="query"?n.jsx(DK,{connection:k,engine:p.find(D=>D.name===k)?.engine,unlocked:p.find(D=>D.name===k)?.writeUnlocked??!1,seed:R,onWriteAccessChange:d,preferences:l},k):n.jsx($K,{connection:k,resultLimit:l.resultLimit}):n.jsx(HK,{onAdd:()=>C({mode:"add"}),onAddWithAi:H})}),A?n.jsx(pK,{initial:A.mode==="edit"?A.target:void 0,projects:s,onClose:()=>C(null),onSaved:d}):null]})}function IK({mode:e,onChange:t}){const s=[{value:"browse",label:"Browse",icon:sE},{value:"query",label:"SQL",icon:kl}];return n.jsx("div",{className:"flex items-center rounded-md border border-border p-0.5",children:s.map(i=>{const a=i.icon;return n.jsxs("button",{type:"button",onClick:()=>t(i.value),className:ae("flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition-colors",e===i.value?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:[n.jsx(a,{className:"size-3.5"}),i.label]},i.value)})})}function $K({connection:e,resultLimit:t}){const{sendToAgent:s}=Dt(),{tables:i,selectedTable:a,setSelectedTable:l,sample:c,tablesError:h,rowsError:f,loadingTables:d,loadingRows:p,limit:g,offset:b,canPrev:v,canNext:w,changePageSize:k,nextPage:N,prevPage:E}=EK(e,t);function T(C){s({prompt:O2(e,C.table,{engine:C.engine,columns:C.columns}),source:{type:"database-table",label:`${C.table.name} table`},mode:"draft"})}function A(C){s({prompt:O2(e,C),source:{type:"database-table",label:`${C.name} table`},mode:"draft"})}return n.jsxs("div",{className:"flex h-full min-h-0",children:[n.jsxs("div",{className:"flex w-56 shrink-0 flex-col border-r border-border",children:[n.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[n.jsx(sE,{className:"size-4 text-muted-foreground"}),n.jsx("span",{className:"text-sm font-semibold",children:"Tables"}),n.jsx(We,{variant:"outline",size:"small",children:i.length}),d?n.jsx(Rt,{className:"size-3.5 animate-spin"}):null]}),h?n.jsx("div",{className:"p-3",children:n.jsx(Je,{variant:"muted",className:"border-destructive/40 text-destructive",children:h})}):n.jsxs("ul",{className:"min-h-0 flex-1 overflow-auto",children:[i.map(C=>n.jsxs("li",{className:ae("group flex items-center gap-1 pr-1 transition-colors hover:bg-muted/50",C.qualifiedName===a&&"bg-muted/70"),children:[n.jsx("button",{type:"button",onClick:()=>l(C.qualifiedName),className:ae("min-w-0 flex-1 truncate px-3 py-1.5 text-left font-mono text-[11px]",C.qualifiedName===a&&"font-semibold"),children:C.qualifiedName}),n.jsx(er,{label:`Ask AI about \`${C.qualifiedName}\``,onAsk:()=>A(C)})]},C.qualifiedName)),!d&&i.length===0?n.jsx("li",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No tables."}):null]})]}),n.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[n.jsxs("div",{className:"group flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[n.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[n.jsx("span",{className:"truncate font-mono text-xs font-semibold",children:a??"Select a table"}),c?n.jsx(er,{label:`Ask AI about \`${c.table.qualifiedName}\``,onAsk:()=>T(c)}):null]}),c?n.jsxs("div",{className:"flex shrink-0 items-center gap-2 text-[11px] text-muted-foreground",children:[n.jsx("span",{className:"tabular-nums",children:c.rowCount===0?"no rows":`rows ${b+1}–${b+c.rowCount}`}),n.jsx("select",{"aria-label":"Rows per page",className:"rounded-md border border-border bg-background px-1.5 py-0.5 text-[11px]",value:g,onChange:C=>k(Number(C.target.value)),children:V5(t).map(C=>n.jsxs("option",{value:C,children:[C," / page"]},C))}),n.jsx(Z,{size:"sm",variant:"outline",className:"h-6 px-2",onClick:E,disabled:!v,type:"button",children:"Prev"}),n.jsx(Z,{size:"sm",variant:"outline",className:"h-6 px-2",onClick:N,disabled:!w,type:"button",children:"Next"})]}):null]}),f?n.jsx("div",{className:"p-4",children:n.jsx(Je,{variant:"muted",className:"border-destructive/40 text-destructive",children:f})}):p?n.jsxs("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:[n.jsx(Rt,{className:"mr-2 size-4 animate-spin"}),"Loading rows…"]}):c?n.jsx(TK,{connection:e,sample:c}):n.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:"Pick a table to sample its rows."})]})]})}function HK({onAdd:e,onAddWithAi:t}){return n.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center",children:n.jsxs("div",{className:"max-w-sm",children:[n.jsx(Qn,{className:"mx-auto size-8 text-muted-foreground/50"}),n.jsx("p",{className:"mt-3 text-sm font-medium",children:"No connections yet"}),n.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Add a read-only Postgres, MySQL, or SQLite connection to browse tables and sample rows. NoMoreIDE can auto-detect connection strings from your services' ",n.jsx("code",{children:".env"})," files."]}),n.jsxs("div",{className:"mt-4 flex items-center justify-center gap-2",children:[n.jsxs(Z,{size:"sm",onClick:e,type:"button",children:[n.jsx(ws,{}),"Add connection"]}),n.jsxs(Z,{size:"sm",variant:"outline",onClick:t,type:"button",children:[n.jsx(Li,{}),"Add with AI"]})]})]})})}const Wi=[{id:"general",label:"General",description:"Language, navigation, and startup context.",icon:iM,scope:"global",keywords:["language","sidebar","project scope"]},{id:"appearance",label:"Appearance",description:"Theme, density, type size, and motion.",icon:WC,scope:"global",keywords:["theme","dark","light","font","motion"]},{id:"terminal",label:"Terminal",description:"Terminal rendering and process safeguards.",icon:_u,scope:"global",keywords:["shell","cursor","scrollback","copy","terminate"]},{id:"services-logs",label:"Services & Logs",description:"How this project presents runtime output.",icon:Bf,scope:"project",keywords:["timestamps","wrap","runtime","services"]},{id:"git-github",label:"Git & GitHub",description:"Source-control preferences and connection status.",icon:Mn,scope:"mixed",keywords:["git","github","co-author","repository"]},{id:"agents-mcp",label:"Agents & MCP",description:"Agent environments and MCP management.",icon:C0,scope:"mixed",keywords:["agent","model","mcp","claude","codex"]},{id:"database-safety",label:"Database & Safety",description:"Project query limits and write safeguards.",icon:Qn,scope:"project",keywords:["database","sql","danger confirmation","writes","limit"]},{id:"notifications",label:"Notifications",description:"Browser notification capability and permission.",icon:CR,scope:"global",keywords:["alerts","desktop","permission"]},{id:"data-privacy",label:"Data & Privacy",description:"Local storage, export, reset, and privacy.",icon:JC,scope:"mixed",keywords:["data","privacy","export","reset","storage"]},{id:"about",label:"About",description:"Version, runtime, documentation, and support.",icon:tM,scope:"global",keywords:["version","docs","runtime","issues"]}],K5={language:{category:"general",label:"Language",description:"Choose the language preference for this console."},"sidebar-docked":{category:"general",label:"Dock sidebar",description:"Keep the navigation expanded while you work."},"project-scope":{category:"general",label:"Default project scope",description:"Choose whether Run pages open across every project or the selected project."},theme:{category:"appearance",label:"Theme",description:"Follow your system or choose an explicit dashboard theme."},density:{category:"appearance",label:"Interface density",description:"Adjust spacing throughout the control surface."},"code-font":{category:"appearance",label:"Code font size",description:"Size used by code and log surfaces."},"reduced-motion":{category:"appearance",label:"Reduced motion",description:"Reduce non-essential movement and animated transitions."},"terminal-font":{category:"terminal",label:"Terminal font size",description:"Text size for terminal sessions."},cursor:{category:"terminal",label:"Cursor style",description:"Shape of the active terminal cursor."},scrollback:{category:"terminal",label:"Scrollback limit",description:"Number of previous terminal lines kept in memory."},"copy-on-select":{category:"terminal",label:"Copy on select",description:"Copy selected terminal text to the clipboard."},"confirm-terminate":{category:"terminal",label:"Confirm before terminating",description:"Ask before closing, stopping, or restarting a running process. Danger confirmation."},"log-timestamps":{category:"services-logs",label:"Show timestamps",description:"Show the time gutter beside each log entry."},"wrap-lines":{category:"services-logs",label:"Wrap log lines",description:"Wrap long output instead of scrolling horizontally."},"github-connection":{category:"git-github",label:"GitHub connection",description:"Review the current GitHub connection without exposing credentials here."},"repository-defaults":{category:"git-github",label:"Repository defaults",description:"Repository-specific Git preferences will appear when their behavior is available."},"agent-environments":{category:"agents-mcp",label:"Agent environments",description:"Manage installed agents, MCP servers, skills, and profiles."},"project-agent-context":{category:"agents-mcp",label:"Project agent context",description:"Project-specific agent configuration remains in Agent Environments."},"confirm-writes":{category:"database-safety",label:"Confirm before writes",description:"Show a danger confirmation before write statements are submitted."},"result-limit":{category:"database-safety",label:"Default result limit",description:"Maximum rows requested for a default browse or query."},connections:{category:"database-safety",label:"Connections",description:"Manage connections and write access in the Database workbench."},"desktop-notifications":{category:"notifications",label:"Desktop notifications",description:"Shows whether desktop notifications are supported in this environment. Permission controls arrive with notification events."},"local-storage":{category:"data-privacy",label:"Local settings storage",description:"UI preferences stay in local browser storage; operational settings live in your NoMoreIDE config directory."},"export-reset":{category:"data-privacy",label:"Export and reset",description:"Export and reset controls are coming in a later delivery."},version:{category:"about",label:"Version",description:"Application version."},console:{category:"about",label:"Console",description:"Local runtime address."},documentation:{category:"about",label:"Documentation",description:"NoMoreIDE documentation and support."}};function Y5(e){const t=K5[e];if(!t)throw new Error(`Missing settings copy for "${e}".`);return t}const UK=Object.keys(K5);function FK(e,t){const s=Rv(e),i=t.trim().toLowerCase().split(/\s+/).filter(Boolean);return UK.filter(a=>{const l=Y5(a);if(l.category!==e)return!1;const c=`${s.label} ${s.description} ${s.keywords.join(" ")} ${l.label} ${l.description}`.toLowerCase();return i.every(h=>c.includes(h))})}function Rv(e){return Wi.find(t=>t.id===e)??Wi[0]}function qK({scope:e}){return n.jsx("span",{className:ae("rounded-full border px-2 py-0.5 font-mono text-[10px] uppercase tracking-wide",e==="project"?"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300":"border-border bg-muted/60 text-muted-foreground"),children:e==="project"?"Current project":"Global"})}function GK({state:e,error:t}){return e==="idle"?null:n.jsxs("div",{"aria-live":"polite",className:ae("flex items-center gap-1.5 text-xs",e==="error"?"text-destructive":"text-muted-foreground"),children:[e==="saving"?n.jsx(Rt,{className:"size-3.5 animate-spin"}):null,e==="saved"?n.jsx(Ws,{className:"size-3.5 text-emerald-600"}):null,e==="error"?n.jsx(Mf,{className:"size-3.5"}):null,n.jsx("span",{children:e==="saving"?"Saving…":e==="saved"?"Saved":t})]})}function Mv({id:e,label:t,description:s,children:i,disabled:a=!1}){return n.jsxs("div",{className:ae("settings-row grid gap-3 border-b border-border/50 px-4 last:border-b-0 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center",a&&"opacity-55"),children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("label",{className:"text-sm font-medium",htmlFor:e,children:t}),n.jsx("p",{className:"mt-0.5 max-w-xl text-xs leading-5 text-muted-foreground",id:`${e}-description`,children:s})]}),n.jsx("div",{className:"min-w-0 sm:justify-self-end",children:i})]})}function Za({id:e,label:t,description:s,checked:i,onChange:a,disabled:l=!1}){return n.jsx(Mv,{description:s,disabled:l,id:e,label:t,children:n.jsx("input",{"aria-describedby":`${e}-description`,checked:i,className:"size-4 accent-foreground",disabled:l,id:e,onChange:c=>a(c.target.checked),type:"checkbox"})})}function Bc({id:e,label:t,description:s,value:i,options:a,onChange:l,disabled:c=!1}){return n.jsx(Mv,{description:s,disabled:c,id:e,label:t,children:n.jsx("select",{"aria-describedby":`${e}-description`,className:"h-8 min-w-36 rounded-md border border-input bg-background px-2 text-xs focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",disabled:c,id:e,onChange:h=>l(h.target.value),value:i,children:a.map(h=>n.jsx("option",{disabled:h.disabled,value:h.value,children:h.label},h.value))})})}function wh({id:e,label:t,description:s,value:i,min:a,max:l,onSave:c,disabled:h=!1,scopeKey:f}){const[d,p]=y.useState(String(i)),[g,b]=y.useState(null);y.useEffect(()=>{p(String(i)),b(null)},[f,i]);function v(){const w=Number(d);if(!Number.isInteger(w)||w<a||w>l){b(`Enter a value from ${a} to ${l}`);return}b(null),c(w)}return n.jsx(Mv,{description:s,disabled:h,id:e,label:t,children:n.jsxs("div",{className:"flex flex-col items-start gap-1 sm:items-end",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(ft,{"aria-describedby":`${e}-description${g?` ${e}-error`:""}`,"aria-invalid":!!g,className:"h-8 w-24 font-mono text-xs",disabled:h,id:e,max:l,min:a,onChange:w=>p(w.target.value),type:"number",value:d}),n.jsx(Z,{"aria-label":`Save ${t}`,disabled:h,onClick:v,size:"sm",type:"button",variant:"outline",children:"Save"})]}),g?n.jsx("span",{className:"text-[11px] text-destructive",id:`${e}-error`,role:"alert",children:g}):null]})})}function ga({title:e,description:t,action:s}){return n.jsxs("div",{className:"settings-row flex flex-col items-stretch justify-between gap-3 border-b border-border/50 px-4 last:border-b-0 sm:flex-row sm:items-center sm:gap-4",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-sm font-medium",children:e}),n.jsx("p",{className:"mt-0.5 break-words text-xs leading-5 text-muted-foreground",children:t})]}),s?n.jsx("div",{className:"w-full shrink-0 [&_button]:w-full sm:w-auto sm:[&_button]:w-auto",children:s}):null]})}function VK({children:e}){return n.jsx("div",{className:"border border-dashed border-border bg-muted/30 px-4 py-3 text-xs leading-5 text-muted-foreground",children:e})}function WK({selected:e,onSelect:t,search:s,onSearch:i,saveState:a,saveError:l,children:c}){const h=y.useRef([]),f=Rv(e),d=f.icon;function p(g,b){let v=null;if(g.key==="ArrowDown"&&(v=(b+1)%Wi.length),g.key==="ArrowUp"&&(v=(b-1+Wi.length)%Wi.length),g.key==="Home"&&(v=0),g.key==="End"&&(v=Wi.length-1),v===null)return;g.preventDefault();const w=Wi[v];t(w.id),h.current[v]?.focus()}return n.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[n.jsxs("header",{className:"flex shrink-0 flex-wrap items-center gap-3 border-b border-border px-3 py-2.5",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(QC,{className:"size-4 text-muted-foreground"}),n.jsx("span",{className:"text-sm font-semibold",children:"Settings"})]}),n.jsxs("div",{className:"relative ml-auto w-full sm:w-64",children:[n.jsx(ZC,{className:"pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),n.jsx("input",{"aria-label":"Search settings",className:"h-8 w-full rounded-md border border-input bg-background pl-8 pr-8 text-xs outline-none focus:ring-2 focus:ring-ring",onChange:g=>i(g.target.value),placeholder:"Search settings",type:"search",value:s}),s?n.jsx("button",{"aria-label":"Clear settings search",className:"absolute right-1.5 top-1/2 -translate-y-1/2 rounded p-1 text-muted-foreground hover:bg-muted",onClick:()=>i(""),type:"button",children:n.jsx(qt,{className:"size-3"})}):null]}),n.jsx(GK,{error:l,state:a})]}),n.jsxs("div",{className:"border-b border-border px-3 py-2 md:hidden",children:[n.jsx("label",{className:"mb-1 block text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",htmlFor:"settings-category-select",children:"Category"}),n.jsx("select",{className:"h-9 w-full rounded-md border border-input bg-background px-2 text-sm",id:"settings-category-select",onChange:g=>t(g.target.value),value:e,children:Wi.map(g=>n.jsx("option",{value:g.id,children:g.label},g.id))})]}),n.jsxs("div",{className:"flex min-h-0 flex-1",children:[n.jsx("aside",{className:"hidden w-56 shrink-0 border-r border-border bg-muted/20 p-2 md:block",children:n.jsx("nav",{"aria-label":"Settings categories",className:"space-y-0.5",children:Wi.map((g,b)=>{const v=g.icon,w=e===g.id;return n.jsxs("button",{"aria-current":w?"page":void 0,className:ae("flex w-full items-center gap-2 rounded-md px-2.5 py-2 text-left text-xs font-medium outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",w?"bg-background text-foreground shadow-sm ring-1 ring-border":"text-muted-foreground hover:bg-muted hover:text-foreground"),onClick:()=>t(g.id),onKeyDown:k=>p(k,b),ref:k=>{h.current[b]=k},tabIndex:w?0:-1,type:"button",children:[n.jsx(v,{className:"size-3.5"}),n.jsx("span",{children:g.label})]},g.id)})})}),n.jsx("main",{className:"min-w-0 flex-1 overflow-y-auto",children:n.jsxs("div",{className:"mx-auto max-w-3xl px-3 py-4 sm:px-6 sm:py-6",children:[s?null:n.jsxs("div",{className:"mb-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(d,{className:"size-4 text-muted-foreground"}),n.jsx("h2",{className:"text-base font-semibold",children:f.label})]}),n.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:f.description})]}),c]})})]})]})}function Wn({scope:e,title:t,children:s}){return n.jsxs("section",{className:"mb-4 overflow-hidden rounded-lg border border-border bg-background/70",children:[n.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border bg-muted/25 px-4 py-2.5",children:[n.jsx("h3",{className:"text-xs font-semibold",children:t??(e==="global"?"Global":"Current project")}),n.jsx(qK,{scope:e})]}),s]})}function Pc({project:e,ready:t,loadError:s,onRetry:i}){return e&&s?n.jsxs("div",{className:"border-b border-destructive/30 bg-destructive/5 px-4 py-3",role:"alert",children:[n.jsx("p",{className:"text-xs text-destructive",children:s}),n.jsx(Z,{"aria-label":"Retry project settings",className:"mt-2",onClick:i,size:"sm",type:"button",variant:"outline",children:"Retry project settings"})]}):e&&!t?n.jsxs("div",{className:"border-b border-border/50 bg-muted/30 px-4 py-2 text-xs text-muted-foreground",children:["Loading settings for ",e.name,"…"]}):e?n.jsxs("div",{className:"border-b border-border/50 bg-amber-500/5 px-4 py-2 text-[11px] text-muted-foreground",children:[n.jsx("span",{className:"font-medium text-foreground",children:e.name})," · Changes are written to ",n.jsx("code",{children:"nomoreide.config.json"}),"."]}):n.jsx("div",{className:"border-b border-border/50 bg-muted/30 px-4 py-2 text-xs text-muted-foreground",children:"Select a project to change project settings."})}function KK({activeProject:e=null,onNavigate:t}={}){const s=sm(),i=!!(e?.path&&e.path===s.activeProjectPath&&!s.projectLoading&&!s.projectLoadError),[a,l]=y.useState("general"),[c,h]=y.useState(""),f=c.trim().toLowerCase(),d=y.useMemo(()=>f?Wi.map(g=>({id:g.id,settingIds:FK(g.id,f)})).filter(g=>g.settingIds.length>0):[],[f]);let p;return s.loading?p=n.jsx("div",{"aria-label":"Loading settings",className:"space-y-3",role:"status",children:[0,1,2].map(g=>n.jsx("div",{className:"h-20 animate-pulse rounded-lg border border-border bg-muted/40"},g))}):s.loadError?p=n.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 p-4",role:"alert",children:[n.jsx("p",{className:"text-sm font-medium",children:"Settings could not be loaded"}),n.jsx("p",{className:"mt-1 text-xs text-destructive",children:s.loadError}),n.jsx(Z,{className:"mt-3",onClick:()=>{s.retry()},size:"sm",type:"button",variant:"outline",children:"Retry"})]}):f?p=n.jsxs("div",{children:[n.jsx("h2",{className:"mb-4 text-base font-semibold",children:"Search results"}),d.length?d.map(({id:g,settingIds:b})=>n.jsxs("div",{className:"mb-5",children:[n.jsx("div",{className:"mb-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:Rv(g).label}),n.jsx(tN,{activeProject:e,category:g,onNavigate:t,projectReady:i,settings:s,visibleSettingIds:new Set(b)})]},g)):n.jsxs(VK,{children:["No settings match “",c.trim(),"”."]})]}):p=n.jsx(tN,{activeProject:e,category:a,onNavigate:t,projectReady:i,settings:s}),n.jsx(WK,{onSearch:h,onSelect:l,saveError:s.saveError,saveState:s.saveState,search:c,selected:a,children:p})}function tN({category:e,activeProject:t,projectReady:s,onNavigate:i,settings:a,visibleSettingIds:l}){const c=!s,h=p=>!l||l.has(p),f=p=>p.some(h),d=p=>{const{label:g,description:b}=Y5(p);return{label:g,description:b}};switch(e){case"general":return n.jsxs(Wn,{scope:"global",children:[h("language")?n.jsx(Bc,{...d("language"),id:"setting-language",onChange:p=>a.updateUi({language:p}),options:UW.map(p=>({value:p.value,label:p.nativeLabel,disabled:!p.available})),value:a.ui.language}):null,h("sidebar-docked")?n.jsx(Za,{...d("sidebar-docked"),checked:a.ui.sidebarDocked,id:"setting-sidebar-docked",onChange:p=>a.updateUi({sidebarDocked:p})}):null,h("project-scope")?n.jsx(Bc,{...d("project-scope"),id:"setting-project-scope",onChange:p=>a.updateUi({projectScope:p}),options:[{value:"all",label:"All projects"},{value:"project",label:"Current project"}],value:a.ui.projectScope}):null]});case"appearance":return n.jsxs(Wn,{scope:"global",children:[h("theme")?n.jsx(Bc,{...d("theme"),id:"setting-theme",onChange:p=>a.updateUi({theme:p}),options:[{value:"system",label:"System"},{value:"light",label:"Light"},{value:"dark",label:"Dark"}],value:a.ui.theme}):null,h("density")?n.jsx(Bc,{...d("density"),id:"setting-density",onChange:p=>a.updateUi({density:p}),options:[{value:"comfortable",label:"Comfortable"},{value:"compact",label:"Compact"}],value:a.ui.density}):null,h("code-font")?n.jsx(wh,{...d("code-font"),id:"setting-code-font",max:18,min:10,onSave:p=>a.updateUi({codeFontSize:p}),value:a.ui.codeFontSize}):null,h("reduced-motion")?n.jsx(Za,{...d("reduced-motion"),checked:a.ui.reducedMotion,id:"setting-reduced-motion",onChange:p=>a.updateUi({reducedMotion:p})}):null]});case"terminal":return n.jsxs(Wn,{scope:"global",children:[h("terminal-font")?n.jsx(wh,{...d("terminal-font"),id:"setting-terminal-font",max:24,min:10,onSave:p=>a.updateGlobal({terminal:{fontSize:p}}),value:a.global.terminal.fontSize}):null,h("cursor")?n.jsx(Bc,{...d("cursor"),id:"setting-cursor",onChange:p=>{a.updateGlobal({terminal:{cursorStyle:p}})},options:[{value:"block",label:"Block"},{value:"underline",label:"Underline"},{value:"bar",label:"Bar"}],value:a.global.terminal.cursorStyle}):null,h("scrollback")?n.jsx(wh,{...d("scrollback"),id:"setting-scrollback",max:1e5,min:500,onSave:p=>a.updateGlobal({terminal:{scrollback:p}}),value:a.global.terminal.scrollback}):null,h("copy-on-select")?n.jsx(Za,{...d("copy-on-select"),checked:a.global.terminal.copyOnSelect,id:"setting-copy-on-select",onChange:p=>{a.updateGlobal({terminal:{copyOnSelect:p}})}}):null,h("confirm-terminate")?n.jsx(Za,{...d("confirm-terminate"),checked:a.global.terminal.confirmTerminate,id:"setting-confirm-terminate",onChange:p=>{a.updateGlobal({terminal:{confirmTerminate:p}})}}):null]});case"services-logs":return n.jsxs(Wn,{scope:"project",children:[n.jsx(Pc,{loadError:a.projectLoadError,onRetry:()=>{a.retryProject()},project:t,ready:s}),h("log-timestamps")?n.jsx(Za,{...d("log-timestamps"),checked:a.project.logs.showTimestamps,disabled:c,id:"setting-log-timestamps",onChange:p=>{a.updateProject({logs:{showTimestamps:p}})}}):null,h("wrap-lines")?n.jsx(Za,{...d("wrap-lines"),checked:a.project.logs.wrapLines,disabled:c,id:"setting-wrap-lines",onChange:p=>{a.updateProject({logs:{wrapLines:p}})}}):null]});case"git-github":return n.jsxs(n.Fragment,{children:[f(["github-connection"])?n.jsx(Wn,{scope:"global",title:"Global",children:n.jsx(ga,{action:n.jsx(Z,{onClick:()=>i?.("github"),size:"sm",type:"button",variant:"outline",children:"Manage GitHub"}),description:d("github-connection").description,title:d("github-connection").label})}):null,f(["repository-defaults"])?n.jsxs(Wn,{scope:"project",title:"Current project",children:[n.jsx(Pc,{loadError:a.projectLoadError,onRetry:()=>{a.retryProject()},project:t,ready:s}),n.jsx(ga,{description:d("repository-defaults").description,title:d("repository-defaults").label})]}):null]});case"agents-mcp":return n.jsxs(n.Fragment,{children:[f(["agent-environments"])?n.jsx(Wn,{scope:"global",title:"Global",children:n.jsx(ga,{action:n.jsx(Z,{onClick:()=>i?.("agent-env"),size:"sm",type:"button",variant:"outline",children:"Open Agent Environments"}),description:d("agent-environments").description,title:d("agent-environments").label})}):null,f(["project-agent-context"])?n.jsxs(Wn,{scope:"project",title:"Current project",children:[n.jsx(Pc,{loadError:a.projectLoadError,onRetry:()=>{a.retryProject()},project:t,ready:s}),n.jsx(ga,{description:d("project-agent-context").description,title:d("project-agent-context").label})]}):null]});case"database-safety":return n.jsxs(Wn,{scope:"project",children:[n.jsx(Pc,{loadError:a.projectLoadError,onRetry:()=>{a.retryProject()},project:t,ready:s}),h("confirm-writes")?n.jsx(Za,{...d("confirm-writes"),checked:a.project.database.confirmWrites,disabled:c,id:"setting-confirm-writes",onChange:p=>{a.updateProject({database:{confirmWrites:p}})}}):null,h("result-limit")?n.jsx(wh,{...d("result-limit"),disabled:c,id:"setting-result-limit",max:5e3,min:10,onSave:p=>a.updateProject({database:{resultLimit:p}}),scopeKey:a.activeProjectPath,value:a.project.database.resultLimit}):null,h("connections")?n.jsx(ga,{action:n.jsx(Z,{disabled:c,onClick:()=>i?.("database"),size:"sm",type:"button",variant:"outline",children:"Open Database"}),description:d("connections").description,title:d("connections").label}):null]});case"notifications":{const p=typeof Notification>"u"?"Unavailable in this runtime":`Permission: ${Notification.permission}`;return n.jsx(Wn,{scope:"global",children:h("desktop-notifications")?n.jsx(ga,{action:n.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:p}),description:d("desktop-notifications").description,title:d("desktop-notifications").label}):null})}case"data-privacy":return n.jsxs(n.Fragment,{children:[f(["local-storage"])?n.jsx(Wn,{scope:"global",title:"Global",children:n.jsx(ga,{description:d("local-storage").description,title:d("local-storage").label})}):null,f(["export-reset"])?n.jsxs(Wn,{scope:"project",title:"Current project",children:[n.jsx(Pc,{loadError:a.projectLoadError,onRetry:()=>{a.retryProject()},project:t,ready:s}),n.jsx(ga,{description:d("export-reset").description,title:d("export-reset").label})]}):null]});case"about":return n.jsx(Wn,{scope:"global",children:n.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-5 gap-y-2 px-4 py-4 text-xs",children:[h("version")?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted-foreground",children:d("version").label}),n.jsxs("code",{children:["v","0.1.77"]})]}):null,h("console")?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted-foreground",children:d("console").label}),n.jsx("code",{children:"127.0.0.1:4317"})]}):null,h("documentation")?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted-foreground",children:d("documentation").label}),n.jsxs("a",{className:"inline-flex items-center gap-1 text-primary hover:underline",href:"https://www.nomoreide.com/docs",rel:"noreferrer",target:"_blank",children:[n.jsx(MC,{className:"size-3"}),"nomoreide.com/docs",n.jsx(Sa,{className:"size-3"})]})]}):null]})})}}function YK({incident:e,onReviewChanges:t}){const{error:s}=hs(),{sendToAgent:i}=Dt(),[a,l]=y.useState(!1),[c,h]=y.useState(null);async function f(){l(!0);try{const{prompt:d,sessionId:p}=await xL(e.id);i({prompt:d,source:{type:"error",label:`${e.service} — ${e.level}`},label:`Fix this ${e.level} in \`${e.service}\`: ${e.title}`}),h(p)}catch(d){s(d instanceof Error?d.message:String(d))}finally{l(!1)}}return n.jsxs("div",{className:"flex h-full min-h-0 min-w-0 flex-col",children:[n.jsxs("div",{className:"shrink-0 border-b border-border px-4 py-3",children:[n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.jsx(We,{variant:e.level==="error"?"danger":"secondary",appearance:"subtle",size:"small",children:e.level}),n.jsx("span",{className:"truncate font-mono text-xs font-semibold",children:e.service}),e.count>1?n.jsxs(We,{variant:"outline",size:"small",children:["×",e.count]}):null]}),n.jsxs(Z,{onClick:()=>{f()},disabled:a,size:"sm",variant:"outline",children:[n.jsx(Yt,{className:"size-3.5"}),a?"Starting…":"Fix with AI"]})]}),n.jsx("p",{className:"mt-1.5 break-words font-mono text-xs text-foreground",children:e.title}),e.file?n.jsxs("p",{className:"mt-1 flex items-center gap-1.5 font-mono text-[11px] text-muted-foreground",children:[n.jsx($C,{className:"size-3.5"}),e.file,e.line?`:${e.line}`:""]}):null,n.jsxs("p",{className:"mt-1 font-mono text-[10px] text-muted-foreground/80",children:["first ",new Date(e.firstSeen).toLocaleString()," · last"," ",new Date(e.lastSeen).toLocaleTimeString()]})]}),n.jsxs("div",{className:"min-h-0 flex-1 overflow-auto p-4",children:[c?n.jsx(Je,{variant:"muted",className:"mb-3",children:n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[n.jsx("span",{className:"text-xs",children:"The agent is working on this in the dock. A snapshot was taken first — review or undo its edits as one change-set."}),t?n.jsxs(Z,{onClick:()=>t(c),size:"sm",variant:"outline",children:[n.jsx(IC,{className:"size-3.5"}),"Review changes"]}):null]})}):null,n.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Log excerpt"}),n.jsx("pre",{className:"overflow-x-auto rounded-md border border-border bg-muted/40 p-3 font-mono text-[11px] leading-relaxed",children:e.logExcerpt.join(`
111
+ `)}),n.jsx("p",{className:"mt-3 text-[11px] text-muted-foreground",children:`"Fix with AI" snapshots the working tree, then sends the agent a repro bundle (this error, the affected file's diff, recent logs, service state, and masked env) so it can fix it — and you can revert the whole change-set if it goes sideways.`})]})]})}function sN(e){return[...e].sort((t,s)=>t.lastSeen<s.lastSeen?1:t.lastSeen>s.lastSeen?-1:s.id-t.id)}function XK(){const[e,t]=y.useState([]),[s,i]=y.useState(!1),[a,l]=y.useState(null),c=y.useCallback(h=>{t(f=>sN([...f.filter(d=>d.id!==h.id),h]))},[]);return y.useEffect(()=>{let h=!0;fE().then(d=>{h&&t(sN(d))}).catch(d=>{h&&l(d instanceof Error?d.message:String(d))});const f=new EventSource("/api/errors/stream");return f.addEventListener("open",()=>i(!0)),f.addEventListener("error",()=>i(!1)),f.addEventListener("incident",d=>{try{const p=JSON.parse(d.data);c(p)}catch{}}),()=>{h=!1,f.close()}},[c]),{incidents:e,connected:s,error:a}}function ZK({inScope:e,onReviewChanges:t}={}){const{incidents:s,connected:i,error:a}=XK(),l=y.useMemo(()=>e?s.filter(d=>e(d.service)):s,[s,e]),[c,h]=y.useState(null);y.useEffect(()=>{if(l.length===0){h(null);return}h(d=>d!==null&&l.some(p=>p.id===d)?d:l[0].id)},[l]);const f=y.useMemo(()=>l.find(d=>d.id===c)??null,[l,c]);return n.jsxs("div",{className:"flex h-full min-h-0 bg-card/85",children:[n.jsxs("div",{className:"flex w-72 shrink-0 flex-col border-r border-border",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(uu,{className:"size-4 text-muted-foreground"}),n.jsx("span",{className:"text-sm font-semibold",children:"Incidents"}),n.jsx(We,{variant:"outline",size:"small",children:l.length})]}),n.jsx(We,{variant:"outline",size:"small",icon:n.jsx("span",{className:ae("inline-block size-1.5 rounded-full",i?"animate-pulse bg-emerald-500":"bg-muted-foreground/60")}),children:i?"live":"reconnecting…"})]}),n.jsx("ul",{className:"min-h-0 flex-1 divide-y divide-border overflow-auto",children:l.map(d=>n.jsx("li",{children:n.jsxs("button",{type:"button",onClick:()=>h(d.id),className:ae("flex w-full flex-col gap-1 px-3 py-2 text-left transition-colors hover:bg-muted/50",d.id===c&&"bg-muted/70"),children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("span",{className:"truncate font-mono text-[11px] font-semibold",children:d.service}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[d.count>1?n.jsxs(We,{variant:"outline",size:"small",children:["×",d.count]}):null,n.jsx(We,{variant:d.level==="error"?"danger":"secondary",appearance:"subtle",size:"small",children:d.level})]})]}),n.jsx("span",{className:"truncate font-mono text-[11px] text-muted-foreground",children:d.title}),n.jsx("span",{className:"font-mono text-[10px] text-muted-foreground/70",children:new Date(d.lastSeen).toLocaleTimeString()})]})},d.id))})]}),n.jsx("div",{className:"min-h-0 min-w-0 flex-1",children:a?n.jsx("div",{className:"p-4",children:n.jsxs(Je,{variant:"muted",className:"border-destructive/40 text-destructive",children:["Failed to load incidents: ",a]})}):f?n.jsx(YK,{incident:f,onReviewChanges:t}):n.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center",children:n.jsxs("div",{className:"max-w-sm",children:[n.jsx(uu,{className:"mx-auto size-8 text-muted-foreground/50"}),n.jsx("p",{className:"mt-3 text-sm font-medium",children:"No incidents yet"}),n.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Errors and stack traces from your running services land here automatically. Each one becomes a one-click prompt for your agent."})]})})})]})}function yf({label:e}){return n.jsx(Je,{variant:"muted",className:"m-4 text-center",children:e})}const QK=900*1e3,Xc=12,lb=200;function JK({events:e}){const[t,s]=y.useState(null),[i,a]=y.useState(null),{rows:l,windowStart:c,windowEnd:h}=y.useMemo(()=>eY(e),[e]),f=t?l.find(d=>d.service===t)??null:null;return n.jsxs(n.Fragment,{children:[n.jsxs(bi,{className:"rounded-none border-0 border-b border-border bg-transparent",children:[n.jsxs(xi,{className:"border-b border-border px-3 py-2",children:[n.jsxs(vi,{className:"flex items-center gap-2",children:[n.jsx(oo,{className:"size-3.5"}),"Runtime Monitor"]}),n.jsx(sr,{className:"text-xs",children:e.length===0?"No events yet":`${e.length} event${e.length===1?"":"s"} · last 15 min`})]}),n.jsx(yi,{className:"p-0",children:l.length===0?n.jsx(yf,{label:"No runtime timeline events yet."}):n.jsxs("div",{className:"divide-y divide-border",children:[l.map(d=>n.jsx(sY,{onClick:()=>s(d.service),row:d,windowEnd:h,windowStart:c},d.service)),n.jsxs("div",{className:"flex justify-between px-3 py-1.5 font-mono text-[10px] text-muted-foreground",children:[n.jsx("span",{children:_f(c)}),n.jsx("span",{children:"now"})]})]})})]}),f?n.jsx(Zn,{icon:n.jsx(oo,{}),onClose:()=>s(null),title:f.service,children:n.jsx(iY,{onSelect:a,row:f})}):null,i?n.jsx(Zn,{icon:n.jsx(oo,{}),onClose:()=>a(null),title:i.title,children:n.jsx(rY,{event:i})}):null]})}function eY(e){const t=Date.now(),s=t,i=t-QK;let a=e.filter(f=>{if(f.kind==="service.http")return!1;const d=new Date(f.timestamp).getTime();return!Number.isNaN(d)&&d>=i});a.length===0&&e.length>0?a=e.slice(-lb):a.length>lb&&(a=a.slice(-lb));const l=new Map;for(const f of a){const d=f.service||"·system",p=l.get(d)??[];p.push(f),l.set(d,p)}const c=Math.max(s-i,1);return{rows:Array.from(l.entries()).map(([f,d])=>{const p=[...d].sort((T,A)=>T.timestamp.localeCompare(A.timestamp)),g=new Array(Xc).fill(0),b=new Array(Xc).fill(null);for(const T of p){const A=new Date(T.timestamp).getTime(),C=Math.max(i,Math.min(s,A)),R=Math.min(Xc-1,Math.floor((C-i)/c*Xc));g[R]+=1;const L=b[R];b[R]=tY(L,T.severity)}const v=p.filter(T=>T.severity==="error").length,w=p.filter(T=>T.severity==="warning").length,k=p.length-v-w,N=[...p].reverse().find(T=>T.severity!=="info")??null,E=v>0?"error":w>0?"warning":"info";return{service:f,events:p,errors:v,warnings:w,infos:k,buckets:g,bucketSeverity:b,lastNotable:N,worstSeverity:E}}).sort((f,d)=>{const p=b=>b.errors*1e3+b.warnings,g=p(d)-p(f);return g!==0?g:f.service.localeCompare(d.service)}),windowStart:i,windowEnd:s}}function tY(e,t){return e==="error"||t==="error"?"error":e==="warning"||t==="warning"?"warning":"info"}function sY({onClick:e,row:t,windowEnd:s,windowStart:i}){const a=Math.max(1,...t.buckets);return n.jsxs("button",{className:"timeline-service-row block w-full px-3 py-2 text-left transition-colors hover:bg-muted/40 focus:outline-none focus-visible:bg-muted/40","data-testid":"timeline-service-row",onClick:e,type:"button",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.jsx("span",{className:ae("size-2 shrink-0 rounded-full",X5(t.worstSeverity))}),n.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium text-foreground",dir:"rtl",children:n.jsx("bdi",{children:t.service})}),t.errors>0?n.jsxs("span",{className:"rounded bg-red-500/15 px-1 font-mono text-[10px] text-red-500",children:[t.errors,"E"]}):null,t.warnings>0?n.jsxs("span",{className:"rounded bg-amber-500/15 px-1 font-mono text-[10px] text-amber-500",children:[t.warnings,"W"]}):null,n.jsx(Dn,{className:"size-3 text-muted-foreground"})]}),n.jsx("div",{className:"timeline-density mt-1.5 grid h-3 gap-px","data-testid":"timeline-density",style:{gridTemplateColumns:`repeat(${Xc}, minmax(0, 1fr))`},children:t.buckets.map((l,c)=>n.jsx(nY,{count:l,max:a,severity:t.bucketSeverity[c]},c))}),t.lastNotable?n.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-muted-foreground",children:t.lastNotable.detail??t.lastNotable.title}):n.jsxs("div",{className:"mt-1 truncate text-[10px] text-muted-foreground",children:[t.infos," info ",t.infos===1?"event":"events"]}),n.jsxs("div",{className:"mt-0.5 flex justify-between font-mono text-[9px] text-muted-foreground/60",children:[n.jsx("span",{children:_f(i)}),n.jsx("span",{children:_f(s)})]})]})}function nY({count:e,max:t,severity:s}){if(e===0)return n.jsx("span",{className:"rounded-sm bg-border/60"});const i=Math.min(1,.35+e/t*.65);return n.jsx("span",{className:ae("rounded-sm",aY(s)),style:{opacity:i},title:`${e} event${e===1?"":"s"}`})}function iY({onSelect:e,row:t}){const s=[...t.events].sort((i,a)=>a.timestamp.localeCompare(i.timestamp));return n.jsxs("div",{className:"flex max-h-[480px] flex-col overflow-hidden",children:[n.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-4 py-2 text-xs text-muted-foreground",children:[n.jsxs("span",{children:[t.events.length," events"]}),n.jsx("span",{children:"·"}),n.jsxs("span",{children:[t.errors," error",t.errors===1?"":"s"]}),n.jsx("span",{children:"·"}),n.jsxs("span",{children:[t.warnings," warning",t.warnings===1?"":"s"]})]}),n.jsx("ul",{className:"min-h-0 divide-y divide-border overflow-auto",children:s.map(i=>n.jsx("li",{children:n.jsxs("button",{className:"block w-full px-4 py-2 text-left hover:bg-muted/40 focus:outline-none focus-visible:bg-muted/40",onClick:()=>e(i),type:"button",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:ae("size-2 shrink-0 rounded-full",X5(i.severity))}),n.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium text-foreground",children:i.title}),n.jsx("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:_f(i.timestamp)})]}),i.detail?n.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-muted-foreground",children:i.detail}):null]})},i.id))})]})}function rY({event:e}){const t=new Date(e.timestamp);return n.jsxs("div",{className:"space-y-3 p-4 text-sm",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("span",{className:ae("rounded px-1.5 py-0.5 font-mono text-[10px] uppercase text-white",oY(e.severity)),children:e.severity}),n.jsx("span",{className:"rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:e.kind}),e.service?n.jsx("span",{className:"rounded border border-border bg-background px-1.5 py-0.5 font-mono text-[10px] text-foreground",children:e.service}):null]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-xs text-muted-foreground",children:"When"}),n.jsx("div",{className:"font-mono text-xs",children:Number.isNaN(t.getTime())?e.timestamp:t.toLocaleString()})]}),e.detail?n.jsxs("div",{children:[n.jsx("div",{className:"text-xs text-muted-foreground",children:"Detail"}),n.jsx("pre",{className:"mt-1 max-h-72 overflow-auto whitespace-pre-wrap rounded border border-border bg-background p-3 font-mono text-xs",children:e.detail})]}):null]})}function X5(e){return e==="error"?"bg-red-500":e==="warning"?"bg-amber-500":"bg-zinc-400"}function aY(e){return e==="error"?"bg-red-500":e==="warning"?"bg-amber-500":"bg-zinc-500"}function oY(e){return e==="error"?"bg-red-600":e==="warning"?"bg-amber-600":"bg-zinc-700"}function _f(e){const t=typeof e=="number"?new Date(e):new Date(e);return Number.isNaN(t.getTime())?"--:--:--":t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}const m0=150,bl=40,nN=200,iN=64,Sh=20;function lY({statuses:e,health:t,hasDependencies:s,onSelectService:i}){const[a,l]=y.useState(null),[c,h]=y.useState(null);y.useEffect(()=>{let p=!0;return fO().then(g=>{p&&l(g)}).catch(g=>{p&&h(g instanceof Error?g.message:String(g))}),()=>{p=!1}},[]);const f=y.useMemo(()=>a?cY(a.nodes):null,[a]);if(c)return n.jsxs(Je,{variant:"destructive",children:["Couldn't load the dependency graph: ",c]});if(!a||!f)return n.jsxs("div",{className:"flex items-center justify-center gap-2 py-10 text-sm text-muted-foreground",children:[n.jsx(Rt,{className:"size-4 animate-spin"}),"Loading graph…"]});if(!s)return n.jsx("div",{className:"grid gap-3",children:n.jsxs(Je,{variant:"muted",children:[n.jsx("div",{className:"font-medium",children:"No dependencies declared yet."}),n.jsxs("div",{className:"mt-1 text-xs",children:["Edit a service and pick the services it should wait for under"," ",n.jsx("span",{className:"font-medium",children:"Dependencies"}),". Groups then start in dependency order, waiting for each service's port before the next."]})]})});const d=a.nodes.filter(p=>p.missing.length>0);return n.jsxs("div",{className:"grid gap-3",children:[a.cycles.length>0?n.jsxs(Je,{variant:"destructive",children:[n.jsxs("div",{className:"flex items-center gap-1.5 font-medium",children:[n.jsx(Rr,{className:"size-4"}),"Dependency cycle detected"]}),n.jsxs("div",{className:"mt-1 text-xs",children:[a.cycles.map(p=>p.join(" → ")).join("; "),". Group start will refuse to run until this is resolved."]})]}):null,d.length>0?n.jsx(Je,{variant:"muted",children:n.jsx("div",{className:"text-xs",children:d.map(p=>n.jsxs("div",{children:[n.jsx("span",{className:"font-medium",children:p.name})," depends on unknown service",p.missing.length>1?"s":"",": ",p.missing.join(", ")]},p.name))})}):null,n.jsx("div",{className:"overflow-auto rounded-md border border-border bg-muted/20 p-2",children:n.jsxs("svg",{"aria-label":"Service dependency graph",height:f.height,role:"img",width:f.width,children:[f.edges.map(p=>n.jsx("path",{className:"fill-none stroke-border",d:p.path,strokeWidth:1.5},`${p.from}->${p.to}`)),f.nodes.map(p=>{const g=e[p.name],b=uY(g?.state,t[p.name]?.status);return n.jsxs("g",{"aria-label":`Select ${p.name}`,className:"cursor-pointer",onClick:()=>i(p.name),transform:`translate(${p.x}, ${p.y})`,children:[n.jsx("rect",{className:ae("stroke-2",b.fill,b.stroke),height:bl,rx:6,width:m0}),n.jsx("circle",{className:b.dot,cx:14,cy:bl/2,r:4}),n.jsx("text",{className:"fill-foreground text-[11px] font-medium",dominantBaseline:"middle",x:26,y:bl/2,children:dY(p.name)})]},p.name)})]})}),a.order.length>0?n.jsxs("div",{className:"text-[11px] text-muted-foreground",children:[n.jsx("span",{className:"font-medium uppercase tracking-wide",children:"Start order:"})," ",a.order.join(" → ")]}):null]})}function cY(e){const t=new Map(e.map(g=>[g.name,g.dependsOn])),s=new Map,i=new Set,a=g=>{const b=s.get(g);if(b!==void 0)return b;if(i.has(g))return 0;i.add(g);const v=t.get(g)??[],w=v.length===0?0:Math.max(...v.map(k=>a(k)+1));return i.delete(g),s.set(g,w),w};for(const g of e)a(g.name);const l=new Map,c=e.map(g=>{const b=s.get(g.name)??0,v=l.get(b)??0;return l.set(b,v+1),{...g,x:Sh+b*nN,y:Sh+v*iN}}),h=new Map(c.map(g=>[g.name,g])),f=c.flatMap(g=>g.dependsOn.flatMap(b=>{const v=h.get(b);if(!v)return[];const w=v.x+m0,k=v.y+bl/2,N=g.x,E=g.y+bl/2,T=(w+N)/2;return[{from:b,to:g.name,path:`M ${w} ${k} C ${T} ${k}, ${T} ${E}, ${N} ${E}`}]})),d=Math.max(0,...c.map(g=>s.get(g.name)??0)),p=Math.max(1,...l.values());return{nodes:c,edges:f,width:Sh*2+d*nN+m0,height:Sh*2+(p-1)*iN+bl}}function uY(e,t){return e==="running"?t==="warning"?{fill:"fill-amber-500/10",stroke:"stroke-amber-500/60",dot:"fill-amber-500"}:t==="unhealthy"?{fill:"fill-red-500/10",stroke:"stroke-red-500/60",dot:"fill-red-500"}:{fill:"fill-emerald-500/10",stroke:"stroke-emerald-500/60",dot:"fill-emerald-500"}:e==="starting"?{fill:"fill-amber-500/10",stroke:"stroke-amber-500/60",dot:"fill-amber-500"}:e==="exited"?{fill:"fill-red-500/10",stroke:"stroke-red-500/60",dot:"fill-red-500"}:{fill:"fill-card",stroke:"stroke-border",dot:"fill-muted-foreground"}}function dY(e,t=18){return e.length>t?`${e.slice(0,t-1)}…`:e}function hY({onOnboardRepo:e,onOnboardWithAi:t,onCreateService:s,onCreateWithAi:i}){return n.jsx("div",{className:"flex h-full min-h-0 items-center justify-center overflow-auto bg-card/85 p-6",children:n.jsxs("div",{className:"w-full max-w-xl space-y-6",children:[n.jsxs("div",{className:"space-y-2 text-center",children:[n.jsx("h2",{className:"text-xl font-semibold",children:"Set up your first service"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"NoMoreIDE runs and watches your services so you don't have to babysit terminals. Add your first one to get started — or let the agent do it for you."})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx(rN,{icon:n.jsx(Mn,{className:"size-5"}),title:"Add from GitHub",description:"Point at a repo — we detect how to run it and register it for you.",onClick:e,onAi:t,aiTitle:"Onboard with AI — the agent clones, detects and runs it for you"}),n.jsx(rN,{icon:n.jsx(ws,{className:"size-5"}),title:"Create a service",description:"Define the command, working directory and port yourself.",onClick:s,onAi:i,aiTitle:"Set up with AI — the agent walks you through it, one step at a time"})]})]})})}function rN({icon:e,title:t,description:s,onClick:i,onAi:a,aiTitle:l}){return n.jsxs("div",{className:"group flex items-stretch overflow-hidden rounded-lg border border-border bg-card shadow-sm transition-colors hover:border-foreground/20",children:[n.jsxs("button",{className:"flex flex-1 items-start gap-3 px-4 py-4 text-left hover:bg-muted/60",onClick:i,type:"button",children:[n.jsx("span",{className:"mt-0.5 shrink-0 text-muted-foreground",children:e}),n.jsxs("span",{className:"min-w-0 space-y-1",children:[n.jsx("span",{className:"block text-sm font-semibold",children:t}),n.jsx("span",{className:"block text-xs text-muted-foreground",children:s})]})]}),n.jsxs("button",{className:"flex shrink-0 items-center gap-1.5 border-l border-border px-4 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground",onClick:a,title:l,type:"button",children:[n.jsx(Yt,{className:"size-4 shrink-0"}),"AI"]})]})}function fY({health:e}){if(!e)return null;const t=e.processTree,s=e.status==="healthy"||e.status==="unknown"?void 0:bY(e.summary);return n.jsxs("div",{className:"mt-1.5 grid min-w-0 gap-2 text-[11px] text-muted-foreground sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.jsxs("span",{className:ae("inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2.5 font-medium",mY(e.status)),children:[n.jsx("span",{className:"inline-flex shrink-0",children:n.jsx(oo,{className:"size-3"})}),n.jsx("span",{className:"whitespace-nowrap",children:e.status})]}),s?n.jsx("span",{className:"min-w-0 truncate",children:s}):null]}),t?n.jsxs("div",{className:"health-metrics flex min-w-max items-center gap-2 font-mono sm:justify-end",children:[n.jsxs("span",{className:"inline-flex items-center gap-1 font-mono",children:[n.jsx(l6,{className:"size-3"}),t.processCount," ",t.processCount===1?"process":"processes"]}),n.jsxs("span",{children:[gY(t.cpuPercent)," CPU"]}),n.jsxs("span",{className:"inline-flex items-center gap-1 font-mono",children:[n.jsx(CM,{className:"size-3"}),pY(t.rssMb)," RAM"]})]}):null]})}function mY(e){return e==="healthy"?"bg-emerald-600 text-white":e==="warning"?"bg-amber-600 text-white":e==="unhealthy"?"bg-red-600 text-white":"bg-zinc-700 text-white"}function pY(e){return Number.isInteger(e)?`${e} MB`:`${e.toFixed(1)} MB`}function gY(e){return`${e.toFixed(1)}%`}function bY(e){return e.replace(/^Recent error log:\s*/i,"Recent stderr: ").replace(/:\s*\d+(?:\.\d+)? MB RSS\.?$/i,"").replace(/\s+RSS\.?$/i,"")}function xY({ports:e}){const t=e.filter(i=>i.state==="occupied").length,s=e.filter(i=>i.state==="managed").length;return n.jsxs(bi,{className:"rounded-none border-0 border-b border-border bg-transparent",children:[n.jsxs(xi,{className:"border-b border-border px-3 py-2",children:[n.jsxs(vi,{className:"flex items-center gap-2",children:[n.jsx(zM,{className:"size-3.5"}),"Ports"]}),n.jsxs(sr,{className:"text-xs",children:[s," managed, ",t," occupied by other"]})]}),n.jsx(yi,{className:"p-0",children:e.length?n.jsx("div",{className:"divide-y divide-border",children:e.map(i=>n.jsxs("div",{className:"grid grid-cols-[1fr_auto] items-center gap-2 px-3 py-2",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsxs("div",{className:"font-mono text-xs",children:[":",i.port]}),n.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:i.services.join(", ")||"Unassigned"}),i.urls[0]?n.jsx("div",{className:"truncate font-mono text-[10px] text-muted-foreground",children:i.urls[0]}):null]}),n.jsx(vY,{port:i})]},i.port))}):n.jsx(yf,{label:"No configured ports yet."})})]})}function vY({compact:e,port:t}){const s=t.state==="managed"?"managed":t.state==="occupied"?"occupied by other":"available",i=t.state==="managed"?"success":t.state==="occupied"?"warning":"outline";return n.jsx(We,{className:ae(e&&"max-w-36 truncate"),variant:i,children:s})}function yY({onChange:e,value:t}){return n.jsxs("div",{className:"relative block",children:[n.jsx(ZC,{className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),n.jsx(ft,{"aria-label":"Search logs",className:"h-8 w-44 pl-7 text-xs",onChange:s=>e(s.target.value),placeholder:"Search logs",value:t})]})}function _Y({className:e,containerRef:t,emptyText:s,logs:i,query:a,showTimestamps:l=!0,wrapLines:c=!0}){return n.jsx("div",{className:ae("code-font-size h-full max-w-full overflow-auto bg-background font-mono leading-5 dark:bg-zinc-950",e),ref:t,role:"log",children:i.length?i.map((h,f)=>n.jsxs("div",{className:ae("grid min-w-max gap-2 border-b border-border/45 px-3 py-0.5 dark:border-zinc-800/80",l?"grid-cols-[88px_minmax(420px,1fr)]":"grid-cols-[minmax(420px,1fr)]",h.stream==="stderr"?"bg-red-50/70 text-red-800 dark:bg-red-950/35 dark:text-red-100":"bg-emerald-50/35 text-zinc-800 dark:bg-zinc-950 dark:text-zinc-200 dark:odd:bg-zinc-900/45"),children:[l?n.jsx("span",{className:"text-muted-foreground dark:text-zinc-500",title:h.timestamp,children:wY(h.timestamp)}):null,n.jsxs("span",{className:c?"whitespace-pre-wrap break-words":"whitespace-pre",children:[h.stream==="stderr"?n.jsx("span",{className:"mr-2 rounded bg-red-100 px-1 font-semibold uppercase text-red-700 dark:bg-red-500/15 dark:text-red-300 dark:ring-1 dark:ring-red-400/20",children:"stderr"}):null,NY(h.text,a)]})]},kY(h,f))):n.jsx("div",{className:"p-3 text-muted-foreground",children:s})})}function wY(e){const t=/T(\d{2}:\d{2}:\d{2})(?:\.(\d{1,3}))?/.exec(e);return t?t[2]?`${t[1]}.${t[2]}`:t[1]:e}function SY(e){return`${e.timestamp} ${e.stream} ${e.text}`}function kY(e,t){return e.cursor??`${e.service}-${e.timestamp}-${e.stream}-${t}`}function NY(e,t){const s=t.trim();if(!s)return e;const i=e.toLowerCase(),a=s.toLowerCase(),l=[];let c=0,h=i.indexOf(a);for(;h!==-1;){h>c&&l.push(e.slice(c,h));const f=h+s.length;l.push(n.jsx("mark",{className:"rounded bg-amber-200 px-0.5 text-amber-950 dark:bg-amber-400/20 dark:text-amber-200",children:e.slice(h,f)},`${h}-${f}`)),c=f,h=i.indexOf(a,c)}return c<e.length&&l.push(e.slice(c)),l}function aN(e){return`${e.kind}:${e.name}`}function CY(e,t=!1,s={}){const[i,a]=y.useState(),[l,c]=y.useState(),[h,f]=y.useState(e.kind==="source"),d=JSON.stringify(s);return y.useEffect(()=>{a(void 0),c(void 0);let p=!1;const g=async()=>{try{if(e.kind==="service"){const v=await _E(e.name,s);p||(a(v.logs),f(v.queryable),c(void 0))}else{const v=await xE(e.name,s);p||(a(v),f(!0),c(void 0))}}catch(v){p||c(v instanceof Error?v.message:String(v))}};g();const b=window.setInterval(g,t?1e3:2e3);return()=>{p=!0,window.clearInterval(b)}},[e.kind,e.name,t,d]),{logs:i,error:l,queryable:h}}const EY=[{label:"Live tail",value:""},{label:"Last 15 min",value:"15 min ago"},{label:"Last hour",value:"1 hour ago"},{label:"Today",value:"today"},{label:"Last 24h",value:"1 day ago"},{label:"Last 7 days",value:"7 days ago"}];function Z5({target:e,query:t,setQuery:s,streaming:i,setStreaming:a,hideStdout:l,setHideStdout:c,fill:h=!1,leading:f,trailing:d}){const g=nm()?.confirmedProject.logs??{showTimestamps:!0,wrapLines:!0},b=e.kind==="source",[v,w]=y.useState(""),[k,N]=y.useState(""),[E,T]=y.useState(t);y.useEffect(()=>{const U=window.setTimeout(()=>T(t),300);return()=>window.clearTimeout(U)},[t]);const A=y.useMemo(()=>{const U={};v&&(U.since=v),k&&(U.level=k);const F=E.trim();return F&&(U.grep=F),U},[v,k,E]),{logs:C,error:R,queryable:L}=CY(e,i,A),H=b||L,B=y.useRef(null),P=y.useRef(!0),[D,G]=y.useState([]),[$,O]=y.useState(!1),V=JSON.stringify(A);y.useEffect(()=>{G([])},[V,e.kind,e.name]);const K=y.useMemo(()=>{const U=C??[];if(D.length===0)return U;const F=new Set(D.map(re=>re.cursor).filter(Boolean));return[...D,...U.filter(re=>!re.cursor||!F.has(re.cursor))]},[C,D]),I=(D[0]??(C??[])[0])?.cursor;async function Y(){if(!(!H||!I||$)){O(!0),P.current=!1;try{const U={...A,before:I,lines:200},F=e.kind==="source"?await xE(e.name,U):(await _E(e.name,U)).logs;F.length&&G(re=>{const fe=new Set(re.map(te=>te.cursor).filter(Boolean));return[...F.filter(te=>!te.cursor||!fe.has(te.cursor)),...re]})}finally{O(!1)}}}const W=t.trim().toLowerCase(),le=y.useMemo(()=>{let U=K;return l&&(U=U.filter(F=>F.stream==="stderr")),W&&(U=U.filter(F=>SY(F).toLowerCase().includes(W))),U},[K,l,W]);y.useEffect(()=>{const U=B.current;if(!U)return;const F=()=>{const re=U.scrollHeight-U.scrollTop-U.clientHeight;P.current=re<40};return F(),U.addEventListener("scroll",F,{passive:!0}),()=>U.removeEventListener("scroll",F)},[]),y.useEffect(()=>{if(!i||!P.current||le.length===0)return;const U=B.current;U&&(U.scrollTop=U.scrollHeight)},[i,le]);const J=C?W?`No log lines match "${t.trim()}".`:l?"No stderr output captured.":"No log entries.":"Loading…";return n.jsxs("div",{className:h?"flex h-full min-h-0 flex-col gap-2":"flex flex-col gap-2",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f,n.jsx(yY,{onChange:s,value:t}),H?n.jsxs(n.Fragment,{children:[n.jsx("select",{"aria-label":"Time range",className:"h-8 rounded-md border border-border bg-background px-2 text-xs",onChange:U=>w(U.target.value),value:v,children:EY.map(U=>n.jsx("option",{value:U.value,children:U.label},U.label))}),n.jsxs("select",{"aria-label":"Level",className:"h-8 rounded-md border border-border bg-background px-2 text-xs",onChange:U=>N(U.target.value),value:k,children:[n.jsx("option",{value:"",children:"All levels"}),n.jsx("option",{value:"warn",children:"Warnings+"}),n.jsx("option",{value:"error",children:"Errors"})]})]}):n.jsxs(oN,{active:l,activeClassName:"border-amber-600 bg-amber-50 text-amber-700 dark:border-amber-400/40 dark:bg-amber-500/15 dark:text-amber-300",onClick:()=>c(!l),children:[n.jsx(M6,{}),"Errors only"]}),n.jsxs(oN,{active:i,activeClassName:"border-emerald-600 bg-emerald-50 text-emerald-700 dark:border-emerald-400/40 dark:bg-emerald-500/15 dark:text-emerald-300",onClick:()=>a(!i),children:[n.jsx(s8,{}),i?"Streaming":"Stream"]}),H&&I?n.jsxs(Z,{disabled:$,onClick:()=>{Y()},size:"sm",type:"button",variant:"outline",children:[n.jsx(Rf,{}),$?"Loading…":"Load older"]}):null,d?n.jsx("div",{className:"ml-auto flex items-center gap-2",children:d}):null]}),R?n.jsx("div",{className:"text-red-600",children:R}):null,n.jsx(_Y,{className:ae("rounded border border-border/60",h?"min-h-0 flex-1":"max-h-80"),containerRef:B,emptyText:J,logs:le,query:t,showTimestamps:g.showTimestamps,wrapLines:g.wrapLines})]})}function oN({active:e,activeClassName:t,children:s,onClick:i}){return n.jsx(Z,{"aria-pressed":e,className:e?t:void 0,onClick:i,size:"sm",type:"button",variant:"outline",children:s})}function jY(e,t){return e.kind===t.kind&&e.name===t.name}function AY({options:e,target:t,onChange:s,className:i}){const a=e.findIndex(c=>jY(c.target,t)),l=[...new Set(e.map(c=>c.group))];return n.jsx("select",{"aria-label":"Log source",className:i??"h-8 max-w-44 rounded-md border border-border bg-background px-2 text-xs",onChange:c=>s(e[Number(c.target.value)].target),value:String(a),children:l.map(c=>n.jsx("optgroup",{label:c,children:e.map((h,f)=>h.group===c?n.jsx("option",{value:String(f),children:h.label},`${h.group}:${h.label}`):null)},c))})}function TY({serviceName:e}){const[t,s]=y.useState(""),[i,a]=y.useState(!1),[l,c]=y.useState(!1),[h,f]=y.useState(!1),d=n.jsx(Z5,{fill:!0,hideStdout:l,query:t,setHideStdout:c,setQuery:s,setStreaming:a,streaming:i,target:{kind:"service",name:e},trailing:n.jsx(Z,{"aria-label":h?"Exit fullscreen logs":"Expand logs",className:"text-muted-foreground hover:text-foreground",onClick:()=>f(p=>!p),size:"icon-sm",title:h?"Exit fullscreen":"Expand",type:"button",variant:"ghost",children:h?n.jsx(L0,{}):n.jsx(D0,{})})});return h?n.jsx(Dv,{onClose:()=>f(!1),title:`Logs — ${e}`,children:d}):n.jsx("div",{className:"h-[60vh] min-h-[24rem]",children:d})}function Dv({title:e,onClose:t,children:s,maxWidthClass:i="max-w-6xl"}){return y.useEffect(()=>{function a(l){l.key==="Escape"&&t()}return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[t]),nr.createPortal(n.jsx("div",{className:"fixed inset-0 z-[1000] bg-black/40 p-4 sm:p-8",onMouseDown:t,children:n.jsxs("div",{"aria-modal":"true",className:`mx-auto flex h-full ${i} flex-col overflow-hidden rounded-lg border border-border bg-card text-xs shadow-xl`,onMouseDown:a=>a.stopPropagation(),role:"dialog",children:[n.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-2",children:[n.jsx("h2",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:e}),n.jsx(Z,{"aria-label":"Close logs",onClick:t,size:"icon",type:"button",variant:"ghost",children:n.jsx(qt,{})})]}),n.jsx("div",{className:"min-h-0 flex-1 p-3",children:s})]})}),document.body)}const RY={journald:"Queries `journalctl -u <unit>` — time range, text, and level filter server-side. Add a host to run it over SSH.",docker:"Queries `docker logs <container>` — time window server-side. Add a host to run it over SSH.",ssh:"Reads via `ssh <host> tail -n 500 <path>` using your ~/.ssh/config + ssh-agent.",file:"Tails an absolute file path on this machine.",command:"Runs the command and treats its output as the log (kubectl logs, …)."};function MY({onClose:e,onAdded:t}){const[s,i]=y.useState(""),[a,l]=y.useState("journald"),[c,h]=y.useState(""),[f,d]=y.useState(""),[p,g]=y.useState(""),[b,v]=y.useState(""),[w,k]=y.useState(""),[N,E]=y.useState(""),[T,A]=y.useState(),[C,R]=y.useState(!1);async function L(){R(!0),A(void 0);try{const H={name:s.trim(),kind:"command"};a==="file"?(H.kind="file",H.path=f.trim()):a==="ssh"?(H.kind="ssh",H.host=c.trim(),H.path=f.trim()):a==="command"?(H.kind="command",H.command=p.trim(),b.trim()&&(H.cwd=b.trim())):a==="journald"?(H.driver="journald",H.unit=w.trim(),c.trim()&&(H.host=c.trim())):a==="docker"&&(H.driver="docker",H.container=N.trim(),c.trim()&&(H.host=c.trim()));const B=await nO(H);t(B,H.name),e()}catch(H){A(H instanceof Error?H.message:String(H))}finally{R(!1)}}return n.jsx(Zn,{icon:n.jsx(XC,{}),onClose:e,size:"md",title:"Add log source",children:n.jsxs("form",{className:"flex flex-col gap-3 p-4 text-xs",onSubmit:H=>{H.preventDefault(),L()},children:[n.jsx(Cr,{label:"Name",children:n.jsx(ft,{autoFocus:!0,onChange:H=>i(H.target.value),placeholder:"PROD",value:s})}),n.jsxs(Cr,{label:"Type",children:[n.jsxs("select",{className:"h-9 w-full rounded-md border border-border bg-background px-2 text-xs",onChange:H=>l(H.target.value),value:a,children:[n.jsx("option",{value:"journald",children:"systemd journal (journald)"}),n.jsx("option",{value:"docker",children:"Docker container"}),n.jsx("option",{value:"ssh",children:"Remote file (SSH)"}),n.jsx("option",{value:"file",children:"Local file"}),n.jsx("option",{value:"command",children:"Command"})]}),n.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:RY[a]})]}),a==="journald"||a==="docker"?n.jsx(Cr,{label:"Host (optional — leave blank to run locally)",children:n.jsx(ft,{onChange:H=>h(H.target.value),placeholder:"jobjourney-prod (an alias from ~/.ssh/config)",value:c})}):null,a==="journald"?n.jsx(Cr,{label:"Unit",children:n.jsx(ft,{onChange:H=>k(H.target.value),placeholder:"jobjourney",value:w})}):null,a==="docker"?n.jsx(Cr,{label:"Container",children:n.jsx(ft,{onChange:H=>E(H.target.value),placeholder:"brainctl-api",value:N})}):null,a==="ssh"?n.jsx(Cr,{label:"Host",children:n.jsx(ft,{onChange:H=>h(H.target.value),placeholder:"prod (an alias from ~/.ssh/config)",value:c})}):null,a==="file"||a==="ssh"?n.jsx(Cr,{label:a==="ssh"?"Remote path":"File path",children:n.jsx(ft,{onChange:H=>d(H.target.value),placeholder:"/var/log/app/out.log",value:f})}):null,a==="command"?n.jsxs(n.Fragment,{children:[n.jsx(Cr,{label:"Command",children:n.jsx(ft,{onChange:H=>g(H.target.value),placeholder:"kubectl logs -l app=myapp --tail 500",value:p})}),n.jsx(Cr,{label:"Working directory (optional)",children:n.jsx(ft,{onChange:H=>v(H.target.value),placeholder:"/srv/app",value:b})})]}):null,T?n.jsx("div",{className:"text-red-600",children:T}):null,n.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[n.jsx(Z,{onClick:e,size:"sm",type:"button",variant:"outline",children:"Cancel"}),n.jsx(Z,{disabled:C||!s.trim(),size:"sm",type:"submit",children:C?"Saving…":"Add source"})]})]})})}function Cr({label:e,children:t}){return n.jsxs("label",{className:"flex flex-col gap-1",children:[n.jsx("span",{className:"font-medium text-muted-foreground",children:e}),t]})}const lN=4;function DY({services:e,initialService:t,onClose:s}){const[i,a]=y.useState([]),[l,c]=y.useState(!1),[h,f]=y.useState(()=>[0]),[d,p]=y.useState(()=>{const A=t?{kind:"service",name:t}:e[0]?{kind:"service",name:e[0]}:void 0;return A?{0:A}:{}}),g=y.useRef(1);y.useEffect(()=>{let A=!1;return sO().then(C=>{A||a(C)}),()=>{A=!0}},[]);const b=[...e.map(A=>({target:{kind:"service",name:A},label:A,group:"Services"})),...i.map(A=>({target:{kind:"source",name:A.name},label:A.name,group:"Log sources"}))],v=b.map(A=>A.target);function w(){if(h.length>=lN||v.length===0)return;const A=g.current++,C=new Set(Object.values(d).map(aN)),R=v.find(L=>!C.has(aN(L)))??v[0];f(L=>[...L,A]),p(L=>({...L,[A]:R}))}function k(A){f(C=>C.filter(R=>R!==A)),p(C=>{const R={...C};return delete R[A],R})}function N(A,C){p(R=>({...R,[A]:C}))}function E(A,C){a(A);const R=h[0];R!==void 0&&N(R,{kind:"source",name:C})}const T=n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{children:"Logs"}),n.jsxs(Z,{onClick:()=>c(!0),size:"sm",type:"button",variant:"outline",children:[n.jsx(ws,{}),"Add source"]}),n.jsxs(Z,{disabled:h.length>=lN||v.length===0,onClick:w,size:"sm",type:"button",variant:"outline",children:[n.jsx(ws,{}),"Add pane"]})]});return n.jsxs(n.Fragment,{children:[n.jsx(Dv,{maxWidthClass:"max-w-[1500px]",onClose:s,title:T,children:v.length===0?n.jsx("div",{className:"grid h-full place-items-center text-center text-muted-foreground",children:n.jsxs("div",{children:[n.jsx("p",{children:"No services or log sources yet."}),n.jsxs(Z,{className:"mt-2",onClick:()=>c(!0),size:"sm",type:"button",children:[n.jsx(ws,{}),"Add a log source"]})]})}):n.jsx("div",{className:ae("grid h-full min-h-0 gap-3",h.length>1?"lg:grid-cols-2":"grid-cols-1",h.length>2?"lg:grid-rows-2":"grid-rows-1"),children:h.map(A=>n.jsx(LY,{onChangeTarget:C=>N(A,C),onRemove:h.length>1?()=>k(A):void 0,options:b,target:d[A]??v[0]},A))})}),l?n.jsx(MY,{onAdded:E,onClose:()=>c(!1)}):null]})}function LY({options:e,target:t,onChangeTarget:s,onRemove:i}){const[a,l]=y.useState(""),[c,h]=y.useState(!0),[f,d]=y.useState(!1);return n.jsx("div",{className:"flex min-h-0 min-w-0 flex-col rounded-lg border border-border bg-background/60 p-2",children:n.jsx(Z5,{fill:!0,hideStdout:f,leading:n.jsx(AY,{onChange:s,options:e,target:t}),query:a,setHideStdout:d,setQuery:l,setStreaming:h,streaming:c,target:t,trailing:i?n.jsx(Z,{"aria-label":"Remove pane",onClick:i,size:"icon",type:"button",variant:"ghost",children:n.jsx(qt,{})}):void 0})})}function OY({runtime:e,reloading:t,onReload:s}){if(!e?.stale)return null;const i=e.staleFiles,a=i.length===1?`${i[0].relativePath} was edited`:`${i.length} config files were edited`;return n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded border border-amber-500/40 bg-amber-500/10 px-2.5 py-1.5 text-amber-700 dark:text-amber-400",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Rr,{className:"size-4 shrink-0"}),n.jsxs("span",{children:["Running with a stale configuration — ",a," after this service started. Reload to apply."]})]}),n.jsxs(Z,{disabled:t,onClick:s,size:"sm",type:"button",variant:"outline",children:[n.jsx(a8,{})," ",t?"Reloading…":"Reload service"]})]})}function zY({rows:e,revealAll:t,onAdd:s,onRemove:i,onUpdate:a}){return e.length===0?n.jsxs("div",{className:"text-muted-foreground",children:["No variables yet."," ",n.jsx("button",{className:"underline",onClick:s,type:"button",children:"Add one"}),"."]}):n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full font-mono text-[11px]",children:[n.jsx("thead",{className:"text-left text-muted-foreground",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-1 pr-3",children:"Key"}),n.jsx("th",{className:"py-1 pr-3",children:"Value"}),n.jsx("th",{className:"py-1 w-8"})]})}),n.jsx("tbody",{children:e.map((l,c)=>{const h=!l.reveal&&!t;return n.jsxs("tr",{className:"border-t border-border/40",children:[n.jsx("td",{className:"py-1 pr-3 align-top",children:n.jsx("input",{className:"w-full rounded border border-border/60 bg-background px-1.5 py-0.5 font-mono",onChange:f=>a(c,{key:f.target.value}),placeholder:"KEY",spellCheck:!1,value:l.key})}),n.jsx("td",{className:"py-1 pr-3 align-top",children:n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("input",{className:"w-full rounded border border-border/60 bg-background px-1.5 py-0.5 font-mono",onChange:f=>a(c,{value:f.target.value}),spellCheck:!1,type:h?"password":"text",value:l.value}),n.jsx("button",{className:"text-muted-foreground hover:text-foreground",onClick:()=>a(c,{reveal:!l.reveal}),title:l.reveal||t?"Hide":"Reveal",type:"button",children:l.reveal||t?n.jsx(j0,{size:14}):n.jsx(Lf,{size:14})})]})}),n.jsx("td",{className:"py-1 align-top",children:n.jsx("button",{className:"text-muted-foreground hover:text-red-600",onClick:()=>i(c),type:"button",children:n.jsx(Oi,{size:14})})})]},c)})})]})})}function BY({serviceName:e,onClose:t,onPick:s}){const[i,a]=y.useState(),[l,c]=y.useState(),[h,f]=y.useState(!0),[d,p]=y.useState();y.useEffect(()=>{let v=!1;return f(!0),c(void 0),(async()=>{try{const w=await bO(e,d);v||a(w)}catch(w){v||c(w instanceof Error?w.message:String(w))}finally{v||f(!1)}})(),()=>{v=!0}},[e,d]);function g(v){if(v.kind==="directory"){p(v.relativePath);return}v.supported&&s(v.relativePath)}function b(){if(!i||i.isRoot)return;const v=i.relativePath,w=v.includes("/")?v.slice(0,v.lastIndexOf("/")):"";p(w||void 0)}return n.jsx(Zn,{icon:n.jsx(Of,{}),onClose:t,size:"lg",title:"Pick a config file",children:n.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[n.jsxs(Z,{disabled:!i||i.isRoot,onClick:b,size:"sm",type:"button",variant:"outline",children:[n.jsx(Rf,{})," Up"]}),n.jsx("code",{className:"truncate rounded bg-muted px-2 py-1 font-mono",children:i?.relativePath||"./"})]}),l?n.jsx("div",{className:"text-red-600",children:l}):h?n.jsx("div",{className:"text-muted-foreground",children:"Loading…"}):!i||i.entries.length===0?n.jsx("div",{className:"text-muted-foreground",children:"Empty directory."}):n.jsx("div",{className:"max-h-[50vh] overflow-auto rounded border border-border/60",children:n.jsx("ul",{className:"divide-y divide-border/40",children:i.entries.map(v=>{const w=v.kind==="directory",k=w||v.supported;return n.jsx("li",{children:n.jsxs("button",{className:ae("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs",k?"hover:bg-muted":"cursor-not-allowed text-muted-foreground"),disabled:!k,onClick:()=>g(v),type:"button",children:[w?n.jsx(xo,{size:14}):n.jsx(HC,{size:14}),n.jsx("span",{className:"flex-1 truncate font-mono",children:v.name}),!w&&v.format?n.jsx(We,{size:"small",variant:"secondary",children:v.format}):null]})},v.relativePath)})})}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Only ",n.jsx("code",{children:".env*"}),", ",n.jsx("code",{children:"appsettings*.json"}),", and"," ",n.jsx("code",{children:"application*.yml"})," can be selected. Other files are shown disabled."]})]})})}function PY(e){const{error:t,success:s}=hs(),[i,a]=y.useState(),[l,c]=y.useState(!1),h=y.useCallback(async()=>{try{a(await _O(e))}catch{a(void 0)}},[e]);y.useEffect(()=>{h()},[h]);const f=y.useCallback(async()=>{c(!0);try{await yE(e),s(`Reloaded ${e} with the latest configuration.`),await h()}catch(d){t(d instanceof Error?d.message:String(d))}finally{c(!1)}},[e,h,t,s]);return{runtime:i,reloading:l,refresh:h,reload:f}}function Q5(e){if(!e.trim())return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function IY(e){const{error:t,success:s}=hs(),[i,a]=y.useState([]),[l,c]=y.useState(),[h,f]=y.useState(),[d,p]=y.useState(!0),[g,b]=y.useState(!1),[v,w]=y.useState(!1),[k,N]=y.useState(!1),[E,T]=y.useState();y.useEffect(()=>{let D=!1;return p(!0),T(void 0),(async()=>{try{const G=await xO(e);if(D)return;a(G.files),G.files.length>0?c($=>$??G.files[0].path):(c(void 0),f(void 0))}catch(G){D||T(G instanceof Error?G.message:String(G))}finally{D||p(!1)}})(),()=>{D=!0}},[e]);const A=y.useCallback(async D=>{b(!0),T(void 0);try{const G=await sS(e,D),$={path:G.path,relativePath:G.relativePath,format:G.format};G.format==="env"?f({info:$,exists:G.exists,rows:G.entries.map(O=>({...O,reveal:!1}))}):f({info:$,exists:G.exists,text:G.format==="json"?Q5(G.content):G.content}),N(!1)}catch(G){T(G instanceof Error?G.message:String(G))}finally{b(!1)}},[e]);y.useEffect(()=>{l&&A(l)},[l,A]);function C(D,G){f($=>{if(!$?.rows)return $;const O=$.rows.map((V,K)=>K===D?{...V,...G}:V);return{...$,rows:O}}),N(!0)}function R(){f(D=>D?.rows?{...D,rows:[...D.rows,{key:"",value:"",secret:!1,reveal:!0}]}:D),N(!0)}function L(D){f(G=>G?.rows?{...G,rows:G.rows.filter(($,O)=>O!==D)}:G),N(!0)}function H(D){f(G=>G&&{...G,text:D}),N(!0)}async function B(){if(h){w(!0);try{if(h.info.format==="env"&&h.rows){const D=await vO(e,h.info.path,h.rows.map(G=>({key:G.key.trim(),value:G.value})));f({info:{path:D.path,relativePath:D.relativePath,format:D.format},exists:D.exists,rows:D.entries.map(G=>({...G,reveal:!1}))}),s(`Saved ${D.entries.length} entries to ${D.relativePath}.`)}else if(h.text!==void 0){const D=await yO(e,h.info.path,h.text);f({info:{path:D.path,relativePath:D.relativePath,format:D.format},exists:D.exists,text:D.content}),s(`Saved ${D.relativePath}.`)}N(!1)}catch(D){t(D instanceof Error?D.message:String(D))}finally{w(!1)}}}async function P(D){try{const G=await sS(e,D),$={path:G.path,relativePath:G.relativePath,format:G.format};return a(O=>O.some(V=>V.path===$.path)?O:[...O,$]),c($.path),s(`Loaded ${$.relativePath}.`),!0}catch(G){return t(G instanceof Error?G.message:String(G)),!1}}return{files:i,selectedPath:l,setSelectedPath:c,loaded:h,loadingList:d,loadingFile:g,saving:v,dirty:k,error:E,addRow:R,removeRow:L,updateRow:C,updateText:H,save:B,pickFile:P}}function $Y({serviceName:e}){const{files:t,selectedPath:s,setSelectedPath:i,loaded:a,loadingList:l,loadingFile:c,saving:h,dirty:f,error:d,addRow:p,removeRow:g,updateRow:b,updateText:v,save:w,pickFile:k}=IY(e),N=PY(e),[E,T]=y.useState(!1),[A,C]=y.useState(!1);async function R(){await w(),await N.refresh()}return l?n.jsx("div",{className:"text-muted-foreground",children:"Loading…"}):d&&!a?n.jsx("div",{className:"text-red-600",children:d}):n.jsxs("div",{className:"space-y-2",children:[n.jsx(OY,{onReload:()=>{N.reload()},reloading:N.reloading,runtime:N.runtime}),n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("span",{className:"text-muted-foreground",children:"File:"}),t.length>0?n.jsx("select",{className:"rounded border border-border/60 bg-background px-1.5 py-0.5 font-mono text-xs",onChange:L=>i(L.target.value),value:s??"",children:t.map(L=>n.jsxs("option",{value:L.path,children:[L.relativePath," [",L.format,"]"]},L.path))}):n.jsx("span",{className:"text-muted-foreground",children:"none detected"}),n.jsxs(Z,{onClick:()=>C(!0),size:"sm",type:"button",variant:"outline",children:[n.jsx(Of,{})," Browse files"]}),a?n.jsx("code",{className:"rounded bg-background px-1.5 py-0.5 font-mono text-muted-foreground",children:a.info.path}):null]}),n.jsxs("div",{className:"flex items-center gap-1",children:[a?.info.format==="env"?n.jsxs(n.Fragment,{children:[n.jsxs(Z,{onClick:()=>T(L=>!L),size:"sm",type:"button",variant:"outline",children:[E?n.jsx(j0,{}):n.jsx(Lf,{}),E?"Hide secrets":"Reveal secrets"]}),n.jsxs(Z,{onClick:p,size:"sm",type:"button",variant:"outline",children:[n.jsx(ws,{})," Add"]})]}):null,n.jsxs(Z,{disabled:!f||h||!a,onClick:()=>{R()},size:"sm",type:"button",children:[n.jsx(YC,{})," ",h?"Saving…":"Save"]})]})]}),d&&!a?n.jsx("div",{className:"text-red-600",children:d}):a?.info.format==="env"&&a.rows?n.jsx("div",{className:ae(c&&"opacity-60 transition-opacity"),children:n.jsx(zY,{revealAll:E,rows:a.rows,onAdd:p,onRemove:g,onUpdate:b})}):a?.text!==void 0?n.jsxs("div",{className:ae("space-y-1",c&&"opacity-60 transition-opacity"),children:[a.info.format==="json"?n.jsx("div",{className:"flex justify-end",children:n.jsx(Z,{onClick:()=>v(Q5(a.text??"")),size:"sm",type:"button",variant:"outline",children:"Format JSON"})}):null,n.jsx("textarea",{className:"min-h-[300px] w-full rounded border border-border/60 bg-background p-2 font-mono text-[11px] leading-relaxed",onChange:L=>v(L.target.value),spellCheck:!1,value:a.text})]}):c?n.jsx("div",{className:"text-muted-foreground",children:"Loading file…"}):null,a?n.jsxs("p",{className:"text-muted-foreground",children:[a.info.format==="env"?"Comments and blank lines are preserved.":a.info.format==="json"?"JSON is validated on save.":"YAML is saved as raw text."," ","The running process won't see changes until you restart it."]}):null,A?n.jsx(BY,{onClose:()=>C(!1),onPick:L=>{k(L).then(H=>{H&&C(!1)})},serviceName:e}):null]})}function HY({serviceName:e,status:t,timeline:s,onRefresh:i}){const{error:a,success:l}=hs(),[c,h]=y.useState(!1),f=t?.inspector,d=t?.state==="running",p=y.useMemo(()=>s.filter(v=>v.kind==="service.http"&&v.service===e).map(v=>{const w=v.data??{};return{id:w.id??v.id,startedAt:v.timestamp,method:w.method??"?",path:w.path??"?",status:w.status??0,durationMs:w.durationMs??0,reqBytes:w.reqBytes??0,resBytes:w.resBytes??0}}).slice(-500).reverse(),[s,e]);async function g(v){h(!0);try{await Mi(`/api/services/${encodeURIComponent(e)}/inspector`,{enabled:v?"true":"false"}),await i(),l(v?`HTTP inspector started for ${e}.`:`HTTP inspector stopped for ${e}.`)}catch(w){a(w instanceof Error?w.message:String(w))}finally{h(!1)}}if(!d)return n.jsx("div",{className:"text-muted-foreground",children:"Service is not running."});if(!f?.enabled)return n.jsxs("div",{className:"space-y-2",children:[n.jsx("p",{className:"text-muted-foreground",children:"The HTTP inspector starts a local proxy that forwards traffic to this service and records every request. Hit the inspect URL instead of the original port to see requests appear here. The service itself is not touched."}),n.jsxs(Z,{disabled:c,onClick:()=>g(!0),size:"sm",type:"button",children:[n.jsx(Mr,{})," Start HTTP inspector"]})]});const b=f.port?`http://127.0.0.1:${f.port}`:void 0;return n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("span",{className:"text-muted-foreground",children:"Inspect URL:"}),b?n.jsxs(n.Fragment,{children:[n.jsx("code",{className:"rounded bg-background px-1.5 py-0.5 font-mono",children:b}),n.jsxs(Z,{onClick:()=>{navigator.clipboard.writeText(b),l("Copied inspect URL.")},size:"sm",type:"button",variant:"outline",children:[n.jsx(Wh,{})," Copy"]}),n.jsx(Z,{onClick:()=>{$f(b)},size:"sm",type:"button",variant:"outline",children:"Open"})]}):n.jsx("span",{className:"text-muted-foreground",children:"starting…"}),n.jsxs("span",{className:"text-muted-foreground",children:["→ upstream :",f.upstreamPort??"?"]}),n.jsxs(Z,{disabled:c,onClick:()=>g(!1),size:"sm",type:"button",variant:"outline",children:[n.jsx(fo,{})," Stop"]})]}),p.length===0?n.jsx("div",{className:"text-muted-foreground",children:"No requests captured yet. Hit the inspect URL in your browser to see traffic."}):n.jsx("div",{className:"max-h-80 overflow-auto",children:n.jsxs("table",{className:"w-full font-mono text-[11px]",children:[n.jsx("thead",{className:"sticky top-0 bg-muted/60 text-left text-muted-foreground",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-1 pr-3",children:"Time"}),n.jsx("th",{className:"py-1 pr-3",children:"Method"}),n.jsx("th",{className:"py-1 pr-3",children:"Path"}),n.jsx("th",{className:"py-1 pr-3 text-right",children:"Status"}),n.jsx("th",{className:"py-1 pr-3 text-right",children:"Size"}),n.jsx("th",{className:"py-1 pr-3 text-right",children:"ms"})]})}),n.jsx("tbody",{children:p.map(v=>n.jsxs("tr",{className:"border-t border-border/40",children:[n.jsx("td",{className:"py-1 pr-3 text-muted-foreground",children:new Date(v.startedAt).toLocaleTimeString()}),n.jsx("td",{className:"py-1 pr-3",children:v.method}),n.jsx("td",{className:"py-1 pr-3 truncate max-w-[40ch]",children:v.path}),n.jsx("td",{className:ae("py-1 pr-3 text-right",UY(v.status)),children:v.status}),n.jsx("td",{className:"py-1 pr-3 text-right text-muted-foreground",children:FY(v.resBytes)}),n.jsx("td",{className:"py-1 pr-3 text-right",children:v.durationMs.toFixed(1)})]},v.id))})]})})]})}function UY(e){return e>=500?"text-red-600 dark:text-red-400":e>=400?"text-amber-600 dark:text-amber-400":e>=300?"text-zinc-500":e>=200?"text-emerald-600 dark:text-emerald-400":"text-muted-foreground"}function FY(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function qY({serviceName:e}){const[t,s]=y.useState(null),[i,a]=y.useState(null),[l,c]=y.useState(()=>Date.now());return y.useEffect(()=>{let h=!1;async function f(){try{const p=await wO(e);h||(s(p),c(Date.now()),a(null))}catch(p){h||a(p instanceof Error?p.message:String(p))}}f();const d=setInterval(()=>{f()},3e3);return()=>{h=!0,clearInterval(d)}},[e]),i?n.jsxs("p",{className:"text-destructive",children:["Failed to load metrics: ",i]}):t?t.samples.length===0?n.jsx("p",{className:"text-muted-foreground",children:"No samples yet. Metrics start collecting once the service is running."}):n.jsx(GY,{series:t,now:l}):n.jsx("p",{className:"text-muted-foreground",children:"Loading metrics…"})}function GY({series:e,now:t}){const{samples:s}=e,i=y.useMemo(()=>cN(s,f=>f.cpu),[s]),a=y.useMemo(()=>cN(s,f=>f.rss),[s]),l=e.startedAt?new Date(e.startedAt):null,c=l?t-l.getTime():null,h=s.length>1?s[s.length-1].t-s[0].t:0;return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[n.jsx(kh,{accent:"#22c55e",label:"CPU",value:`${i.last.toFixed(1)}%`,sub:`peak ${i.max.toFixed(1)}% · avg ${i.avg.toFixed(1)}%`}),n.jsx(kh,{accent:"#3b82f6",label:"Memory",value:cb(a.last),sub:`peak ${cb(a.max)} · avg ${cb(a.avg)}`}),n.jsx(kh,{accent:"#a855f7",label:"Uptime",value:c!=null?hN(c):"—",sub:l?`since ${l.toLocaleTimeString()}`:"not running"}),n.jsx(kh,{accent:"#f59e0b",label:"Samples",value:String(s.length),sub:h?`over ${hN(h)}`:"collecting…"})]}),n.jsx(dN,{label:"CPU",samples:s,pick:f=>f.cpu,summary:i,color:"#22c55e",suffix:"%",unit:"percent"}),n.jsx(dN,{label:"Memory (RSS)",samples:s,pick:f=>f.rss,summary:a,color:"#3b82f6",suffix:" MB",unit:"mb"})]})}function cN(e,t){const s=e.map(t),i=s.reduce((a,l)=>a+l,0);return{last:s[s.length-1],max:Math.max(...s),min:Math.min(...s),avg:i/s.length}}function kh({accent:e,label:t,value:s,sub:i}){return n.jsxs("div",{className:"rounded-lg border border-border bg-card px-3 py-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full",style:{backgroundColor:e}}),n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:t})]}),n.jsx("div",{className:"mt-1 font-mono text-lg leading-none tabular-nums",children:s}),n.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-muted-foreground",children:i})]})}const ol=160,uN=44,VY=20;function dN({label:e,samples:t,pick:s,summary:i,color:a,suffix:l,unit:c}){const h=y.useMemo(()=>`metric-grad-${c}-${Math.random().toString(36).slice(2,8)}`,[c]),f=t.map(s),d=Math.max(...f,c==="percent"?10:1),p=WY(d),g=0,b=p-g||1,v=t[0].t,w=t[t.length-1].t,k=Math.max(1,w-v),N=D=>(D-v)/k*1e3,E=D=>(1-(D-g)/b)*1e3,T=t.map(D=>`${N(D.t).toFixed(1)},${E(s(D)).toFixed(1)}`),A=`M0,1000 L${T.join(" L")} L1000,1000 Z`,C=`M${T.join(" L")}`,R=N(w),L=E(i.last),H=E(i.avg),B=[1,.75,.5,.25,0],P=5;return n.jsxs("figure",{className:"space-y-1",children:[n.jsxs("figcaption",{className:"flex items-baseline justify-between",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:e}),n.jsxs("span",{className:"font-mono text-[11px] text-muted-foreground",children:["now ",n.jsxs("span",{className:"text-foreground",children:[i.last.toFixed(1),l]}),n.jsx("span",{className:"mx-1.5",children:"·"}),"peak ",i.max.toFixed(1),l,n.jsx("span",{className:"mx-1.5",children:"·"}),"avg ",i.avg.toFixed(1),l]})]}),n.jsxs("div",{className:"rounded-lg border border-border bg-card p-2",children:[n.jsxs("div",{className:"flex",children:[n.jsx("div",{className:"relative flex shrink-0 flex-col justify-between text-right font-mono text-[10px] text-muted-foreground",style:{width:uN,height:ol},children:B.map(D=>n.jsx("span",{className:"pr-1 leading-none",children:KY(g+D*b,c)},D))}),n.jsxs("div",{className:"relative min-w-0 flex-1",style:{height:ol},children:[B.map((D,G)=>n.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-t border-border/40",style:{top:`${D===1?0:D===0?ol-1:(1-D)*ol}px`,borderStyle:G===B.length-1?"solid":"dashed"}},D)),n.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-t border-dashed",style:{top:`${H/1e3*ol}px`,borderColor:a,opacity:.4}}),n.jsxs("svg",{"aria-label":e,className:"absolute inset-0 h-full w-full",preserveAspectRatio:"none",role:"img",viewBox:"0 0 1000 1000",children:[n.jsx("defs",{children:n.jsxs("linearGradient",{id:h,x1:"0",x2:"0",y1:"0",y2:"1",children:[n.jsx("stop",{offset:"0%",stopColor:a,stopOpacity:.35}),n.jsx("stop",{offset:"100%",stopColor:a,stopOpacity:.02})]})}),n.jsx("path",{d:A,fill:`url(#${h})`}),n.jsx("path",{d:C,fill:"none",stroke:a,strokeWidth:2,vectorEffect:"non-scaling-stroke",strokeLinejoin:"round",strokeLinecap:"round"})]}),n.jsx("span",{className:"pointer-events-none absolute z-10 block h-2.5 w-2.5 -translate-x-1/2 -translate-y-1/2 rounded-full ring-2 ring-card",style:{left:`${R/1e3*100}%`,top:`${L/1e3*ol}px`,backgroundColor:a,boxShadow:`0 0 0 4px ${a}33`}})]})]}),n.jsx("div",{className:"flex font-mono text-[10px] text-muted-foreground",style:{height:VY,paddingLeft:uN},children:n.jsx("div",{className:"relative flex-1",children:Array.from({length:P+1},(D,G)=>{const $=G/P,O=v+$*k;return n.jsx("span",{className:"absolute top-1 whitespace-nowrap",style:{left:`${$*100}%`,transform:G===0?"translateX(0)":G===P?"translateX(-100%)":"translateX(-50%)"},children:YY(O-w)},G)})})})]})]})}function WY(e){if(e<=1)return 1;const t=Math.pow(10,Math.floor(Math.log10(e))),s=e/t;return(s<=1?1:s<=2?2:s<=5?5:10)*t}function KY(e,t){return t==="percent"?`${e.toFixed(0)}%`:e>=1024?`${(e/1024).toFixed(1)}G`:`${e.toFixed(0)}M`}function cb(e){return e>=1024?`${(e/1024).toFixed(2)} GB`:`${e.toFixed(0)} MB`}function hN(e){const t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;const s=Math.floor(t/60);if(s<60)return`${s}m ${t%60}s`;const i=Math.floor(s/60);return i<24?`${i}h ${s%60}m`:`${Math.floor(i/24)}d ${i%24}h`}function YY(e){const t=Math.round(e/1e3);if(t===0)return"now";if(Math.abs(t)<60)return`${t}s`;const i=Math.round(t/60);return Math.abs(i)<60?`${i}m`:`${Math.round(i/60)}h`}function XY({rows:e,running:t}){if(e.length===0)return n.jsx("div",{className:"text-muted-foreground",children:t?"No process tree available for this running service.":"No process tree (service not running)."});const s=[...e].sort((a,l)=>l.cpuPercent-a.cpuPercent),i=new Set(e.map(a=>a.pid));return n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full font-mono text-[11px]",children:[n.jsx("thead",{className:"text-left text-muted-foreground",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-1 pr-3",children:"PID"}),n.jsx("th",{className:"py-1 pr-3",children:"PPID"}),n.jsx("th",{className:"py-1 pr-3 text-right",children:"CPU%"}),n.jsx("th",{className:"py-1 pr-3 text-right",children:"RSS MB"}),n.jsx("th",{className:"py-1",children:"Command"})]})}),n.jsx("tbody",{children:s.map(a=>{const l=i.has(a.ppid);return n.jsxs("tr",{className:"border-t border-border/40",children:[n.jsx("td",{className:"py-1 pr-3",children:a.pid}),n.jsx("td",{className:"py-1 pr-3 text-muted-foreground",children:a.ppid}),n.jsx("td",{className:"py-1 pr-3 text-right",children:a.cpuPercent.toFixed(1)}),n.jsx("td",{className:"py-1 pr-3 text-right",children:a.rssMb.toFixed(1)}),n.jsx("td",{className:ae("py-1 truncate max-w-[60ch]",l&&"pl-4"),children:a.command})]},a.pid)})})]})})}const fN={connecting:"bg-amber-500",running:"bg-emerald-500",exited:"bg-muted-foreground/40",error:"bg-red-500"},ZY={state:"connecting",cwd:"Local workspace",detail:"Opening shell"};function J5({sessionId:e,active:t,toolbarExtra:s}){const{confirmedGlobal:i}=sm(),a=y.useRef(null),[l,c]=y.useState(ZY),[h,f]=y.useState(null),d=y.useCallback(b=>c(b),[]),p=y.useCallback(b=>{a.current?.[b]()},[]),g=y.useCallback(b=>{if(i.terminal.confirmTerminate){f(b);return}p(b)},[i.terminal.confirmTerminate,p]);return n.jsxs("section",{className:ae("flex h-full min-h-0 flex-col bg-[#090909] text-white",!t&&"hidden"),children:[n.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-between gap-3 border-b border-white/10 bg-[#111111] px-4 py-2",children:[n.jsx("div",{className:"min-w-0",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("span",{className:"relative flex size-2.5 shrink-0 items-center justify-center",title:l.state,children:[l.state==="connecting"&&n.jsx("span",{className:ae("absolute inline-flex size-full animate-ping rounded-full opacity-60",fN[l.state])}),n.jsx("span",{className:ae("relative inline-flex size-2 rounded-full",fN[l.state])})]}),n.jsxs("span",{className:"truncate font-mono text-[11px] text-white/55",children:[l.cwd," · ",l.detail]})]})}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(Z,{"aria-label":"Restart terminal",className:"text-white/60 hover:bg-white/10 hover:text-white",size:"icon-sm",variant:"ghost",onClick:()=>g("restart"),title:"Restart terminal",type:"button",children:n.jsx(zf,{})}),n.jsx(Z,{"aria-label":"Stop terminal",className:"text-white/60 hover:bg-white/10 hover:text-white",size:"icon-sm",variant:"ghost",onClick:()=>g("stop"),title:"Stop terminal",type:"button",children:n.jsx(fo,{})}),s]})]}),n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(B5,{active:t,displaySettings:i.terminal,onStatusChange:d,ref:a,sessionId:e})}),h?n.jsx(Al,{confirmLabel:h==="restart"?"Restart terminal":"Stop terminal",message:`The running shell process will be terminated${h==="restart"?" and a new shell will be started":""}.`,onCancel:()=>f(null),onConfirm:()=>{p(h),f(null)},title:h==="restart"?"Restart terminal?":"Stop terminal?",tone:"danger"}):null]})}function QY({serviceName:e,active:t}){const[s,i]=y.useState(null),[a,l]=y.useState(null),[c,h]=y.useState(!1),f=y.useRef(!1),d=y.useRef(!0);y.useEffect(()=>(d.current=!0,()=>{d.current=!1}),[]),y.useEffect(()=>{!t||f.current||(f.current=!0,(async()=>{try{const b=await Rh({serviceName:e});d.current&&i(b.id)}catch(b){d.current&&(l(b instanceof Error?b.message:String(b)),f.current=!1)}})())},[t,e]);const p=n.jsx(Z,{"aria-label":c?"Exit fullscreen terminal":"Expand terminal",className:"text-white/60 hover:bg-white/10 hover:text-white",onClick:()=>h(b=>!b),size:"icon-sm",title:c?"Exit fullscreen":"Expand",type:"button",variant:"ghost",children:c?n.jsx(L0,{}):n.jsx(D0,{})}),g=a?n.jsxs("div",{className:"p-3 font-mono text-[11px] text-destructive",children:["Could not open terminal: ",a]}):s?n.jsx(J5,{active:t,sessionId:s,toolbarExtra:p}):n.jsx("div",{className:"p-3 font-mono text-[11px] text-muted-foreground",children:"Opening terminal…"});return c&&t?n.jsx(Dv,{onClose:()=>h(!1),title:`Terminal — ${e}`,children:g}):n.jsx("div",{className:ae("h-[60vh] min-h-[24rem] overflow-hidden rounded-md border border-border",!t&&"hidden"),children:g})}const JY=500;function eX(e){const[t,s]=y.useState(),[i,a]=y.useState([]),[l,c]=y.useState(),[h,f]=y.useState(!1),d=y.useRef(void 0);y.useEffect(()=>{d.current=void 0,s(void 0),a([]);const g=new EventSource(`/api/services/${encodeURIComponent(e)}/test/stream`),b=v=>{try{const w=JSON.parse(v.data);w.run.id!==d.current&&(d.current=w.run.id,a([])),s(w.run),w.line&&a(k=>[...k,w.line].slice(-JY))}catch{}};return g.addEventListener("status",b),g.addEventListener("output",b),()=>g.close()},[e]);const p=y.useCallback(async g=>{f(!0),c(void 0);try{await kO(e,g)}catch(b){c(b instanceof Error?b.message:String(b))}finally{f(!1)}},[e]);return{run:t,lines:i,error:l,starting:h,start:p}}const tX={running:"secondary",passed:"success",failed:"error",error:"error"},sX={running:"Running",passed:"Passed",failed:"Failed",error:"Error"};function nX({serviceName:e}){const{run:t,lines:s,error:i,starting:a,start:l}=eX(e),[c,h]=y.useState(""),f=t?.status==="running"||a,d=t?.status==="failed"||t?.status==="error";return n.jsxs("div",{className:"space-y-2",children:[n.jsxs("form",{className:"flex items-center gap-2",onSubmit:p=>{p.preventDefault(),f||l(c.trim()||void 0)},children:[n.jsx(ft,{className:"h-7 flex-1 text-[11px]",disabled:f,onChange:p=>h(p.target.value),placeholder:"Optional test pattern (e.g. config-store)",value:c}),n.jsx(Z,{disabled:f,size:"sm",type:"submit",children:f?"Running…":"Run tests"})]}),i?n.jsx("div",{className:"text-red-600",children:i}):null,t?n.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-muted-foreground",children:[n.jsx(We,{size:"small",variant:tX[t.status],children:sX[t.status]}),n.jsx("code",{className:"font-mono text-[11px]",children:t.command}),t.failingCount>0?n.jsxs("span",{children:["· ",t.failingCount," failing"]}):null,t.exitCode!=null?n.jsxs("span",{children:["· exit ",t.exitCode]}):null]}):n.jsx("div",{className:"text-muted-foreground",children:"No test runs yet."}),s.length>0?n.jsx("pre",{className:"max-h-72 overflow-auto whitespace-pre-wrap break-all rounded bg-background p-2 font-mono text-[11px]",children:s.map((p,g)=>n.jsx("div",{className:ae(p.stream==="stderr"&&"text-red-500"),children:p.text},g))}):null,d?n.jsxs("div",{className:"rounded border border-border bg-muted/40 p-2",children:["Failures were piped into the"," ",n.jsx("a",{className:"font-medium underline",href:"/errors",children:"Error Inbox"})," ","— open an incident there to copy a debugging prompt for your agent."]}):null]})}function iX({serviceName:e,status:t,health:s,timeline:i,onRefresh:a}){const[l,c]=gl("service-detail:tab","metrics"),h=s?.processTree?.processes??[];return n.jsxs("div",{className:"border-t border-border bg-muted/30 px-3 py-2 text-xs",children:[n.jsxs("div",{className:"mb-2 flex gap-1",children:[n.jsx(Qa,{active:l==="logs",onClick:()=>c("logs"),children:"Logs"}),n.jsxs(Qa,{active:l==="processes",onClick:()=>c("processes"),children:["Processes ",h.length?n.jsx(We,{variant:"secondary",size:"small",children:h.length}):null]}),n.jsx(Qa,{active:l==="metrics",onClick:()=>c("metrics"),children:"Metrics"}),n.jsxs(Qa,{active:l==="http",onClick:()=>c("http"),children:["HTTP",t?.inspector?.enabled?n.jsx(We,{variant:"success",size:"small",children:"on"}):null]}),n.jsx(Qa,{active:l==="env",onClick:()=>c("env"),children:"Env"}),n.jsx(Qa,{active:l==="tests",onClick:()=>c("tests"),children:"Tests"}),n.jsx(Qa,{active:l==="terminal",onClick:()=>c("terminal"),children:"Terminal"})]}),l==="processes"?n.jsx(XY,{rows:h,running:t?.state==="running"}):null,l==="metrics"?n.jsx(qY,{serviceName:e}):null,l==="http"?n.jsx(HY,{serviceName:e,status:t,timeline:i,onRefresh:a}):null,l==="env"?n.jsx($Y,{serviceName:e}):null,l==="tests"?n.jsx(nX,{serviceName:e}):null,l==="logs"?n.jsx(TY,{serviceName:e}):null,n.jsx(QY,{active:l==="terminal",serviceName:e},e)]})}function Qa({active:e,onClick:t,children:s}){return n.jsx("button",{className:ae("inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors",e?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),onClick:t,type:"button",children:s})}const rX={high:"success",medium:"warning",low:"secondary"};function aX({onClose:e,onRefresh:t}){const s=hs(),{sendToAgent:i}=Dt(),[a,l]=y.useState("url"),[c,h]=y.useState(""),[f,d]=y.useState(!1),[p,g]=y.useState(null),[b,v]=y.useState(null),[w,k]=y.useState([]),[N,E]=y.useState([]),[T,A]=y.useState(null),C=T?.kind==="docker-compose"?N.find(B=>B.composeService===T.composeService):void 0;async function R(){if(c.trim()){d(!0),g(null);try{const B=await lO(c.trim());v(B.profile),k(B.proposals),E(B.databases),A(B.proposals[0]??null),B.proposals.length===0&&g("Cloned, but couldn't detect how to run this repo. Refine with AI or add it manually."),l("review")}catch(B){g(B instanceof Error?B.message:String(B))}finally{d(!1)}}}function L(){i({prompt:`Onboard this repository and register it as a NoMoreIDE service: ${c.trim()}
112
+ Use nomoreide_onboard_repo to inspect it, pick the best run command, then register and start it.`,source:{type:"repo-onboard",label:"Onboard repo"},label:`Onboard and run this repo: ${c.trim()}`}),e()}async function H(B){if(T){d(!0),g(null);try{await cO(T,B,C),await t(),s.success(`${T.name} registered${C?" (+ database)":""}${B?" and starting":""}.`),e()}catch(P){g(P instanceof Error?P.message:String(P))}finally{d(!1)}}}return n.jsxs(Zn,{icon:n.jsx(Mn,{}),onClose:e,size:"lg",title:"Add from GitHub",children:[a==="url"?n.jsx(oX,{url:c,busy:f,error:p,onChange:h,onScan:R,onRefine:L}):null,a==="review"&&b?n.jsx(lX,{profile:b,proposals:w,selected:T,database:C,error:p,onSelect:A,onEdit:A,onBack:()=>l("url"),onRefine:L,onContinue:()=>l("install")}):null,a==="install"&&T?n.jsx(uX,{proposal:T,busy:f,error:p,onBack:()=>l("review"),onRegister:H}):null]})}function oX({url:e,busy:t,error:s,onChange:i,onScan:a,onRefine:l}){return n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("p",{className:"text-sm text-muted-foreground",children:"Paste a repository URL. NoMoreIDE clones it, detects how it runs, and proposes a service."}),n.jsx(ft,{autoFocus:!0,placeholder:"https://github.com/owner/repo",value:e,onChange:c=>i(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!t&&a()}}),s?n.jsx("p",{className:"text-sm text-destructive",children:s}):null,n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs(Z,{variant:"ghost",size:"sm",onClick:l,disabled:!e.trim(),children:[n.jsx(Li,{className:"size-3.5"}),"Refine with AI"]}),n.jsxs(Z,{onClick:a,disabled:t||!e.trim(),children:[t?n.jsx(Rt,{className:"size-4 animate-spin"}):n.jsx(Mn,{className:"size-4"}),t?"Cloning…":"Clone & detect"]})]})]})}function lX({profile:e,proposals:t,selected:s,database:i,error:a,onSelect:l,onEdit:c,onBack:h,onRefine:f,onContinue:d}){return n.jsxs("div",{className:"flex flex-col gap-4",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsx("span",{className:"text-sm font-medium",children:e.name}),e.languages.map(p=>n.jsx(We,{variant:"outline",size:"small",label:p},p))]}),a?n.jsx("p",{className:"text-sm text-destructive",children:a}):null,t.length>0?n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsxs("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:["Detected service",t.length>1?"s":""]}),t.map(p=>{const g=s?.name===p.name;return n.jsxs("button",{type:"button",onClick:()=>l(p),className:`rounded-md border px-3 py-2 text-left text-sm transition-colors ${g?"border-primary bg-primary/5":"border-border hover:bg-muted/50"}`,children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("span",{className:"font-medium",children:p.name}),n.jsx(We,{variant:rX[p.confidence],size:"small",label:p.confidence})]}),n.jsx("div",{className:"mt-0.5 font-mono text-xs text-muted-foreground",children:p.kind==="docker-compose"?`compose · ${p.composeService}`:p.command}),n.jsx("div",{className:"text-[11px] text-muted-foreground",children:p.reason})]},p.name)})]}):null,s?n.jsx(cX,{proposal:s,onChange:c}):null,i?n.jsxs("div",{className:"flex items-center gap-1.5 rounded-md border border-border bg-muted/30 px-2.5 py-1.5 text-xs text-muted-foreground",children:[n.jsx(Qn,{className:"size-3.5"}),n.jsxs("span",{children:["Also registers database ",n.jsx("span",{className:"font-medium",children:i.name})," (",i.engine,") so it shows in the Database tab."]})]}):null,e.envKeys.length>0?n.jsxs("div",{className:"text-xs text-muted-foreground",children:[n.jsx("span",{className:"font-medium",children:"Env from .env.example:"})," ",e.envKeys.join(", ")]}):null,e.readmeExcerpt?n.jsxs("details",{className:"rounded-md border border-border bg-muted/30 p-2 text-xs",children:[n.jsx("summary",{className:"cursor-pointer font-medium",children:"README excerpt"}),n.jsx("pre",{className:"mt-2 max-h-40 overflow-auto whitespace-pre-wrap font-mono",children:e.readmeExcerpt})]}):null,n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs(Z,{variant:"ghost",size:"sm",onClick:h,children:[n.jsx(yu,{className:"size-3.5"}),"Back"]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs(Z,{variant:"outline",size:"sm",onClick:f,children:[n.jsx(Li,{className:"size-3.5"}),"Refine with AI"]}),n.jsx(Z,{onClick:d,disabled:!s,children:"Continue"})]})]})]})}function cX({proposal:e,onChange:t}){return n.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[n.jsx(Zc,{label:"Service name",children:n.jsx(ft,{value:e.name,onChange:s=>t({...e,name:s.target.value})})}),n.jsx(Zc,{label:"Port (optional)",children:n.jsx(ft,{value:e.port?.toString()??"",placeholder:"auto",onChange:s=>t({...e,port:s.target.value?Number(s.target.value):void 0})})}),e.kind==="docker-compose"?n.jsx(Zc,{label:"Compose service",className:"col-span-2",children:n.jsx(ft,{value:e.composeService??"",onChange:s=>t({...e,composeService:s.target.value})})}):n.jsx(Zc,{label:"Run command",className:"col-span-2",children:n.jsx(ft,{value:e.command??"",onChange:s=>t({...e,command:s.target.value})})})]})}function uX({proposal:e,busy:t,error:s,onBack:i,onRegister:a}){const[l,c]=y.useState(e.installCommand??""),[h,f]=y.useState([]),[d,p]=y.useState(!1),[g,b]=y.useState(!1),v=y.useRef(null);function w(N){f(E=>[...E,N]),queueMicrotask(()=>{const E=v.current;E&&(E.scrollTop=E.scrollHeight)})}async function k(){l.trim()&&(p(!0),b(!1),f([]),await uO({clonePath:e.cwd,command:l.trim()},{onLine:N=>w(N.text),onDone:N=>{w(N===0?"✓ install complete":`✗ install exited ${N}`),p(!1),b(N===0)},onError:N=>{w(`✗ ${N}`),p(!1)}}))}return n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsxs("div",{className:"flex items-end gap-2",children:[n.jsx(Zc,{label:"Install command (optional)",className:"flex-1",children:n.jsx(ft,{value:l,placeholder:"e.g. npm install",onChange:N=>c(N.target.value)})}),n.jsxs(Z,{variant:"outline",onClick:k,disabled:d||!l.trim(),children:[d?n.jsx(Rt,{className:"size-4 animate-spin"}):n.jsx(cu,{className:"size-4"}),"Install"]})]}),h.length>0?n.jsx("pre",{ref:v,className:"max-h-48 overflow-auto rounded-md border border-border bg-black/80 p-2 font-mono text-[11px] text-green-200",children:h.join(`
113
+ `)}):null,s?n.jsx("p",{className:"text-sm text-destructive",children:s}):null,n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs(Z,{variant:"ghost",size:"sm",onClick:i,children:[n.jsx(yu,{className:"size-3.5"}),"Back"]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Z,{variant:"outline",onClick:()=>a(!1),disabled:t,children:"Register only"}),n.jsxs(Z,{onClick:()=>a(!0),disabled:t,children:[t?n.jsx(Rt,{className:"size-4 animate-spin"}):n.jsx(Mr,{className:"size-4"}),g||!l.trim()?"Register & start":"Skip install & start"]})]})]})]})}function Zc({label:e,className:t,children:s}){return n.jsxs("label",{className:`flex flex-col gap-1 text-xs ${t??""}`,children:[n.jsx("span",{className:"font-medium text-muted-foreground",children:e}),s]})}function dX({data:e,onRefresh:t,focusService:s,onServiceFocused:i,scopeName:a}){const l=e.config.services[0]?.name??"",[c,h]=y.useState(l),[f,d]=y.useState(null),[p,g]=y.useState(!1),{sendToAgent:b,startOnboard:v}=Dt(),[w,k]=y.useState(!1),[N,E]=y.useState(!1),[T,A]=y.useState(!1),[C,R]=y.useState(!1),[L,H]=y.useState(!1),B=y.useRef({}),{error:P,message:D,success:G}=hs(),$=y.useMemo(()=>new Set(e.config.bundles.flatMap(te=>te.services)),[e.config.bundles]),O=y.useMemo(()=>{const te=new Map;for(const ye of e.config.bundles)for(const Ee of ye.services)te.has(Ee)||te.set(Ee,ye.name);return te},[e.config.bundles]),V=y.useMemo(()=>e.config.services.filter(te=>!$.has(te.name)),[e.config.services,$]),K=y.useMemo(()=>e.config.services.map(te=>te.name),[e.config.services]),I=y.useMemo(()=>e.config.services.some(te=>(te.dependsOn?.length??0)>0),[e.config.services]),Y=e.health??{},W=e.config.bundles.length>0||V.length>0;y.useEffect(()=>{!e.config.services.some(ye=>ye.name===c)&&l&&h(l)},[e.config.services,l,c]),y.useEffect(()=>{s&&e.config.services.some(te=>te.name===s)&&(h(s),i?.())},[s,e.config.services,i]);const le=y.useMemo(()=>e.config.services.find(te=>te.name===c),[e.config.services,c]),J=c?e.runtime.services[c]:void 0,U=c?Y[c]:void 0;async function F(te,ye){if(!te.services.includes(ye))try{await NO(te.name,te.services,ye),G(`Added ${ye} to ${te.name}.`),await t()}catch(Ee){P(Ee instanceof Error?Ee.message:String(Ee))}}async function re(){if(le){if(iu(J?.state)){P(`Stop ${le.name} before deleting it.`);return}if(window.confirm(`Delete service "${le.name}"? This removes it from your config.`))try{await gO(le.name),G(`Deleted ${le.name}.`),await t()}catch(te){P(te instanceof Error?te.message:String(te))}}}async function fe(te){const ye=e.config.bundles.filter(Ee=>Ee.services.includes(te));if(ye.length!==0)try{for(const Ee of ye)await EO(Ee.name,Ee.services,te);D({text:`Removed ${te} from ${ye.map(Ee=>Ee.name).join(", ")}.`}),await t()}catch(Ee){P(Ee instanceof Error?Ee.message:String(Ee))}}y.useEffect(()=>{const te=Object.fromEntries(e.config.services.map(Ee=>[Ee.name,e.runtime.services[Ee.name]?.state??"stopped"])),ye=B.current;if(Object.keys(ye).length){const Ee=new Map,De=new Map;for(const Ye of e.config.services){const we=te[Ye.name],He=ye[Ye.name];if(!He||He===we)continue;const $e=e.runtime.services[Ye.name],St=O.get(Ye.name);if(St){const Gt=Ee.get(St)??new Map;if(Gt.set(we,(Gt.get(we)??0)+1),Ee.set(St,Gt),we==="exited"){const At=De.get(St)??[];At.push($e?.exitCode),De.set(St,At)}continue}if(we==="running")G(`${Ye.name} is running.`);else if(we==="stopped")D({text:`${Ye.name} stopped.`});else if(we==="starting")D({text:`${Ye.name} is starting.`});else if(we==="exited"){const Gt=$e?.exitCode===void 0||$e.exitCode===null?"":` with code ${$e.exitCode}`;P(`${Ye.name} exited${Gt}.`)}}for(const[Ye,we]of Ee)fX({exitCodes:De.get(Ye)??[],groupName:Ye,showErrorToast:P,showMessageToast:D,showSuccessToast:G,transitions:we})}B.current=te},[e.config.services,e.runtime.services,O,P,D,G]);const se=e.config.services.length>0;return n.jsxs(n.Fragment,{children:[!se&&a?n.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center",children:n.jsxs("div",{className:"max-w-sm text-sm text-muted-foreground",children:[n.jsxs("p",{className:"font-medium text-foreground",children:["No services in ",a]}),n.jsx("p",{className:"mt-1 text-xs",children:"Services whose working directory lives under this project appear here. Switch to All projects in the sidebar to see everything."})]})}):se?n.jsxs("div",{className:ae("grid h-full min-h-0 overflow-hidden bg-card/85",T?"lg:grid-cols-[320px_minmax(0,1fr)]":"lg:grid-cols-[320px_minmax(0,1fr)_340px]"),children:[n.jsx("div",{className:"min-h-0 min-w-0 overflow-auto border-r border-border",children:n.jsxs(bi,{className:"min-w-0 rounded-none border-0 border-b border-border bg-transparent",children:[n.jsx(xi,{className:"border-b border-border px-3 py-2",children:n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx(vi,{className:"text-sm",children:"Services"}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsxs(Z,{"aria-haspopup":"dialog",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>E(!0),size:"sm",type:"button",variant:"outline",children:[n.jsx(Xh,{className:"size-3.5"}),"Graph"]}),n.jsxs(Z,{"aria-haspopup":"dialog",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>k(!0),size:"sm",type:"button",variant:"outline",children:[n.jsx(XC,{className:"size-3.5"}),"Logs"]}),n.jsx(hX,{onCreateGroup:()=>d("group"),onCreateService:()=>d("service"),onOnboardRepo:()=>g(!0),onOnboardWithAi:v,canGroupWithAi:V.length>1,onCreateWithAi:()=>b({prompt:L2,source:{type:"service-setup",label:"Add a service"},label:"Help me add a new service, one step at a time."}),onGroupWithAi:()=>b({prompt:WH(V),source:{type:"group-services",label:"Group services"},label:"Propose how to group my ungrouped services."})})]})]})}),n.jsx(yi,{className:"p-0",children:W?n.jsxs("div",{className:"divide-y divide-border",children:[e.config.bundles.map(te=>n.jsx(AF,{group:te,onRefresh:t,ports:e.ports,allServices:e.config.services,health:Y,services:e.config.services.filter(ye=>te.services.includes(ye.name)),statuses:e.runtime.services,timeline:e.timeline,selectedService:c,onSelectService:h,onDropService:ye=>{F(te,ye)}},te.name)),V.length?n.jsxs("div",{className:ae("transition-colors",L&&"bg-primary/5 outline-dashed outline-2 -outline-offset-2 outline-primary/60"),onDragOver:te=>{te.dataTransfer.types.includes(gu)&&(te.preventDefault(),te.dataTransfer.dropEffect="move",H(!0))},onDragLeave:()=>H(!1),onDrop:te=>{te.preventDefault(),H(!1);const ye=te.dataTransfer.getData(gu);ye&&fe(ye)},children:[n.jsxs("div",{className:"flex items-center justify-between gap-2 bg-muted/55 px-3 py-1 text-[10px] font-semibold uppercase text-muted-foreground",children:[n.jsx("span",{children:"Ungrouped"}),n.jsx("span",{className:"text-muted-foreground/80",children:V.length})]}),n.jsx("div",{className:"divide-y divide-border",children:V.map(te=>n.jsx(U3,{service:te,status:e.runtime.services[te.name],health:Y[te.name],ports:e.ports,onRefresh:t,timeline:e.timeline,selected:c===te.name,onSelect:()=>h(te.name)},te.name))})]}):null]}):n.jsx(yf,{label:"No services registered yet."})})]})}),n.jsx("div",{className:"min-h-0 min-w-0 overflow-auto",children:le?n.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[n.jsxs("div",{className:"shrink-0 space-y-2 border-b border-border bg-background/60 px-4 py-3",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.jsx("h2",{className:"min-w-0 truncate text-base font-semibold",children:le.name}),n.jsx(F3,{state:J?.state??"stopped"}),n.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1.5",children:[(()=>{const te=J?.url??(le.port?RF(le.port):void 0);return te?n.jsx(pl,{label:`Open ${te}`,children:n.jsx(Z,{"aria-label":"Open in browser",className:"size-7",onClick:()=>{$f(te)},size:"icon",type:"button",variant:"outline",children:n.jsx(Sa,{})})}):null})(),U?.agentContext&&le?n.jsx(pl,{label:"Debug this service with AI",children:n.jsx(Z,{"aria-label":"Debug this service with AI",className:"size-7",onClick:()=>b({prompt:QH({service:le.name,context:U.agentContext}),source:{type:"service-debug",label:le.name},label:`Debug \`${le.name}\` with its current context.`}),size:"icon",type:"button",variant:"outline",children:n.jsx(Yt,{className:"size-3.5"})})}):null,n.jsx(gv,{active:iu(J?.state),baseUrl:`/api/services/${encodeURIComponent(le.name)}`,compact:!0,resourceKind:"service",resourceName:le.name,targetLabel:le.name,onRefresh:t}),n.jsx(ju,{className:"size-7 border border-border bg-background opacity-100 hover:border-foreground/30",items:[{icon:n.jsx(yl,{className:"size-3.5"}),label:"Edit service",onSelect:()=>R(!0)},...iu(J?.state)?[]:[{icon:n.jsx(Oi,{className:"size-3.5 text-destructive"}),label:"Delete service",onSelect:()=>{re()}}]],label:`More actions for ${le.name}`}),n.jsx(pl,{label:T?"Show Ports & Timeline":"Hide Ports & Timeline",side:"left",children:n.jsx(Z,{"aria-label":T?"Show Ports & Timeline":"Hide Ports & Timeline",className:"size-7",onClick:()=>A(te=>!te),size:"icon",type:"button",variant:"ghost",children:T?n.jsx(HR,{}):n.jsx(Dn,{})})})]})]}),le.command?n.jsxs("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:le.command,children:["$ ",le.command]}):null,le.cwd?n.jsx("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:le.cwd,children:le.cwd}):null,n.jsx(fY,{health:U})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:n.jsx(iX,{serviceName:le.name,status:J,health:U,timeline:e.timeline??[],onRefresh:t},le.name)})]}):n.jsx(yf,{label:"Select a service to see details."})}),T?null:n.jsxs("div",{className:"min-h-0 overflow-auto border-l border-border",children:[n.jsx(xY,{ports:e.ports}),n.jsx(JK,{events:e.timeline??[]})]})]}):n.jsx(hY,{onOnboardRepo:()=>g(!0),onOnboardWithAi:v,onCreateService:()=>d("service"),onCreateWithAi:()=>b({prompt:L2,source:{type:"service-setup",label:"Add a service"},label:"Help me add a new service, one step at a time."})}),C&&le?n.jsx(Zn,{icon:n.jsx(yl,{}),onClose:()=>R(!1),size:"lg",title:`Edit Service — ${le.name}`,children:n.jsx(Q2,{cwd:e.cwd,initialService:le,availableServices:K,onRefresh:t,onSaved:()=>R(!1)})}):null,f?n.jsx(Zn,{icon:f==="service"?n.jsx(ws,{}):n.jsx(Tf,{}),onClose:()=>d(null),size:f==="service"?"lg":"md",title:f==="service"?"Add Service":"Create Group",children:f==="service"?n.jsx(Q2,{cwd:e.cwd,availableServices:K,onRefresh:t,onSaved:()=>d(null)}):n.jsx(H3,{services:V,onRefresh:t,onSaved:()=>d(null)})}):null,p?n.jsx(aX,{onClose:()=>g(!1),onRefresh:t}):null,w?n.jsx(DY,{initialService:c||void 0,onClose:()=>k(!1),services:e.config.services.map(te=>te.name)}):null,N?n.jsx(Zn,{icon:n.jsx(Xh,{}),onClose:()=>E(!1),size:"lg",title:"Service Dependency Graph",children:n.jsx(lY,{statuses:e.runtime.services,health:Y,hasDependencies:I,onSelectService:te=>{h(te),E(!1)}})}):null]})}function hX({onCreateService:e,onCreateGroup:t,onCreateWithAi:s,onGroupWithAi:i,canGroupWithAi:a,onOnboardRepo:l,onOnboardWithAi:c}){const[h,f]=y.useState(!1);function d(p){f(!1),p()}return n.jsxs("div",{className:"relative",children:[n.jsx(pl,{label:"Add",side:"bottom",children:n.jsx(Z,{"aria-expanded":h,"aria-haspopup":"menu","aria-label":"Add service or group",className:"size-7",onClick:()=>f(p=>!p),size:"icon",type:"button",variant:"ghost",children:n.jsx(ws,{})})}),h?n.jsxs(n.Fragment,{children:[n.jsx("button",{"aria-hidden":!0,className:"fixed inset-0 z-[40] cursor-default",onClick:()=>f(!1),tabIndex:-1,type:"button"}),n.jsxs("div",{className:"absolute right-0 z-[50] mt-1 w-56 overflow-hidden rounded-md border border-border bg-card py-1 shadow-lg",role:"menu",children:[n.jsxs("div",{className:"group flex items-stretch",children:[n.jsxs("button",{className:"flex flex-1 items-center gap-2 whitespace-nowrap px-3 py-2 text-left text-sm hover:bg-muted/60 [&_svg]:size-4",onClick:()=>d(e),role:"menuitem",type:"button",children:[n.jsx(ws,{}),"Create Service"]}),n.jsxs("button",{className:"flex max-w-0 items-center gap-1.5 overflow-hidden whitespace-nowrap border-l border-transparent px-0 text-[11px] font-medium text-muted-foreground opacity-0 transition-all duration-200 ease-out hover:bg-muted/60 hover:text-foreground group-hover:max-w-24 group-hover:border-border group-hover:px-3 group-hover:opacity-100",onClick:()=>d(s),role:"menuitem",title:"Set up with AI — the agent walks you through it",type:"button",children:[n.jsx(Yt,{className:"size-3.5 shrink-0"}),"AI"]})]}),n.jsxs("div",{className:"group flex items-stretch",children:[n.jsxs("button",{className:"flex flex-1 items-center gap-2 whitespace-nowrap px-3 py-2 text-left text-sm hover:bg-muted/60 [&_svg]:size-4",onClick:()=>d(t),role:"menuitem",type:"button",children:[n.jsx(Tf,{}),"Create Group"]}),a?n.jsxs("button",{className:"flex max-w-0 items-center gap-1.5 overflow-hidden whitespace-nowrap border-l border-transparent px-0 text-[11px] font-medium text-muted-foreground opacity-0 transition-all duration-200 ease-out hover:bg-muted/60 hover:text-foreground group-hover:max-w-24 group-hover:border-border group-hover:px-3 group-hover:opacity-100",onClick:()=>d(i),role:"menuitem",title:"Group with AI — the agent proposes groupings for your ungrouped services",type:"button",children:[n.jsx(Yt,{className:"size-3.5 shrink-0"}),"AI"]}):null]}),n.jsxs("div",{className:"group flex items-stretch",children:[n.jsxs("button",{className:"flex flex-1 items-center gap-2 whitespace-nowrap px-3 py-2 text-left text-sm hover:bg-muted/60 [&_svg]:size-4",onClick:()=>d(l),role:"menuitem",type:"button",children:[n.jsx(Mn,{}),"Add from GitHub"]}),n.jsxs("button",{className:"flex max-w-0 items-center gap-1.5 overflow-hidden whitespace-nowrap border-l border-transparent px-0 text-[11px] font-medium text-muted-foreground opacity-0 transition-all duration-200 ease-out hover:bg-muted/60 hover:text-foreground group-hover:max-w-24 group-hover:border-border group-hover:px-3 group-hover:opacity-100",onClick:()=>d(c),role:"menuitem",title:"Onboard with AI — the agent clones, detects and runs it for you",type:"button",children:[n.jsx(Yt,{className:"size-3.5 shrink-0"}),"AI"]})]})]})]}):null]})}function fX({exitCodes:e,groupName:t,showErrorToast:s,showMessageToast:i,showSuccessToast:a,transitions:l}){if(l.size===1){const[f]=l.keys();if(f==="running")a(`${t} group is running.`);else if(f==="stopped")i({text:`${t} group stopped.`});else if(f==="starting")i({text:`${t} group is starting.`});else if(f==="exited"){const d=e.filter(g=>g!=null),p=d.length?` with code ${d.join(", ")}`:"";s(`${t} group exited${p}.`)}return}const c=[...l.entries()].map(([f,d])=>`${d} ${f}`).join(", "),h=`${t} group updated: ${c}.`;l.has("exited")?s(h):i({text:h})}function mX({data:e,onOpenService:t}){const s=y.useMemo(()=>pX(e),[e]);return s.length?n.jsxs("div",{className:"flex shrink-0 items-center gap-3 overflow-x-auto border-b border-border bg-card/60 px-4 py-1.5 backdrop-blur",children:[n.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 font-mono text-[10px] uppercase tracking-wider text-muted-foreground",children:[n.jsx(oo,{className:"size-3"}),"Running"]}),n.jsx("div",{className:"flex min-w-0 items-center gap-2",children:s.map(i=>n.jsxs("button",{className:"group flex shrink-0 items-center gap-2 rounded-md border border-border/60 bg-background/60 px-2.5 py-1 font-mono text-[11px] transition-colors hover:border-border hover:bg-muted",onClick:()=>t(i.name),title:i.url?`${i.name} — ${i.url}`:i.name,type:"button",children:[n.jsx("span",{className:ae("size-2 shrink-0 rounded-full",bX(i.tone))}),n.jsx("span",{className:"max-w-40 truncate font-medium text-foreground",children:i.name}),i.port?n.jsxs("span",{className:"text-muted-foreground",children:[":",i.port]}):null,i.uptime?n.jsxs("span",{className:"text-muted-foreground/70",children:["↑",i.uptime]}):null]},i.name))})]}):null}function pX(e){const t=new Map(e.config.services.map(s=>[s.name,s.port]));return Object.values(e.runtime.services).filter(s=>s.state==="running"||s.state==="starting").map(s=>({name:s.name,tone:gX(s,e.health[s.name]),port:t.get(s.name)??xX(s.url),uptime:s.state==="running"?vX(s.startedAt):"starting…",url:s.url})).sort((s,i)=>s.name.localeCompare(i.name))}function gX(e,t){return e.state==="starting"?"starting":t?.status==="healthy"?"healthy":t?.status==="warning"?"warning":t?.status==="unhealthy"?"unhealthy":"healthy"}function bX(e){return e==="starting"?"animate-pulse bg-amber-500":e==="warning"?"bg-amber-500":e==="unhealthy"?"bg-red-500":e==="unknown"?"bg-zinc-500":"bg-emerald-500"}function xX(e){if(e)try{const t=new URL(e).port;return t?Number(t):void 0}catch{return}}function vX(e){if(!e)return;const t=new Date(e).getTime();if(Number.isNaN(t))return;const s=Math.max(0,Math.floor((Date.now()-t)/1e3));if(s<60)return`${s}s`;const i=Math.floor(s/60);if(i<60)return`${i}m`;const a=Math.floor(i/60),l=i%60;return a<24?`${a}h${l?`${l}m`:""}`:`${Math.floor(a/24)}d${a%24?`${a%24}h`:""}`}function yX(){const{confirmedGlobal:e}=sm(),[t,s]=y.useState([]),[i,a]=y.useState(null),[l,c]=y.useState(!1),[h,f]=y.useState(null);y.useEffect(()=>{let b=!1;return(async()=>{let v=await SE().catch(()=>[]);if(v.length===0){const w=await Rh().catch(()=>null);v=w?[w]:[]}b||(s(v),a(v[0]?.id??null))})(),()=>{b=!0}},[]);const d=y.useCallback(async()=>{c(!0);try{const b=await Rh();s(v=>[...v,b]),a(b.id)}finally{c(!1)}},[]),p=y.useCallback(async b=>{c(!0);try{await Zb(b);const v=t.findIndex(k=>k.id===b),w=t.filter(k=>k.id!==b);if(w.length===0){const k=await Rh();s([k]),a(k.id);return}if(s(w),i===b){const k=w[Math.min(v,w.length-1)];a(k.id)}}finally{c(!1)}},[t,i]),g=y.useCallback((b,v)=>{if(e.terminal.confirmTerminate){f({id:b,name:v});return}p(b)},[p,e.terminal.confirmTerminate]);return n.jsxs("section",{className:"flex h-full min-h-0 flex-col bg-[#090909] text-white",children:[n.jsxs("div",{"aria-label":"Terminal tabs",className:"flex shrink-0 items-center gap-1 overflow-x-auto border-b border-white/10 bg-[#111111] px-2 py-1.5",role:"tablist",children:[t.map((b,v)=>{const w=b.label??`Terminal ${v+1}`;return n.jsxs("div",{className:ae("group flex items-center gap-1 rounded-md border border-transparent px-2 py-1 text-xs",b.id===i?"border-white/15 bg-white/10 text-white":"text-white/60 hover:bg-white/5"),children:[n.jsx("button",{"aria-selected":b.id===i,className:"max-w-[160px] truncate font-medium",onClick:()=>a(b.id),role:"tab",type:"button",children:w}),n.jsx("button",{"aria-label":`Close ${w}`,className:"rounded p-0.5 text-white/40 opacity-0 transition hover:bg-white/10 hover:text-white group-hover:opacity-100",disabled:l,onClick:()=>g(b.id,w),type:"button",children:n.jsx(qt,{className:"size-3"})})]},b.id)}),n.jsx("button",{"aria-label":"New terminal",className:"ml-1 rounded-md p-1 text-white/60 transition hover:bg-white/10 hover:text-white disabled:opacity-40",disabled:l,onClick:()=>{d()},type:"button",children:n.jsx(ws,{className:"size-4"})})]}),n.jsx("div",{className:"relative min-h-0 flex-1",children:t.length===0?n.jsx("div",{className:"flex h-full items-center justify-center font-mono text-[11px] text-white/40",children:"Starting terminal…"}):t.map(b=>n.jsx("div",{className:"absolute inset-0",children:n.jsx(J5,{active:b.id===i,sessionId:b.id})},b.id))}),h?n.jsx(Al,{confirmLabel:`Close ${h.name}`,loading:l,message:"The running shell process will be terminated and this terminal tab will be closed.",onCancel:()=>f(null),onConfirm:()=>{const b=h.id;f(null),p(b)},title:`Close ${h.name}?`,tone:"danger"}):null]})}function e4({branch:e}){return n.jsx("span",{className:"min-w-0 max-w-40",title:e,children:n.jsx(We,{className:"w-full max-w-full shadow-none",variant:"outline",children:e})})}function t4({branch:e,error:t,files:s,selectedFile:i,onSelectFile:a,root:l,staging:c}){const h=y.useMemo(()=>kX(s).filter(p=>p.files.length),[s]),[f,d]=y.useState({staged:!1,unstaged:!1,untracked:!1});return n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border bg-card/95 px-2.5 py-1.5",children:[n.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[12px] font-semibold tracking-tight",children:[n.jsx(Mn,{className:"size-3.5"}),n.jsx("span",{className:"truncate",children:"Changes"})]}),n.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[e?n.jsx(e4,{branch:e}):null,n.jsx(We,{variant:"secondary",children:s.length})]})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-auto py-1",children:h.length?h.map(p=>n.jsx(_X,{collapsed:f[p.id],group:p,onSelectFile:a,onToggle:()=>d(g=>({...g,[p.id]:!g[p.id]})),root:l,selectedFile:i,staging:c},p.id)):n.jsx(Je,{variant:"muted",className:"m-3 text-center",children:t??"No changed files."})})]})}function _X({collapsed:e,group:t,onSelectFile:s,onToggle:i,root:a,selectedFile:l,staging:c}){const h=e?Dn:Jn,f=t.files.map(p=>p.path),d=c?t.id==="staged"?{label:"Unstage all",run:()=>c.onUnstage(f)}:{label:"Stage all",run:()=>c.onStage(f)}:null;return n.jsxs("section",{className:"border-b border-border last:border-b-0",children:[n.jsxs("div",{className:"flex w-full items-center justify-between gap-2 bg-muted/45 px-2 py-0.5 text-[10px] font-semibold uppercase text-muted-foreground hover:bg-muted",children:[n.jsxs("button",{className:"flex min-w-0 flex-1 items-center gap-1.5 text-left",onClick:i,type:"button",children:[n.jsx(h,{className:"size-3.5"}),n.jsx("span",{className:"truncate",children:t.label})]}),d?n.jsx("button",{className:"shrink-0 rounded px-1 text-[10px] font-medium normal-case text-muted-foreground transition-colors hover:bg-background hover:text-foreground disabled:opacity-50",disabled:c?.busy,onClick:d.run,type:"button",children:d.label}):null,n.jsx(We,{className:"min-w-6 justify-center font-mono shadow-none",size:"small",variant:"outline",children:t.files.length})]}),e?null:n.jsx("div",{children:t.files.map(p=>n.jsx(wX,{active:l===p.path,file:p,group:t.id,onClick:()=>s(p.path),root:a,staging:c},p.path))})]})}function wX({active:e,file:t,group:s,onClick:i,root:a,staging:l}){const c=t.path.split("/").pop()||t.path,h=t.path.split("/").slice(0,-1).join("/"),f=a?$3(Au(a,t.path)):{},d=s==="staged";return n.jsxs("div",{className:ae("group flex w-full items-center gap-1.5 px-1 py-0.5 text-[12px] hover:bg-muted",e&&"bg-muted font-medium"),children:[n.jsxs("button",{"aria-label":`Open changed file ${t.path}`,className:"flex min-w-0 flex-1 items-center gap-1.5 text-left",onClick:i,type:"button",...f,children:[n.jsx(Av,{path:t.path}),n.jsxs("span",{className:"flex min-w-0 flex-1 items-baseline gap-1.5 truncate",children:[n.jsx("span",{"data-testid":"changed-file-name",className:"shrink-0 truncate",children:c}),h?n.jsx("span",{"data-testid":"changed-file-dir",className:"min-w-0 truncate text-muted-foreground",children:h}):null]})]}),l?n.jsx("button",{"aria-label":`${d?"Unstage":"Stage"} ${t.path}`,className:"shrink-0 rounded p-0.5 text-muted-foreground opacity-0 transition-colors hover:bg-background hover:text-foreground focus:opacity-100 group-hover:opacity-100 disabled:opacity-50",disabled:l.busy,onClick:()=>d?l.onUnstage([t.path]):l.onStage([t.path]),title:d?"Unstage":"Stage",type:"button",children:d?n.jsx(VC,{className:"size-3.5"}):n.jsx(ws,{className:"size-3.5"})}):null,n.jsx("span",{className:ae("ml-1 shrink-0 font-mono text-[10px] font-semibold",s==="untracked"&&"text-amber-700 dark:text-amber-400",s==="staged"&&"text-emerald-700 dark:text-emerald-400",s==="unstaged"&&"text-zinc-800 dark:text-zinc-300"),children:SX(t,s)})]})}function SX(e,t){return t==="untracked"?"?":t==="staged"?e.index.trim():e.workingTree.trim()}function kX(e){return[{id:"unstaged",label:"Changes",files:e.filter(t=>!(t.index==="?"&&t.workingTree==="?")&&t.workingTree.trim())},{id:"staged",label:"Staged Changes",files:e.filter(t=>!(t.index==="?"&&t.workingTree==="?")&&t.index.trim()&&!t.workingTree.trim())},{id:"untracked",label:"Untracked Files",files:e.filter(t=>t.index==="?"&&t.workingTree==="?")}]}function s4({branch:e,files:t,onDone:s,repo:i}){const{sendToAgent:a}=Dt(),[l,c]=y.useState(""),[h,f]=y.useState(null),[d,p]=y.useState(null),[g,b]=y.useState(null),v=y.useMemo(()=>t.filter(E=>E.index.trim()&&E.index!=="?").map(E=>E.path),[t]),w=v.length>0&&l.trim().length>0&&h===null;async function k(E,T){f(E),p(null),b(null);try{if(await gE(l.trim(),i),T){const A=await Hf(i);b(`Committed and pushed ${A.branch}.`)}else b("Committed staged changes.");c(""),s()}catch(A){p(A instanceof Error?A.message:String(A))}finally{f(null)}}function N(){a({prompt:FH({branch:e,stagedFiles:v}),source:{type:"git-commit",label:"commit message"},mode:"send",label:"Suggest a commit message"})}return n.jsxs("div",{className:"shrink-0 space-y-2 border-t border-border bg-card/95 p-2.5",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-tight text-muted-foreground",children:"Commit"}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[v.length," staged"]}),n.jsxs("button",{"aria-label":"Suggest a commit message with AI",className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50",disabled:v.length===0,onClick:N,title:"Ask the agent to draft a commit message from the staged diff",type:"button",children:[n.jsx(Yt,{className:"size-3.5"}),"AI message"]})]})]}),n.jsx("textarea",{"aria-label":"Commit message",className:"min-h-16 w-full resize-y rounded-md border border-border bg-background px-2.5 py-1.5 text-[12px] outline-none transition-colors placeholder:text-muted-foreground focus:border-foreground/40 focus:ring-2 focus:ring-ring",onChange:E=>{c(E.target.value),p(null),b(null)},placeholder:v.length?"Commit message…":"Stage files to commit",value:l}),n.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[n.jsxs(Z,{disabled:!w,onClick:()=>{k("commit",!1)},size:"sm",type:"button",variant:"outline",children:[h==="commit"?n.jsx(Rt,{className:"size-3.5 animate-spin"}):n.jsx(Ws,{className:"size-3.5"}),"Commit"]}),n.jsxs(Z,{disabled:!w,onClick:()=>{k("push",!0)},size:"sm",type:"button",children:[h==="push"?n.jsx(Rt,{className:"size-3.5 animate-spin"}):n.jsx(Pf,{className:"size-3.5"}),"Commit & push"]})]}),d?n.jsx(Je,{className:"px-2.5 py-1.5 text-[11px]",variant:"destructive",children:d}):g?n.jsx(Je,{className:"px-2.5 py-1.5 text-[11px]",variant:"muted",children:g}):null]})}function NX(e){const t={name:"",path:"",children:[],isFile:!1},s=new Map;s.set("",t);const i=[...e].sort();for(const l of i){const c=l.split("/");let h="";for(let f=0;f<c.length;f+=1){const d=c[f],p=f===c.length-1,g=h?`${h}/${d}`:d;let b=s.get(g);b||(b={name:d,path:g,children:[],isFile:p},s.set(g,b),s.get(h)?.children.push(b)),h=g}}const a=l=>{l.children.sort((c,h)=>c.isFile!==h.isFile?c.isFile?1:-1:c.name.localeCompare(h.name)),l.children.forEach(a)};return a(t),t}function mN(e,t){const s={"":!0},i=a=>{for(const l of a.children)l.isFile||(s[l.path]=!0,t&&i(l))};return i(e),s}function pN({defaultExpandAll:e=!1,paths:t,status:s,selectedFile:i,onSelectFile:a,branch:l,emptyMessage:c="No tracked files.",root:h,title:f="Files"}){const d=y.useMemo(()=>NX(t),[t]),p=y.useMemo(()=>mN(d,e),[e,d]),g=y.useMemo(()=>mN(d,!0),[d]),b=Math.max(0,Object.keys(g).length-1),v=y.useMemo(()=>{const R=new Map;for(const L of s)R.set(L.path,L);return R},[s]),[w,k]=y.useState(p),[N,E]=y.useState(!1);y.useEffect(()=>{N||d.children.length===0||(k(p),E(!0))},[p,N,d.children.length]);function T(R){k(L=>({...L,[R]:!L[R]}))}function A(){k(g)}function C(){k({"":!0})}return n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border bg-card/95 px-2.5 py-1.5",children:[n.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[12px] font-semibold tracking-tight",children:[n.jsx(xo,{className:"size-3.5"}),n.jsx("span",{className:"truncate",children:f})]}),n.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[b>0?n.jsxs("span",{className:"flex items-center gap-0.5",children:[n.jsx("button",{"aria-label":"Expand all folders",className:"flex size-6 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:A,title:"Expand all folders",type:"button",children:n.jsx(hM,{className:"size-3.5"})}),n.jsx("button",{"aria-label":"Collapse all folders",className:"flex size-6 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:C,title:"Collapse all folders",type:"button",children:n.jsx(uM,{className:"size-3.5"})})]}):null,l?n.jsx(e4,{branch:l}):null,n.jsx(We,{variant:"secondary",children:t.length})]})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-auto py-1",children:d.children.length===0?n.jsx(Je,{variant:"muted",className:"m-3 text-center",children:c}):d.children.map(R=>n.jsx(n4,{depth:0,expanded:w,node:R,onSelectFile:a,onToggle:T,root:h,selectedFile:i,statusByPath:v},R.path))})]})}function n4({depth:e,expanded:t,node:s,onSelectFile:i,onToggle:a,root:l,selectedFile:c,statusByPath:h}){const f=t[s.path]??!1,d=6+e*12,p=l?$3(Au(l,s.path)):{};if(s.isFile){const v=h.get(s.path),w=c===s.path;return n.jsxs("button",{className:ae("flex w-full items-center gap-1.5 px-1 py-0.5 text-left text-[12px] hover:bg-muted",w&&"bg-muted font-medium"),onClick:()=>i(s.path),style:{paddingLeft:d},type:"button",...p,children:[n.jsx(Av,{path:s.path}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:s.name}),v?n.jsx(CX,{file:v}):null]})}const g=f?Jn:Dn,b=f?Of:xo;return n.jsxs("div",{children:[n.jsxs("button",{className:"flex w-full items-center gap-1 py-0.5 text-left text-[12px] font-medium hover:bg-muted",onClick:()=>a(s.path),style:{paddingLeft:d},type:"button",...p,children:[n.jsx(g,{className:"size-3.5 shrink-0 text-muted-foreground"}),n.jsx(b,{className:"size-3.5 shrink-0 text-amber-600"}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:s.name})]}),f?s.children.map(v=>n.jsx(n4,{depth:e+1,expanded:t,node:v,onSelectFile:i,onToggle:a,root:l,selectedFile:c,statusByPath:h},v.path)):null]})}function CX({file:e}){const t=e.workingTree.trim()||e.index.trim();if(!t)return null;const s=e.index.trim()&&!e.workingTree.trim()?"text-emerald-700 dark:text-emerald-400":t==="?"?"text-amber-700 dark:text-amber-400":"text-zinc-700 dark:text-zinc-300";return n.jsx("span",{className:ae("ml-1 shrink-0 font-mono text-[10px] font-semibold",s),children:t})}var ub,gN;function EX(){if(gN)return ub;gN=1;function e(q){return q instanceof Map?q.clear=q.delete=q.set=function(){throw new Error("map is read-only")}:q instanceof Set&&(q.add=q.clear=q.delete=function(){throw new Error("set is read-only")}),Object.freeze(q),Object.getOwnPropertyNames(q).forEach(ne=>{const xe=q[ne],Pe=typeof xe;(Pe==="object"||Pe==="function")&&!Object.isFrozen(xe)&&e(xe)}),q}class t{constructor(ne){ne.data===void 0&&(ne.data={}),this.data=ne.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function s(q){return q.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function i(q,...ne){const xe=Object.create(null);for(const Pe in q)xe[Pe]=q[Pe];return ne.forEach(function(Pe){for(const at in Pe)xe[at]=Pe[at]}),xe}const a="</span>",l=q=>!!q.scope,c=(q,{prefix:ne})=>{if(q.startsWith("language:"))return q.replace("language:","language-");if(q.includes(".")){const xe=q.split(".");return[`${ne}${xe.shift()}`,...xe.map((Pe,at)=>`${Pe}${"_".repeat(at+1)}`)].join(" ")}return`${ne}${q}`};class h{constructor(ne,xe){this.buffer="",this.classPrefix=xe.classPrefix,ne.walk(this)}addText(ne){this.buffer+=s(ne)}openNode(ne){if(!l(ne))return;const xe=c(ne.scope,{prefix:this.classPrefix});this.span(xe)}closeNode(ne){l(ne)&&(this.buffer+=a)}value(){return this.buffer}span(ne){this.buffer+=`<span class="${ne}">`}}const f=(q={})=>{const ne={children:[]};return Object.assign(ne,q),ne};class d{constructor(){this.rootNode=f(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(ne){this.top.children.push(ne)}openNode(ne){const xe=f({scope:ne});this.add(xe),this.stack.push(xe)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(ne){return this.constructor._walk(ne,this.rootNode)}static _walk(ne,xe){return typeof xe=="string"?ne.addText(xe):xe.children&&(ne.openNode(xe),xe.children.forEach(Pe=>this._walk(ne,Pe)),ne.closeNode(xe)),ne}static _collapse(ne){typeof ne!="string"&&ne.children&&(ne.children.every(xe=>typeof xe=="string")?ne.children=[ne.children.join("")]:ne.children.forEach(xe=>{d._collapse(xe)}))}}class p extends d{constructor(ne){super(),this.options=ne}addText(ne){ne!==""&&this.add(ne)}startScope(ne){this.openNode(ne)}endScope(){this.closeNode()}__addSublanguage(ne,xe){const Pe=ne.root;xe&&(Pe.scope=`language:${xe}`),this.add(Pe)}toHTML(){return new h(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function g(q){return q?typeof q=="string"?q:q.source:null}function b(q){return k("(?=",q,")")}function v(q){return k("(?:",q,")*")}function w(q){return k("(?:",q,")?")}function k(...q){return q.map(xe=>g(xe)).join("")}function N(q){const ne=q[q.length-1];return typeof ne=="object"&&ne.constructor===Object?(q.splice(q.length-1,1),ne):{}}function E(...q){return"("+(N(q).capture?"":"?:")+q.map(Pe=>g(Pe)).join("|")+")"}function T(q){return new RegExp(q.toString()+"|").exec("").length-1}function A(q,ne){const xe=q&&q.exec(ne);return xe&&xe.index===0}const C=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function R(q,{joinWith:ne}){let xe=0;return q.map(Pe=>{xe+=1;const at=xe;let Mt=g(Pe),qe="";for(;Mt.length>0;){const Ue=C.exec(Mt);if(!Ue){qe+=Mt;break}qe+=Mt.substring(0,Ue.index),Mt=Mt.substring(Ue.index+Ue[0].length),Ue[0][0]==="\\"&&Ue[1]?qe+="\\"+String(Number(Ue[1])+at):(qe+=Ue[0],Ue[0]==="("&&xe++)}return qe}).map(Pe=>`(${Pe})`).join(ne)}const L=/\b\B/,H="[a-zA-Z]\\w*",B="[a-zA-Z_]\\w*",P="\\b\\d+(\\.\\d+)?",D="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",G="\\b(0b[01]+)",$="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",O=(q={})=>{const ne=/^#![ ]*\//;return q.binary&&(q.begin=k(ne,/.*\b/,q.binary,/\b.*/)),i({scope:"meta",begin:ne,end:/$/,relevance:0,"on:begin":(xe,Pe)=>{xe.index!==0&&Pe.ignoreMatch()}},q)},V={begin:"\\\\[\\s\\S]",relevance:0},K={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[V]},I={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[V]},Y={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},W=function(q,ne,xe={}){const Pe=i({scope:"comment",begin:q,end:ne,contains:[]},xe);Pe.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const at=E("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return Pe.contains.push({begin:k(/[ ]+/,"(",at,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Pe},le=W("//","$"),J=W("/\\*","\\*/"),U=W("#","$"),F={scope:"number",begin:P,relevance:0},re={scope:"number",begin:D,relevance:0},fe={scope:"number",begin:G,relevance:0},se={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[V,{begin:/\[/,end:/\]/,relevance:0,contains:[V]}]},te={scope:"title",begin:H,relevance:0},ye={scope:"title",begin:B,relevance:0},Ee={begin:"\\.\\s*"+B,relevance:0};var Ye=Object.freeze({__proto__:null,APOS_STRING_MODE:K,BACKSLASH_ESCAPE:V,BINARY_NUMBER_MODE:fe,BINARY_NUMBER_RE:G,COMMENT:W,C_BLOCK_COMMENT_MODE:J,C_LINE_COMMENT_MODE:le,C_NUMBER_MODE:re,C_NUMBER_RE:D,END_SAME_AS_BEGIN:function(q){return Object.assign(q,{"on:begin":(ne,xe)=>{xe.data._beginMatch=ne[1]},"on:end":(ne,xe)=>{xe.data._beginMatch!==ne[1]&&xe.ignoreMatch()}})},HASH_COMMENT_MODE:U,IDENT_RE:H,MATCH_NOTHING_RE:L,METHOD_GUARD:Ee,NUMBER_MODE:F,NUMBER_RE:P,PHRASAL_WORDS_MODE:Y,QUOTE_STRING_MODE:I,REGEXP_MODE:se,RE_STARTERS_RE:$,SHEBANG:O,TITLE_MODE:te,UNDERSCORE_IDENT_RE:B,UNDERSCORE_TITLE_MODE:ye});function we(q,ne){q.input[q.index-1]==="."&&ne.ignoreMatch()}function He(q,ne){q.className!==void 0&&(q.scope=q.className,delete q.className)}function $e(q,ne){ne&&q.beginKeywords&&(q.begin="\\b("+q.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",q.__beforeBegin=we,q.keywords=q.keywords||q.beginKeywords,delete q.beginKeywords,q.relevance===void 0&&(q.relevance=0))}function St(q,ne){Array.isArray(q.illegal)&&(q.illegal=E(...q.illegal))}function Gt(q,ne){if(q.match){if(q.begin||q.end)throw new Error("begin & end are not supported with match");q.begin=q.match,delete q.match}}function At(q,ne){q.relevance===void 0&&(q.relevance=1)}const Ln=(q,ne)=>{if(!q.beforeMatch)return;if(q.starts)throw new Error("beforeMatch cannot be used with starts");const xe=Object.assign({},q);Object.keys(q).forEach(Pe=>{delete q[Pe]}),q.keywords=xe.keywords,q.begin=k(xe.beforeMatch,b(xe.begin)),q.starts={relevance:0,contains:[Object.assign(xe,{endsParent:!0})]},q.relevance=0,delete xe.beforeMatch},_n=["of","and","for","in","not","or","if","then","parent","list","value"],ms="keyword";function Hs(q,ne,xe=ms){const Pe=Object.create(null);return typeof q=="string"?at(xe,q.split(" ")):Array.isArray(q)?at(xe,q):Object.keys(q).forEach(function(Mt){Object.assign(Pe,Hs(q[Mt],ne,Mt))}),Pe;function at(Mt,qe){ne&&(qe=qe.map(Ue=>Ue.toLowerCase())),qe.forEach(function(Ue){const ot=Ue.split("|");Pe[ot[0]]=[Mt,un(ot[0],ot[1])]})}}function un(q,ne){return ne?Number(ne):ei(q)?0:1}function ei(q){return _n.includes(q.toLowerCase())}const On={},Lt=q=>{console.error(q)},ps=(q,...ne)=>{console.log(`WARN: ${q}`,...ne)},is=(q,ne)=>{On[`${q}/${ne}`]||(console.log(`Deprecated as of ${q}. ${ne}`),On[`${q}/${ne}`]=!0)},et=new Error;function tt(q,ne,{key:xe}){let Pe=0;const at=q[xe],Mt={},qe={};for(let Ue=1;Ue<=ne.length;Ue++)qe[Ue+Pe]=at[Ue],Mt[Ue+Pe]=!0,Pe+=T(ne[Ue-1]);q[xe]=qe,q[xe]._emit=Mt,q[xe]._multi=!0}function Ct(q){if(Array.isArray(q.begin)){if(q.skip||q.excludeBegin||q.returnBegin)throw Lt("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),et;if(typeof q.beginScope!="object"||q.beginScope===null)throw Lt("beginScope must be object"),et;tt(q,q.begin,{key:"beginScope"}),q.begin=R(q.begin,{joinWith:""})}}function S(q){if(Array.isArray(q.end)){if(q.skip||q.excludeEnd||q.returnEnd)throw Lt("skip, excludeEnd, returnEnd not compatible with endScope: {}"),et;if(typeof q.endScope!="object"||q.endScope===null)throw Lt("endScope must be object"),et;tt(q,q.end,{key:"endScope"}),q.end=R(q.end,{joinWith:""})}}function ee(q){q.scope&&typeof q.scope=="object"&&q.scope!==null&&(q.beginScope=q.scope,delete q.scope)}function ge(q){ee(q),typeof q.beginScope=="string"&&(q.beginScope={_wrap:q.beginScope}),typeof q.endScope=="string"&&(q.endScope={_wrap:q.endScope}),Ct(q),S(q)}function _e(q){function ne(qe,Ue){return new RegExp(g(qe),"m"+(q.case_insensitive?"i":"")+(q.unicodeRegex?"u":"")+(Ue?"g":""))}class xe{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Ue,ot){ot.position=this.position++,this.matchIndexes[this.matchAt]=ot,this.regexes.push([ot,Ue]),this.matchAt+=T(Ue)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Ue=this.regexes.map(ot=>ot[1]);this.matcherRe=ne(R(Ue,{joinWith:"|"}),!0),this.lastIndex=0}exec(Ue){this.matcherRe.lastIndex=this.lastIndex;const ot=this.matcherRe.exec(Ue);if(!ot)return null;const gs=ot.findIndex((ir,So)=>So>0&&ir!==void 0),ts=this.matchIndexes[gs];return ot.splice(0,gs),Object.assign(ot,ts)}}class Pe{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Ue){if(this.multiRegexes[Ue])return this.multiRegexes[Ue];const ot=new xe;return this.rules.slice(Ue).forEach(([gs,ts])=>ot.addRule(gs,ts)),ot.compile(),this.multiRegexes[Ue]=ot,ot}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Ue,ot){this.rules.push([Ue,ot]),ot.type==="begin"&&this.count++}exec(Ue){const ot=this.getMatcher(this.regexIndex);ot.lastIndex=this.lastIndex;let gs=ot.exec(Ue);if(this.resumingScanAtSamePosition()&&!(gs&&gs.index===this.lastIndex)){const ts=this.getMatcher(0);ts.lastIndex=this.lastIndex+1,gs=ts.exec(Ue)}return gs&&(this.regexIndex+=gs.position+1,this.regexIndex===this.count&&this.considerAll()),gs}}function at(qe){const Ue=new Pe;return qe.contains.forEach(ot=>Ue.addRule(ot.begin,{rule:ot,type:"begin"})),qe.terminatorEnd&&Ue.addRule(qe.terminatorEnd,{type:"end"}),qe.illegal&&Ue.addRule(qe.illegal,{type:"illegal"}),Ue}function Mt(qe,Ue){const ot=qe;if(qe.isCompiled)return ot;[He,Gt,ge,Ln].forEach(ts=>ts(qe,Ue)),q.compilerExtensions.forEach(ts=>ts(qe,Ue)),qe.__beforeBegin=null,[$e,St,At].forEach(ts=>ts(qe,Ue)),qe.isCompiled=!0;let gs=null;return typeof qe.keywords=="object"&&qe.keywords.$pattern&&(qe.keywords=Object.assign({},qe.keywords),gs=qe.keywords.$pattern,delete qe.keywords.$pattern),gs=gs||/\w+/,qe.keywords&&(qe.keywords=Hs(qe.keywords,q.case_insensitive)),ot.keywordPatternRe=ne(gs,!0),Ue&&(qe.begin||(qe.begin=/\B|\b/),ot.beginRe=ne(ot.begin),!qe.end&&!qe.endsWithParent&&(qe.end=/\B|\b/),qe.end&&(ot.endRe=ne(ot.end)),ot.terminatorEnd=g(ot.end)||"",qe.endsWithParent&&Ue.terminatorEnd&&(ot.terminatorEnd+=(qe.end?"|":"")+Ue.terminatorEnd)),qe.illegal&&(ot.illegalRe=ne(qe.illegal)),qe.contains||(qe.contains=[]),qe.contains=[].concat(...qe.contains.map(function(ts){return Re(ts==="self"?qe:ts)})),qe.contains.forEach(function(ts){Mt(ts,ot)}),qe.starts&&Mt(qe.starts,Ue),ot.matcher=at(ot),ot}if(q.compilerExtensions||(q.compilerExtensions=[]),q.contains&&q.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return q.classNameAliases=i(q.classNameAliases||{}),Mt(q)}function oe(q){return q?q.endsWithParent||oe(q.starts):!1}function Re(q){return q.variants&&!q.cachedVariants&&(q.cachedVariants=q.variants.map(function(ne){return i(q,{variants:null},ne)})),q.cachedVariants?q.cachedVariants:oe(q)?i(q,{starts:q.starts?i(q.starts):null}):Object.isFrozen(q)?i(q):q}var M="11.11.1";class ce extends Error{constructor(ne,xe){super(ne),this.name="HTMLInjectionError",this.html=xe}}const Me=s,Se=i,me=Symbol("nomatch"),Ae=7,Ne=function(q){const ne=Object.create(null),xe=Object.create(null),Pe=[];let at=!0;const Mt="Could not find the language '{}', did you forget to load/include a language module?",qe={disableAutodetect:!0,name:"Plain text",contains:[]};let Ue={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:p};function ot(Le){return Ue.noHighlightRe.test(Le)}function gs(Le){let st=Le.className+" ";st+=Le.parentNode?Le.parentNode.className:"";const bt=Ue.languageDetectRe.exec(st);if(bt){const Ot=dn(bt[1]);return Ot||(ps(Mt.replace("{}",bt[1])),ps("Falling back to no-highlight mode for this block.",Le)),Ot?bt[1]:"no-highlight"}return st.split(/\s+/).find(Ot=>ot(Ot)||dn(Ot))}function ts(Le,st,bt){let Ot="",xs="";typeof st=="object"?(Ot=Le,bt=st.ignoreIllegals,xs=st.language):(is("10.7.0","highlight(lang, code, ...args) has been deprecated."),is("10.7.0",`Please use highlight(code, options) instead.
114
+ https://github.com/highlightjs/highlight.js/issues/2277`),xs=Le,Ot=st),bt===void 0&&(bt=!0);const rn={code:Ot,language:xs};Ta("before:highlight",rn);const zn=rn.result?rn.result:ir(rn.language,rn.code,bt);return zn.code=rn.code,Ta("after:highlight",zn),zn}function ir(Le,st,bt,Ot){const xs=Object.create(null);function rn(Ie,Ze){return Ie.keywords[Ze]}function zn(){if(!rt.keywords){ks.addText(zt);return}let Ie=0;rt.keywordPatternRe.lastIndex=0;let Ze=rt.keywordPatternRe.exec(zt),ut="";for(;Ze;){ut+=zt.substring(Ie,Ze.index);const yt=Ys.case_insensitive?Ze[0].toLowerCase():Ze[0],rs=rn(rt,yt);if(rs){const[ti,Pl]=rs;if(ks.addText(ut),ut="",xs[yt]=(xs[yt]||0)+1,xs[yt]<=Ae&&($r+=Pl),ti.startsWith("_"))ut+=Ze[0];else{const Fu=Ys.classNameAliases[ti]||ti;Bn(Ze[0],Fu)}}else ut+=Ze[0];Ie=rt.keywordPatternRe.lastIndex,Ze=rt.keywordPatternRe.exec(zt)}ut+=zt.substring(Ie),ks.addText(ut)}function wn(){if(zt==="")return;let Ie=null;if(typeof rt.subLanguage=="string"){if(!ne[rt.subLanguage]){ks.addText(zt);return}Ie=ir(rt.subLanguage,zt,!0,Uu[rt.subLanguage]),Uu[rt.subLanguage]=Ie._top}else Ie=ko(zt,rt.subLanguage.length?rt.subLanguage:null);rt.relevance>0&&($r+=Ie.relevance),ks.__addSublanguage(Ie._emitter,Ie.language)}function Kt(){rt.subLanguage!=null?wn():zn(),zt=""}function Bn(Ie,Ze){Ie!==""&&(ks.startScope(Ze),ks.addText(Ie),ks.endScope())}function $u(Ie,Ze){let ut=1;const yt=Ze.length-1;for(;ut<=yt;){if(!Ie._emit[ut]){ut++;continue}const rs=Ys.classNameAliases[Ie[ut]]||Ie[ut],ti=Ze[ut];rs?Bn(ti,rs):(zt=ti,zn(),zt=""),ut++}}function Co(Ie,Ze){return Ie.scope&&typeof Ie.scope=="string"&&ks.openNode(Ys.classNameAliases[Ie.scope]||Ie.scope),Ie.beginScope&&(Ie.beginScope._wrap?(Bn(zt,Ys.classNameAliases[Ie.beginScope._wrap]||Ie.beginScope._wrap),zt=""):Ie.beginScope._multi&&($u(Ie.beginScope,Ze),zt="")),rt=Object.create(Ie,{parent:{value:rt}}),rt}function Ol(Ie,Ze,ut){let yt=A(Ie.endRe,ut);if(yt){if(Ie["on:end"]){const rs=new t(Ie);Ie["on:end"](Ze,rs),rs.isMatchIgnored&&(yt=!1)}if(yt){for(;Ie.endsParent&&Ie.parent;)Ie=Ie.parent;return Ie}}if(Ie.endsWithParent)return Ol(Ie.parent,Ze,ut)}function Eo(Ie){return rt.matcher.regexIndex===0?(zt+=Ie[0],1):(Hr=!0,0)}function lm(Ie){const Ze=Ie[0],ut=Ie.rule,yt=new t(ut),rs=[ut.__beforeBegin,ut["on:begin"]];for(const ti of rs)if(ti&&(ti(Ie,yt),yt.isMatchIgnored))return Eo(Ze);return ut.skip?zt+=Ze:(ut.excludeBegin&&(zt+=Ze),Kt(),!ut.returnBegin&&!ut.excludeBegin&&(zt=Ze)),Co(ut,Ie),ut.returnBegin?0:Ze.length}function Sn(Ie){const Ze=Ie[0],ut=st.substring(Ie.index),yt=Ol(rt,Ie,ut);if(!yt)return me;const rs=rt;rt.endScope&&rt.endScope._wrap?(Kt(),Bn(Ze,rt.endScope._wrap)):rt.endScope&&rt.endScope._multi?(Kt(),$u(rt.endScope,Ie)):rs.skip?zt+=Ze:(rs.returnEnd||rs.excludeEnd||(zt+=Ze),Kt(),rs.excludeEnd&&(zt=Ze));do rt.scope&&ks.closeNode(),!rt.skip&&!rt.subLanguage&&($r+=rt.relevance),rt=rt.parent;while(rt!==yt.parent);return yt.starts&&Co(yt.starts,Ie),rs.returnEnd?0:Ze.length}function zl(){const Ie=[];for(let Ze=rt;Ze!==Ys;Ze=Ze.parent)Ze.scope&&Ie.unshift(Ze.scope);Ie.forEach(Ze=>ks.openNode(Ze))}let Ra={};function jo(Ie,Ze){const ut=Ze&&Ze[0];if(zt+=Ie,ut==null)return Kt(),0;if(Ra.type==="begin"&&Ze.type==="end"&&Ra.index===Ze.index&&ut===""){if(zt+=st.slice(Ze.index,Ze.index+1),!at){const yt=new Error(`0 width match regex (${Le})`);throw yt.languageName=Le,yt.badRule=Ra.rule,yt}return 1}if(Ra=Ze,Ze.type==="begin")return lm(Ze);if(Ze.type==="illegal"&&!bt){const yt=new Error('Illegal lexeme "'+ut+'" for mode "'+(rt.scope||"<unnamed>")+'"');throw yt.mode=rt,yt}else if(Ze.type==="end"){const yt=Sn(Ze);if(yt!==me)return yt}if(Ze.type==="illegal"&&ut==="")return zt+=`
115
+ `,1;if(Bl>1e5&&Bl>Ze.index*3)throw new Error("potential infinite loop, way more iterations than matches");return zt+=ut,ut.length}const Ys=dn(Le);if(!Ys)throw Lt(Mt.replace("{}",Le)),new Error('Unknown language: "'+Le+'"');const Hu=_e(Ys);let Ao="",rt=Ot||Hu;const Uu={},ks=new Ue.__emitter(Ue);zl();let zt="",$r=0,or=0,Bl=0,Hr=!1;try{if(Ys.__emitTokens)Ys.__emitTokens(st,ks);else{for(rt.matcher.considerAll();;){Bl++,Hr?Hr=!1:rt.matcher.considerAll(),rt.matcher.lastIndex=or;const Ie=rt.matcher.exec(st);if(!Ie)break;const Ze=st.substring(or,Ie.index),ut=jo(Ze,Ie);or=Ie.index+ut}jo(st.substring(or))}return ks.finalize(),Ao=ks.toHTML(),{language:Le,value:Ao,relevance:$r,illegal:!1,_emitter:ks,_top:rt}}catch(Ie){if(Ie.message&&Ie.message.includes("Illegal"))return{language:Le,value:Me(st),illegal:!0,relevance:0,_illegalBy:{message:Ie.message,index:or,context:st.slice(or-100,or+100),mode:Ie.mode,resultSoFar:Ao},_emitter:ks};if(at)return{language:Le,value:Me(st),illegal:!1,relevance:0,errorRaised:Ie,_emitter:ks,_top:rt};throw Ie}}function So(Le){const st={value:Me(Le),illegal:!1,relevance:0,_top:qe,_emitter:new Ue.__emitter(Ue)};return st._emitter.addText(Le),st}function ko(Le,st){st=st||Ue.languages||Object.keys(ne);const bt=So(Le),Ot=st.filter(dn).filter(Pr).map(Kt=>ir(Kt,Le,!1));Ot.unshift(bt);const xs=Ot.sort((Kt,Bn)=>{if(Kt.relevance!==Bn.relevance)return Bn.relevance-Kt.relevance;if(Kt.language&&Bn.language){if(dn(Kt.language).supersetOf===Bn.language)return 1;if(dn(Bn.language).supersetOf===Kt.language)return-1}return 0}),[rn,zn]=xs,wn=rn;return wn.secondBest=zn,wn}function zi(Le,st,bt){const Ot=st&&xe[st]||bt;Le.classList.add("hljs"),Le.classList.add(`language-${Ot}`)}function bs(Le){let st=null;const bt=gs(Le);if(ot(bt))return;if(Ta("before:highlightElement",{el:Le,language:bt}),Le.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",Le);return}if(Le.children.length>0&&(Ue.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(Le)),Ue.throwUnescapedHTML))throw new ce("One of your code blocks includes unescaped HTML.",Le.innerHTML);st=Le;const Ot=st.textContent,xs=bt?ts(Ot,{language:bt,ignoreIllegals:!0}):ko(Ot);Le.innerHTML=xs.value,Le.dataset.highlighted="yes",zi(Le,bt,xs.language),Le.result={language:xs.language,re:xs.relevance,relevance:xs.relevance},xs.secondBest&&(Le.secondBest={language:xs.secondBest.language,relevance:xs.secondBest.relevance}),Ta("after:highlightElement",{el:Le,result:xs,text:Ot})}function nn(Le){Ue=Se(Ue,Le)}const Br=()=>{No(),is("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Dl(){No(),is("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Bu=!1;function No(){function Le(){No()}if(document.readyState==="loading"){Bu||window.addEventListener("DOMContentLoaded",Le,!1),Bu=!0;return}document.querySelectorAll(Ue.cssSelector).forEach(bs)}function Pu(Le,st){let bt=null;try{bt=st(q)}catch(Ot){if(Lt("Language definition for '{}' could not be registered.".replace("{}",Le)),at)Lt(Ot);else throw Ot;bt=qe}bt.name||(bt.name=Le),ne[Le]=bt,bt.rawDefinition=st.bind(null,q),bt.aliases&&rr(bt.aliases,{languageName:Le})}function Aa(Le){delete ne[Le];for(const st of Object.keys(xe))xe[st]===Le&&delete xe[st]}function Ll(){return Object.keys(ne)}function dn(Le){return Le=(Le||"").toLowerCase(),ne[Le]||ne[xe[Le]]}function rr(Le,{languageName:st}){typeof Le=="string"&&(Le=[Le]),Le.forEach(bt=>{xe[bt.toLowerCase()]=st})}function Pr(Le){const st=dn(Le);return st&&!st.disableAutodetect}function Ir(Le){Le["before:highlightBlock"]&&!Le["before:highlightElement"]&&(Le["before:highlightElement"]=st=>{Le["before:highlightBlock"](Object.assign({block:st.el},st))}),Le["after:highlightBlock"]&&!Le["after:highlightElement"]&&(Le["after:highlightElement"]=st=>{Le["after:highlightBlock"](Object.assign({block:st.el},st))})}function Ss(Le){Ir(Le),Pe.push(Le)}function Iu(Le){const st=Pe.indexOf(Le);st!==-1&&Pe.splice(st,1)}function Ta(Le,st){const bt=Le;Pe.forEach(function(Ot){Ot[bt]&&Ot[bt](st)})}function ar(Le){return is("10.7.0","highlightBlock will be removed entirely in v12.0"),is("10.7.0","Please use highlightElement now."),bs(Le)}Object.assign(q,{highlight:ts,highlightAuto:ko,highlightAll:No,highlightElement:bs,highlightBlock:ar,configure:nn,initHighlighting:Br,initHighlightingOnLoad:Dl,registerLanguage:Pu,unregisterLanguage:Aa,listLanguages:Ll,getLanguage:dn,registerAliases:rr,autoDetection:Pr,inherit:Se,addPlugin:Ss,removePlugin:Iu}),q.debugMode=function(){at=!1},q.safeMode=function(){at=!0},q.versionString=M,q.regex={concat:k,lookahead:b,either:E,optional:w,anyNumberOfTimes:v};for(const Le in Ye)typeof Ye[Le]=="object"&&e(Ye[Le]);return Object.assign(q,Ye),q},Be=Ne({});return Be.newInstance=()=>Ne({}),ub=Be,Be.HighlightJS=Be,Be.default=Be,ub}var db,bN;function jX(){if(bN)return db;bN=1;function e(t){const s=t.regex,i=s.concat(/[\p{L}_]/u,s.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),a=/[\p{L}0-9._:-]+/u,l={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},c={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},h=t.inherit(c,{begin:/\(/,end:/\)/}),f=t.inherit(t.APOS_STRING_MODE,{className:"string"}),d=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),p={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:a,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[l]},{begin:/'/,end:/'/,contains:[l]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[c,d,f,h,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[c,h,d,f]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},l,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[d]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[p],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[p],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:s.concat(/</,s.lookahead(s.concat(i,s.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:i,relevance:0,starts:p}]},{className:"tag",begin:s.concat(/<\//,s.lookahead(s.concat(i,/>/))),contains:[{className:"name",begin:i,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}return db=e,db}var hb,xN;function AX(){if(xN)return hb;xN=1;function e(t){const s=t.regex,i={},a={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[i]}]};Object.assign(i,{className:"variable",variants:[{begin:s.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},a]});const l={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},c=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),h={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},f={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,i,l]};l.contains.push(f);const d={match:/\\"/},p={className:"string",begin:/'/,end:/'/},g={match:/\\'/},b={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,i]},v=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],w=t.SHEBANG({binary:`(${v.join("|")})`,relevance:10}),k={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},N=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],E=["true","false"],T={match:/(\/[a-z._-]+)+/},A=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],C=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],R=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],L=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:N,literal:E,built_in:[...A,...C,"set","shopt",...R,...L]},contains:[w,t.SHEBANG(),k,b,c,h,T,f,d,p,g,i]}}return hb=e,hb}var fb,vN;function TX(){if(vN)return fb;vN=1;function e(t){const s=t.regex,i=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),a="decltype\\(auto\\)",l="[a-zA-Z_]\\w*::",h="("+a+"|"+s.optional(l)+"[a-zA-Z_]\\w*"+s.optional("<[^<>]+>")+")",f={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},p={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},g={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},b={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(p,{className:"string"}),{className:"string",begin:/<.*?>/},i,t.C_BLOCK_COMMENT_MODE]},v={className:"title",begin:s.optional(l)+t.IDENT_RE,relevance:0},w=s.optional(l)+t.IDENT_RE+"\\s*\\(",E={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},T=[b,f,i,t.C_BLOCK_COMMENT_MODE,g,p],A={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:E,contains:T.concat([{begin:/\(/,end:/\)/,keywords:E,contains:T.concat(["self"]),relevance:0}]),relevance:0},C={begin:"("+h+"[\\*&\\s]+)+"+w,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:E,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:a,keywords:E,relevance:0},{begin:w,returnBegin:!0,contains:[t.inherit(v,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:E,relevance:0,contains:[i,t.C_BLOCK_COMMENT_MODE,p,g,f,{begin:/\(/,end:/\)/,keywords:E,relevance:0,contains:["self",i,t.C_BLOCK_COMMENT_MODE,p,g,f]}]},f,i,t.C_BLOCK_COMMENT_MODE,b]};return{name:"C",aliases:["h"],keywords:E,disableAutodetect:!0,illegal:"</",contains:[].concat(A,C,T,[b,{begin:t.IDENT_RE+"::",keywords:E},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:b,strings:p,keywords:E}}}return fb=e,fb}var mb,yN;function RX(){if(yN)return mb;yN=1;function e(t){const s=t.regex,i=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),a="decltype\\(auto\\)",l="[a-zA-Z_]\\w*::",h="(?!struct)("+a+"|"+s.optional(l)+"[a-zA-Z_]\\w*"+s.optional("<[^<>]+>")+")",f={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},p={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},g={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},b={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(p,{className:"string"}),{className:"string",begin:/<.*?>/},i,t.C_BLOCK_COMMENT_MODE]},v={className:"title",begin:s.optional(l)+t.IDENT_RE,relevance:0},w=s.optional(l)+t.IDENT_RE+"\\s*\\(",k=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],N=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],E=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],T=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],R={type:N,keyword:k,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:E},L={className:"function.dispatch",relevance:0,keywords:{_hint:T},begin:s.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,s.lookahead(/(<[^<>]+>|)\s*\(/))},H=[L,b,f,i,t.C_BLOCK_COMMENT_MODE,g,p],B={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:R,contains:H.concat([{begin:/\(/,end:/\)/,keywords:R,contains:H.concat(["self"]),relevance:0}]),relevance:0},P={className:"function",begin:"("+h+"[\\*&\\s]+)+"+w,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:R,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:a,keywords:R,relevance:0},{begin:w,returnBegin:!0,contains:[v],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[p,g]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:R,relevance:0,contains:[i,t.C_BLOCK_COMMENT_MODE,p,g,f,{begin:/\(/,end:/\)/,keywords:R,relevance:0,contains:["self",i,t.C_BLOCK_COMMENT_MODE,p,g,f]}]},f,i,t.C_BLOCK_COMMENT_MODE,b]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:R,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(B,P,L,H,[b,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:R,contains:["self",f]},{begin:t.IDENT_RE+"::",keywords:R},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}return mb=e,mb}var pb,_N;function MX(){if(_N)return pb;_N=1;function e(t){const s=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],i=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],a=["default","false","null","true"],l=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],c=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],h={keyword:l.concat(c),built_in:s,literal:a},f=t.inherit(t.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),d={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},p={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},g={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},b=t.inherit(g,{illegal:/\n/}),v={className:"subst",begin:/\{/,end:/\}/,keywords:h},w=t.inherit(v,{illegal:/\n/}),k={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},t.BACKSLASH_ESCAPE,w]},N={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},v]},E=t.inherit(N,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},w]});v.contains=[N,k,g,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,d,t.C_BLOCK_COMMENT_MODE],w.contains=[E,k,b,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,d,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const T={variants:[p,N,k,g,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},A={begin:"<",end:">",contains:[{beginKeywords:"in out"},f]},C=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",R={begin:"@"+t.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:h,illegal:/::/,contains:[t.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},T,d,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},f,A,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[f,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[f,A,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+C+"\\s+)+"+t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:h,contains:[{beginKeywords:i.join(" "),relevance:0},{begin:t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[t.TITLE_MODE,A],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,relevance:0,contains:[T,d,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},R]}}return pb=e,pb}var gb,wN;function DX(){if(wN)return gb;wN=1;const e=d=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:d.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[d.APOS_STRING_MODE,d.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:d.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),t=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],s=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],i=[...t,...s],a=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),l=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),c=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),h=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function f(d){const p=d.regex,g=e(d),b={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},v="and or not only",w=/@-?\w[\w]*(-\w+)*/,k="[a-zA-Z-][a-zA-Z0-9_-]*",N=[d.APOS_STRING_MODE,d.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[g.BLOCK_COMMENT,b,g.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+k,relevance:0},g.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+l.join("|")+")"},{begin:":(:)?("+c.join("|")+")"}]},g.CSS_VARIABLE,{className:"attribute",begin:"\\b("+h.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[g.BLOCK_COMMENT,g.HEXCOLOR,g.IMPORTANT,g.CSS_NUMBER_MODE,...N,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...N,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},g.FUNCTION_DISPATCH]},{begin:p.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:w},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:v,attribute:a.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...N,g.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+i.join("|")+")\\b"}]}}return gb=f,gb}var bb,SN;function LX(){if(SN)return bb;SN=1;function e(t){const s=t.regex,i={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},a={begin:"^[-\\*]{3,}",end:"$"},l={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},c={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},h={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},f=/[A-Za-z][A-Za-z0-9+.-]*/,d={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:s.concat(/\[.+?\]\(/,f,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},p={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},g={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},b=t.inherit(p,{contains:[]}),v=t.inherit(g,{contains:[]});p.contains.push(v),g.contains.push(b);let w=[i,d];return[p,g,b,v].forEach(T=>{T.contains=T.contains.concat(w)}),w=w.concat(p,g),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:w},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:w}]}]},i,c,p,g,{className:"quote",begin:"^>\\s+",contains:w,end:"$"},l,a,d,h,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}return bb=e,bb}var xb,kN;function OX(){if(kN)return xb;kN=1;function e(t){const s=t.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:s.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:s.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}return xb=e,xb}var vb,NN;function zX(){if(NN)return vb;NN=1;function e(t){const s=t.regex,i="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",a=s.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),l=s.concat(a,/(::\w+)*/),h={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},f={className:"doctag",begin:"@[A-Za-z]+"},d={begin:"#<",end:">"},p=[t.COMMENT("#","$",{contains:[f]}),t.COMMENT("^=begin","^=end",{contains:[f],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],g={className:"subst",begin:/#\{/,end:/\}/,keywords:h},b={className:"string",contains:[t.BACKSLASH_ESCAPE,g],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:s.concat(/<<[-~]?'?/,s.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[t.BACKSLASH_ESCAPE,g]})]}]},v="[1-9](_?[0-9])*|0",w="[0-9](_?[0-9])*",k={className:"number",relevance:0,variants:[{begin:`\\b(${v})(\\.(${w}))?([eE][+-]?(${w})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},N={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:h}]},H=[b,{variants:[{match:[/class\s+/,l,/\s+<\s+/,l]},{match:[/\b(class|module)\s+/,l]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:h},{match:[/(include|extend)\s+/,l],scope:{2:"title.class"},keywords:h},{relevance:0,match:[l,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:a,scope:"title.class"},{match:[/def/,/\s+/,i],scope:{1:"keyword",3:"title.function"},contains:[N]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[b,{begin:i}],relevance:0},k,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:h},{begin:"("+t.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[t.BACKSLASH_ESCAPE,g],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(d,p),relevance:0}].concat(d,p);g.contains=H,N.contains=H;const G=[{begin:/^\s*=>/,starts:{end:"$",contains:H}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:h,contains:H}}];return p.unshift(d),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:h,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(G).concat(p).concat(H)}}return vb=e,vb}var yb,CN;function BX(){if(CN)return yb;CN=1;function e(t){const c={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:c,illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"string",variants:[t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[t.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:c,illegal:/["']/}]}]}}return yb=e,yb}var _b,EN;function PX(){if(EN)return _b;EN=1;function e(t){const s=t.regex,i=/[_A-Za-z][_0-9A-Za-z]*/;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[t.HASH_COMMENT_MODE,t.QUOTE_STRING_MODE,t.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:s.concat(i,s.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}return _b=e,_b}var wb,jN;function IX(){if(jN)return wb;jN=1;function e(t){const s=t.regex,i={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:t.NUMBER_RE}]},a=t.COMMENT();a.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const l={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},c={className:"literal",begin:/\bon|off|true|false|yes|no\b/},h={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},f={begin:/\[/,end:/\]/,contains:[a,c,l,h,i,"self"],relevance:0},d=/[A-Za-z0-9_-]+/,p=/"(\\"|[^"])*"/,g=/'[^']*'/,b=s.either(d,p,g),v=s.concat(b,"(\\s*\\.\\s*",b,")*",s.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[a,{className:"section",begin:/\[+/,end:/\]+/},{begin:v,className:"attr",starts:{end:/$/,contains:[a,f,c,l,h,i]}}]}}return wb=e,wb}var Sb,AN;function $X(){if(AN)return Sb;AN=1;var e="[0-9](_*[0-9])*",t=`\\.(${e})`,s="[0-9a-fA-F](_*[0-9a-fA-F])*",i={className:"number",variants:[{begin:`(\\b(${e})((${t})|\\.)?|(${t}))[eE][+-]?(${e})[fFdD]?\\b`},{begin:`\\b(${e})((${t})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${t})[fFdD]?\\b`},{begin:`\\b(${e})[fFdD]\\b`},{begin:`\\b0[xX]((${s})\\.?|(${s})?\\.(${s}))[pP][+-]?(${e})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${s})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function a(c,h,f){return f===-1?"":c.replace(h,d=>a(c,h,f-1))}function l(c){const h=c.regex,f="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",d=f+a("(?:<"+f+"~~~(?:\\s*,\\s*"+f+"~~~)*>)?",/~~~/g,2),w={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},k={className:"meta",begin:"@"+f,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},N={className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[c.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:w,illegal:/<\/|#/,contains:[c.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},c.C_LINE_COMMENT_MODE,c.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[c.BACKSLASH_ESCAPE]},c.APOS_STRING_MODE,c.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,f],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[h.concat(/(?!else)/,f),/\s+/,f,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,f],className:{1:"keyword",3:"title.class"},contains:[N,c.C_LINE_COMMENT_MODE,c.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+d+"\\s+)",c.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:w,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[k,c.APOS_STRING_MODE,c.QUOTE_STRING_MODE,i,c.C_BLOCK_COMMENT_MODE]},c.C_LINE_COMMENT_MODE,c.C_BLOCK_COMMENT_MODE]},i,k]}}return Sb=l,Sb}var kb,TN;function HX(){if(TN)return kb;TN=1;const e="[A-Za-z$_][0-9A-Za-z$_]*",t=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],s=["true","false","null","undefined","NaN","Infinity"],i=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],a=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],l=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],c=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],h=[].concat(l,i,a);function f(d){const p=d.regex,g=(ye,{after:Ee})=>{const De="</"+ye[0].slice(1);return ye.input.indexOf(De,Ee)!==-1},b=e,v={begin:"<>",end:"</>"},w=/<[A-Za-z0-9\\._:-]+\s*\/>/,k={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(ye,Ee)=>{const De=ye[0].length+ye.index,Ye=ye.input[De];if(Ye==="<"||Ye===","){Ee.ignoreMatch();return}Ye===">"&&(g(ye,{after:De})||Ee.ignoreMatch());let we;const He=ye.input.substring(De);if(we=He.match(/^\s*=/)){Ee.ignoreMatch();return}if((we=He.match(/^\s+extends\s+/))&&we.index===0){Ee.ignoreMatch();return}}},N={$pattern:e,keyword:t,literal:s,built_in:h,"variable.language":c},E="[0-9](_?[0-9])*",T=`\\.(${E})`,A="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",C={className:"number",variants:[{begin:`(\\b(${A})((${T})|\\.)?|(${T}))[eE][+-]?(${E})\\b`},{begin:`\\b(${A})\\b((${T})\\b|\\.)?|(${T})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},R={className:"subst",begin:"\\$\\{",end:"\\}",keywords:N,contains:[]},L={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[d.BACKSLASH_ESCAPE,R],subLanguage:"xml"}},H={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[d.BACKSLASH_ESCAPE,R],subLanguage:"css"}},B={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[d.BACKSLASH_ESCAPE,R],subLanguage:"graphql"}},P={className:"string",begin:"`",end:"`",contains:[d.BACKSLASH_ESCAPE,R]},G={className:"comment",variants:[d.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:b+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),d.C_BLOCK_COMMENT_MODE,d.C_LINE_COMMENT_MODE]},$=[d.APOS_STRING_MODE,d.QUOTE_STRING_MODE,L,H,B,P,{match:/\$\d+/},C];R.contains=$.concat({begin:/\{/,end:/\}/,keywords:N,contains:["self"].concat($)});const O=[].concat(G,R.contains),V=O.concat([{begin:/(\s*)\(/,end:/\)/,keywords:N,contains:["self"].concat(O)}]),K={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:N,contains:V},I={variants:[{match:[/class/,/\s+/,b,/\s+/,/extends/,/\s+/,p.concat(b,"(",p.concat(/\./,b),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,b],scope:{1:"keyword",3:"title.class"}}]},Y={relevance:0,match:p.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...i,...a]}},W={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},le={variants:[{match:[/function/,/\s+/,b,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[K],illegal:/%/},J={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function U(ye){return p.concat("(?!",ye.join("|"),")")}const F={match:p.concat(/\b/,U([...l,"super","import"].map(ye=>`${ye}\\s*\\(`)),b,p.lookahead(/\s*\(/)),className:"title.function",relevance:0},re={begin:p.concat(/\./,p.lookahead(p.concat(b,/(?![0-9A-Za-z$_(])/))),end:b,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},fe={match:[/get|set/,/\s+/,b,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},K]},se="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+d.UNDERSCORE_IDENT_RE+")\\s*=>",te={match:[/const|var|let/,/\s+/,b,/\s*/,/=\s*/,/(async\s*)?/,p.lookahead(se)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[K]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:N,exports:{PARAMS_CONTAINS:V,CLASS_REFERENCE:Y},illegal:/#(?![$_A-z])/,contains:[d.SHEBANG({label:"shebang",binary:"node",relevance:5}),W,d.APOS_STRING_MODE,d.QUOTE_STRING_MODE,L,H,B,P,G,{match:/\$\d+/},C,Y,{scope:"attr",match:b+p.lookahead(":"),relevance:0},te,{begin:"("+d.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[G,d.REGEXP_MODE,{className:"function",begin:se,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:d.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:N,contains:V}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:v.begin,end:v.end},{match:w},{begin:k.begin,"on:begin":k.isTrulyOpeningTag,end:k.end}],subLanguage:"xml",contains:[{begin:k.begin,end:k.end,skip:!0,contains:["self"]}]}]},le,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+d.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[K,d.inherit(d.TITLE_MODE,{begin:b,className:"title.function"})]},{match:/\.\.\./,relevance:0},re,{match:"\\$"+b,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[K]},F,J,I,fe,{match:/\$[(.]/}]}}return kb=f,kb}var Nb,RN;function UX(){if(RN)return Nb;RN=1;function e(t){const s={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},i={match:/[{}[\],:]/,className:"punctuation",relevance:0},a=["true","false","null"],l={scope:"literal",beginKeywords:a.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:a},contains:[s,i,t.QUOTE_STRING_MODE,l,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}return Nb=e,Nb}var Cb,MN;function FX(){if(MN)return Cb;MN=1;var e="[0-9](_*[0-9])*",t=`\\.(${e})`,s="[0-9a-fA-F](_*[0-9a-fA-F])*",i={className:"number",variants:[{begin:`(\\b(${e})((${t})|\\.)?|(${t}))[eE][+-]?(${e})[fFdD]?\\b`},{begin:`\\b(${e})((${t})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${t})[fFdD]?\\b`},{begin:`\\b(${e})[fFdD]\\b`},{begin:`\\b0[xX]((${s})\\.?|(${s})?\\.(${s}))[pP][+-]?(${e})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${s})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function a(l){const c={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},h={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},f={className:"symbol",begin:l.UNDERSCORE_IDENT_RE+"@"},d={className:"subst",begin:/\$\{/,end:/\}/,contains:[l.C_NUMBER_MODE]},p={className:"variable",begin:"\\$"+l.UNDERSCORE_IDENT_RE},g={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[p,d]},{begin:"'",end:"'",illegal:/\n/,contains:[l.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[l.BACKSLASH_ESCAPE,p,d]}]};d.contains.push(g);const b={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+l.UNDERSCORE_IDENT_RE+")?"},v={className:"meta",begin:"@"+l.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[l.inherit(g,{className:"string"}),"self"]}]},w=i,k=l.COMMENT("/\\*","\\*/",{contains:[l.C_BLOCK_COMMENT_MODE]}),N={variants:[{className:"type",begin:l.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},E=N;return E.variants[1].contains=[N],N.variants[1].contains=[E],{name:"Kotlin",aliases:["kt","kts"],keywords:c,contains:[l.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),l.C_LINE_COMMENT_MODE,k,h,f,b,v,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:c,relevance:5,contains:[{begin:l.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[l.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:c,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[N,l.C_LINE_COMMENT_MODE,k],relevance:0},l.C_LINE_COMMENT_MODE,k,b,v,g,l.C_NUMBER_MODE]},k]},{begin:[/class|interface|trait/,/\s+/,l.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},l.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},b,v]},g,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
116
+ `},w]}}return Cb=a,Cb}var Eb,DN;function qX(){if(DN)return Eb;DN=1;const e=p=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:p.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[p.APOS_STRING_MODE,p.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:p.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),t=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],s=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],i=[...t,...s],a=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),l=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),c=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),h=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),f=l.concat(c).sort().reverse();function d(p){const g=e(p),b=f,v="and or not only",w="[\\w-]+",k="("+w+"|@\\{"+w+"\\})",N=[],E=[],T=function(O){return{className:"string",begin:"~?"+O+".*?"+O}},A=function(O,V,K){return{className:O,begin:V,relevance:K}},C={$pattern:/[a-z-]+/,keyword:v,attribute:a.join(" ")},R={begin:"\\(",end:"\\)",contains:E,keywords:C,relevance:0};E.push(p.C_LINE_COMMENT_MODE,p.C_BLOCK_COMMENT_MODE,T("'"),T('"'),g.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},g.HEXCOLOR,R,A("variable","@@?"+w,10),A("variable","@\\{"+w+"\\}"),A("built_in","~?`[^`]*?`"),{className:"attribute",begin:w+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},g.IMPORTANT,{beginKeywords:"and not"},g.FUNCTION_DISPATCH);const L=E.concat({begin:/\{/,end:/\}/,contains:N}),H={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(E)},B={begin:k+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},g.CSS_VARIABLE,{className:"attribute",begin:"\\b("+h.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:E}}]},P={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:C,returnEnd:!0,contains:E,relevance:0}},D={className:"variable",variants:[{begin:"@"+w+"\\s*:",relevance:15},{begin:"@"+w}],starts:{end:"[;}]",returnEnd:!0,contains:L}},G={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:k,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[p.C_LINE_COMMENT_MODE,p.C_BLOCK_COMMENT_MODE,H,A("keyword","all\\b"),A("variable","@\\{"+w+"\\}"),{begin:"\\b("+i.join("|")+")\\b",className:"selector-tag"},g.CSS_NUMBER_MODE,A("selector-tag",k,0),A("selector-id","#"+k),A("selector-class","\\."+k,0),A("selector-tag","&",0),g.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+l.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+c.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:L},{begin:"!important"},g.FUNCTION_DISPATCH]},$={begin:w+`:(:)?(${b.join("|")})`,returnBegin:!0,contains:[G]};return N.push(p.C_LINE_COMMENT_MODE,p.C_BLOCK_COMMENT_MODE,P,D,$,B,G,H,g.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:N}}return Eb=d,Eb}var jb,LN;function GX(){if(LN)return jb;LN=1;function e(t){const s="\\[=*\\[",i="\\]=*\\]",a={begin:s,end:i,contains:["self"]},l=[t.COMMENT("--(?!"+s+")","$"),t.COMMENT("--"+s,i,{contains:[a],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:t.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:l.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[t.inherit(t.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:l}].concat(l)},t.C_NUMBER_MODE,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{className:"string",begin:s,end:i,contains:[a],relevance:5}])}}return jb=e,jb}var Ab,ON;function VX(){if(ON)return Ab;ON=1;function e(t){const s={className:"variable",variants:[{begin:"\\$\\("+t.UNDERSCORE_IDENT_RE+"\\)",contains:[t.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},i={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,s]},a={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[s,i]},l={begin:"^"+t.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},c={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},h={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[s]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[t.HASH_COMMENT_MODE,s,i,a,l,c,h]}}return Ab=e,Ab}var Tb,zN;function WX(){if(zN)return Tb;zN=1;function e(t){const s=t.regex,i=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],a=/[dualxmsipngr]{0,12}/,l={$pattern:/[\w.]+/,keyword:i.join(" ")},c={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:l},h={begin:/->\{/,end:/\}/},f={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},d={scope:"variable",variants:[{begin:/\$\d/},{begin:s.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[f]},p={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},g=[t.BACKSLASH_ESCAPE,c,d],b=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],v=(N,E,T="\\1")=>{const A=T==="\\1"?T:s.concat(T,E);return s.concat(s.concat("(?:",N,")"),E,/(?:\\.|[^\\\/])*?/,A,/(?:\\.|[^\\\/])*?/,T,a)},w=(N,E,T)=>s.concat(s.concat("(?:",N,")"),E,/(?:\\.|[^\\\/])*?/,T,a),k=[d,t.HASH_COMMENT_MODE,t.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),h,{className:"string",contains:g,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},p,{begin:"(\\/\\/|"+t.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[t.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:v("s|tr|y",s.either(...b,{capture:!0}))},{begin:v("s|tr|y","\\(","\\)")},{begin:v("s|tr|y","\\[","\\]")},{begin:v("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:w("(?:m|qr)?",/\//,/\//)},{begin:w("m|qr",s.either(...b,{capture:!0}),/\1/)},{begin:w("m|qr",/\(/,/\)/)},{begin:w("m|qr",/\[/,/\]/)},{begin:w("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,f]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,f,p]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return c.contains=k,h.contains=k,{name:"Perl",aliases:["pl","pm"],keywords:l,contains:k}}return Tb=e,Tb}var Rb,BN;function KX(){if(BN)return Rb;BN=1;function e(t){const s={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},i=/[a-zA-Z@][a-zA-Z0-9_]*/,f={"variable.language":["this","super"],$pattern:i,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},d={$pattern:i,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:f,illegal:"</",contains:[s,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,t.C_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+d.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:d,contains:[t.UNDERSCORE_TITLE_MODE]},{begin:"\\."+t.UNDERSCORE_IDENT_RE,relevance:0}]}}return Rb=e,Rb}var Mb,PN;function YX(){if(PN)return Mb;PN=1;function e(t){const s=t.regex,i=/(?![A-Za-z0-9])(?![$])/,a=s.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,i),l=s.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,i),c=s.concat(/[A-Z]+/,i),h={scope:"variable",match:"\\$+"+a},f={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},d={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},p=t.inherit(t.APOS_STRING_MODE,{illegal:null}),g=t.inherit(t.QUOTE_STRING_MODE,{illegal:null,contains:t.QUOTE_STRING_MODE.contains.concat(d)}),b={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(d),"on:begin":(K,I)=>{I.data._beginMatch=K[1]||K[2]},"on:end":(K,I)=>{I.data._beginMatch!==K[1]&&I.ignoreMatch()}},v=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),w=`[
117
+ ]`,k={scope:"string",variants:[g,p,b,v]},N={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},E=["false","null","true"],T=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],A=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],R={keyword:T,literal:(K=>{const I=[];return K.forEach(Y=>{I.push(Y),Y.toLowerCase()===Y?I.push(Y.toUpperCase()):I.push(Y.toLowerCase())}),I})(E),built_in:A},L=K=>K.map(I=>I.replace(/\|\d+$/,"")),H={variants:[{match:[/new/,s.concat(w,"+"),s.concat("(?!",L(A).join("\\b|"),"\\b)"),l],scope:{1:"keyword",4:"title.class"}}]},B=s.concat(a,"\\b(?!\\()"),P={variants:[{match:[s.concat(/::/,s.lookahead(/(?!class\b)/)),B],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[l,s.concat(/::/,s.lookahead(/(?!class\b)/)),B],scope:{1:"title.class",3:"variable.constant"}},{match:[l,s.concat("::",s.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[l,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},D={scope:"attr",match:s.concat(a,s.lookahead(":"),s.lookahead(/(?!::)/))},G={relevance:0,begin:/\(/,end:/\)/,keywords:R,contains:[D,h,P,t.C_BLOCK_COMMENT_MODE,k,N,H]},$={relevance:0,match:[/\b/,s.concat("(?!fn\\b|function\\b|",L(T).join("\\b|"),"|",L(A).join("\\b|"),"\\b)"),a,s.concat(w,"*"),s.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[G]};G.contains.push($);const O=[D,P,t.C_BLOCK_COMMENT_MODE,k,N,H],V={begin:s.concat(/#\[\s*\\?/,s.either(l,c)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:E,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:E,keyword:["new","array"]},contains:["self",...O]},...O,{scope:"meta",variants:[{match:l},{match:c}]}]};return{case_insensitive:!1,keywords:R,contains:[V,t.HASH_COMMENT_MODE,t.COMMENT("//","$"),t.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:t.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},f,{scope:"variable.language",match:/\$this\b/},h,$,P,{match:[/const/,/\s/,a],scope:{1:"keyword",3:"variable.constant"}},H,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},t.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:R,contains:["self",V,h,P,t.C_BLOCK_COMMENT_MODE,k,N]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},t.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[t.inherit(t.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},t.UNDERSCORE_TITLE_MODE]},k,N]}}return Mb=e,Mb}var Db,IN;function XX(){if(IN)return Db;IN=1;function e(t){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},t.inherit(t.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),t.inherit(t.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}return Db=e,Db}var Lb,$N;function ZX(){if($N)return Lb;$N=1;function e(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}return Lb=e,Lb}var Ob,HN;function QX(){if(HN)return Ob;HN=1;function e(t){const s=t.regex,i=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),a=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],f={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:a,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},d={className:"meta",begin:/^(>>>|\.\.\.) /},p={className:"subst",begin:/\{/,end:/\}/,keywords:f,illegal:/#/},g={begin:/\{\{/,relevance:0},b={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,d],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,d],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,d,g,p]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,d,g,p]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,g,p]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,g,p]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},v="[0-9](_?[0-9])*",w=`(\\b(${v}))?\\.(${v})|\\b(${v})\\.`,k=`\\b|${a.join("|")}`,N={className:"number",relevance:0,variants:[{begin:`(\\b(${v})|(${w}))[eE][+-]?(${v})[jJ]?(?=${k})`},{begin:`(${w})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${k})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${k})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${k})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${k})`},{begin:`\\b(${v})[jJ](?=${k})`}]},E={className:"comment",begin:s.lookahead(/# type:/),end:/$/,keywords:f,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},T={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:f,contains:["self",d,N,b,t.HASH_COMMENT_MODE]}]};return p.contains=[b,N,d],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:f,illegal:/(<\/|\?)|=>/,contains:[d,N,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},b,E,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,i],scope:{1:"keyword",3:"title.function"},contains:[T]},{variants:[{match:[/\bclass/,/\s+/,i,/\s*/,/\(\s*/,i,/\s*\)/]},{match:[/\bclass/,/\s+/,i]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[N,T,b]}]}}return Ob=e,Ob}var zb,UN;function JX(){if(UN)return zb;UN=1;function e(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}return zb=e,zb}var Bb,FN;function eZ(){if(FN)return Bb;FN=1;function e(t){const s=t.regex,i=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,a=s.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),l=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,c=s.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:i,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[t.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:s.lookahead(s.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:i},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),t.HASH_COMMENT_MODE,{scope:"string",contains:[t.BACKSLASH_ESCAPE],variants:[t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[l,a]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,a]},{scope:{1:"punctuation",2:"number"},match:[c,a]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,a]}]},{scope:{3:"operator"},match:[i,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:l},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:c},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}return Bb=e,Bb}var Pb,qN;function tZ(){if(qN)return Pb;qN=1;function e(t){const s=t.regex,i=/(r#)?/,a=s.concat(i,t.UNDERSCORE_IDENT_RE),l=s.concat(i,t.IDENT_RE),c={className:"title.function.invoke",relevance:0,begin:s.concat(/\b/,/(?!let|for|while|if|else|match\b)/,l,s.lookahead(/\s*\(/))},h="([ui](8|16|32|64|128|size)|f(32|64))?",f=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],d=["true","false","Some","None","Ok","Err"],p=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],g=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:t.IDENT_RE+"!?",type:g,keyword:f,literal:d,built_in:p},illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.COMMENT("/\\*","\\*/",{contains:["self"]}),t.inherit(t.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+h},{begin:"\\b0o([0-7_]+)"+h},{begin:"\\b0x([A-Fa-f0-9_]+)"+h},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+h}],relevance:0},{begin:[/fn/,/\s+/,a],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,a],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,a,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,a],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,a],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:p,type:g}},{className:"punctuation",begin:"->"},c]}}return Pb=e,Pb}var Ib,GN;function sZ(){if(GN)return Ib;GN=1;const e=d=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:d.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[d.APOS_STRING_MODE,d.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:d.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),t=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],s=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],i=[...t,...s],a=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),l=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),c=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),h=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function f(d){const p=e(d),g=c,b=l,v="@[a-z-]+",w="and or not only",N={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[d.C_LINE_COMMENT_MODE,d.C_BLOCK_COMMENT_MODE,p.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},p.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+i.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+b.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+g.join("|")+")"},N,{begin:/\(/,end:/\)/,contains:[p.CSS_NUMBER_MODE]},p.CSS_VARIABLE,{className:"attribute",begin:"\\b("+h.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[p.BLOCK_COMMENT,N,p.HEXCOLOR,p.CSS_NUMBER_MODE,d.QUOTE_STRING_MODE,d.APOS_STRING_MODE,p.IMPORTANT,p.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:v,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:w,attribute:a.join(" ")},contains:[{begin:v,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},N,d.QUOTE_STRING_MODE,d.APOS_STRING_MODE,p.HEXCOLOR,p.CSS_NUMBER_MODE]},p.FUNCTION_DISPATCH]}}return Ib=f,Ib}var $b,VN;function nZ(){if(VN)return $b;VN=1;function e(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}return $b=e,$b}var Hb,WN;function iZ(){if(WN)return Hb;WN=1;function e(t){const s=t.regex,i=t.COMMENT("--","$"),a={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},l={begin:/"/,end:/"/,contains:[{match:/""/}]},c=["true","false","unknown"],h=["double precision","large object","with timezone","without timezone"],f=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],d=["add","asc","collation","desc","final","first","last","view"],p=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],g=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],b=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],v=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],w=g,k=[...p,...d].filter(L=>!g.includes(L)),N={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},E={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},T={match:s.concat(/\b/,s.either(...w),/\s*\(/),relevance:0,keywords:{built_in:w}};function A(L){return s.concat(/\b/,s.either(...L.map(H=>H.replace(/\s+/,"\\s+"))),/\b/)}const C={scope:"keyword",match:A(v),relevance:0};function R(L,{exceptions:H,when:B}={}){const P=B;return H=H||[],L.map(D=>D.match(/\|\d+$/)||H.includes(D)?D:P(D)?`${D}|0`:D)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:R(k,{when:L=>L.length<3}),literal:c,type:f,built_in:b},contains:[{scope:"type",match:A(h)},C,T,N,a,l,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,i,E]}}return Hb=e,Hb}var Ub,KN;function rZ(){if(KN)return Ub;KN=1;function e(B){return B?typeof B=="string"?B:B.source:null}function t(B){return s("(?=",B,")")}function s(...B){return B.map(D=>e(D)).join("")}function i(B){const P=B[B.length-1];return typeof P=="object"&&P.constructor===Object?(B.splice(B.length-1,1),P):{}}function a(...B){return"("+(i(B).capture?"":"?:")+B.map(G=>e(G)).join("|")+")"}const l=B=>s(/\b/,B,/\w$/.test(B)?/\b/:/\B/),c=["Protocol","Type"].map(l),h=["init","self"].map(l),f=["Any","Self"],d=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],p=["false","nil","true"],g=["assignment","associativity","higherThan","left","lowerThan","none","right"],b=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],v=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],w=a(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),k=a(w,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),N=s(w,k,"*"),E=a(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),T=a(E,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),A=s(E,T,"*"),C=s(/[A-Z]/,T,"*"),R=["attached","autoclosure",s(/convention\(/,a("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",s(/objc\(/,A,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],L=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function H(B){const P={match:/\s+/,relevance:0},D=B.COMMENT("/\\*","\\*/",{contains:["self"]}),G=[B.C_LINE_COMMENT_MODE,D],$={match:[/\./,a(...c,...h)],className:{2:"keyword"}},O={match:s(/\./,a(...d)),relevance:0},V=d.filter(me=>typeof me=="string").concat(["_|0"]),K=d.filter(me=>typeof me!="string").concat(f).map(l),I={variants:[{className:"keyword",match:a(...K,...h)}]},Y={$pattern:a(/\b\w+/,/#\w+/),keyword:V.concat(b),literal:p},W=[$,O,I],le={match:s(/\./,a(...v)),relevance:0},J={className:"built_in",match:s(/\b/,a(...v),/(?=\()/)},U=[le,J],F={match:/->/,relevance:0},re={className:"operator",relevance:0,variants:[{match:N},{match:`\\.(\\.|${k})+`}]},fe=[F,re],se="([0-9]_*)+",te="([0-9a-fA-F]_*)+",ye={className:"number",relevance:0,variants:[{match:`\\b(${se})(\\.(${se}))?([eE][+-]?(${se}))?\\b`},{match:`\\b0x(${te})(\\.(${te}))?([pP][+-]?(${se}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},Ee=(me="")=>({className:"subst",variants:[{match:s(/\\/,me,/[0\\tnr"']/)},{match:s(/\\/,me,/u\{[0-9a-fA-F]{1,8}\}/)}]}),De=(me="")=>({className:"subst",match:s(/\\/,me,/[\t ]*(?:[\r\n]|\r\n)/)}),Ye=(me="")=>({className:"subst",label:"interpol",begin:s(/\\/,me,/\(/),end:/\)/}),we=(me="")=>({begin:s(me,/"""/),end:s(/"""/,me),contains:[Ee(me),De(me),Ye(me)]}),He=(me="")=>({begin:s(me,/"/),end:s(/"/,me),contains:[Ee(me),Ye(me)]}),$e={className:"string",variants:[we(),we("#"),we("##"),we("###"),He(),He("#"),He("##"),He("###")]},St=[B.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[B.BACKSLASH_ESCAPE]}],Gt={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:St},At=me=>{const Ae=s(me,/\//),Ne=s(/\//,me);return{begin:Ae,end:Ne,contains:[...St,{scope:"comment",begin:`#(?!.*${Ne})`,end:/$/}]}},Ln={scope:"regexp",variants:[At("###"),At("##"),At("#"),Gt]},_n={match:s(/`/,A,/`/)},ms={className:"variable",match:/\$\d+/},Hs={className:"variable",match:`\\$${T}+`},un=[_n,ms,Hs],ei={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:L,contains:[...fe,ye,$e]}]}},On={scope:"keyword",match:s(/@/,a(...R),t(a(/\(/,/\s+/)))},Lt={scope:"meta",match:s(/@/,A)},ps=[ei,On,Lt],is={match:t(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:s(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,T,"+")},{className:"type",match:C,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:s(/\s+&\s+/,t(C)),relevance:0}]},et={begin:/</,end:/>/,keywords:Y,contains:[...G,...W,...ps,F,is]};is.contains.push(et);const tt={match:s(A,/\s*:/),keywords:"_|0",relevance:0},Ct={begin:/\(/,end:/\)/,relevance:0,keywords:Y,contains:["self",tt,...G,Ln,...W,...U,...fe,ye,$e,...un,...ps,is]},S={begin:/</,end:/>/,keywords:"repeat each",contains:[...G,is]},ee={begin:a(t(s(A,/\s*:/)),t(s(A,/\s+/,A,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:A}]},ge={begin:/\(/,end:/\)/,keywords:Y,contains:[ee,...G,...W,...fe,ye,$e,...ps,is,Ct],endsParent:!0,illegal:/["']/},_e={match:[/(func|macro)/,/\s+/,a(_n.match,A,N)],className:{1:"keyword",3:"title.function"},contains:[S,ge,P],illegal:[/\[/,/%/]},oe={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[S,ge,P],illegal:/\[|%/},Re={match:[/operator/,/\s+/,N],className:{1:"keyword",3:"title"}},M={begin:[/precedencegroup/,/\s+/,C],className:{1:"keyword",3:"title"},contains:[is],keywords:[...g,...p],end:/}/},ce={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Me={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Se={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,A,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:Y,contains:[S,...W,{begin:/:/,end:/\{/,keywords:Y,contains:[{scope:"title.class.inherited",match:C},...W],relevance:0}]};for(const me of $e.variants){const Ae=me.contains.find(Be=>Be.label==="interpol");Ae.keywords=Y;const Ne=[...W,...U,...fe,ye,$e,...un];Ae.contains=[...Ne,{begin:/\(/,end:/\)/,contains:["self",...Ne]}]}return{name:"Swift",keywords:Y,contains:[...G,_e,oe,ce,Me,Se,Re,M,{beginKeywords:"import",end:/$/,contains:[...G],relevance:0},Ln,...W,...U,...fe,ye,$e,...un,...ps,is,Ct]}}return Ub=H,Ub}var Fb,YN;function aZ(){if(YN)return Fb;YN=1;function e(t){const s="true false yes no null",i="[\\w#;/?:@&=+$,.~*'()[\\]]+",a={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},l={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},c={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},h={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,l]},f=t.inherit(h,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),v={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},w={end:",",endsWithParent:!0,excludeEnd:!0,keywords:s,relevance:0},k={begin:/\{/,end:/\}/,contains:[w],illegal:"\\n",relevance:0},N={begin:"\\[",end:"\\]",contains:[w],illegal:"\\n",relevance:0},E=[a,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+i},{className:"type",begin:"!<"+i+">"},{className:"type",begin:"!"+i},{className:"type",begin:"!!"+i},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:s,keywords:{literal:s}},v,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},k,N,c,h],T=[...E];return T.pop(),T.push(f),w.contains=T,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:E}}return Fb=e,Fb}var qb,XN;function oZ(){if(XN)return qb;XN=1;const e="[A-Za-z$_][0-9A-Za-z$_]*",t=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],s=["true","false","null","undefined","NaN","Infinity"],i=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],a=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],l=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],c=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],h=[].concat(l,i,a);function f(p){const g=p.regex,b=(Ee,{after:De})=>{const Ye="</"+Ee[0].slice(1);return Ee.input.indexOf(Ye,De)!==-1},v=e,w={begin:"<>",end:"</>"},k=/<[A-Za-z0-9\\._:-]+\s*\/>/,N={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Ee,De)=>{const Ye=Ee[0].length+Ee.index,we=Ee.input[Ye];if(we==="<"||we===","){De.ignoreMatch();return}we===">"&&(b(Ee,{after:Ye})||De.ignoreMatch());let He;const $e=Ee.input.substring(Ye);if(He=$e.match(/^\s*=/)){De.ignoreMatch();return}if((He=$e.match(/^\s+extends\s+/))&&He.index===0){De.ignoreMatch();return}}},E={$pattern:e,keyword:t,literal:s,built_in:h,"variable.language":c},T="[0-9](_?[0-9])*",A=`\\.(${T})`,C="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",R={className:"number",variants:[{begin:`(\\b(${C})((${A})|\\.)?|(${A}))[eE][+-]?(${T})\\b`},{begin:`\\b(${C})\\b((${A})\\b|\\.)?|(${A})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},L={className:"subst",begin:"\\$\\{",end:"\\}",keywords:E,contains:[]},H={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[p.BACKSLASH_ESCAPE,L],subLanguage:"xml"}},B={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[p.BACKSLASH_ESCAPE,L],subLanguage:"css"}},P={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[p.BACKSLASH_ESCAPE,L],subLanguage:"graphql"}},D={className:"string",begin:"`",end:"`",contains:[p.BACKSLASH_ESCAPE,L]},$={className:"comment",variants:[p.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:v+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),p.C_BLOCK_COMMENT_MODE,p.C_LINE_COMMENT_MODE]},O=[p.APOS_STRING_MODE,p.QUOTE_STRING_MODE,H,B,P,D,{match:/\$\d+/},R];L.contains=O.concat({begin:/\{/,end:/\}/,keywords:E,contains:["self"].concat(O)});const V=[].concat($,L.contains),K=V.concat([{begin:/(\s*)\(/,end:/\)/,keywords:E,contains:["self"].concat(V)}]),I={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:E,contains:K},Y={variants:[{match:[/class/,/\s+/,v,/\s+/,/extends/,/\s+/,g.concat(v,"(",g.concat(/\./,v),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,v],scope:{1:"keyword",3:"title.class"}}]},W={relevance:0,match:g.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...i,...a]}},le={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},J={variants:[{match:[/function/,/\s+/,v,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[I],illegal:/%/},U={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function F(Ee){return g.concat("(?!",Ee.join("|"),")")}const re={match:g.concat(/\b/,F([...l,"super","import"].map(Ee=>`${Ee}\\s*\\(`)),v,g.lookahead(/\s*\(/)),className:"title.function",relevance:0},fe={begin:g.concat(/\./,g.lookahead(g.concat(v,/(?![0-9A-Za-z$_(])/))),end:v,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},se={match:[/get|set/,/\s+/,v,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},I]},te="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+p.UNDERSCORE_IDENT_RE+")\\s*=>",ye={match:[/const|var|let/,/\s+/,v,/\s*/,/=\s*/,/(async\s*)?/,g.lookahead(te)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[I]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:E,exports:{PARAMS_CONTAINS:K,CLASS_REFERENCE:W},illegal:/#(?![$_A-z])/,contains:[p.SHEBANG({label:"shebang",binary:"node",relevance:5}),le,p.APOS_STRING_MODE,p.QUOTE_STRING_MODE,H,B,P,D,$,{match:/\$\d+/},R,W,{scope:"attr",match:v+g.lookahead(":"),relevance:0},ye,{begin:"("+p.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[$,p.REGEXP_MODE,{className:"function",begin:te,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:p.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:E,contains:K}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:w.begin,end:w.end},{match:k},{begin:N.begin,"on:begin":N.isTrulyOpeningTag,end:N.end}],subLanguage:"xml",contains:[{begin:N.begin,end:N.end,skip:!0,contains:["self"]}]}]},J,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+p.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[I,p.inherit(p.TITLE_MODE,{begin:v,className:"title.function"})]},{match:/\.\.\./,relevance:0},fe,{match:"\\$"+v,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[I]},re,U,Y,se,{match:/\$[(.]/}]}}function d(p){const g=p.regex,b=f(p),v=e,w=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],k={begin:[/namespace/,/\s+/,p.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},N={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:w},contains:[b.exports.CLASS_REFERENCE]},E={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},T=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],A={$pattern:e,keyword:t.concat(T),literal:s,built_in:h.concat(w),"variable.language":c},C={className:"meta",begin:"@"+v},R=(P,D,G)=>{const $=P.contains.findIndex(O=>O.label===D);if($===-1)throw new Error("can not find mode to replace");P.contains.splice($,1,G)};Object.assign(b.keywords,A),b.exports.PARAMS_CONTAINS.push(C);const L=b.contains.find(P=>P.scope==="attr"),H=Object.assign({},L,{match:g.concat(v,g.lookahead(/\s*\?:/))});b.exports.PARAMS_CONTAINS.push([b.exports.CLASS_REFERENCE,L,H]),b.contains=b.contains.concat([C,k,N,H]),R(b,"shebang",p.SHEBANG()),R(b,"use_strict",E);const B=b.contains.find(P=>P.label==="func.def");return B.relevance=0,Object.assign(b,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),b}return qb=d,qb}var Gb,ZN;function lZ(){if(ZN)return Gb;ZN=1;function e(t){const s=t.regex,i={className:"string",begin:/"(""|[^/n])"C\b/},a={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},l=/\d{1,2}\/\d{1,2}\/\d{4}/,c=/\d{4}-\d{1,2}-\d{1,2}/,h=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,f=/\d{1,2}(:\d{1,2}){1,2}/,d={className:"literal",variants:[{begin:s.concat(/# */,s.either(c,l),/ *#/)},{begin:s.concat(/# */,f,/ *#/)},{begin:s.concat(/# */,h,/ *#/)},{begin:s.concat(/# */,s.either(c,l),/ +/,s.either(h,f),/ *#/)}]},p={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},g={className:"label",begin:/^\w+:/},b=t.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),v=t.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[i,a,d,p,g,b,v,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[v]}]}}return Gb=e,Gb}var Vb,QN;function cZ(){if(QN)return Vb;QN=1;function e(t){t.regex;const s=t.COMMENT(/\(;/,/;\)/);s.contains.push("self");const i=t.COMMENT(/;;/,/$/),a=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],l={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},c={className:"variable",begin:/\$[\w_]+/},h={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},f={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},d={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},p={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:a},contains:[i,s,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},c,h,l,t.QUOTE_STRING_MODE,d,p,f]}}return Vb=e,Vb}var Wb,JN;function uZ(){if(JN)return Wb;JN=1;var e=EX();return e.registerLanguage("xml",jX()),e.registerLanguage("bash",AX()),e.registerLanguage("c",TX()),e.registerLanguage("cpp",RX()),e.registerLanguage("csharp",MX()),e.registerLanguage("css",DX()),e.registerLanguage("markdown",LX()),e.registerLanguage("diff",OX()),e.registerLanguage("ruby",zX()),e.registerLanguage("go",BX()),e.registerLanguage("graphql",PX()),e.registerLanguage("ini",IX()),e.registerLanguage("java",$X()),e.registerLanguage("javascript",HX()),e.registerLanguage("json",UX()),e.registerLanguage("kotlin",FX()),e.registerLanguage("less",qX()),e.registerLanguage("lua",GX()),e.registerLanguage("makefile",VX()),e.registerLanguage("perl",WX()),e.registerLanguage("objectivec",KX()),e.registerLanguage("php",YX()),e.registerLanguage("php-template",XX()),e.registerLanguage("plaintext",ZX()),e.registerLanguage("python",QX()),e.registerLanguage("python-repl",JX()),e.registerLanguage("r",eZ()),e.registerLanguage("rust",tZ()),e.registerLanguage("scss",sZ()),e.registerLanguage("shell",nZ()),e.registerLanguage("sql",iZ()),e.registerLanguage("swift",rZ()),e.registerLanguage("yaml",aZ()),e.registerLanguage("typescript",oZ()),e.registerLanguage("vbnet",lZ()),e.registerLanguage("wasm",cZ()),e.HighlightJS=e,e.default=e,Wb=e,Wb}var dZ=uZ();const p0=nR(dZ);function Lv(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var wo=Lv();function i4(e){wo=e}var so={exec:()=>null};function ll(e){let t=[];return s=>{let i=Math.max(0,Math.min(3,s-1)),a=t[i];return a||(a=e(i),t[i]=a),a}}function Nt(e,t=""){let s=typeof e=="string"?e:e.source,i={replace:(a,l)=>{let c=typeof l=="string"?l:l.source;return c=c.replace(cn.caret,"$1"),s=s.replace(a,c),i},getRegex:()=>new RegExp(s,t)};return i}var hZ=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch{return!1}})(),cn={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:ll(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:ll(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:ll(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:ll(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:ll(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:ll(e=>new RegExp(`^ {0,${e}}>`))},fZ=/^(?:[ \t]*(?:\n|$))+/,mZ=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,pZ=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Lu=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,gZ=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ov=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,r4=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,a4=Nt(r4).replace(/bull/g,Ov).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),bZ=Nt(r4).replace(/bull/g,Ov).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),zv=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,xZ=/^[^\n]+/,Bv=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,vZ=Nt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Bv).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),yZ=Nt(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ov).getRegex(),rm="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Pv=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,_Z=Nt("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Pv).replace("tag",rm).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),o4=Nt(zv).replace("hr",Lu).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",rm).getRegex(),wZ=Nt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",o4).getRegex(),Iv={blockquote:wZ,code:mZ,def:vZ,fences:pZ,heading:gZ,hr:Lu,html:_Z,lheading:a4,list:yZ,newline:fZ,paragraph:o4,table:so,text:xZ},eC=Nt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Lu).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",rm).getRegex(),SZ={...Iv,lheading:bZ,table:eC,paragraph:Nt(zv).replace("hr",Lu).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",eC).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",rm).getRegex()},kZ={...Iv,html:Nt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Pv).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:so,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Nt(zv).replace("hr",Lu).replace("heading",` *#{1,6} *[^
118
+ ]`).replace("lheading",a4).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},NZ=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,CZ=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,l4=/^( {2,}|\\)\n(?!\s*$)/,EZ=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ml=/[\p{P}\p{S}]/u,am=/[\s\p{P}\p{S}]/u,$v=/[^\s\p{P}\p{S}]/u,jZ=Nt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,am).getRegex(),c4=/(?!~)[\p{P}\p{S}]/u,AZ=/(?!~)[\s\p{P}\p{S}]/u,TZ=/(?:[^\s\p{P}\p{S}]|~)/u,RZ=Nt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",hZ?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),u4=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,MZ=Nt(u4,"u").replace(/punct/g,Ml).getRegex(),DZ=Nt(u4,"u").replace(/punct/g,c4).getRegex(),d4="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",LZ=Nt(d4,"gu").replace(/notPunctSpace/g,$v).replace(/punctSpace/g,am).replace(/punct/g,Ml).getRegex(),OZ=Nt(d4,"gu").replace(/notPunctSpace/g,TZ).replace(/punctSpace/g,AZ).replace(/punct/g,c4).getRegex(),zZ=Nt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,$v).replace(/punctSpace/g,am).replace(/punct/g,Ml).getRegex(),BZ=Nt(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Ml).getRegex(),PZ="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",IZ=Nt(PZ,"gu").replace(/notPunctSpace/g,$v).replace(/punctSpace/g,am).replace(/punct/g,Ml).getRegex(),$Z=Nt(/\\(punct)/,"gu").replace(/punct/g,Ml).getRegex(),HZ=Nt(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),UZ=Nt(Pv).replace("(?:-->|$)","-->").getRegex(),FZ=Nt("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",UZ).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),wf=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,qZ=Nt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",wf).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),h4=Nt(/^!?\[(label)\]\[(ref)\]/).replace("label",wf).replace("ref",Bv).getRegex(),f4=Nt(/^!?\[(ref)\](?:\[\])?/).replace("ref",Bv).getRegex(),GZ=Nt("reflink|nolink(?!\\()","g").replace("reflink",h4).replace("nolink",f4).getRegex(),tC=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Hv={_backpedal:so,anyPunctuation:$Z,autolink:HZ,blockSkip:RZ,br:l4,code:CZ,del:so,delLDelim:so,delRDelim:so,emStrongLDelim:MZ,emStrongRDelimAst:LZ,emStrongRDelimUnd:zZ,escape:NZ,link:qZ,nolink:f4,punctuation:jZ,reflink:h4,reflinkSearch:GZ,tag:FZ,text:EZ,url:so},VZ={...Hv,link:Nt(/^!?\[(label)\]\((.*?)\)/).replace("label",wf).getRegex(),reflink:Nt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",wf).getRegex()},g0={...Hv,emStrongRDelimAst:OZ,emStrongLDelim:DZ,delLDelim:BZ,delRDelim:IZ,url:Nt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",tC).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Nt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",tC).getRegex()},WZ={...g0,br:Nt(l4).replace("{2,}","*").getRegex(),text:Nt(g0.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Nh={normal:Iv,gfm:SZ,pedantic:kZ},Ic={normal:Hv,gfm:g0,breaks:WZ,pedantic:VZ},KZ={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},sC=e=>KZ[e];function Gi(e,t){if(t){if(cn.escapeTest.test(e))return e.replace(cn.escapeReplace,sC)}else if(cn.escapeTestNoEncode.test(e))return e.replace(cn.escapeReplaceNoEncode,sC);return e}function nC(e){try{e=encodeURI(e).replace(cn.percentDecode,"%")}catch{return null}return e}function iC(e,t){let s=e.replace(cn.findPipe,(l,c,h)=>{let f=!1,d=c;for(;--d>=0&&h[d]==="\\";)f=!f;return f?"|":" |"}),i=s.split(cn.splitPipe),a=0;if(i[0].trim()||i.shift(),i.length>0&&!i.at(-1)?.trim()&&i.pop(),t)if(i.length>t)i.splice(t);else for(;i.length<t;)i.push("");for(;a<i.length;a++)i[a]=i[a].trim().replace(cn.slashPipe,"|");return i}function ba(e,t,s){let i=e.length;if(i===0)return"";let a=0;for(;a<i&&e.charAt(i-a-1)===t;)a++;return e.slice(0,i-a)}function rC(e){let t=e.split(`
119
+ `),s=t.length-1;for(;s>=0&&cn.blankLine.test(t[s]);)s--;return t.length-s<=2?e:t.slice(0,s+1).join(`
120
+ `)}function YZ(e,t){if(e.indexOf(t[1])===-1)return-1;let s=0;for(let i=0;i<e.length;i++)if(e[i]==="\\")i++;else if(e[i]===t[0])s++;else if(e[i]===t[1]&&(s--,s<0))return i;return s>0?-2:-1}function XZ(e,t=0){let s=t,i="";for(let a of e)if(a===" "){let l=4-s%4;i+=" ".repeat(l),s+=l}else i+=a,s++;return i}function aC(e,t,s,i,a){let l=t.href,c=t.title||null,h=e[1].replace(a.other.outputLinkReplace,"$1");i.state.inLink=!0;let f={type:e[0].charAt(0)==="!"?"image":"link",raw:s,href:l,title:c,text:h,tokens:i.inlineTokens(h)};return i.state.inLink=!1,f}function ZZ(e,t,s){let i=e.match(s.other.indentCodeCompensation);if(i===null)return t;let a=i[1];return t.split(`
121
+ `).map(l=>{let c=l.match(s.other.beginningSpace);if(c===null)return l;let[h]=c;return h.length>=a.length?l.slice(a.length):l}).join(`
122
+ `)}var Sf=class{options;rules;lexer;constructor(e){this.options=e||wo}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let s=this.options.pedantic?t[0]:rC(t[0]),i=s.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:s,codeBlockStyle:"indented",text:i}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let s=t[0],i=ZZ(s,t[3]||"",this.rules);return{type:"code",raw:s,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let s=t[2].trim();if(this.rules.other.endingHash.test(s)){let i=ba(s,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(s=i.trim())}return{type:"heading",raw:ba(t[0],`
123
+ `),depth:t[1].length,text:s,tokens:this.lexer.inline(s)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:ba(t[0],`
124
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let s=ba(t[0],`
125
+ `).split(`
126
+ `),i="",a="",l=[];for(;s.length>0;){let c=!1,h=[],f;for(f=0;f<s.length;f++)if(this.rules.other.blockquoteStart.test(s[f]))h.push(s[f]),c=!0;else if(!c)h.push(s[f]);else break;s=s.slice(f);let d=h.join(`
127
+ `),p=d.replace(this.rules.other.blockquoteSetextReplace,`
128
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
129
+ ${d}`:d,a=a?`${a}
130
+ ${p}`:p;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,l,!0),this.lexer.state.top=g,s.length===0)break;let b=l.at(-1);if(b?.type==="code")break;if(b?.type==="blockquote"){let v=b,w=v.raw+`
131
+ `+s.join(`
132
+ `),k=this.blockquote(w);l[l.length-1]=k,i=i.substring(0,i.length-v.raw.length)+k.raw,a=a.substring(0,a.length-v.text.length)+k.text;break}else if(b?.type==="list"){let v=b,w=v.raw+`
133
+ `+s.join(`
134
+ `),k=this.list(w);l[l.length-1]=k,i=i.substring(0,i.length-b.raw.length)+k.raw,a=a.substring(0,a.length-v.raw.length)+k.raw,s=w.substring(l.at(-1).raw.length).split(`
135
+ `);continue}}return{type:"blockquote",raw:i,tokens:l,text:a}}}list(e){let t=this.rules.block.list.exec(e);if(t){let s=t[1].trim(),i=s.length>1,a={type:"list",raw:"",ordered:i,start:i?+s.slice(0,-1):"",loose:!1,items:[]};s=i?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=i?s:"[*+-]");let l=this.rules.other.listItemRegex(s),c=!1;for(;e;){let f=!1,d="",p="";if(!(t=l.exec(e))||this.rules.block.hr.test(e))break;d=t[0],e=e.substring(d.length);let g=XZ(t[2].split(`
136
+ `,1)[0],t[1].length),b=e.split(`
137
+ `,1)[0],v=!g.trim(),w=0;if(this.options.pedantic?(w=2,p=g.trimStart()):v?w=t[1].length+1:(w=g.search(this.rules.other.nonSpaceChar),w=w>4?1:w,p=g.slice(w),w+=t[1].length),v&&this.rules.other.blankLine.test(b)&&(d+=b+`
138
+ `,e=e.substring(b.length+1),f=!0),!f){let k=this.rules.other.nextBulletRegex(w),N=this.rules.other.hrRegex(w),E=this.rules.other.fencesBeginRegex(w),T=this.rules.other.headingBeginRegex(w),A=this.rules.other.htmlBeginRegex(w),C=this.rules.other.blockquoteBeginRegex(w);for(;e;){let R=e.split(`
139
+ `,1)[0],L;if(b=R,this.options.pedantic?(b=b.replace(this.rules.other.listReplaceNesting," "),L=b):L=b.replace(this.rules.other.tabCharGlobal," "),E.test(b)||T.test(b)||A.test(b)||C.test(b)||k.test(b)||N.test(b))break;if(L.search(this.rules.other.nonSpaceChar)>=w||!b.trim())p+=`
140
+ `+L.slice(w);else{if(v||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||E.test(g)||T.test(g)||N.test(g))break;p+=`
141
+ `+b}v=!b.trim(),d+=R+`
142
+ `,e=e.substring(R.length+1),g=L.slice(w)}}a.loose||(c?a.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(c=!0)),a.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),a.raw+=d}let h=a.items.at(-1);if(h)h.raw=h.raw.trimEnd(),h.text=h.text.trimEnd();else return;a.raw=a.raw.trimEnd();for(let f of a.items){this.lexer.state.top=!1,f.tokens=this.lexer.blockTokens(f.text,[]);let d=f.tokens[0];if(f.task&&(d?.type==="text"||d?.type==="paragraph")){f.text=f.text.replace(this.rules.other.listReplaceTask,""),d.raw=d.raw.replace(this.rules.other.listReplaceTask,""),d.text=d.text.replace(this.rules.other.listReplaceTask,"");for(let g=this.lexer.inlineQueue.length-1;g>=0;g--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)){this.lexer.inlineQueue[g].src=this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(f.raw);if(p){let g={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};f.checked=g.checked,a.loose?f.tokens[0]&&["paragraph","text"].includes(f.tokens[0].type)&&"tokens"in f.tokens[0]&&f.tokens[0].tokens?(f.tokens[0].raw=g.raw+f.tokens[0].raw,f.tokens[0].text=g.raw+f.tokens[0].text,f.tokens[0].tokens.unshift(g)):f.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):f.tokens.unshift(g)}}else f.task&&(f.task=!1);if(!a.loose){let p=f.tokens.filter(b=>b.type==="space"),g=p.length>0&&p.some(b=>this.rules.other.anyLine.test(b.raw));a.loose=g}}if(a.loose)for(let f of a.items){f.loose=!0;for(let d of f.tokens)d.type==="text"&&(d.type="paragraph")}return a}}html(e){let t=this.rules.block.html.exec(e);if(t){let s=rC(t[0]);return{type:"html",block:!0,raw:s,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:s}}}def(e){let t=this.rules.block.def.exec(e);if(t){let s=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",a=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:s,raw:ba(t[0],`
143
+ `),href:i,title:a}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let s=iC(t[1]),i=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),a=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
144
+ `):[],l={type:"table",raw:ba(t[0],`
145
+ `),header:[],align:[],rows:[]};if(s.length===i.length){for(let c of i)this.rules.other.tableAlignRight.test(c)?l.align.push("right"):this.rules.other.tableAlignCenter.test(c)?l.align.push("center"):this.rules.other.tableAlignLeft.test(c)?l.align.push("left"):l.align.push(null);for(let c=0;c<s.length;c++)l.header.push({text:s[c],tokens:this.lexer.inline(s[c]),header:!0,align:l.align[c]});for(let c of a)l.rows.push(iC(c,l.header.length).map((h,f)=>({text:h,tokens:this.lexer.inline(h),header:!1,align:l.align[f]})));return l}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let s=t[1].trim();return{type:"heading",raw:ba(t[0],`
146
+ `),depth:t[2].charAt(0)==="="?1:2,text:s,tokens:this.lexer.inline(s)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let s=t[1].charAt(t[1].length-1)===`
147
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:s,tokens:this.lexer.inline(s)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let s=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(s)){if(!this.rules.other.endAngleBracket.test(s))return;let l=ba(s.slice(0,-1),"\\");if((s.length-l.length)%2===0)return}else{let l=YZ(t[2],"()");if(l===-2)return;if(l>-1){let c=(t[0].indexOf("!")===0?5:4)+t[1].length+l;t[2]=t[2].substring(0,l),t[0]=t[0].substring(0,c).trim(),t[3]=""}}let i=t[2],a="";if(this.options.pedantic){let l=this.rules.other.pedanticHrefTitle.exec(i);l&&(i=l[1],a=l[3])}else a=t[3]?t[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(s)?i=i.slice(1):i=i.slice(1,-1)),aC(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:a&&a.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let s;if((s=this.rules.inline.reflink.exec(e))||(s=this.rules.inline.nolink.exec(e))){let i=(s[2]||s[1]).replace(this.rules.other.multipleSpaceGlobal," "),a=t[i.toLowerCase()];if(!a){let l=s[0].charAt(0);return{type:"text",raw:l,text:l}}return aC(s,a,s[0],this.lexer,this.rules)}}emStrong(e,t,s=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!(!i||!i[1]&&!i[2]&&!i[3]&&!i[4]||i[4]&&s.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[3])||!s||this.rules.inline.punctuation.exec(s))){let a=[...i[0]].length-1,l,c,h=a,f=0,d=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+a);(i=d.exec(t))!==null;){if(l=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!l)continue;if(c=[...l].length,i[3]||i[4]){h+=c;continue}else if((i[5]||i[6])&&a%3&&!((a+c)%3)){f+=c;continue}if(h-=c,h>0)continue;c=Math.min(c,c+h+f);let p=[...i[0]][0].length,g=e.slice(0,a+i.index+p+c);if(Math.min(a,c)%2){let v=g.slice(1,-1);return{type:"em",raw:g,text:v,tokens:this.lexer.inlineTokens(v)}}let b=g.slice(2,-2);return{type:"strong",raw:g,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let s=t[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(s),a=this.rules.other.startingSpaceChar.test(s)&&this.rules.other.endingSpaceChar.test(s);return i&&a&&(s=s.substring(1,s.length-1)),{type:"codespan",raw:t[0],text:s}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,s=""){let i=this.rules.inline.delLDelim.exec(e);if(i&&(!i[1]||!s||this.rules.inline.punctuation.exec(s))){let a=[...i[0]].length-1,l,c,h=a,f=this.rules.inline.delRDelim;for(f.lastIndex=0,t=t.slice(-1*e.length+a);(i=f.exec(t))!==null;){if(l=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!l||(c=[...l].length,c!==a))continue;if(i[3]||i[4]){h+=c;continue}if(h-=c,h>0)continue;c=Math.min(c,c+h);let d=[...i[0]][0].length,p=e.slice(0,a+i.index+d+c),g=p.slice(a,-a);return{type:"del",raw:p,text:g,tokens:this.lexer.inlineTokens(g)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let s,i;return t[2]==="@"?(s=t[1],i="mailto:"+s):(s=t[1],i=s),{type:"link",raw:t[0],text:s,href:i,tokens:[{type:"text",raw:s,text:s}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let s,i;if(t[2]==="@")s=t[0],i="mailto:"+s;else{let a;do a=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(a!==t[0]);s=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:s,href:i,tokens:[{type:"text",raw:s,text:s}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let s=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:s}}}},Ti=class b0{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||wo,this.options.tokenizer=this.options.tokenizer||new Sf,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let s={other:cn,block:Nh.normal,inline:Ic.normal};this.options.pedantic?(s.block=Nh.pedantic,s.inline=Ic.pedantic):this.options.gfm&&(s.block=Nh.gfm,this.options.breaks?s.inline=Ic.breaks:s.inline=Ic.gfm),this.tokenizer.rules=s}static get rules(){return{block:Nh,inline:Ic}}static lex(t,s){return new b0(s).lex(t)}static lexInline(t,s){return new b0(s).inlineTokens(t)}lex(t){t=t.replace(cn.carriageReturn,`
148
+ `),this.blockTokens(t,this.tokens);for(let s=0;s<this.inlineQueue.length;s++){let i=this.inlineQueue[s];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,s=[],i=!1){this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(cn.tabCharGlobal," ").replace(cn.spaceLine,""));let a=1/0;for(;t;){if(t.length<a)a=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}let l;if(this.options.extensions?.block?.some(h=>(l=h.call({lexer:this},t,s))?(t=t.substring(l.raw.length),s.push(l),!0):!1))continue;if(l=this.tokenizer.space(t)){t=t.substring(l.raw.length);let h=s.at(-1);l.raw.length===1&&h!==void 0?h.raw+=`
149
+ `:s.push(l);continue}if(l=this.tokenizer.code(t)){t=t.substring(l.raw.length);let h=s.at(-1);h?.type==="paragraph"||h?.type==="text"?(h.raw+=(h.raw.endsWith(`
150
+ `)?"":`
151
+ `)+l.raw,h.text+=`
152
+ `+l.text,this.inlineQueue.at(-1).src=h.text):s.push(l);continue}if(l=this.tokenizer.fences(t)){t=t.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.heading(t)){t=t.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.hr(t)){t=t.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.blockquote(t)){t=t.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.list(t)){t=t.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.html(t)){t=t.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.def(t)){t=t.substring(l.raw.length);let h=s.at(-1);h?.type==="paragraph"||h?.type==="text"?(h.raw+=(h.raw.endsWith(`
153
+ `)?"":`
154
+ `)+l.raw,h.text+=`
155
+ `+l.raw,this.inlineQueue.at(-1).src=h.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title},s.push(l));continue}if(l=this.tokenizer.table(t)){t=t.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.lheading(t)){t=t.substring(l.raw.length),s.push(l);continue}let c=t;if(this.options.extensions?.startBlock){let h=1/0,f=t.slice(1),d;this.options.extensions.startBlock.forEach(p=>{d=p.call({lexer:this},f),typeof d=="number"&&d>=0&&(h=Math.min(h,d))}),h<1/0&&h>=0&&(c=t.substring(0,h+1))}if(this.state.top&&(l=this.tokenizer.paragraph(c))){let h=s.at(-1);i&&h?.type==="paragraph"?(h.raw+=(h.raw.endsWith(`
156
+ `)?"":`
157
+ `)+l.raw,h.text+=`
158
+ `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):s.push(l),i=c.length!==t.length,t=t.substring(l.raw.length);continue}if(l=this.tokenizer.text(t)){t=t.substring(l.raw.length);let h=s.at(-1);h?.type==="text"?(h.raw+=(h.raw.endsWith(`
159
+ `)?"":`
160
+ `)+l.raw,h.text+=`
161
+ `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):s.push(l);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,s}inline(t,s=[]){return this.inlineQueue.push({src:t,tokens:s}),s}inlineTokens(t,s=[]){this.tokenizer.lexer=this;let i=t,a=null;if(this.tokens.links){let d=Object.keys(this.tokens.links);if(d.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(i))!==null;)d.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(i))!==null;)i=i.slice(0,a.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let l;for(;(a=this.tokenizer.rules.inline.blockSkip.exec(i))!==null;)l=a[2]?a[2].length:0,i=i.slice(0,a.index+l)+"["+"a".repeat(a[0].length-l-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=this.options.hooks?.emStrongMask?.call({lexer:this},i)??i;let c=!1,h="",f=1/0;for(;t;){if(t.length<f)f=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}c||(h=""),c=!1;let d;if(this.options.extensions?.inline?.some(g=>(d=g.call({lexer:this},t,s))?(t=t.substring(d.raw.length),s.push(d),!0):!1))continue;if(d=this.tokenizer.escape(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.tag(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.link(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(d.raw.length);let g=s.at(-1);d.type==="text"&&g?.type==="text"?(g.raw+=d.raw,g.text+=d.text):s.push(d);continue}if(d=this.tokenizer.emStrong(t,i,h)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.codespan(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.br(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.del(t,i,h)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.autolink(t)){t=t.substring(d.raw.length),s.push(d);continue}if(!this.state.inLink&&(d=this.tokenizer.url(t))){t=t.substring(d.raw.length),s.push(d);continue}let p=t;if(this.options.extensions?.startInline){let g=1/0,b=t.slice(1),v;this.options.extensions.startInline.forEach(w=>{v=w.call({lexer:this},b),typeof v=="number"&&v>=0&&(g=Math.min(g,v))}),g<1/0&&g>=0&&(p=t.substring(0,g+1))}if(d=this.tokenizer.inlineText(p)){t=t.substring(d.raw.length),d.raw.slice(-1)!=="_"&&(h=d.raw.slice(-1)),c=!0;let g=s.at(-1);g?.type==="text"?(g.raw+=d.raw,g.text+=d.text):s.push(d);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return s}infiniteLoopError(t){let s="Infinite loop on byte: "+t;if(this.options.silent)console.error(s);else throw new Error(s)}},kf=class{options;parser;constructor(e){this.options=e||wo}space(e){return""}code({text:e,lang:t,escaped:s}){let i=(t||"").match(cn.notSpaceStart)?.[0],a=e.replace(cn.endingNewline,"")+`
162
+ `;return i?'<pre><code class="language-'+Gi(i)+'">'+(s?a:Gi(a,!0))+`</code></pre>
163
+ `:"<pre><code>"+(s?a:Gi(a,!0))+`</code></pre>
164
+ `}blockquote({tokens:e}){return`<blockquote>
165
+ ${this.parser.parse(e)}</blockquote>
166
+ `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
167
+ `}hr(e){return`<hr>
168
+ `}list(e){let t=e.ordered,s=e.start,i="";for(let c=0;c<e.items.length;c++){let h=e.items[c];i+=this.listitem(h)}let a=t?"ol":"ul",l=t&&s!==1?' start="'+s+'"':"";return"<"+a+l+`>
169
+ `+i+"</"+a+`>
170
+ `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
171
+ `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
172
+ `}table(e){let t="",s="";for(let a=0;a<e.header.length;a++)s+=this.tablecell(e.header[a]);t+=this.tablerow({text:s});let i="";for(let a=0;a<e.rows.length;a++){let l=e.rows[a];s="";for(let c=0;c<l.length;c++)s+=this.tablecell(l[c]);i+=this.tablerow({text:s})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
173
+ <thead>
174
+ `+t+`</thead>
175
+ `+i+`</table>
176
+ `}tablerow({text:e}){return`<tr>
177
+ ${e}</tr>
178
+ `}tablecell(e){let t=this.parser.parseInline(e.tokens),s=e.header?"th":"td";return(e.align?`<${s} align="${e.align}">`:`<${s}>`)+t+`</${s}>
179
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Gi(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:s}){let i=this.parser.parseInline(s),a=nC(e);if(a===null)return i;e=a;let l='<a href="'+e+'"';return t&&(l+=' title="'+Gi(t)+'"'),l+=">"+i+"</a>",l}image({href:e,title:t,text:s,tokens:i}){i&&(s=this.parser.parseInline(i,this.parser.textRenderer));let a=nC(e);if(a===null)return Gi(s);e=a;let l=`<img src="${e}" alt="${Gi(s)}"`;return t&&(l+=` title="${Gi(t)}"`),l+=">",l}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Gi(e.text)}},Uv=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},Ri=class x0{options;renderer;textRenderer;constructor(t){this.options=t||wo,this.options.renderer=this.options.renderer||new kf,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Uv}static parse(t,s){return new x0(s).parse(t)}static parseInline(t,s){return new x0(s).parseInline(t)}parse(t){this.renderer.parser=this;let s="";for(let i=0;i<t.length;i++){let a=t[i];if(this.options.extensions?.renderers?.[a.type]){let c=a,h=this.options.extensions.renderers[c.type].call({parser:this},c);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.type)){s+=h||"";continue}}let l=a;switch(l.type){case"space":{s+=this.renderer.space(l);break}case"hr":{s+=this.renderer.hr(l);break}case"heading":{s+=this.renderer.heading(l);break}case"code":{s+=this.renderer.code(l);break}case"table":{s+=this.renderer.table(l);break}case"blockquote":{s+=this.renderer.blockquote(l);break}case"list":{s+=this.renderer.list(l);break}case"checkbox":{s+=this.renderer.checkbox(l);break}case"html":{s+=this.renderer.html(l);break}case"def":{s+=this.renderer.def(l);break}case"paragraph":{s+=this.renderer.paragraph(l);break}case"text":{s+=this.renderer.text(l);break}default:{let c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return s}parseInline(t,s=this.renderer){this.renderer.parser=this;let i="";for(let a=0;a<t.length;a++){let l=t[a];if(this.options.extensions?.renderers?.[l.type]){let h=this.options.extensions.renderers[l.type].call({parser:this},l);if(h!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){i+=h||"";continue}}let c=l;switch(c.type){case"escape":{i+=s.text(c);break}case"html":{i+=s.html(c);break}case"link":{i+=s.link(c);break}case"image":{i+=s.image(c);break}case"checkbox":{i+=s.checkbox(c);break}case"strong":{i+=s.strong(c);break}case"em":{i+=s.em(c);break}case"codespan":{i+=s.codespan(c);break}case"br":{i+=s.br(c);break}case"del":{i+=s.del(c);break}case"text":{i+=s.text(c);break}default:{let h='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return i}},Qc=class{options;block;constructor(e){this.options=e||wo}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?Ti.lex:Ti.lexInline}provideParser(e=this.block){return e?Ri.parse:Ri.parseInline}},QZ=class{defaults=Lv();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Ri;Renderer=kf;TextRenderer=Uv;Lexer=Ti;Tokenizer=Sf;Hooks=Qc;constructor(...e){this.use(...e)}walkTokens(e,t){let s=[];for(let i of e)switch(s=s.concat(t.call(this,i)),i.type){case"table":{let a=i;for(let l of a.header)s=s.concat(this.walkTokens(l.tokens,t));for(let l of a.rows)for(let c of l)s=s.concat(this.walkTokens(c.tokens,t));break}case"list":{let a=i;s=s.concat(this.walkTokens(a.items,t));break}default:{let a=i;this.defaults.extensions?.childTokens?.[a.type]?this.defaults.extensions.childTokens[a.type].forEach(l=>{let c=a[l].flat(1/0);s=s.concat(this.walkTokens(c,t))}):a.tokens&&(s=s.concat(this.walkTokens(a.tokens,t)))}}return s}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(s=>{let i={...s};if(i.async=this.defaults.async||i.async||!1,s.extensions&&(s.extensions.forEach(a=>{if(!a.name)throw new Error("extension name required");if("renderer"in a){let l=t.renderers[a.name];l?t.renderers[a.name]=function(...c){let h=a.renderer.apply(this,c);return h===!1&&(h=l.apply(this,c)),h}:t.renderers[a.name]=a.renderer}if("tokenizer"in a){if(!a.level||a.level!=="block"&&a.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let l=t[a.level];l?l.unshift(a.tokenizer):t[a.level]=[a.tokenizer],a.start&&(a.level==="block"?t.startBlock?t.startBlock.push(a.start):t.startBlock=[a.start]:a.level==="inline"&&(t.startInline?t.startInline.push(a.start):t.startInline=[a.start]))}"childTokens"in a&&a.childTokens&&(t.childTokens[a.name]=a.childTokens)}),i.extensions=t),s.renderer){let a=this.defaults.renderer||new kf(this.defaults);for(let l in s.renderer){if(!(l in a))throw new Error(`renderer '${l}' does not exist`);if(["options","parser"].includes(l))continue;let c=l,h=s.renderer[c],f=a[c];a[c]=(...d)=>{let p=h.apply(a,d);return p===!1&&(p=f.apply(a,d)),p||""}}i.renderer=a}if(s.tokenizer){let a=this.defaults.tokenizer||new Sf(this.defaults);for(let l in s.tokenizer){if(!(l in a))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;let c=l,h=s.tokenizer[c],f=a[c];a[c]=(...d)=>{let p=h.apply(a,d);return p===!1&&(p=f.apply(a,d)),p}}i.tokenizer=a}if(s.hooks){let a=this.defaults.hooks||new Qc;for(let l in s.hooks){if(!(l in a))throw new Error(`hook '${l}' does not exist`);if(["options","block"].includes(l))continue;let c=l,h=s.hooks[c],f=a[c];Qc.passThroughHooks.has(l)?a[c]=d=>{if(this.defaults.async&&Qc.passThroughHooksRespectAsync.has(l))return(async()=>{let g=await h.call(a,d);return f.call(a,g)})();let p=h.call(a,d);return f.call(a,p)}:a[c]=(...d)=>{if(this.defaults.async)return(async()=>{let g=await h.apply(a,d);return g===!1&&(g=await f.apply(a,d)),g})();let p=h.apply(a,d);return p===!1&&(p=f.apply(a,d)),p}}i.hooks=a}if(s.walkTokens){let a=this.defaults.walkTokens,l=s.walkTokens;i.walkTokens=function(c){let h=[];return h.push(l.call(this,c)),a&&(h=h.concat(a.call(this,c))),h}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Ti.lex(e,t??this.defaults)}parser(e,t){return Ri.parse(e,t??this.defaults)}parseMarkdown(e){return(t,s)=>{let i={...s},a={...this.defaults,...i},l=this.onError(!!a.silent,!!a.async);if(this.defaults.async===!0&&i.async===!1)return l(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return l(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(a.hooks&&(a.hooks.options=a,a.hooks.block=e),a.async)return(async()=>{let c=a.hooks?await a.hooks.preprocess(t):t,h=await(a.hooks?await a.hooks.provideLexer(e):e?Ti.lex:Ti.lexInline)(c,a),f=a.hooks?await a.hooks.processAllTokens(h):h;a.walkTokens&&await Promise.all(this.walkTokens(f,a.walkTokens));let d=await(a.hooks?await a.hooks.provideParser(e):e?Ri.parse:Ri.parseInline)(f,a);return a.hooks?await a.hooks.postprocess(d):d})().catch(l);try{a.hooks&&(t=a.hooks.preprocess(t));let c=(a.hooks?a.hooks.provideLexer(e):e?Ti.lex:Ti.lexInline)(t,a);a.hooks&&(c=a.hooks.processAllTokens(c)),a.walkTokens&&this.walkTokens(c,a.walkTokens);let h=(a.hooks?a.hooks.provideParser(e):e?Ri.parse:Ri.parseInline)(c,a);return a.hooks&&(h=a.hooks.postprocess(h)),h}catch(c){return l(c)}}}onError(e,t){return s=>{if(s.message+=`
180
+ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+Gi(s.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(s);throw s}}},bo=new QZ;function It(e,t){return bo.parse(e,t)}It.options=It.setOptions=function(e){return bo.setOptions(e),It.defaults=bo.defaults,i4(It.defaults),It};It.getDefaults=Lv;It.defaults=wo;It.use=function(...e){return bo.use(...e),It.defaults=bo.defaults,i4(It.defaults),It};It.walkTokens=function(e,t){return bo.walkTokens(e,t)};It.parseInline=bo.parseInline;It.Parser=Ri;It.parser=Ri.parse;It.Renderer=kf;It.TextRenderer=Uv;It.Lexer=Ti;It.lexer=Ti.lex;It.Tokenizer=Sf;It.Hooks=Qc;It.parse=It;It.options;It.setOptions;It.use;It.walkTokens;It.parseInline;Ri.parse;Ti.lex;function JZ(e){return e.replace(/<\/?(script|style|iframe|object|embed)\b[^>]*>/gi,"").replace(/\son\w+\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi,"").replace(/(href|src)\s*=\s*("|')\s*javascript:[^"']*\2/gi,"$1=$2#$2")}function Fv({content:e}){const t=y.useMemo(()=>{const i=It.parse(e,{async:!1,gfm:!0,breaks:!1});return JZ(i)},[e]),s=y.useRef(null);return y.useEffect(()=>{const i=s.current;i&&i.querySelectorAll("pre code").forEach(a=>{p0.highlightElement(a)})},[t]),n.jsx("div",{ref:s,className:"md-preview min-w-0 px-6 py-5",dangerouslySetInnerHTML:{__html:t}})}var eQ=Object.create,m4=Object.defineProperty,tQ=Object.getOwnPropertyDescriptor,sQ=Object.getOwnPropertyNames,nQ=Object.getPrototypeOf,iQ=Object.prototype.hasOwnProperty,es=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),rQ=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(var a=sQ(t),l=0,c=a.length,h;l<c;l++)h=a[l],!iQ.call(e,h)&&h!==s&&m4(e,h,{get:(f=>t[f]).bind(null,h),enumerable:!(i=tQ(t,h))||i.enumerable});return e},aQ=(e,t,s)=>(s=e!=null?eQ(nQ(e)):{},rQ(m4(s,"default",{value:e,enumerable:!0}),e)),Ou=es(((e,t)=>{function s(f){return typeof f>"u"||f===null}function i(f){return typeof f=="object"&&f!==null}function a(f){return Array.isArray(f)?f:s(f)?[]:[f]}function l(f,d){if(d){const p=Object.keys(d);for(let g=0,b=p.length;g<b;g+=1){const v=p[g];f[v]=d[v]}}return f}function c(f,d){let p="";for(let g=0;g<d;g+=1)p+=f;return p}function h(f){return f===0&&Number.NEGATIVE_INFINITY===1/f}t.exports.isNothing=s,t.exports.isObject=i,t.exports.toArray=a,t.exports.repeat=c,t.exports.isNegativeZero=h,t.exports.extend=l})),zu=es(((e,t)=>{function s(a,l){let c="";const h=a.reason||"(unknown reason)";return a.mark?(a.mark.name&&(c+='in "'+a.mark.name+'" '),c+="("+(a.mark.line+1)+":"+(a.mark.column+1)+")",!l&&a.mark.snippet&&(c+=`
181
+
182
+ `+a.mark.snippet),h+" "+c):h}function i(a,l){Error.call(this),this.name="YAMLException",this.reason=a,this.mark=l,this.message=s(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i.prototype.toString=function(l){return this.name+": "+s(this,l)},t.exports=i})),oQ=es(((e,t)=>{var s=Ou();function i(c,h,f,d,p){let g="",b="";const v=Math.floor(p/2)-1;return d-h>v&&(g=" ... ",h=d-v+g.length),f-d>v&&(b=" ...",f=d+v-b.length),{str:g+c.slice(h,f).replace(/\t/g,"→")+b,pos:d-h+g.length}}function a(c,h){return s.repeat(" ",h-c.length)+c}function l(c,h){if(h=Object.create(h||null),!c.buffer)return null;h.maxLength||(h.maxLength=79),typeof h.indent!="number"&&(h.indent=1),typeof h.linesBefore!="number"&&(h.linesBefore=3),typeof h.linesAfter!="number"&&(h.linesAfter=2);const f=/\r?\n|\r|\0/g,d=[0],p=[];let g,b=-1;for(;g=f.exec(c.buffer);)p.push(g.index),d.push(g.index+g[0].length),c.position<=g.index&&b<0&&(b=d.length-2);b<0&&(b=d.length-1);let v="";const w=Math.min(c.line+h.linesAfter,p.length).toString().length,k=h.maxLength-(h.indent+w+3);for(let E=1;E<=h.linesBefore&&!(b-E<0);E++){const T=i(c.buffer,d[b-E],p[b-E],c.position-(d[b]-d[b-E]),k);v=s.repeat(" ",h.indent)+a((c.line-E+1).toString(),w)+" | "+T.str+`
183
+ `+v}const N=i(c.buffer,d[b],p[b],c.position,k);v+=s.repeat(" ",h.indent)+a((c.line+1).toString(),w)+" | "+N.str+`
184
+ `,v+=s.repeat("-",h.indent+w+3+N.pos)+`^
185
+ `;for(let E=1;E<=h.linesAfter&&!(b+E>=p.length);E++){const T=i(c.buffer,d[b+E],p[b+E],c.position-(d[b]-d[b+E]),k);v+=s.repeat(" ",h.indent)+a((c.line+E+1).toString(),w)+" | "+T.str+`
186
+ `}return v.replace(/\n$/,"")}t.exports=l})),yn=es(((e,t)=>{var s=zu(),i=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],a=["scalar","sequence","mapping"];function l(h){const f={};return h!==null&&Object.keys(h).forEach(function(d){h[d].forEach(function(p){f[String(p)]=d})}),f}function c(h,f){if(f=f||{},Object.keys(f).forEach(function(d){if(i.indexOf(d)===-1)throw new s('Unknown option "'+d+'" is met in definition of "'+h+'" YAML type.')}),this.options=f,this.tag=h,this.kind=f.kind||null,this.resolve=f.resolve||function(){return!0},this.construct=f.construct||function(d){return d},this.instanceOf=f.instanceOf||null,this.predicate=f.predicate||null,this.represent=f.represent||null,this.representName=f.representName||null,this.defaultStyle=f.defaultStyle||null,this.multi=f.multi||!1,this.styleAliases=l(f.styleAliases||null),a.indexOf(this.kind)===-1)throw new s('Unknown kind "'+this.kind+'" is specified for "'+h+'" YAML type.')}t.exports=c})),p4=es(((e,t)=>{var s=zu(),i=yn();function a(h,f){const d=[];return h[f].forEach(function(p){let g=d.length;d.forEach(function(b,v){b.tag===p.tag&&b.kind===p.kind&&b.multi===p.multi&&(g=v)}),d[g]=p}),d}function l(){const h={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function f(d){d.multi?(h.multi[d.kind].push(d),h.multi.fallback.push(d)):h[d.kind][d.tag]=h.fallback[d.tag]=d}for(let d=0,p=arguments.length;d<p;d+=1)arguments[d].forEach(f);return h}function c(h){return this.extend(h)}c.prototype.extend=function(f){let d=[],p=[];if(f instanceof i)p.push(f);else if(Array.isArray(f))p=p.concat(f);else if(f&&(Array.isArray(f.implicit)||Array.isArray(f.explicit)))f.implicit&&(d=d.concat(f.implicit)),f.explicit&&(p=p.concat(f.explicit));else throw new s("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");d.forEach(function(b){if(!(b instanceof i))throw new s("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(b.loadKind&&b.loadKind!=="scalar")throw new s("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(b.multi)throw new s("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),p.forEach(function(b){if(!(b instanceof i))throw new s("Specified list of YAML types (or a single Type object) contains a non-Type object.")});const g=Object.create(c.prototype);return g.implicit=(this.implicit||[]).concat(d),g.explicit=(this.explicit||[]).concat(p),g.compiledImplicit=a(g,"implicit"),g.compiledExplicit=a(g,"explicit"),g.compiledTypeMap=l(g.compiledImplicit,g.compiledExplicit),g},t.exports=c})),g4=es(((e,t)=>{t.exports=new(yn())("tag:yaml.org,2002:str",{kind:"scalar",construct:function(s){return s!==null?s:""}})})),b4=es(((e,t)=>{t.exports=new(yn())("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(s){return s!==null?s:[]}})})),x4=es(((e,t)=>{t.exports=new(yn())("tag:yaml.org,2002:map",{kind:"mapping",construct:function(s){return s!==null?s:{}}})})),v4=es(((e,t)=>{t.exports=new(p4())({explicit:[g4(),b4(),x4()]})})),y4=es(((e,t)=>{var s=yn();function i(c){if(c===null)return!0;const h=c.length;return h===1&&c==="~"||h===4&&(c==="null"||c==="Null"||c==="NULL")}function a(){return null}function l(c){return c===null}t.exports=new s("tag:yaml.org,2002:null",{kind:"scalar",resolve:i,construct:a,predicate:l,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"})})),_4=es(((e,t)=>{var s=yn();function i(c){if(c===null)return!1;const h=c.length;return h===4&&(c==="true"||c==="True"||c==="TRUE")||h===5&&(c==="false"||c==="False"||c==="FALSE")}function a(c){return c==="true"||c==="True"||c==="TRUE"}function l(c){return Object.prototype.toString.call(c)==="[object Boolean]"}t.exports=new s("tag:yaml.org,2002:bool",{kind:"scalar",resolve:i,construct:a,predicate:l,represent:{lowercase:function(c){return c?"true":"false"},uppercase:function(c){return c?"TRUE":"FALSE"},camelcase:function(c){return c?"True":"False"}},defaultStyle:"lowercase"})})),w4=es(((e,t)=>{var s=Ou(),i=yn();function a(g){return g>=48&&g<=57||g>=65&&g<=70||g>=97&&g<=102}function l(g){return g>=48&&g<=55}function c(g){return g>=48&&g<=57}function h(g){if(g===null)return!1;const b=g.length;let v=0,w=!1;if(!b)return!1;let k=g[v];if((k==="-"||k==="+")&&(k=g[++v]),k==="0"){if(v+1===b)return!0;if(k=g[++v],k==="b"){for(v++;v<b;v++){if(k=g[v],k!=="0"&&k!=="1")return!1;w=!0}return w&&Number.isFinite(f(g))}if(k==="x"){for(v++;v<b;v++){if(!a(g.charCodeAt(v)))return!1;w=!0}return w&&Number.isFinite(f(g))}if(k==="o"){for(v++;v<b;v++){if(!l(g.charCodeAt(v)))return!1;w=!0}return w&&Number.isFinite(f(g))}}for(;v<b;v++){if(!c(g.charCodeAt(v)))return!1;w=!0}return w?Number.isFinite(f(g)):!1}function f(g){let b=g,v=1,w=b[0];if((w==="-"||w==="+")&&(w==="-"&&(v=-1),b=b.slice(1),w=b[0]),b==="0")return 0;if(w==="0"){if(b[1]==="b")return v*parseInt(b.slice(2),2);if(b[1]==="x")return v*parseInt(b.slice(2),16);if(b[1]==="o")return v*parseInt(b.slice(2),8)}return v*parseInt(b,10)}function d(g){return f(g)}function p(g){return Object.prototype.toString.call(g)==="[object Number]"&&g%1===0&&!s.isNegativeZero(g)}t.exports=new i("tag:yaml.org,2002:int",{kind:"scalar",resolve:h,construct:d,predicate:p,represent:{binary:function(g){return g>=0?"0b"+g.toString(2):"-0b"+g.toString(2).slice(1)},octal:function(g){return g>=0?"0o"+g.toString(8):"-0o"+g.toString(8).slice(1)},decimal:function(g){return g.toString(10)},hexadecimal:function(g){return g>=0?"0x"+g.toString(16).toUpperCase():"-0x"+g.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})})),S4=es(((e,t)=>{var s=Ou(),i=yn(),a=new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),l=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function c(g){return g===null||!a.test(g)?!1:Number.isFinite(parseFloat(g,10))?!0:l.test(g)}function h(g){let b=g.toLowerCase();const v=b[0]==="-"?-1:1;return"+-".indexOf(b[0])>=0&&(b=b.slice(1)),b===".inf"?v===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:b===".nan"?NaN:v*parseFloat(b,10)}var f=/^[-+]?[0-9]+e/;function d(g,b){if(isNaN(g))switch(b){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===g)switch(b){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===g)switch(b){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(s.isNegativeZero(g))return"-0.0";const v=g.toString(10);return f.test(v)?v.replace("e",".e"):v}function p(g){return Object.prototype.toString.call(g)==="[object Number]"&&(g%1!==0||s.isNegativeZero(g))}t.exports=new i("tag:yaml.org,2002:float",{kind:"scalar",resolve:c,construct:h,predicate:p,represent:d,defaultStyle:"lowercase"})})),k4=es(((e,t)=>{t.exports=v4().extend({implicit:[y4(),_4(),w4(),S4()]})})),N4=es(((e,t)=>{t.exports=k4()})),C4=es(((e,t)=>{var s=yn(),i=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),a=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function l(f){return f===null?!1:i.exec(f)!==null||a.exec(f)!==null}function c(f){let d=0,p=null,g=i.exec(f);if(g===null&&(g=a.exec(f)),g===null)throw new Error("Date resolve error");const b=+g[1],v=+g[2]-1,w=+g[3];if(!g[4])return new Date(Date.UTC(b,v,w));const k=+g[4],N=+g[5],E=+g[6];if(g[7]){for(d=g[7].slice(0,3);d.length<3;)d+="0";d=+d}if(g[9]){const A=+g[10],C=+(g[11]||0);p=(A*60+C)*6e4,g[9]==="-"&&(p=-p)}const T=new Date(Date.UTC(b,v,w,k,N,E,d));return p&&T.setTime(T.getTime()-p),T}function h(f){return f.toISOString()}t.exports=new s("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:l,construct:c,instanceOf:Date,represent:h})})),E4=es(((e,t)=>{var s=yn();function i(a){return a==="<<"||a===null}t.exports=new s("tag:yaml.org,2002:merge",{kind:"scalar",resolve:i})})),j4=es(((e,t)=>{var s=yn(),i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
187
+ \r`;function a(f){if(f===null)return!1;let d=0;const p=f.length,g=i;for(let b=0;b<p;b++){const v=g.indexOf(f.charAt(b));if(!(v>64)){if(v<0)return!1;d+=6}}return d%8===0}function l(f){const d=f.replace(/[\r\n=]/g,""),p=d.length,g=i;let b=0;const v=[];for(let k=0;k<p;k++)k%4===0&&k&&(v.push(b>>16&255),v.push(b>>8&255),v.push(b&255)),b=b<<6|g.indexOf(d.charAt(k));const w=p%4*6;return w===0?(v.push(b>>16&255),v.push(b>>8&255),v.push(b&255)):w===18?(v.push(b>>10&255),v.push(b>>2&255)):w===12&&v.push(b>>4&255),new Uint8Array(v)}function c(f){let d="",p=0;const g=f.length,b=i;for(let w=0;w<g;w++)w%3===0&&w&&(d+=b[p>>18&63],d+=b[p>>12&63],d+=b[p>>6&63],d+=b[p&63]),p=(p<<8)+f[w];const v=g%3;return v===0?(d+=b[p>>18&63],d+=b[p>>12&63],d+=b[p>>6&63],d+=b[p&63]):v===2?(d+=b[p>>10&63],d+=b[p>>4&63],d+=b[p<<2&63],d+=b[64]):v===1&&(d+=b[p>>2&63],d+=b[p<<4&63],d+=b[64],d+=b[64]),d}function h(f){return Object.prototype.toString.call(f)==="[object Uint8Array]"}t.exports=new s("tag:yaml.org,2002:binary",{kind:"scalar",resolve:a,construct:l,predicate:h,represent:c})})),A4=es(((e,t)=>{var s=yn(),i=Object.prototype.hasOwnProperty,a=Object.prototype.toString;function l(h){if(h===null)return!0;const f=[],d=h;for(let p=0,g=d.length;p<g;p+=1){const b=d[p];let v=!1;if(a.call(b)!=="[object Object]")return!1;let w;for(w in b)if(i.call(b,w))if(!v)v=!0;else return!1;if(!v)return!1;if(f.indexOf(w)===-1)f.push(w);else return!1}return!0}function c(h){return h!==null?h:[]}t.exports=new s("tag:yaml.org,2002:omap",{kind:"sequence",resolve:l,construct:c})})),T4=es(((e,t)=>{var s=yn(),i=Object.prototype.toString;function a(c){if(c===null)return!0;const h=c,f=new Array(h.length);for(let d=0,p=h.length;d<p;d+=1){const g=h[d];if(i.call(g)!=="[object Object]")return!1;const b=Object.keys(g);if(b.length!==1)return!1;f[d]=[b[0],g[b[0]]]}return!0}function l(c){if(c===null)return[];const h=c,f=new Array(h.length);for(let d=0,p=h.length;d<p;d+=1){const g=h[d],b=Object.keys(g);f[d]=[b[0],g[b[0]]]}return f}t.exports=new s("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:a,construct:l})})),R4=es(((e,t)=>{var s=yn(),i=Object.prototype.hasOwnProperty;function a(c){if(c===null)return!0;const h=c;for(const f in h)if(i.call(h,f)&&h[f]!==null)return!1;return!0}function l(c){return c!==null?c:{}}t.exports=new s("tag:yaml.org,2002:set",{kind:"mapping",resolve:a,construct:l})})),qv=es(((e,t)=>{t.exports=N4().extend({implicit:[C4(),E4()],explicit:[j4(),A4(),T4(),R4()]})})),lQ=es(((e,t)=>{var s=Ou(),i=zu(),a=oQ(),l=qv(),c=Object.prototype.hasOwnProperty,h=1,f=2,d=3,p=4,g=1,b=2,v=3,w=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,k=/[\x85\u2028\u2029]/,N=/[,\[\]{}]/,E=/^(?:!|!!|![0-9A-Za-z-]+!)$/,T=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function A(S){return Object.prototype.toString.call(S)}function C(S){return S===10||S===13}function R(S){return S===9||S===32}function L(S){return S===9||S===32||S===10||S===13}function H(S){return S===44||S===91||S===93||S===123||S===125}function B(S){if(S>=48&&S<=57)return S-48;const ee=S|32;return ee>=97&&ee<=102?ee-97+10:-1}function P(S){return S===120?2:S===117?4:S===85?8:0}function D(S){return S>=48&&S<=57?S-48:-1}function G(S){switch(S){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
188
+ `;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"…";case 95:return" ";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function $(S){return S<=65535?String.fromCharCode(S):String.fromCharCode((S-65536>>10)+55296,(S-65536&1023)+56320)}function O(S,ee,ge){ee==="__proto__"?Object.defineProperty(S,ee,{configurable:!0,enumerable:!0,writable:!0,value:ge}):S[ee]=ge}var V=new Array(256),K=new Array(256);for(let S=0;S<256;S++)V[S]=G(S)?1:0,K[S]=G(S);function I(S,ee){this.input=S,this.filename=ee.filename||null,this.schema=ee.schema||l,this.onWarning=ee.onWarning||null,this.legacy=ee.legacy||!1,this.json=ee.json||!1,this.listener=ee.listener||null,this.maxDepth=typeof ee.maxDepth=="number"?ee.maxDepth:100,this.maxMergeSeqLength=typeof ee.maxMergeSeqLength=="number"?ee.maxMergeSeqLength:20,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=S.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function Y(S,ee){const ge={name:S.filename,buffer:S.input.slice(0,-1),position:S.position,line:S.line,column:S.position-S.lineStart};return ge.snippet=a(ge),new i(ee,ge)}function W(S,ee){throw Y(S,ee)}function le(S,ee){S.onWarning&&S.onWarning.call(null,Y(S,ee))}function J(S,ee,ge){const _e=S.anchorMapTransactions;if(_e.length!==0){const oe=_e[_e.length-1];c.call(oe,ee)||(oe[ee]={existed:c.call(S.anchorMap,ee),value:S.anchorMap[ee]})}S.anchorMap[ee]=ge}function U(S){S.anchorMapTransactions.push(Object.create(null))}function F(S){const ee=S.anchorMapTransactions.pop(),ge=S.anchorMapTransactions;if(ge.length===0)return;const _e=ge[ge.length-1],oe=Object.keys(ee);for(let Re=0,M=oe.length;Re<M;Re+=1){const ce=oe[Re];c.call(_e,ce)||(_e[ce]=ee[ce])}}function re(S){const ee=S.anchorMapTransactions.pop(),ge=Object.keys(ee);for(let _e=ge.length-1;_e>=0;_e-=1){const oe=ee[ge[_e]];oe.existed?S.anchorMap[ge[_e]]=oe.value:delete S.anchorMap[ge[_e]]}}function fe(S){return{position:S.position,line:S.line,lineStart:S.lineStart,lineIndent:S.lineIndent,firstTabInLine:S.firstTabInLine,tag:S.tag,anchor:S.anchor,kind:S.kind,result:S.result}}function se(S,ee){S.position=ee.position,S.line=ee.line,S.lineStart=ee.lineStart,S.lineIndent=ee.lineIndent,S.firstTabInLine=ee.firstTabInLine,S.tag=ee.tag,S.anchor=ee.anchor,S.kind=ee.kind,S.result=ee.result}var te={YAML:function(ee,ge,_e){ee.version!==null&&W(ee,"duplication of %YAML directive"),_e.length!==1&&W(ee,"YAML directive accepts exactly one argument");const oe=/^([0-9]+)\.([0-9]+)$/.exec(_e[0]);oe===null&&W(ee,"ill-formed argument of the YAML directive");const Re=parseInt(oe[1],10),M=parseInt(oe[2],10);Re!==1&&W(ee,"unacceptable YAML version of the document"),ee.version=_e[0],ee.checkLineBreaks=M<2,M!==1&&M!==2&&le(ee,"unsupported YAML version of the document")},TAG:function(ee,ge,_e){let oe;_e.length!==2&&W(ee,"TAG directive accepts exactly two arguments");const Re=_e[0];oe=_e[1],E.test(Re)||W(ee,"ill-formed tag handle (first argument) of the TAG directive"),c.call(ee.tagMap,Re)&&W(ee,'there is a previously declared suffix for "'+Re+'" tag handle'),T.test(oe)||W(ee,"ill-formed tag prefix (second argument) of the TAG directive");try{oe=decodeURIComponent(oe)}catch{W(ee,"tag prefix is malformed: "+oe)}ee.tagMap[Re]=oe}};function ye(S,ee,ge,_e){if(ee<ge){const oe=S.input.slice(ee,ge);if(_e)for(let Re=0,M=oe.length;Re<M;Re+=1){const ce=oe.charCodeAt(Re);ce===9||ce>=32&&ce<=1114111||W(S,"expected valid JSON character")}else w.test(oe)&&W(S,"the stream contains non-printable characters");S.result+=oe}}function Ee(S,ee,ge,_e){s.isObject(ge)||W(S,"cannot merge mappings; the provided source object is unacceptable");const oe=Object.keys(ge);for(let Re=0,M=oe.length;Re<M;Re+=1){const ce=oe[Re];c.call(ee,ce)||(O(ee,ce,ge[ce]),_e[ce]=!0)}}function De(S,ee,ge,_e,oe,Re,M,ce,Me){if(Array.isArray(oe)){oe=Array.prototype.slice.call(oe);for(let Se=0,me=oe.length;Se<me;Se+=1)Array.isArray(oe[Se])&&W(S,"nested arrays are not supported inside keys"),typeof oe=="object"&&A(oe[Se])==="[object Object]"&&(oe[Se]="[object Object]")}if(typeof oe=="object"&&A(oe)==="[object Object]"&&(oe="[object Object]"),oe=String(oe),ee===null&&(ee={}),_e==="tag:yaml.org,2002:merge")if(Array.isArray(Re)){Re.length>S.maxMergeSeqLength&&W(S,"merge sequence length exceeded maxMergeSeqLength ("+S.maxMergeSeqLength+")");const Se=new Set;for(let me=0,Ae=Re.length;me<Ae;me+=1){const Ne=Re[me];Se.has(Ne)||(Se.add(Ne),Ee(S,ee,Ne,ge))}}else Ee(S,ee,Re,ge);else!S.json&&!c.call(ge,oe)&&c.call(ee,oe)&&(S.line=M||S.line,S.lineStart=ce||S.lineStart,S.position=Me||S.position,W(S,"duplicated mapping key")),O(ee,oe,Re),delete ge[oe];return ee}function Ye(S){const ee=S.input.charCodeAt(S.position);ee===10?S.position++:ee===13?(S.position++,S.input.charCodeAt(S.position)===10&&S.position++):W(S,"a line break is expected"),S.line+=1,S.lineStart=S.position,S.firstTabInLine=-1}function we(S,ee,ge){let _e=0,oe=S.input.charCodeAt(S.position);for(;oe!==0;){for(;R(oe);)oe===9&&S.firstTabInLine===-1&&(S.firstTabInLine=S.position),oe=S.input.charCodeAt(++S.position);if(ee&&oe===35)do oe=S.input.charCodeAt(++S.position);while(oe!==10&&oe!==13&&oe!==0);if(C(oe))for(Ye(S),oe=S.input.charCodeAt(S.position),_e++,S.lineIndent=0;oe===32;)S.lineIndent++,oe=S.input.charCodeAt(++S.position);else break}return ge!==-1&&_e!==0&&S.lineIndent<ge&&le(S,"deficient indentation"),_e}function He(S){let ee=S.position,ge=S.input.charCodeAt(ee);return!!((ge===45||ge===46)&&ge===S.input.charCodeAt(ee+1)&&ge===S.input.charCodeAt(ee+2)&&(ee+=3,ge=S.input.charCodeAt(ee),ge===0||L(ge)))}function $e(S,ee){ee===1?S.result+=" ":ee>1&&(S.result+=s.repeat(`
189
+ `,ee-1))}function St(S,ee,ge){let _e,oe,Re,M,ce,Me;const Se=S.kind,me=S.result;let Ae=S.input.charCodeAt(S.position);if(L(Ae)||H(Ae)||Ae===35||Ae===38||Ae===42||Ae===33||Ae===124||Ae===62||Ae===39||Ae===34||Ae===37||Ae===64||Ae===96)return!1;if(Ae===63||Ae===45){const Ne=S.input.charCodeAt(S.position+1);if(L(Ne)||ge&&H(Ne))return!1}for(S.kind="scalar",S.result="",_e=oe=S.position,Re=!1;Ae!==0;){if(Ae===58){const Ne=S.input.charCodeAt(S.position+1);if(L(Ne)||ge&&H(Ne))break}else if(Ae===35){if(L(S.input.charCodeAt(S.position-1)))break}else{if(S.position===S.lineStart&&He(S)||ge&&H(Ae))break;if(C(Ae))if(M=S.line,ce=S.lineStart,Me=S.lineIndent,we(S,!1,-1),S.lineIndent>=ee){Re=!0,Ae=S.input.charCodeAt(S.position);continue}else{S.position=oe,S.line=M,S.lineStart=ce,S.lineIndent=Me;break}}Re&&(ye(S,_e,oe,!1),$e(S,S.line-M),_e=oe=S.position,Re=!1),R(Ae)||(oe=S.position+1),Ae=S.input.charCodeAt(++S.position)}return ye(S,_e,oe,!1),S.result?!0:(S.kind=Se,S.result=me,!1)}function Gt(S,ee){let ge,_e,oe=S.input.charCodeAt(S.position);if(oe!==39)return!1;for(S.kind="scalar",S.result="",S.position++,ge=_e=S.position;(oe=S.input.charCodeAt(S.position))!==0;)if(oe===39)if(ye(S,ge,S.position,!0),oe=S.input.charCodeAt(++S.position),oe===39)ge=S.position,S.position++,_e=S.position;else return!0;else C(oe)?(ye(S,ge,_e,!0),$e(S,we(S,!1,ee)),ge=_e=S.position):S.position===S.lineStart&&He(S)?W(S,"unexpected end of the document within a single quoted scalar"):(S.position++,R(oe)||(_e=S.position));W(S,"unexpected end of the stream within a single quoted scalar")}function At(S,ee){let ge,_e,oe,Re=S.input.charCodeAt(S.position);if(Re!==34)return!1;for(S.kind="scalar",S.result="",S.position++,ge=_e=S.position;(Re=S.input.charCodeAt(S.position))!==0;){if(Re===34)return ye(S,ge,S.position,!0),S.position++,!0;if(Re===92){if(ye(S,ge,S.position,!0),Re=S.input.charCodeAt(++S.position),C(Re))we(S,!1,ee);else if(Re<256&&V[Re])S.result+=K[Re],S.position++;else if((oe=P(Re))>0){let M=oe,ce=0;for(;M>0;M--)Re=S.input.charCodeAt(++S.position),(oe=B(Re))>=0?ce=(ce<<4)+oe:W(S,"expected hexadecimal character");S.result+=$(ce),S.position++}else W(S,"unknown escape sequence");ge=_e=S.position}else C(Re)?(ye(S,ge,_e,!0),$e(S,we(S,!1,ee)),ge=_e=S.position):S.position===S.lineStart&&He(S)?W(S,"unexpected end of the document within a double quoted scalar"):(S.position++,R(Re)||(_e=S.position))}W(S,"unexpected end of the stream within a double quoted scalar")}function Ln(S,ee){let ge=!0,_e,oe,Re;const M=S.tag;let ce;const Me=S.anchor;let Se,me,Ae,Ne;const Be=Object.create(null);let q,ne,xe,Pe=S.input.charCodeAt(S.position);if(Pe===91)Se=93,Ne=!1,ce=[];else if(Pe===123)Se=125,Ne=!0,ce={};else return!1;for(S.anchor!==null&&J(S,S.anchor,ce),Pe=S.input.charCodeAt(++S.position);Pe!==0;){if(we(S,!0,ee),Pe=S.input.charCodeAt(S.position),Pe===Se)return S.position++,S.tag=M,S.anchor=Me,S.kind=Ne?"mapping":"sequence",S.result=ce,!0;ge?Pe===44&&W(S,"expected the node content, but found ','"):W(S,"missed comma between flow collection entries"),ne=q=xe=null,me=Ae=!1,Pe===63&&L(S.input.charCodeAt(S.position+1))&&(me=Ae=!0,S.position++,we(S,!0,ee)),_e=S.line,oe=S.lineStart,Re=S.position,ps(S,ee,h,!1,!0),ne=S.tag,q=S.result,we(S,!0,ee),Pe=S.input.charCodeAt(S.position),(Ae||S.line===_e)&&Pe===58&&(me=!0,Pe=S.input.charCodeAt(++S.position),we(S,!0,ee),ps(S,ee,h,!1,!0),xe=S.result),Ne?De(S,ce,Be,ne,q,xe,_e,oe,Re):me?ce.push(De(S,null,Be,ne,q,xe,_e,oe,Re)):ce.push(q),we(S,!0,ee),Pe=S.input.charCodeAt(S.position),Pe===44?(ge=!0,Pe=S.input.charCodeAt(++S.position)):ge=!1}W(S,"unexpected end of the stream within a flow collection")}function _n(S,ee){let ge,_e=g,oe=!1,Re=!1,M=ee,ce=0,Me=!1,Se,me=S.input.charCodeAt(S.position);if(me===124)ge=!1;else if(me===62)ge=!0;else return!1;for(S.kind="scalar",S.result="";me!==0;)if(me=S.input.charCodeAt(++S.position),me===43||me===45)g===_e?_e=me===43?v:b:W(S,"repeat of a chomping mode identifier");else if((Se=D(me))>=0)Se===0?W(S,"bad explicit indentation width of a block scalar; it cannot be less than one"):Re?W(S,"repeat of an indentation width identifier"):(M=ee+Se-1,Re=!0);else break;if(R(me)){do me=S.input.charCodeAt(++S.position);while(R(me));if(me===35)do me=S.input.charCodeAt(++S.position);while(!C(me)&&me!==0)}for(;me!==0;){for(Ye(S),S.lineIndent=0,me=S.input.charCodeAt(S.position);(!Re||S.lineIndent<M)&&me===32;)S.lineIndent++,me=S.input.charCodeAt(++S.position);if(!Re&&S.lineIndent>M&&(M=S.lineIndent),C(me)){ce++;continue}if(!Re&&M===0&&W(S,"missing indentation for block scalar"),S.lineIndent<M){_e===v?S.result+=s.repeat(`
190
+ `,oe?1+ce:ce):_e===g&&oe&&(S.result+=`
191
+ `);break}ge?R(me)?(Me=!0,S.result+=s.repeat(`
192
+ `,oe?1+ce:ce)):Me?(Me=!1,S.result+=s.repeat(`
193
+ `,ce+1)):ce===0?oe&&(S.result+=" "):S.result+=s.repeat(`
194
+ `,ce):S.result+=s.repeat(`
195
+ `,oe?1+ce:ce),oe=!0,Re=!0,ce=0;const Ae=S.position;for(;!C(me)&&me!==0;)me=S.input.charCodeAt(++S.position);ye(S,Ae,S.position,!1)}return!0}function ms(S,ee){const ge=S.tag,_e=S.anchor,oe=[];let Re=!1;if(S.firstTabInLine!==-1)return!1;S.anchor!==null&&J(S,S.anchor,oe);let M=S.input.charCodeAt(S.position);for(;M!==0&&(S.firstTabInLine!==-1&&(S.position=S.firstTabInLine,W(S,"tab characters must not be used in indentation")),!(M!==45||!L(S.input.charCodeAt(S.position+1))));){if(Re=!0,S.position++,we(S,!0,-1)&&S.lineIndent<=ee){oe.push(null),M=S.input.charCodeAt(S.position);continue}const ce=S.line;if(ps(S,ee,d,!1,!0),oe.push(S.result),we(S,!0,-1),M=S.input.charCodeAt(S.position),(S.line===ce||S.lineIndent>ee)&&M!==0)W(S,"bad indentation of a sequence entry");else if(S.lineIndent<ee)break}return Re?(S.tag=ge,S.anchor=_e,S.kind="sequence",S.result=oe,!0):!1}function Hs(S,ee,ge){let _e,oe,Re,M;const ce=S.tag,Me=S.anchor,Se={},me=Object.create(null);let Ae=null,Ne=null,Be=null,q=!1,ne=!1;if(S.firstTabInLine!==-1)return!1;S.anchor!==null&&J(S,S.anchor,Se);let xe=S.input.charCodeAt(S.position);for(;xe!==0;){!q&&S.firstTabInLine!==-1&&(S.position=S.firstTabInLine,W(S,"tab characters must not be used in indentation"));const Pe=S.input.charCodeAt(S.position+1),at=S.line;if((xe===63||xe===58)&&L(Pe))xe===63?(q&&(De(S,Se,me,Ae,Ne,null,oe,Re,M),Ae=Ne=Be=null),ne=!0,q=!0,_e=!0):q?(q=!1,_e=!0):W(S,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),S.position+=1,xe=Pe;else{if(oe=S.line,Re=S.lineStart,M=S.position,!ps(S,ge,f,!1,!0))break;if(S.line===at){for(xe=S.input.charCodeAt(S.position);R(xe);)xe=S.input.charCodeAt(++S.position);if(xe===58)xe=S.input.charCodeAt(++S.position),L(xe)||W(S,"a whitespace character is expected after the key-value separator within a block mapping"),q&&(De(S,Se,me,Ae,Ne,null,oe,Re,M),Ae=Ne=Be=null),ne=!0,q=!1,_e=!1,Ae=S.tag,Ne=S.result;else if(ne)W(S,"can not read an implicit mapping pair; a colon is missed");else return S.tag=ce,S.anchor=Me,!0}else if(ne)W(S,"can not read a block mapping entry; a multiline key may not be an implicit key");else return S.tag=ce,S.anchor=Me,!0}if((S.line===at||S.lineIndent>ee)&&(q&&(oe=S.line,Re=S.lineStart,M=S.position),ps(S,ee,p,!0,_e)&&(q?Ne=S.result:Be=S.result),q||(De(S,Se,me,Ae,Ne,Be,oe,Re,M),Ae=Ne=Be=null),we(S,!0,-1),xe=S.input.charCodeAt(S.position)),(S.line===at||S.lineIndent>ee)&&xe!==0)W(S,"bad indentation of a mapping entry");else if(S.lineIndent<ee)break}return q&&De(S,Se,me,Ae,Ne,null,oe,Re,M),ne&&(S.tag=ce,S.anchor=Me,S.kind="mapping",S.result=Se),ne}function un(S){let ee=!1,ge=!1,_e,oe,Re=S.input.charCodeAt(S.position);if(Re!==33)return!1;S.tag!==null&&W(S,"duplication of a tag property"),Re=S.input.charCodeAt(++S.position),Re===60?(ee=!0,Re=S.input.charCodeAt(++S.position)):Re===33?(ge=!0,_e="!!",Re=S.input.charCodeAt(++S.position)):_e="!";let M=S.position;if(ee){do Re=S.input.charCodeAt(++S.position);while(Re!==0&&Re!==62);S.position<S.length?(oe=S.input.slice(M,S.position),Re=S.input.charCodeAt(++S.position)):W(S,"unexpected end of the stream within a verbatim tag")}else{for(;Re!==0&&!L(Re);)Re===33&&(ge?W(S,"tag suffix cannot contain exclamation marks"):(_e=S.input.slice(M-1,S.position+1),E.test(_e)||W(S,"named tag handle cannot contain such characters"),ge=!0,M=S.position+1)),Re=S.input.charCodeAt(++S.position);oe=S.input.slice(M,S.position),N.test(oe)&&W(S,"tag suffix cannot contain flow indicator characters")}oe&&!T.test(oe)&&W(S,"tag name cannot contain such characters: "+oe);try{oe=decodeURIComponent(oe)}catch{W(S,"tag name is malformed: "+oe)}return ee?S.tag=oe:c.call(S.tagMap,_e)?S.tag=S.tagMap[_e]+oe:_e==="!"?S.tag="!"+oe:_e==="!!"?S.tag="tag:yaml.org,2002:"+oe:W(S,'undeclared tag handle "'+_e+'"'),!0}function ei(S){let ee=S.input.charCodeAt(S.position);if(ee!==38)return!1;S.anchor!==null&&W(S,"duplication of an anchor property"),ee=S.input.charCodeAt(++S.position);const ge=S.position;for(;ee!==0&&!L(ee)&&!H(ee);)ee=S.input.charCodeAt(++S.position);return S.position===ge&&W(S,"name of an anchor node must contain at least one character"),S.anchor=S.input.slice(ge,S.position),!0}function On(S){let ee=S.input.charCodeAt(S.position);if(ee!==42)return!1;ee=S.input.charCodeAt(++S.position);const ge=S.position;for(;ee!==0&&!L(ee)&&!H(ee);)ee=S.input.charCodeAt(++S.position);S.position===ge&&W(S,"name of an alias node must contain at least one character");const _e=S.input.slice(ge,S.position);return c.call(S.anchorMap,_e)||W(S,'unidentified alias "'+_e+'"'),S.result=S.anchorMap[_e],we(S,!0,-1),!0}function Lt(S,ee,ge,_e){const oe=fe(S);return U(S),se(S,ee),S.tag=null,S.anchor=null,S.kind=null,S.result=null,Hs(S,ge,_e)&&S.kind==="mapping"?(F(S),!0):(re(S),se(S,oe),!1)}function ps(S,ee,ge,_e,oe){let Re,M,ce=1,Me=!1,Se=!1,me=null,Ae,Ne,Be;S.depth>=S.maxDepth&&W(S,"nesting exceeded maxDepth ("+S.maxDepth+")"),S.depth+=1,S.listener!==null&&S.listener("open",S),S.tag=null,S.anchor=null,S.kind=null,S.result=null;const q=Re=M=p===ge||d===ge;if(_e&&we(S,!0,-1)&&(Me=!0,S.lineIndent>ee?ce=1:S.lineIndent===ee?ce=0:S.lineIndent<ee&&(ce=-1)),ce===1)for(;;){const ne=S.input.charCodeAt(S.position),xe=fe(S);if(Me&&(ne===33&&S.tag!==null||ne===38&&S.anchor!==null)||!un(S)&&!ei(S))break;me===null&&(me=xe),we(S,!0,-1)?(Me=!0,M=q,S.lineIndent>ee?ce=1:S.lineIndent===ee?ce=0:S.lineIndent<ee&&(ce=-1)):M=!1}if(M&&(M=Me||oe),ce===1||p===ge)if(h===ge||f===ge?Ne=ee:Ne=ee+1,Be=S.position-S.lineStart,ce===1)if(M&&(ms(S,Be)||Hs(S,Be,Ne))||Ln(S,Ne))Se=!0;else{const ne=S.input.charCodeAt(S.position);me!==null&&q&&!M&&ne!==124&&ne!==62&&Lt(S,me,me.position-me.lineStart,Ne)||Re&&_n(S,Ne)||Gt(S,Ne)||At(S,Ne)?Se=!0:On(S)?(Se=!0,(S.tag!==null||S.anchor!==null)&&W(S,"alias node should not have any properties")):St(S,Ne,h===ge)&&(Se=!0,S.tag===null&&(S.tag="?")),S.anchor!==null&&J(S,S.anchor,S.result)}else ce===0&&(Se=M&&ms(S,Be));if(S.tag===null)S.anchor!==null&&J(S,S.anchor,S.result);else if(S.tag==="?"){S.result!==null&&S.kind!=="scalar"&&W(S,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+S.kind+'"');for(let ne=0,xe=S.implicitTypes.length;ne<xe;ne+=1)if(Ae=S.implicitTypes[ne],Ae.resolve(S.result)){S.result=Ae.construct(S.result),S.tag=Ae.tag,S.anchor!==null&&J(S,S.anchor,S.result);break}}else if(S.tag!=="!"){if(c.call(S.typeMap[S.kind||"fallback"],S.tag))Ae=S.typeMap[S.kind||"fallback"][S.tag];else{Ae=null;const ne=S.typeMap.multi[S.kind||"fallback"];for(let xe=0,Pe=ne.length;xe<Pe;xe+=1)if(S.tag.slice(0,ne[xe].tag.length)===ne[xe].tag){Ae=ne[xe];break}}Ae||W(S,"unknown tag !<"+S.tag+">"),S.result!==null&&Ae.kind!==S.kind&&W(S,"unacceptable node kind for !<"+S.tag+'> tag; it should be "'+Ae.kind+'", not "'+S.kind+'"'),Ae.resolve(S.result,S.tag)?(S.result=Ae.construct(S.result,S.tag),S.anchor!==null&&J(S,S.anchor,S.result)):W(S,"cannot resolve a node with !<"+S.tag+"> explicit tag")}return S.listener!==null&&S.listener("close",S),S.depth-=1,S.tag!==null||S.anchor!==null||Se}function is(S){const ee=S.position;let ge=!1,_e;for(S.version=null,S.checkLineBreaks=S.legacy,S.tagMap=Object.create(null),S.anchorMap=Object.create(null);(_e=S.input.charCodeAt(S.position))!==0&&(we(S,!0,-1),_e=S.input.charCodeAt(S.position),!(S.lineIndent>0||_e!==37));){ge=!0,_e=S.input.charCodeAt(++S.position);let oe=S.position;for(;_e!==0&&!L(_e);)_e=S.input.charCodeAt(++S.position);const Re=S.input.slice(oe,S.position),M=[];for(Re.length<1&&W(S,"directive name must not be less than one character in length");_e!==0;){for(;R(_e);)_e=S.input.charCodeAt(++S.position);if(_e===35){do _e=S.input.charCodeAt(++S.position);while(_e!==0&&!C(_e));break}if(C(_e))break;for(oe=S.position;_e!==0&&!L(_e);)_e=S.input.charCodeAt(++S.position);M.push(S.input.slice(oe,S.position))}_e!==0&&Ye(S),c.call(te,Re)?te[Re](S,Re,M):le(S,'unknown document directive "'+Re+'"')}if(we(S,!0,-1),S.lineIndent===0&&S.input.charCodeAt(S.position)===45&&S.input.charCodeAt(S.position+1)===45&&S.input.charCodeAt(S.position+2)===45?(S.position+=3,we(S,!0,-1)):ge&&W(S,"directives end mark is expected"),ps(S,S.lineIndent-1,p,!1,!0),we(S,!0,-1),S.checkLineBreaks&&k.test(S.input.slice(ee,S.position))&&le(S,"non-ASCII line breaks are interpreted as content"),S.documents.push(S.result),S.position===S.lineStart&&He(S)){S.input.charCodeAt(S.position)===46&&(S.position+=3,we(S,!0,-1));return}S.position<S.length-1&&W(S,"end of the stream or a document separator is expected")}function et(S,ee){S=String(S),ee=ee||{},S.length!==0&&(S.charCodeAt(S.length-1)!==10&&S.charCodeAt(S.length-1)!==13&&(S+=`
196
+ `),S.charCodeAt(0)===65279&&(S=S.slice(1)));const ge=new I(S,ee),_e=S.indexOf("\0");for(_e!==-1&&(ge.position=_e,W(ge,"null byte is not allowed in input")),ge.input+="\0";ge.input.charCodeAt(ge.position)===32;)ge.lineIndent+=1,ge.position+=1;for(;ge.position<ge.length-1;)is(ge);return ge.documents}function tt(S,ee,ge){ee!==null&&typeof ee=="object"&&typeof ge>"u"&&(ge=ee,ee=null);const _e=et(S,ge);if(typeof ee!="function")return _e;for(let oe=0,Re=_e.length;oe<Re;oe+=1)ee(_e[oe])}function Ct(S,ee){const ge=et(S,ee);if(ge.length!==0){if(ge.length===1)return ge[0];throw new i("expected a single document in the stream, but found more")}}t.exports.loadAll=tt,t.exports.load=Ct})),cQ=es(((e,t)=>{var s=Ou(),i=zu(),a=qv(),l=Object.prototype.toString,c=Object.prototype.hasOwnProperty,h=65279,f=9,d=10,p=13,g=32,b=33,v=34,w=35,k=37,N=38,E=39,T=42,A=44,C=45,R=58,L=61,H=62,B=63,P=64,D=91,G=93,$=96,O=123,V=124,K=125,I={};I[0]="\\0",I[7]="\\a",I[8]="\\b",I[9]="\\t",I[10]="\\n",I[11]="\\v",I[12]="\\f",I[13]="\\r",I[27]="\\e",I[34]='\\"',I[92]="\\\\",I[133]="\\N",I[160]="\\_",I[8232]="\\L",I[8233]="\\P";var Y=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],W=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function le(M,ce){if(ce===null)return{};const Me={},Se=Object.keys(ce);for(let me=0,Ae=Se.length;me<Ae;me+=1){let Ne=Se[me],Be=String(ce[Ne]);Ne.slice(0,2)==="!!"&&(Ne="tag:yaml.org,2002:"+Ne.slice(2));const q=M.compiledTypeMap.fallback[Ne];q&&c.call(q.styleAliases,Be)&&(Be=q.styleAliases[Be]),Me[Ne]=Be}return Me}function J(M){let ce,Me;const Se=M.toString(16).toUpperCase();if(M<=255)ce="x",Me=2;else if(M<=65535)ce="u",Me=4;else if(M<=4294967295)ce="U",Me=8;else throw new i("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+ce+s.repeat("0",Me-Se.length)+Se}var U=1,F=2;function re(M){this.schema=M.schema||a,this.indent=Math.max(1,M.indent||2),this.noArrayIndent=M.noArrayIndent||!1,this.skipInvalid=M.skipInvalid||!1,this.flowLevel=s.isNothing(M.flowLevel)?-1:M.flowLevel,this.styleMap=le(this.schema,M.styles||null),this.sortKeys=M.sortKeys||!1,this.lineWidth=M.lineWidth||80,this.noRefs=M.noRefs||!1,this.noCompatMode=M.noCompatMode||!1,this.condenseFlow=M.condenseFlow||!1,this.quotingType=M.quotingType==='"'?F:U,this.forceQuotes=M.forceQuotes||!1,this.replacer=typeof M.replacer=="function"?M.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function fe(M,ce){const Me=s.repeat(" ",ce);let Se=0,me="";const Ae=M.length;for(;Se<Ae;){let Ne;const Be=M.indexOf(`
197
+ `,Se);Be===-1?(Ne=M.slice(Se),Se=Ae):(Ne=M.slice(Se,Be+1),Se=Be+1),Ne.length&&Ne!==`
198
+ `&&(me+=Me),me+=Ne}return me}function se(M,ce){return`
199
+ `+s.repeat(" ",M.indent*ce)}function te(M,ce){for(let Me=0,Se=M.implicitTypes.length;Me<Se;Me+=1)if(M.implicitTypes[Me].resolve(ce))return!0;return!1}function ye(M){return M===g||M===f}function Ee(M){return M>=32&&M<=126||M>=161&&M<=55295&&M!==8232&&M!==8233||M>=57344&&M<=65533&&M!==h||M>=65536&&M<=1114111}function De(M){return Ee(M)&&M!==h&&M!==p&&M!==d}function Ye(M,ce,Me){const Se=De(M),me=Se&&!ye(M);return(Me?Se:Se&&M!==A&&M!==D&&M!==G&&M!==O&&M!==K)&&M!==w&&!(ce===R&&!me)||De(ce)&&!ye(ce)&&M===w||ce===R&&me}function we(M){return Ee(M)&&M!==h&&!ye(M)&&M!==C&&M!==B&&M!==R&&M!==A&&M!==D&&M!==G&&M!==O&&M!==K&&M!==w&&M!==N&&M!==T&&M!==b&&M!==V&&M!==L&&M!==H&&M!==E&&M!==v&&M!==k&&M!==P&&M!==$}function He(M){return!ye(M)&&M!==R}function $e(M,ce){const Me=M.charCodeAt(ce);let Se;return Me>=55296&&Me<=56319&&ce+1<M.length&&(Se=M.charCodeAt(ce+1),Se>=56320&&Se<=57343)?(Me-55296)*1024+Se-56320+65536:Me}function St(M){return/^\n* /.test(M)}var Gt=1,At=2,Ln=3,_n=4,ms=5;function Hs(M,ce,Me,Se,me,Ae,Ne,Be){let q,ne=0,xe=null,Pe=!1,at=!1;const Mt=Se!==-1;let qe=-1,Ue=we($e(M,0))&&He($e(M,M.length-1));if(ce||Ne)for(q=0;q<M.length;ne>=65536?q+=2:q++){if(ne=$e(M,q),!Ee(ne))return ms;Ue=Ue&&Ye(ne,xe,Be),xe=ne}else{for(q=0;q<M.length;ne>=65536?q+=2:q++){if(ne=$e(M,q),ne===d)Pe=!0,Mt&&(at=at||q-qe-1>Se&&M[qe+1]!==" ",qe=q);else if(!Ee(ne))return ms;Ue=Ue&&Ye(ne,xe,Be),xe=ne}at=at||Mt&&q-qe-1>Se&&M[qe+1]!==" "}return!Pe&&!at?Ue&&!Ne&&!me(M)?Gt:Ae===F?ms:At:Me>9&&St(M)?ms:Ne?Ae===F?ms:At:at?_n:Ln}function un(M,ce,Me,Se,me){M.dump=(function(){if(ce.length===0)return M.quotingType===F?'""':"''";if(!M.noCompatMode&&(Y.indexOf(ce)!==-1||W.test(ce)))return M.quotingType===F?'"'+ce+'"':"'"+ce+"'";const Ae=M.indent*Math.max(1,Me),Ne=M.lineWidth===-1?-1:Math.max(Math.min(M.lineWidth,40),M.lineWidth-Ae),Be=Se||M.flowLevel>-1&&Me>=M.flowLevel;function q(ne){return te(M,ne)}switch(Hs(ce,Be,M.indent,Ne,q,M.quotingType,M.forceQuotes&&!Se,me)){case Gt:return ce;case At:return"'"+ce.replace(/'/g,"''")+"'";case Ln:return"|"+ei(ce,M.indent)+On(fe(ce,Ae));case _n:return">"+ei(ce,M.indent)+On(fe(Lt(ce,Ne),Ae));case ms:return'"'+is(ce)+'"';default:throw new i("impossible error: invalid scalar style")}})()}function ei(M,ce){const Me=St(M)?String(ce):"",Se=M[M.length-1]===`
200
+ `;return Me+(Se&&(M[M.length-2]===`
201
+ `||M===`
202
+ `)?"+":Se?"":"-")+`
203
+ `}function On(M){return M[M.length-1]===`
204
+ `?M.slice(0,-1):M}function Lt(M,ce){const Me=/(\n+)([^\n]*)/g;let Se=(function(){let Be=M.indexOf(`
205
+ `);return Be=Be!==-1?Be:M.length,Me.lastIndex=Be,ps(M.slice(0,Be),ce)})(),me=M[0]===`
206
+ `||M[0]===" ",Ae,Ne;for(;Ne=Me.exec(M);){const Be=Ne[1],q=Ne[2];Ae=q[0]===" ",Se+=Be+(!me&&!Ae&&q!==""?`
207
+ `:"")+ps(q,ce),me=Ae}return Se}function ps(M,ce){if(M===""||M[0]===" ")return M;const Me=/ [^ ]/g;let Se,me=0,Ae,Ne=0,Be=0,q="";for(;Se=Me.exec(M);)Be=Se.index,Be-me>ce&&(Ae=Ne>me?Ne:Be,q+=`
208
+ `+M.slice(me,Ae),me=Ae+1),Ne=Be;return q+=`
209
+ `,M.length-me>ce&&Ne>me?q+=M.slice(me,Ne)+`
210
+ `+M.slice(Ne+1):q+=M.slice(me),q.slice(1)}function is(M){let ce="",Me=0;for(let Se=0;Se<M.length;Me>=65536?Se+=2:Se++){Me=$e(M,Se);const me=I[Me];!me&&Ee(Me)?(ce+=M[Se],Me>=65536&&(ce+=M[Se+1])):ce+=me||J(Me)}return ce}function et(M,ce,Me){let Se="";const me=M.tag;for(let Ae=0,Ne=Me.length;Ae<Ne;Ae+=1){let Be=Me[Ae];M.replacer&&(Be=M.replacer.call(Me,String(Ae),Be)),(ge(M,ce,Be,!1,!1)||typeof Be>"u"&&ge(M,ce,null,!1,!1))&&(Se!==""&&(Se+=","+(M.condenseFlow?"":" ")),Se+=M.dump)}M.tag=me,M.dump="["+Se+"]"}function tt(M,ce,Me,Se){let me="";const Ae=M.tag;for(let Ne=0,Be=Me.length;Ne<Be;Ne+=1){let q=Me[Ne];M.replacer&&(q=M.replacer.call(Me,String(Ne),q)),(ge(M,ce+1,q,!0,!0,!1,!0)||typeof q>"u"&&ge(M,ce+1,null,!0,!0,!1,!0))&&((!Se||me!=="")&&(me+=se(M,ce)),M.dump&&d===M.dump.charCodeAt(0)?me+="-":me+="- ",me+=M.dump)}M.tag=Ae,M.dump=me||"[]"}function Ct(M,ce,Me){let Se="";const me=M.tag,Ae=Object.keys(Me);for(let Ne=0,Be=Ae.length;Ne<Be;Ne+=1){let q="";Se!==""&&(q+=", "),M.condenseFlow&&(q+='"');const ne=Ae[Ne];let xe=Me[ne];M.replacer&&(xe=M.replacer.call(Me,ne,xe)),ge(M,ce,ne,!1,!1)&&(M.dump.length>1024&&(q+="? "),q+=M.dump+(M.condenseFlow?'"':"")+":"+(M.condenseFlow?"":" "),ge(M,ce,xe,!1,!1)&&(q+=M.dump,Se+=q))}M.tag=me,M.dump="{"+Se+"}"}function S(M,ce,Me,Se){let me="";const Ae=M.tag,Ne=Object.keys(Me);if(M.sortKeys===!0)Ne.sort();else if(typeof M.sortKeys=="function")Ne.sort(M.sortKeys);else if(M.sortKeys)throw new i("sortKeys must be a boolean or a function");for(let Be=0,q=Ne.length;Be<q;Be+=1){let ne="";(!Se||me!=="")&&(ne+=se(M,ce));const xe=Ne[Be];let Pe=Me[xe];if(M.replacer&&(Pe=M.replacer.call(Me,xe,Pe)),!ge(M,ce+1,xe,!0,!0,!0))continue;const at=M.tag!==null&&M.tag!=="?"||M.dump&&M.dump.length>1024;at&&(M.dump&&d===M.dump.charCodeAt(0)?ne+="?":ne+="? "),ne+=M.dump,at&&(ne+=se(M,ce)),ge(M,ce+1,Pe,!0,at)&&(M.dump&&d===M.dump.charCodeAt(0)?ne+=":":ne+=": ",ne+=M.dump,me+=ne)}M.tag=Ae,M.dump=me||"{}"}function ee(M,ce,Me){const Se=Me?M.explicitTypes:M.implicitTypes;for(let me=0,Ae=Se.length;me<Ae;me+=1){const Ne=Se[me];if((Ne.instanceOf||Ne.predicate)&&(!Ne.instanceOf||typeof ce=="object"&&ce instanceof Ne.instanceOf)&&(!Ne.predicate||Ne.predicate(ce))){if(Me?Ne.multi&&Ne.representName?M.tag=Ne.representName(ce):M.tag=Ne.tag:M.tag="?",Ne.represent){const Be=M.styleMap[Ne.tag]||Ne.defaultStyle;let q;if(l.call(Ne.represent)==="[object Function]")q=Ne.represent(ce,Be);else if(c.call(Ne.represent,Be))q=Ne.represent[Be](ce,Be);else throw new i("!<"+Ne.tag+'> tag resolver accepts not "'+Be+'" style');M.dump=q}return!0}}return!1}function ge(M,ce,Me,Se,me,Ae,Ne){M.tag=null,M.dump=Me,ee(M,Me,!1)||ee(M,Me,!0);const Be=l.call(M.dump),q=Se;Se&&(Se=M.flowLevel<0||M.flowLevel>ce);const ne=Be==="[object Object]"||Be==="[object Array]";let xe,Pe;if(ne&&(xe=M.duplicates.indexOf(Me),Pe=xe!==-1),(M.tag!==null&&M.tag!=="?"||Pe||M.indent!==2&&ce>0)&&(me=!1),Pe&&M.usedDuplicates[xe])M.dump="*ref_"+xe;else{if(ne&&Pe&&!M.usedDuplicates[xe]&&(M.usedDuplicates[xe]=!0),Be==="[object Object]")Se&&Object.keys(M.dump).length!==0?(S(M,ce,M.dump,me),Pe&&(M.dump="&ref_"+xe+M.dump)):(Ct(M,ce,M.dump),Pe&&(M.dump="&ref_"+xe+" "+M.dump));else if(Be==="[object Array]")Se&&M.dump.length!==0?(M.noArrayIndent&&!Ne&&ce>0?tt(M,ce-1,M.dump,me):tt(M,ce,M.dump,me),Pe&&(M.dump="&ref_"+xe+M.dump)):(et(M,ce,M.dump),Pe&&(M.dump="&ref_"+xe+" "+M.dump));else if(Be==="[object String]")M.tag!=="?"&&un(M,M.dump,ce,Ae,q);else{if(Be==="[object Undefined]")return!1;if(M.skipInvalid)return!1;throw new i("unacceptable kind of an object to dump "+Be)}if(M.tag!==null&&M.tag!=="?"){let at=encodeURI(M.tag[0]==="!"?M.tag.slice(1):M.tag).replace(/!/g,"%21");M.tag[0]==="!"?at="!"+at:at.slice(0,18)==="tag:yaml.org,2002:"?at="!!"+at.slice(18):at="!<"+at+">",M.dump=at+" "+M.dump}}return!0}function _e(M,ce){const Me=[],Se=[];oe(M,Me,Se);const me=Se.length;for(let Ae=0;Ae<me;Ae+=1)ce.duplicates.push(Me[Se[Ae]]);ce.usedDuplicates=new Array(me)}function oe(M,ce,Me){if(M!==null&&typeof M=="object"){const Se=ce.indexOf(M);if(Se!==-1)Me.indexOf(Se)===-1&&Me.push(Se);else if(ce.push(M),Array.isArray(M))for(let me=0,Ae=M.length;me<Ae;me+=1)oe(M[me],ce,Me);else{const me=Object.keys(M);for(let Ae=0,Ne=me.length;Ae<Ne;Ae+=1)oe(M[me[Ae]],ce,Me)}}}function Re(M,ce){ce=ce||{};const Me=new re(ce);Me.noRefs||_e(M,Me);let Se=M;return Me.replacer&&(Se=Me.replacer.call({"":Se},"",Se)),ge(Me,0,Se,!0,!0)?Me.dump+`
211
+ `:""}t.exports.dump=Re})),M4=aQ(es(((e,t)=>{var s=lQ(),i=cQ();function a(l,c){return function(){throw new Error("Function yaml."+l+" is removed in js-yaml 4. Use yaml."+c+" instead, which is now safe by default.")}}t.exports.Type=yn(),t.exports.Schema=p4(),t.exports.FAILSAFE_SCHEMA=v4(),t.exports.JSON_SCHEMA=k4(),t.exports.CORE_SCHEMA=N4(),t.exports.DEFAULT_SCHEMA=qv(),t.exports.load=s.load,t.exports.loadAll=s.loadAll,t.exports.dump=i.dump,t.exports.YAMLException=zu(),t.exports.types={binary:j4(),float:S4(),map:x4(),null:y4(),pairs:T4(),set:R4(),timestamp:C4(),bool:_4(),int:w4(),merge:E4(),omap:A4(),seq:b4(),str:g4()},t.exports.safeLoad=a("safeLoad","load"),t.exports.safeLoadAll=a("safeLoadAll","loadAll"),t.exports.safeDump=a("safeDump","dump")}))()),{Type:Oee,Schema:zee,FAILSAFE_SCHEMA:Bee,JSON_SCHEMA:Pee,CORE_SCHEMA:Iee,DEFAULT_SCHEMA:$ee,load:Hee,loadAll:Uee,dump:Fee,YAMLException:qee,types:Gee,safeLoad:Vee,safeLoadAll:Wee,safeDump:Kee}=M4.default,uQ=M4.default;function D4(e){return e!==null&&typeof e=="object"}function L4(e){return typeof e=="string"?"text-rose-700 dark:text-rose-300":typeof e=="number"?"text-emerald-700 dark:text-emerald-300":typeof e=="boolean"?"text-blue-700 dark:text-blue-400":e==null?"text-muted-foreground italic":"text-foreground"}function O4(e){return e==null?"null":typeof e=="string"?e===""?'""':e:String(e)}function z4({label:e,value:t,depth:s,defaultOpen:i}){const[a,l]=y.useState(i),c={paddingLeft:`${s*1.1}rem`};if(!D4(t))return n.jsxs("div",{className:"flex items-baseline gap-2 py-[1px]",style:c,children:[n.jsxs("span",{className:"text-muted-foreground",children:[e,":"]}),n.jsx("span",{className:ae("whitespace-pre-wrap break-words",L4(t)),children:O4(t)})]});const h=Array.isArray(t)?t.map((d,p)=>[String(p),d]):Object.entries(t),f=Array.isArray(t)?`[${h.length}]`:`{${h.length}}`;return n.jsxs("div",{children:[n.jsxs("button",{type:"button",onClick:()=>l(d=>!d),className:"flex w-full items-center gap-1 py-[1px] text-left hover:bg-muted",style:c,children:[a?n.jsx(Jn,{className:"size-3.5 shrink-0 text-muted-foreground"}):n.jsx(Dn,{className:"size-3.5 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"font-medium text-foreground",children:e}),n.jsx("span",{className:"text-muted-foreground",children:f})]}),a?h.map(([d,p])=>n.jsx(z4,{label:d,value:p,depth:s+1,defaultOpen:s<1},d)):null]})}function dQ({content:e}){const t=y.useMemo(()=>{try{const i=uQ.loadAll(e);return{value:i.length<=1?i[0]:i,error:null}}catch(i){return{value:null,error:i instanceof Error?i.message:String(i)}}},[e]);if(t.error)return n.jsx("div",{className:"p-4",children:n.jsxs(Je,{variant:"destructive",children:["Could not parse YAML: ",t.error]})});if(!D4(t.value))return n.jsx("div",{className:"p-4 font-mono text-[12px]",children:n.jsx("span",{className:L4(t.value),children:O4(t.value)})});const s=Array.isArray(t.value)?t.value.map((i,a)=>[String(a),i]):Object.entries(t.value);return n.jsx("div",{className:"min-w-max px-4 py-3 font-mono text-[12px] leading-[1.6]",children:s.map(([i,a])=>n.jsx(z4,{label:i,value:a,depth:0,defaultOpen:!0},i))})}const hQ=y.lazy(()=>wu(()=>import("./code-editor-JM7t6elV.js"),[]).then(e=>({default:e.CodeEditor})));function fQ(e){const t=e.split("/").pop()?.toLowerCase().split(".").pop()??"";return t==="md"||t==="mdx"||t==="markdown"?"markdown":t==="yml"||t==="yaml"?"yaml":null}function mQ(e){const t=e.split("/").pop()?.toLowerCase()??"",s=t.includes(".")?t.split(".").pop()??"":"",i={ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",c:"c",h:"c",cpp:"cpp",cc:"cpp",hpp:"cpp",cs:"csharp",sh:"bash",bash:"bash",zsh:"bash",json:"json",yaml:"yaml",yml:"yaml",toml:"ini",ini:"ini",md:"markdown",mdx:"markdown",css:"css",scss:"scss",less:"less",html:"xml",xml:"xml",sql:"sql",dockerfile:"dockerfile"};return i[s]?i[s]:t==="dockerfile"?"dockerfile":null}function pQ(e,t){const s=e.endsWith(`
212
+ `)?e.slice(0,-1):e;return!t||!p0.getLanguage(t)?s.split(`
213
+ `).map(oC):s.split(`
214
+ `).map(i=>{if(!i)return"";try{return p0.highlight(i,{language:t,ignoreIllegals:!0}).value}catch{return oC(i)}})}function oC(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function gQ({content:e,path:t}){const s=y.useMemo(()=>mQ(t),[t]),i=y.useMemo(()=>pQ(e,s),[e,s]),a=`${Math.max(2,String(i.length).length)}ch`;return n.jsx("div",{className:"min-w-max font-mono text-[12px] leading-[1.5]",children:i.map((l,c)=>n.jsxs("div",{className:"flex",children:[n.jsx("span",{className:"shrink-0 select-none border-r border-zinc-200 bg-zinc-100 px-2 text-right text-zinc-400 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-500",style:{minWidth:`calc(${a} + 1rem)`},children:c+1}),n.jsx("span",{className:"hljs whitespace-pre px-3 text-zinc-800 dark:text-zinc-100",dangerouslySetInnerHTML:{__html:l||" "}})]},c))})}function bQ({path:e,isModified:t,onViewDiff:s,onFileSaved:i,onSendToAi:a}){const[l,c]=y.useState(null),[h,f]=y.useState(""),[d,p]=y.useState(!1),[g,b]=y.useState(null),[v,w]=y.useState(!1),[k,N]=y.useState(!1),{success:E,error:T}=hs(),A=y.useMemo(()=>fQ(e),[e]),[C,R]=y.useState("preview"),L=!!(l&&!l.binary&&!l.truncated),H=l?h!==l.content:!1;y.useEffect(()=>{R(A?"preview":"source"),p(!1)},[A]),y.useEffect(()=>{if(!e){c(null);return}let D=!0;return w(!0),b(null),p(!1),EL(e).then(G=>{D&&(c(G),f(G.content),w(!1))}).catch(G=>{D&&(b(G instanceof Error?G.message:String(G)),w(!1))}),()=>{D=!1}},[e]);async function B(){if(!(!e||!l||!H||k)){N(!0);try{await jL(e,h);const D={...l,content:h,size:new TextEncoder().encode(h).length};c(D),p(!1),E(`Saved ${e}.`),i?.(e)}catch(D){T(D instanceof Error?D.message:String(D))}finally{N(!1)}}}function P(){f(l?.content??""),p(!1)}return e?n.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col border-l border-border bg-card",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-1.5",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:e}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground",children:[n.jsx("span",{children:"Read-only view of tracked file."}),l?.truncated?n.jsx("span",{className:"text-amber-700",children:"Truncated — file exceeds 1MB."}):null,l?.binary?n.jsx("span",{className:"text-amber-700",children:"Binary file."}):null]})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[A&&!l?.binary?n.jsxs("div",{className:"flex items-center rounded-md border border-border p-0.5",children:[n.jsxs("button",{type:"button",onClick:()=>R("preview"),"aria-pressed":C==="preview",className:ae("flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition-colors",C==="preview"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"),children:[n.jsx(Lf,{className:"size-3.5"}),"Preview"]}),n.jsxs("button",{type:"button",onClick:()=>R("source"),"aria-pressed":C==="source",className:ae("flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition-colors",C==="source"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"),children:[n.jsx(zC,{className:"size-3.5"}),"Source"]})]}):null,t?n.jsx(Z,{onClick:s,size:"sm",type:"button",variant:"outline",children:"View diff"}):null,a?n.jsx(Z,{"aria-label":"Send file to AI input",className:"size-8",disabled:!e,onClick:a,size:"icon",title:"Send file path to AI input",type:"button",variant:"outline",children:n.jsx(Yt,{className:"size-4"})}):null,d?n.jsxs(n.Fragment,{children:[n.jsxs(Z,{disabled:!H||k,onClick:()=>{B()},size:"sm",type:"button",children:[n.jsx(YC,{}),"Apply"]}),n.jsxs(Z,{disabled:k,onClick:P,size:"sm",type:"button",variant:"outline",children:[n.jsx(qt,{}),"Cancel"]})]}):L?n.jsxs(Z,{onClick:()=>{R("source"),p(!0)},size:"sm",type:"button",variant:"outline",children:[n.jsx(yl,{}),"Edit"]}):null]})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-auto bg-card",children:g?n.jsx("div",{className:"p-4",children:n.jsx(Je,{variant:"destructive",children:g})}):v?n.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading…"}):l?.binary?n.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Cannot display binary content."}):l?d?n.jsx(y.Suspense,{fallback:n.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading editor…"}),children:n.jsx(hQ,{path:e,value:h,onChange:f})}):A&&C==="preview"?A==="markdown"?n.jsx(Fv,{content:l.content}):n.jsx(dQ,{content:l.content}):n.jsx(gQ,{content:l.content,path:e}):null})]}):n.jsx("div",{className:"p-4",children:n.jsx(Je,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a file to view its contents."})})}function xQ({activeHunkIndex:e,filePaths:t,hunkCount:s,pendingNextFilePath:i,selectedFile:a}){if(s>0&&e<s-1)return{kind:"hunk",activeHunkIndex:e+1};const l=t.indexOf(a),c=t[l+1];return c?i===c?{kind:"file",filePath:c}:{kind:"confirm-next-file",filePath:c}:{kind:"none"}}function lC(e){const t={name:"",fullPath:"",children:new Map};for(const s of e){const i=s.name.split("/");let a=t;i.forEach((l,c)=>{let h=a.children.get(l);h||(h={name:l,fullPath:i.slice(0,c+1).join("/"),children:new Map},a.children.set(l,h)),a=h}),a.branch=s}return t}function cC({label:e,tree:t,onSelect:s,defaultOpen:i,forceOpen:a}){const[l,c]=y.useState(i??!1),h=a||l,f=t.children.size===0;return n.jsxs("div",{className:"mb-1",children:[n.jsxs("button",{type:"button",onClick:()=>c(d=>!d),className:"flex w-full items-center gap-1 px-2 py-0.5 text-left text-[11px] font-semibold uppercase tracking-wide text-muted-foreground hover:text-foreground",children:[h?n.jsx(Jn,{size:12}):n.jsx(Dn,{size:12}),e,f?null:n.jsxs("span",{className:"ml-1 text-[10px] font-normal",children:["(",t.children.size,")"]})]}),h&&!f?n.jsx("ul",{children:Array.from(t.children.values()).map(d=>n.jsx(B4,{node:d,depth:1,onSelect:s,forceOpen:a},d.fullPath))}):null]})}function B4({node:e,depth:t,onSelect:s,forceOpen:i}){const[a,l]=y.useState(!0),c=i||a,h=e.children.size>0,f=e.branch,d={paddingLeft:`${t*10}px`};return!h&&f?n.jsx("li",{children:n.jsxs("button",{type:"button",onClick:()=>s(f),style:d,title:f.name,className:`flex w-full items-center gap-1.5 py-0.5 pr-2 text-left text-[12px] hover:bg-muted/60 ${f.current?"font-semibold text-emerald-700":""}`,children:[n.jsx(Mn,{size:11,className:"shrink-0 opacity-70"}),n.jsx("span",{className:"truncate",children:e.name}),f.current?n.jsx("span",{className:"text-[10px]",children:"●"}):null]})}):n.jsxs("li",{children:[n.jsxs("button",{type:"button",onClick:()=>{f?s(f):l(p=>!p)},style:d,className:"flex w-full items-center gap-1 py-0.5 pr-2 text-left text-[12px] hover:bg-muted/60",children:[h?c?n.jsx(Jn,{size:11}):n.jsx(Dn,{size:11}):n.jsx("span",{className:"inline-block w-[11px]"}),n.jsx("span",{className:"truncate",children:e.name})]}),c&&h?n.jsx("ul",{children:Array.from(e.children.values()).map(p=>n.jsx(B4,{node:p,depth:t+1,onSelect:s,forceOpen:i},p.fullPath))}):null]})}function vQ({selectedCommit:e,selectedFile:t,diff:s,diffLoading:i,diffError:a}){return n.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col bg-card border-b border-border",children:[n.jsx("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-1.5",children:n.jsxs("div",{className:"min-w-0",children:[n.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:t??(e?e.subject:"Commit")}),e?n.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground",children:[n.jsx("span",{className:"font-mono",children:e.hash.slice(0,12)}),n.jsxs("span",{children:[e.author," <",e.email,">"]}),n.jsx("span",{children:new Date(e.timestamp*1e3).toLocaleString()})]}):null]})}),n.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:a?n.jsx("div",{className:"p-4",children:n.jsx(Je,{variant:"destructive",children:a})}):e?i?n.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading diff…"}):s?n.jsx(Eu,{activeHunkIndex:0,diff:s}):n.jsx("div",{className:"p-4",children:n.jsx(Je,{variant:"muted",className:"border-dashed p-6 text-center",children:e.parents.length>1?"Merge commit with no conflict resolution — no diff against the first parent.":"No textual changes in this commit."})}):n.jsx("div",{className:"p-4",children:n.jsx(Je,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a commit to inspect its diff."})})})]})}function yQ({files:e,filesError:t,selectedHash:s,selectedFile:i,onSelect:a}){return n.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[n.jsx("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:n.jsxs("h2",{className:"text-[13px] font-semibold tracking-tight",children:["Files",e.length?n.jsx("span",{className:"ml-2 text-[11px] font-normal text-muted-foreground",children:e.length}):null]})}),n.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:t?n.jsx("div",{className:"p-3",children:n.jsx(Je,{variant:"destructive",children:t})}):s?e.length===0?n.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"No file changes."}):n.jsx("ul",{className:"divide-y divide-border",children:e.map(l=>n.jsx("li",{children:n.jsxs("button",{onClick:()=>a(l.path),type:"button",title:l.path,className:`flex w-full items-center gap-2 px-2 py-1 text-left text-[12px] transition-colors hover:bg-muted/60 ${i===l.path?"bg-muted":""}`,children:[n.jsx("span",{className:_Q(l.index),children:l.index.trim()||"·"}),n.jsx("span",{className:"truncate font-mono",children:l.path})]})},l.path))}):n.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"Select a commit to see its files."})})]})}function _Q(e){const t="inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-[10px] font-bold";switch(e.trim().toUpperCase()){case"A":return`${t} bg-emerald-100 text-emerald-800 dark:bg-emerald-500/15 dark:text-emerald-300`;case"D":return`${t} bg-red-100 text-red-800 dark:bg-red-500/15 dark:text-red-300`;case"M":return`${t} bg-amber-100 text-amber-800 dark:bg-amber-500/15 dark:text-amber-300`;case"R":return`${t} bg-blue-100 text-blue-800 dark:bg-blue-500/15 dark:text-blue-300`;case"C":return`${t} bg-indigo-100 text-indigo-800 dark:bg-indigo-500/15 dark:text-indigo-300`;default:return`${t} bg-slate-100 text-slate-700 dark:bg-slate-500/15 dark:text-slate-300`}}const uC=["#3b82f6","#10b981","#f59e0b","#ec4899","#8b5cf6","#14b8a6","#ef4444","#84cc16"];function $c(e){return uC[e%uC.length]}function wQ({lane:e,laneCount:t,edges:s,throughLanes:i,isMerge:a,height:l=28,laneWidth:c=14}){const f=Math.max(e+1,t,1)*c,d=l/2,p=Hc(e,c),g=a?4:3.5;return n.jsxs("svg",{width:f,height:l,viewBox:`0 0 ${f} ${l}`,style:{flex:"0 0 auto",display:"block"},children:[i.map(b=>n.jsx("line",{x1:Hc(b,c),y1:0,x2:Hc(b,c),y2:l,stroke:$c(b),strokeWidth:1.5},`t-${b}`)),n.jsx("line",{x1:p,y1:0,x2:p,y2:d,stroke:$c(e),strokeWidth:1.5}),s.map((b,v)=>{const w=Hc(b.fromLane,c),k=Hc(b.toLane,c);if(w===k)return n.jsx("line",{x1:w,y1:d,x2:k,y2:l,stroke:$c(b.toLane),strokeWidth:1.5},`e-${v}`);const N=d+(l-d)/2;return n.jsx("path",{d:`M ${w} ${d} C ${w} ${N}, ${k} ${N}, ${k} ${l}`,fill:"none",stroke:$c(b.toLane),strokeWidth:1.5},`e-${v}`)}),n.jsx("circle",{cx:p,cy:d,r:g,fill:$c(e),stroke:"var(--background, #fff)",strokeWidth:1.5})]})}function Hc(e,t){return e*t+t/2}const SQ=5,v0=new Map,Kb=new Map,y0=[];let _0=0;function dC(){for(;_0<SQ&&y0.length>0;){const e=y0.shift();e&&(_0++,e())}}function kQ(e){return v0.get(e)}function NQ(e){const t=v0.get(e);if(t)return Promise.resolve(t);const s=Kb.get(e);if(s)return s;const i=new Promise((a,l)=>{y0.push(()=>{QL(e).then(c=>{c.state!=="pending"&&v0.set(e,c),a(c)}).catch(l).finally(()=>{_0--,Kb.delete(e),dC()})})});return Kb.set(e,i),dC(),i}function CQ({sha:e}){const[t,s]=y.useState(()=>kQ(e)??null),i=y.useRef(null);if(y.useEffect(()=>{if(t)return;const c=i.current;if(!c||typeof IntersectionObserver>"u")return;let h=!0;const f=new IntersectionObserver(d=>{d.some(p=>p.isIntersecting)&&(f.disconnect(),NQ(e).then(p=>{h&&s(p)}).catch(()=>{}))},{rootMargin:"200px"});return f.observe(c),()=>{h=!1,f.disconnect()}},[e,t]),!t||t.state==="unknown"||t.totalCount===0)return n.jsx("span",{ref:i,"aria-hidden":!0,className:"inline-block size-2 shrink-0"});const a=EQ(t.state),l=`CI: ${t.state} (${t.totalCount} check${t.totalCount!==1?"s":""})`;return n.jsx("span",{"aria-label":l,className:`shrink-0 size-2 rounded-full ${a}`,title:l})}function EQ(e){switch(e){case"success":return"bg-emerald-500";case"pending":return"bg-amber-400 animate-pulse";case"failure":return"bg-red-500";case"error":return"bg-orange-500";default:return"bg-zinc-400"}}const hC=28;function jQ({commits:e,loading:t,error:s,selectedHash:i,maxLanes:a,rowRefs:l,onSelect:c,onLoadMore:h}){const{sendToAgent:f}=Dt(),[d,p]=y.useState(null);function g(b,v){p(null),f({prompt:UH(b,v),source:{type:"git-commit",label:b.hash.slice(0,7)},label:`${b.hash.slice(0,7)}: ${v}`})}return n.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[n.jsxs("h2",{className:"text-[13px] font-semibold tracking-tight",children:["Commit tree",e.length?n.jsxs("span",{className:"ml-2 text-[11px] font-normal text-muted-foreground",children:[e.length," commits"]}):null]}),n.jsx(Z,{disabled:t,onClick:h,size:"sm",type:"button",variant:"outline",children:"Load more"})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:s?n.jsx("div",{className:"p-3",children:n.jsx(Je,{variant:"destructive",children:s})}):t&&e.length===0?n.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"Loading commits…"}):e.length===0?n.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"No commits."}):n.jsx("ul",{className:"divide-y divide-border",children:e.map(b=>n.jsxs("li",{ref:v=>{v?l.current.set(b.hash,v):l.current.delete(b.hash)},className:"group flex flex-col",children:[n.jsxs("div",{className:`flex items-center transition-colors hover:bg-muted/60 ${i===b.hash?"bg-muted":""}`,children:[n.jsxs("button",{onClick:()=>c(b.hash),type:"button",className:"flex min-w-0 flex-1 items-center gap-2 px-2 py-0.5 text-left",style:{minHeight:hC},title:`${b.hash}
215
+ ${b.author} <${b.email}>
216
+ ${b.subject}`,children:[n.jsx(wQ,{lane:b.lane,laneCount:Math.max(b.laneCount,a),edges:b.edges,throughLanes:b.throughLanes,isMerge:b.parents.length>1,height:hC}),n.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] text-muted-foreground",children:[b.hash.slice(0,7),n.jsx(CQ,{sha:b.hash})]}),n.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[b.refs.map(v=>n.jsx("span",{className:TQ(v.kind),children:v.name},`${v.kind}-${v.name}`)),n.jsx("span",{className:"truncate text-[12px]",children:b.subject})]}),n.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:b.author}),n.jsx("span",{className:"shrink-0 font-mono text-[10px] tabular-nums text-muted-foreground/70",title:new Date(b.timestamp*1e3).toLocaleString(),children:AQ(b.timestamp)})]}),n.jsx(er,{className:`mr-1 shrink-0 ${d===b.hash?"opacity-100":""}`,label:`Ask AI about commit ${b.hash.slice(0,7)}`,onAsk:()=>p(v=>v===b.hash?null:b.hash)})]}),d===b.hash?n.jsx("div",{className:"px-2 pb-1.5 pt-0.5",children:n.jsx(Lr,{placeholder:"What should the agent do with this commit? (explain, summarize, find regressions…)",onSubmit:v=>g(b,v),onCancel:()=>p(null)})}):null]},b.hash))})})]})}function AQ(e){if(!e)return"";const t=Math.max(0,Math.floor(Date.now()/1e3-e));if(t<60)return`${t}s`;const s=Math.floor(t/60);if(s<60)return`${s}m`;const i=Math.floor(s/60);if(i<24)return`${i}h`;const a=Math.floor(i/24);if(a<30)return`${a}d`;const l=Math.floor(a/30);return l<12?`${l}mo`:`${Math.floor(l/12)}y`}function TQ(e){const t="rounded border px-1.5 py-px text-[10px] font-medium";switch(e){case"head":return`${t} border-emerald-200 bg-emerald-100 text-emerald-800 dark:border-emerald-400/30 dark:bg-emerald-500/15 dark:text-emerald-300`;case"branch":return`${t} border-blue-200 bg-blue-100 text-blue-800 dark:border-blue-400/30 dark:bg-blue-500/15 dark:text-blue-300`;case"remote":return`${t} border-slate-200 bg-slate-100 text-slate-700 dark:border-zinc-700/80 dark:bg-zinc-800/80 dark:text-zinc-300`;case"tag":return`${t} border-amber-200 bg-amber-100 text-amber-800 dark:border-amber-400/30 dark:bg-amber-500/15 dark:text-amber-300`}}const fC=200;function RQ(){const[e,t]=y.useState([]),[s,i]=y.useState(fC),[a,l]=y.useState(0),[c,h]=y.useState(!0),[f,d]=y.useState(null),[p,g]=y.useState(null),[b,v]=y.useState([]),[w,k]=y.useState(!1),[N,E]=y.useState(null),[T,A]=y.useState(null),[C,R]=y.useState(""),[L,H]=y.useState(!1),[B,P]=y.useState(null),D=y.useCallback(O=>{g(O),v([]),A(null),R("")},[]);y.useEffect(()=>{let O=!0;return h(!0),d(null),wL(s).then(V=>{O&&(t(V),V.length>0&&!V.some(K=>K.hash===p)&&D(V[0].hash))}).catch(V=>{O&&d(V instanceof Error?V.message:String(V))}).finally(()=>{O&&h(!1)}),()=>{O=!1}},[s,a]),y.useEffect(()=>{if(!p){v([]),A(null),k(!1);return}let O=!0;return E(null),k(!0),kL(p).then(V=>{O&&(v(V),A(V[0]?.path??null))}).catch(V=>{O&&E(V instanceof Error?V.message:String(V))}).finally(()=>{O&&k(!1)}),()=>{O=!1}},[p]),y.useEffect(()=>{if(!p||!T){R(""),H(!1);return}let O=!0;return P(null),H(!0),SL(p,T).then(V=>{O&&R(V)}).catch(V=>{O&&P(V instanceof Error?V.message:String(V))}).finally(()=>{O&&H(!1)}),()=>{O=!1}},[p,T]);const G=y.useMemo(()=>e.reduce((O,V)=>Math.max(O,V.laneCount),1),[e]),$=e.find(O=>O.hash===p)??null;return{commits:e,loading:c,error:f,selectedHash:p,setSelectedHash:D,files:b,filesError:N,selectedFile:T,setSelectedFile:A,diff:C,diffLoading:L||w,diffError:B,maxLanes:G,selectedCommit:$,loadMore:()=>i(O=>O+fC),refresh:()=>l(O=>O+1)}}function MQ({branches:e=[]}){const{commits:t,loading:s,error:i,selectedHash:a,setSelectedHash:l,files:c,filesError:h,selectedFile:f,setSelectedFile:d,diff:p,diffLoading:g,diffError:b,maxLanes:v,selectedCommit:w,loadMore:k,refresh:N}=RQ();jl(N);const[E,T]=y.useState(""),A=y.useMemo(()=>{const P=E.trim().toLowerCase();return P?e.filter(D=>D.name.toLowerCase().includes(P)):e},[e,E]),C=y.useMemo(()=>lC(A.filter(P=>!P.remote)),[A]),R=y.useMemo(()=>lC(A.filter(P=>P.remote)),[A]),L=E.trim().length>0,H=y.useRef(new Map);function B(P){const D=P.remote?"remote":"branch",G=t.find(V=>V.refs.some(K=>K.kind===D&&K.name===P.name));if(!G)return;l(G.hash);const $=H.current.get(G.hash),O=$?.parentElement?.parentElement;!$||!O||O.scrollTo({top:Math.max($.offsetTop-O.clientHeight/2+$.clientHeight/2,0),behavior:"smooth"})}return n.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 grid-cols-[220px_minmax(0,1fr)]",children:[n.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[n.jsxs("div",{className:"flex shrink-0 flex-col gap-1 border-b border-border px-3 py-1.5",children:[n.jsx("h2",{className:"text-[13px] font-semibold tracking-tight",children:"Branches"}),n.jsx("input",{type:"search",value:E,onChange:P=>T(P.target.value),placeholder:"Search branches…",className:"w-full rounded border border-border bg-background px-2 py-1 text-[11px] outline-none focus:border-foreground"})]}),n.jsxs("div",{className:"min-h-0 flex-1 overflow-auto py-1",children:[n.jsx(cC,{label:"Local",tree:C,onSelect:B,defaultOpen:!0,forceOpen:L}),n.jsx(cC,{label:"Remote",tree:R,onSelect:B,forceOpen:L})]})]}),n.jsxs("div",{className:"grid min-h-0 min-w-0 grid-rows-[minmax(0,3fr)_minmax(0,2fr)]",children:[n.jsx(vQ,{selectedCommit:w,selectedFile:f,diff:p,diffLoading:g,diffError:b}),n.jsxs("div",{className:"grid min-h-0 min-w-0 grid-cols-[minmax(0,1fr)_280px]",children:[n.jsx(jQ,{commits:t,loading:s,error:i,selectedHash:a,maxLanes:v,rowRefs:H,onSelect:l,onLoadMore:k}),n.jsx(yQ,{files:c,filesError:h,selectedHash:a,selectedFile:f,onSelect:d})]})]})]})}function DQ({repo:e,file:t,onClose:s}){const[i,a]=y.useState(""),[l,c]=y.useState(null),[h,f]=y.useState(!0);y.useEffect(()=>{let p=!0;return f(!0),c(null),mE(t,e).then(g=>{p&&a(g)}).catch(g=>{p&&c(g instanceof Error?g.message:String(g))}).finally(()=>{p&&f(!1)}),()=>{p=!1}},[e,t]),y.useEffect(()=>{function p(g){g.key==="Escape"&&s()}return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[s]);const d=mv(i);return nr.createPortal(n.jsxs("div",{className:"fixed inset-0 z-[1000] flex justify-end",children:[n.jsx("button",{"aria-label":"Close diff",className:"absolute inset-0 bg-black/35",onClick:s,type:"button"}),n.jsxs("div",{className:"relative z-10 flex h-full w-[min(900px,calc(100vw-3rem))] flex-col bg-card shadow-xl",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-2",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:t}),n.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground",children:[n.jsx("span",{className:"font-mono",children:e}),d.additions||d.deletions?n.jsxs("span",{className:"flex items-center gap-1 font-mono",children:[n.jsxs("span",{className:"text-emerald-700",children:["+",d.additions]}),n.jsxs("span",{className:"text-red-700",children:["-",d.deletions]})]}):null]})]}),n.jsx(Z,{"aria-label":"Close diff",onClick:s,size:"icon",variant:"ghost",children:n.jsx(qt,{})})]}),n.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:l?n.jsx("div",{className:"p-4",children:n.jsx(Je,{variant:"destructive",children:l})}):h?n.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:"Loading diff…"}):n.jsx(Eu,{diff:i||"No unstaged diff for this file."})})]})]}),document.body)}function P4(e){return e.split(/[\\/]/).filter(Boolean).pop()??"project"}function LQ({initialPath:e,onSelect:t,selectedPath:s}){const[i,a]=y.useState(e),[l,c]=y.useState(e),[h,f]=y.useState(null),[d,p]=y.useState(null),[g,b]=y.useState(!1),v=OQ(h);return y.useEffect(()=>{a(e)},[e]),y.useEffect(()=>{h&&c(h.path)},[h]),y.useEffect(()=>{let w=!0;return b(!0),p(null),wE(i).then(k=>{w&&(f(k),t(k.path))}).catch(k=>{w&&p(k instanceof Error?k.message:String(k))}).finally(()=>{w&&b(!1)}),()=>{w=!1}},[i,t]),n.jsxs("div",{className:"rounded-md border border-border bg-background",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border p-2",children:[v?n.jsx(Z,{"aria-label":"Open parent folder",onClick:()=>h&&a(h.parent),size:"icon",type:"button",variant:"ghost",children:n.jsx(Jn,{className:"rotate-90"})}):null,n.jsx(ft,{"aria-label":"Folder path",className:"h-7 min-w-0 flex-1 font-mono text-xs",onChange:w=>c(w.target.value),onKeyDown:w=>{if(w.key==="Enter"){w.preventDefault();const k=l.trim();k&&a(k)}},spellCheck:!1,value:l}),g?n.jsx(Rt,{className:"size-4 shrink-0 animate-spin text-muted-foreground"}):null]}),n.jsxs("div",{className:"max-h-56 overflow-auto p-1",children:[d?n.jsx(Je,{variant:"destructive",className:"m-1",children:d}):null,!d&&h?.entries.length===0?n.jsx(Je,{variant:"muted",className:"m-1 text-center",children:"No folders here."}):null,h?.entries.map(w=>n.jsxs(Z,{className:ae("h-8 w-full justify-start rounded-sm px-2 text-left",s===w.path&&"bg-muted"),onClick:()=>a(w.path),title:w.path,type:"button",variant:"ghost",children:[n.jsx(xo,{className:"text-accent"}),n.jsx("span",{className:"truncate",children:w.name})]},w.path))]})]})}function OQ(e){return!!(e&&e.parent!==e.path)}function I4({confirmLabel:e="Use this folder",errorMessage:t,initialPath:s,onCancel:i,onSelect:a,onUse:l,selectedPath:c,title:h="Choose Git Project Folder"}){return nr.createPortal(n.jsx("div",{className:"fixed inset-0 z-[1000] grid place-items-center bg-black/35 px-4",children:n.jsxs("div",{className:"w-full max-w-2xl rounded-xl border border-border bg-card p-4 shadow-xl",children:[n.jsxs("div",{className:"mb-3 flex items-center gap-3",children:[n.jsx("div",{className:"flex size-8 items-center justify-center rounded-lg border border-border bg-background",children:n.jsx(xo,{className:"size-4"})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm font-semibold",children:h}),n.jsx("div",{className:"truncate font-mono text-xs text-muted-foreground",children:c})]}),n.jsx(Z,{"aria-label":"Close folder picker",onClick:i,size:"icon",variant:"ghost",children:n.jsx(qt,{})})]}),n.jsx(LQ,{initialPath:s,onSelect:a,selectedPath:c}),t?n.jsx("div",{className:"mt-3 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:t}):null,n.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[n.jsx(Z,{onClick:i,type:"button",variant:"outline",children:"Cancel"}),n.jsx(Z,{onClick:()=>{l()},type:"button",children:e})]})]})}),document.body)}const Uc=5,zQ=240,w0=8,BQ=176+w0;function PQ({currentRepoPath:e}){const[t,s]=y.useState(null),[i,a]=y.useState([]),[l,c]=y.useState(null),[h,f]=y.useState(!0),[d,p]=y.useState(null),g=y.useRef(null),b=y.useRef(null),[v,w]=y.useState(0);y.useEffect(()=>{const O=b.current;if(!O)return;const V=new ResizeObserver(K=>{w(K[0].contentRect.width)});return V.observe(O),()=>V.disconnect()},[t]);const k=y.useCallback(()=>{let O=!0;return f(!0),c(null),yg().then(V=>{O&&(s(V.repos),a(V.board))}).catch(V=>{O&&c(V instanceof Error?V.message:String(V))}).finally(()=>{O&&f(!1)}),()=>{O=!1}},[]);y.useEffect(k,[k]);const N=y.useCallback(()=>{yg().then(O=>{s(O.repos),a(O.board)}).catch(O=>{c(O instanceof Error?O.message:String(O))})},[]),E=y.useCallback(O=>{a(O),Xw(O).catch(V=>{c(V instanceof Error?V.message:String(V))})},[]),T=y.useCallback(async O=>{const V=O.trim();if(!V.startsWith("/"))return"Please add an absolute path (it must start with /).";try{const K=P4(V);await Mi("/api/git/repositories",{name:K,path:V});const I=await yg();s(I.repos);const Y=(I.board.includes(K)?I.board:[...I.board,K]).slice(0,Uc);return a(Y),await Xw(Y),null}catch(K){return K instanceof Error?K.message:String(K)}},[]),A=new Map((t??[]).map(O=>[O.name,O])),C=i.map(O=>A.get(O)).filter(O=>!!O).slice(0,Uc),R=(t??[]).filter(O=>!i.includes(O.name)),L=C.length<Uc,H=Math.max(0,v-(L?BQ:0)),B=v===0?Uc:Math.max(1,Math.floor((H+w0)/(zQ+w0))),P=Math.min(C.length,B),D=C.slice(0,P),G=C.length-P;function $(O){const V=g.current;if(g.current=null,V===null||V===O)return;const K=[...i],[I]=K.splice(V,1);K.splice(O,0,I),E(K)}return n.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border bg-card/95 px-3 py-1.5",children:[n.jsxs("span",{className:"flex items-center gap-1.5 text-[12px] font-semibold tracking-tight",children:[n.jsx(T0,{className:"size-3.5"}),"Repositories",t?n.jsxs(We,{variant:"secondary",className:"ml-1",children:[C.length,t.length>C.length?` / ${t.length}`:""]}):null,G>0?n.jsxs("span",{className:"ml-1 text-[10px] font-normal text-muted-foreground",children:["+",G," hidden — widen the window or remove one"]}):null]}),n.jsxs(Z,{"aria-label":"Refresh repositories",disabled:h,onClick:k,size:"sm",type:"button",variant:"outline",children:[n.jsx(Dr,{className:h?"animate-spin":void 0}),"Refresh"]})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:l?n.jsx(Je,{variant:"destructive",className:"m-3",children:l}):t&&t.length===0?n.jsx(Je,{variant:"muted",className:"m-3 text-center",children:"No Git projects registered. Add one with the project picker in the header."}):n.jsxs("div",{className:"flex h-full min-h-0 gap-2 p-2",ref:b,children:[D.map((O,V)=>n.jsx(IQ,{repo:O,isCurrent:!!e&&O.path===e,selectedFile:d?.repo===O.name?d.file:"",onSelectFile:K=>p({repo:O.name,file:K}),onRemove:()=>E(i.filter(K=>K!==O.name)),onMutated:N,onDragStart:()=>{g.current=V},onDropColumn:()=>$(V)},O.name)),L?n.jsx($Q,{unpinned:R,onAdd:O=>E([...i,O].slice(0,Uc)),onRegister:T}):null]})}),d?n.jsx(DQ,{repo:d.repo,file:d.file,onClose:()=>p(null)}):null]})}function IQ({repo:e,isCurrent:t,selectedFile:s,onSelectFile:i,onRemove:a,onMutated:l,onDragStart:c,onDropColumn:h}){const[f,d]=y.useState(!1),[p,g]=y.useState(!1),[b,v]=y.useState(!1),w=y.useCallback(async(T,A)=>{if(A.length){g(!0);try{await T(A,e.name),l()}finally{g(!1)}}},[e.name,l]),k={busy:p,onStage:T=>{w(P0,T)},onUnstage:T=>{w(pE,T)}},N=e.files.filter(T=>T.index.trim()&&T.index!=="?").length,E=b?Jn:Dn;return n.jsxs("div",{className:ae("flex min-w-0 flex-1 flex-col overflow-hidden rounded-md border border-border bg-card",t&&"border-primary/60 ring-1 ring-primary/30",f&&"ring-2 ring-foreground/40"),onDragOver:T=>{T.preventDefault(),d(!0)},onDragLeave:()=>d(!1),onDrop:()=>{d(!1),h()},children:[n.jsxs("div",{className:"flex shrink-0 cursor-grab items-center justify-between gap-1 border-b border-border bg-muted/40 px-1.5 py-1.5 active:cursor-grabbing",draggable:!0,onDragStart:c,children:[n.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[n.jsx(V6,{className:"size-3.5 shrink-0 text-muted-foreground/60"}),n.jsx("span",{className:"truncate text-[12px] font-semibold",title:e.path,children:e.name}),t?n.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 rounded bg-primary px-1 py-px text-[9px] font-semibold uppercase tracking-wide text-primary-foreground",title:"The repository currently selected across NoMoreIDE",children:[n.jsx(Ws,{className:"size-2.5"}),"Current"]}):null]}),n.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[n.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] text-muted-foreground",children:[e.ahead?n.jsxs("span",{className:"flex items-center",title:`${e.ahead} ahead`,children:[n.jsx(Af,{className:"size-3"}),e.ahead]}):null,e.behind?n.jsxs("span",{className:"flex items-center",title:`${e.behind} behind`,children:[n.jsx(jf,{className:"size-3"}),e.behind]}):null]}),n.jsx("button",{"aria-label":`Remove ${e.name} from board`,className:"rounded p-0.5 text-muted-foreground transition-colors hover:bg-background hover:text-foreground",onClick:a,title:"Remove from board (stays registered)",type:"button",children:n.jsx(qt,{className:"size-3.5"})})]})]}),n.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:n.jsx(t4,{branch:e.branch||void 0,error:e.error,files:e.files,onSelectFile:i,root:e.path,selectedFile:s,staging:k})}),n.jsxs("div",{className:"shrink-0 border-t border-border",children:[n.jsxs("button",{"aria-expanded":b,className:"flex w-full items-center gap-1.5 bg-muted/40 px-2 py-1 text-left text-[11px] font-semibold uppercase tracking-tight text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:()=>v(T=>!T),type:"button",children:[n.jsx(E,{className:"size-3.5 shrink-0"}),n.jsx("span",{className:"flex-1",children:"Commit"}),N?n.jsxs(We,{size:"small",variant:"secondary",children:[N," staged"]}):null]}),b?n.jsx(s4,{branch:e.branch||void 0,files:e.files,onDone:l,repo:e.name}):null]})]})}function $Q({unpinned:e,onAdd:t,onRegister:s}){const[i,a]=y.useState(!1),[l,c]=y.useState(null),[h,f]=y.useState(""),[d,p]=y.useState(null),[g,b]=y.useState(!1),[v,w]=y.useState(!1),[k,N]=y.useState(""),E=y.useRef(null),T=y.useRef(null);function A(){if(i){a(!1);return}c(E.current?.getBoundingClientRect()??null),p(null),a(!0)}y.useEffect(()=>{if(!i)return;function L(H){const B=H.target;B instanceof Node&&(T.current?.contains(B)||E.current?.contains(B)||a(!1))}return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[i]);async function C(L){b(!0),p(null);const H=await s(L);return b(!1),H?(p(H),!1):(f(""),a(!1),!0)}async function R(L){L.preventDefault(),await C(h)}return n.jsxs("div",{className:"w-44 shrink-0",children:[n.jsxs("button",{ref:E,className:"flex h-full w-full flex-col items-center justify-center gap-1.5 rounded-md border border-dashed border-border text-muted-foreground transition-colors hover:border-foreground/40 hover:text-foreground",onClick:A,type:"button",children:[n.jsx(ws,{className:"size-5"}),n.jsx("span",{className:"text-[12px] font-medium",children:"Add repository"})]}),i&&l?nr.createPortal(n.jsxs("div",{ref:T,className:"fixed z-[1000] w-72 overflow-hidden rounded-lg border border-border bg-card shadow-xl",style:{left:Math.max(8,Math.min(l.left,window.innerWidth-296)),top:Math.min(l.top,window.innerHeight-320)},children:[e.length?n.jsxs("div",{className:"border-b border-border",children:[n.jsx("div",{className:"px-3 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Pin a registered repo"}),n.jsx("div",{className:"max-h-52 overflow-auto pb-1",children:e.map(L=>n.jsxs("button",{className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm hover:bg-muted",onClick:()=>{t(L.name),a(!1)},type:"button",children:[n.jsx(T0,{className:"size-3.5 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"min-w-0 flex-1 truncate",title:L.path,children:L.name}),L.files.length?n.jsx(We,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:L.files.length}):null]},L.name))})]}):null,n.jsxs("div",{className:"p-2.5",children:[n.jsx("div",{className:"pb-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Add a new repository"}),n.jsxs("form",{className:"flex gap-1.5",onSubmit:R,children:[n.jsx(ft,{"aria-label":"Repository absolute path",className:"h-7 flex-1 px-2 font-mono text-[11px]",onChange:L=>{f(L.target.value),p(null)},placeholder:"/absolute/path/to/repo",value:h}),n.jsx(Z,{className:"h-7 px-2 text-[11px]",disabled:g||!h.trim(),size:"sm",type:"submit",children:"Add"})]}),n.jsxs(Z,{className:"mt-1.5 h-7 w-full gap-1.5 text-[11px]",disabled:g,onClick:()=>{N(h.trim()||""),w(!0)},size:"sm",type:"button",variant:"outline",children:[n.jsx(R0,{className:"size-3"}),"Browse folders…"]}),d?n.jsx("div",{className:"mt-1.5 text-[10px] text-destructive",children:d}):null]})]}),document.body):null,v?n.jsx(I4,{confirmLabel:"Add repository",errorMessage:d,initialPath:k||"/",selectedPath:k,title:"Add Repository",onCancel:()=>w(!1),onSelect:N,onUse:async()=>{await C(k)&&w(!1)}}):null]})}const S0=300,HQ=600,UQ=new Set(["md","mdx","markdown","txt","rst","adoc","json","jsonc","json5","yaml","yml","toml","xml","ini","cfg","conf","env","properties","csv","tsv","lock","svg","map","snap","png","jpg","jpeg","gif","ico","webp"]);function FQ(e){const t=e.toLowerCase();if(t.endsWith(".d.ts")||t.endsWith(".min.js")||t.endsWith(".min.css"))return!1;const s=t.lastIndexOf(".");return s<0?!0:!UQ.has(t.slice(s+1))}function qQ(e){return e>=HQ?"danger":e>=S0?"warn":"ok"}const GQ={ok:"bg-emerald-500/60",warn:"bg-amber-500/70",danger:"bg-destructive/70"},VQ={ok:"text-muted-foreground",warn:"text-amber-600 dark:text-amber-400",danger:"text-destructive"};function WQ({onOpenFile:e,root:t}){const[s,i]=y.useState([]),[a,l]=y.useState(!0),[c,h]=y.useState(null),[f,d]=y.useState(!0);function p(){l(!0),h(null),CL().then(i).catch(k=>h(k instanceof Error?k.message:String(k))).finally(()=>l(!1))}y.useEffect(()=>{p()},[]);const g=y.useMemo(()=>f?s.filter(k=>FQ(k.path)):s,[s,f]),b=s.length-g.length,v=g[0]?.lines??1,w=g.filter(k=>k.lines>=S0).length;return n.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[n.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[n.jsx($C,{className:"size-4"}),n.jsx("span",{className:"font-semibold text-foreground",children:"Largest files"}),!a&&!c?n.jsxs("span",{children:[g.length," files · ",w," over ",S0," lines",f&&b>0?` · ${b} data/docs hidden`:""]}):null]}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsxs(Z,{size:"sm",variant:f?"default":"outline",className:"h-7",onClick:()=>d(k=>!k),title:"Hide docs, data, config and generated files",type:"button",children:[n.jsx(zC,{}),"Code only"]}),n.jsxs(Z,{size:"sm",variant:"outline",className:"h-7",onClick:p,disabled:a,type:"button",children:[a?n.jsx(Rt,{className:"animate-spin"}):n.jsx(Dr,{}),"Refresh"]})]})]}),c?n.jsx(Je,{variant:"destructive",className:"m-3",children:c}):a&&s.length===0?n.jsxs("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:[n.jsx(Rt,{className:"mr-2 size-4 animate-spin"}),"Scanning tracked files…"]}):g.length===0?n.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:s.length===0?"No tracked text files found.":"No code files — toggle off “Code only” to see data & docs."}):n.jsx("ul",{className:"min-h-0 flex-1 divide-y divide-border/60 overflow-auto",children:g.map((k,N)=>{const E=qQ(k.lines);return n.jsxs("li",{className:"group flex items-center gap-3 px-3 transition-colors hover:bg-muted/50",children:[n.jsx("span",{className:"w-6 shrink-0 text-right font-mono text-[10px] text-muted-foreground",children:N+1}),n.jsx("button",{type:"button",onClick:()=>e(k.path),className:"min-w-0 flex-1 py-1.5 text-left",children:n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx("span",{className:"truncate font-mono text-[11px]",children:k.path}),n.jsxs("span",{className:ae("shrink-0 font-mono text-[11px] tabular-nums",VQ[E]),children:[k.truncated?"≥":"",k.lines.toLocaleString()," lines"]})]}),n.jsx("div",{className:"mt-1 h-1 w-full overflow-hidden rounded-full bg-muted",children:n.jsx("div",{className:ae("h-full rounded-full",GQ[E]),style:{width:`${Math.max(2,k.lines/v*100)}%`}})})]})}),n.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-0.5",children:[n.jsx(KQ,{file:k,root:t}),n.jsx(YQ,{file:k,root:t})]})]},k.path)})})]})}function KQ({file:e,root:t}){const{sendToAgent:s}=Dt(),i=Au(t,e.path),a=e.path.split("/").pop()??e.path;function l(){s({prompt:HH({absolutePath:i,lines:e.lines,relativePath:e.path}),source:{label:a,type:"large-file"},label:`Help me split \`${e.path}\` (${e.lines.toLocaleString()} lines).`,mode:"send"})}function c(){s({prompt:i,source:{label:a,type:"large-file"},mode:"draft"})}return n.jsx($4,{label:`AI actions for ${e.path}`,trigger:n.jsx(Yt,{className:"size-3.5"}),children:h=>n.jsxs(n.Fragment,{children:[n.jsx(lu,{icon:n.jsx(Yt,{className:"size-3.5"}),onSelect:()=>{h(),l()},children:"Ask AI to split this file"}),n.jsx(lu,{icon:n.jsx(PC,{className:"size-3.5"}),onSelect:()=>{h(),c()},children:"Send file path to AI"})]})})}function YQ({file:e,root:t}){const{error:s,success:i}=hs(),a=Au(t,e.path),l=e.path.split("/").pop()??e.path;async function c(h,f){try{await navigator.clipboard.writeText(h),i(`Copied ${f}.`)}catch(d){s(d instanceof Error?d.message:`Could not copy ${f}.`)}}return n.jsx($4,{label:`Copy path for ${e.path}`,trigger:n.jsxs(n.Fragment,{children:[n.jsx(BC,{className:"size-3.5"}),n.jsx("span",{className:"sr-only",children:"More actions"})]}),children:h=>n.jsxs(n.Fragment,{children:[n.jsx(lu,{icon:n.jsx(A0,{className:"size-3.5"}),onSelect:()=>{h(),c(l,"file name")},children:"Copy file name"}),n.jsx(lu,{icon:n.jsx(Wh,{className:"size-3.5"}),onSelect:()=>{h(),c(e.path,"relative path")},children:"Copy relative path"}),n.jsx(lu,{icon:n.jsx(Wh,{className:"size-3.5"}),onSelect:()=>{h(),c(a,"absolute path")},children:"Copy absolute path"})]})})}function $4({children:e,label:t,trigger:s}){const[i,a]=y.useState(!1),[l,c]=y.useState({right:0,top:0}),h=y.useRef(null),f=y.useRef(null);function d(){a(!1)}function p(){const g=h.current?.getBoundingClientRect();g&&c({top:g.bottom+6,right:window.innerWidth-g.right}),a(b=>!b)}return y.useEffect(()=>{if(!i)return;function g(v){const w=v.target;h.current?.contains(w)||f.current?.contains(w)||d()}function b(v){v.key==="Escape"&&d()}return document.addEventListener("mousedown",g),document.addEventListener("keydown",b),window.addEventListener("scroll",d,!0),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",b),window.removeEventListener("scroll",d,!0)}},[i]),n.jsxs(n.Fragment,{children:[n.jsx("button",{"aria-label":t,className:ae("flex h-7 min-w-7 shrink-0 items-center justify-center gap-1 rounded-md px-1.5 text-muted-foreground opacity-0 transition-all duration-150 hover:bg-muted hover:text-foreground group-hover:opacity-100",i&&"bg-muted text-foreground opacity-100"),onClick:p,ref:h,title:t,type:"button",children:s}),i?nr.createPortal(n.jsx("div",{className:"fixed z-50 w-56 overflow-hidden rounded-md border border-border bg-card p-1 shadow-md",ref:f,style:{top:l.top,right:l.right},children:e(d)}),document.body):null]})}function lu({children:e,icon:t,onSelect:s}){return n.jsxs("button",{className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-foreground transition-colors hover:bg-muted",onClick:s,type:"button",children:[n.jsx("span",{className:"text-muted-foreground",children:t}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:e})]})}function XQ({data:e,onRefresh:t}){const{insertPath:s}=Dt(),[i,a]=y.useState(!1),[l,c]=y.useState("changes"),[h,f]=y.useState("changes"),[d,p]=y.useState(e.git.status?.files[0]?.path??""),[g,b]=y.useState(""),[v,w]=y.useState([]),[k,N]=y.useState(null),[E,T]=y.useState(""),[A,C]=y.useState(null),[R,L]=y.useState(0),[H,B]=y.useState(null),[P,D]=y.useState(()=>new Set),G=e.git.status?.files??[],$=y.useMemo(()=>{const we=new Set(G.map($e=>$e.path)),He=[...P].filter($e=>!we.has($e)).sort().map($e=>({path:$e,index:" ",workingTree:"M"}));return[...G,...He]},[G,P]),O=y.useMemo(()=>$.map(we=>we.path),[$]),V=y.useMemo(()=>mv(E),[E]),K=y.useCallback(async(we,He)=>{if(He.length){a(!0);try{await we(He),t?.()}finally{a(!1)}}},[t]),I=t?{busy:i,onStage:we=>{K(P0,we)},onUnstage:we=>{K(pE,we)}}:void 0;y.useEffect(()=>{const we=$[0]?.path??"";p(He=>He&&$.some($e=>$e.path===He)?He:we)},[$]),y.useEffect(()=>{if(l!=="all"||v.length>0)return;let we=!0;return N(null),NL().then(He=>{we&&w(He)}).catch(He=>{we&&N(He instanceof Error?He.message:String(He))}),()=>{we=!1}},[l,v.length]),y.useEffect(()=>{if(!d){T("");return}let we=!0;return C(null),mE(d).then(He=>{we&&(T(He),L(0),B(null))}).catch(He=>{we&&C(He instanceof Error?He.message:String(He))}),()=>{we=!1}},[d]);function Y(we){L(0),B(null),p(we)}function W(){const we=xQ({activeHunkIndex:R,filePaths:O,hunkCount:V.hunks,pendingNextFilePath:H,selectedFile:d});we.kind==="hunk"?(B(null),L(we.activeHunkIndex)):we.kind==="confirm-next-file"?B(we.filePath):we.kind==="file"?Y(we.filePath):B(null)}function le(){if(B(null),R>0){L($e=>$e-1);return}const we=$.findIndex($e=>$e.path===d),He=$[we-1];He&&Y(He.path)}const J=$.findIndex(we=>we.path===d),U=!!(V.hunks&&R<V.hunks-1||$[J+1]),F=!!(R>0||$[J-1]),re=H?`End of file. Click Next again to open ${H}.`:null,fe=we=>`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${we?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,se=we=>`flex-1 px-2 py-0.5 text-[11px] font-medium transition-colors ${we?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,te=y.useMemo(()=>{const we=new Set($.map(He=>He.path));for(const He of P)we.add(He);return we},[$,P]);if(!e.git.selectedRepository)return n.jsx(ZQ,{});function ye(){g&&(c("changes"),f("changes"),Y(g))}function Ee(we){D(He=>new Set(He).add(we)),b(we),c("changes"),f("changes"),Y(we)}function De(we){b(we),c("all")}function Ye(we){we&&s(Au(e.git.cwd,we))}return n.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:[n.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card/95 px-3 py-1",children:[n.jsx("button",{type:"button",className:fe(l==="changes"),onClick:()=>c("changes"),children:"Changes"}),n.jsx("button",{type:"button","aria-label":"Show changed files across all repositories",className:fe(l==="board"),onClick:()=>c("board"),children:"Board"}),n.jsx("button",{type:"button","aria-label":"Open all tracked files",className:fe(l==="all"),onClick:()=>c("all"),children:"All files"}),n.jsx("button",{type:"button",className:fe(l==="graph"),onClick:()=>c("graph"),children:"Tree"}),n.jsx("button",{type:"button",className:fe(l==="largest"),onClick:()=>c("largest"),children:"Largest files"}),n.jsx("button",{type:"button",className:fe(l==="snapshots"),onClick:()=>c("snapshots"),children:"Snapshots"})]}),n.jsx("div",{className:"min-h-0 flex-1",children:l==="board"?n.jsx(PQ,{currentRepoPath:e.git.cwd}):l==="graph"?n.jsx(MQ,{branches:e.git.branches??[]}):l==="largest"?n.jsx(WQ,{onOpenFile:De,root:e.git.cwd}):l==="snapshots"?n.jsx(uH,{}):l==="all"?n.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 xl:grid-cols-[320px_minmax(0,1fr)]",children:[n.jsx("aside",{className:"flex min-h-0 flex-col overflow-hidden",children:k?n.jsx(Je,{variant:"destructive",className:"m-3",children:k}):n.jsx(pN,{branch:e.git.status?.branch||void 0,onSelectFile:b,paths:v,root:e.git.cwd,selectedFile:g,status:$})}),n.jsx(bQ,{isModified:te.has(g),onFileSaved:Ee,onSendToAi:()=>Ye(g),onViewDiff:ye,path:g})]}):n.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 xl:grid-cols-[320px_minmax(0,1fr)]",children:[n.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden",children:[n.jsxs("div",{className:"flex shrink-0 gap-0.5 border-b border-border bg-card/95 p-1",children:[n.jsx("button",{"aria-label":"Show changed files as a list",className:se(h==="changes"),onClick:()=>f("changes"),type:"button",children:"Changes"}),n.jsx("button",{"aria-label":"Show changed files as a tree",className:se(h==="tree"),onClick:()=>f("tree"),type:"button",children:"Tree"})]}),h==="changes"?n.jsx(t4,{branch:e.git.status?.branch||void 0,error:e.git.error,files:$,selectedFile:d,onSelectFile:Y,root:e.git.cwd,staging:I}):n.jsx(pN,{branch:e.git.status?.branch||void 0,defaultExpandAll:!0,emptyMessage:e.git.error??"No changed files.",onSelectFile:Y,paths:O,root:e.git.cwd,selectedFile:d,status:$,title:"Changes"}),t&&e.git.status?n.jsx(s4,{branch:e.git.status.branch||void 0,files:$,onDone:t}):null]}),n.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col border-l border-border bg-card",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-1.5",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:d||"Diff"}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground",children:[n.jsx("span",{children:"Long rows wrap inside the editor pane."}),V.additions||V.deletions?n.jsxs("span",{className:"flex items-center gap-1 font-mono",children:[n.jsxs("span",{className:"text-emerald-700",children:["+",V.additions]}),n.jsxs("span",{className:"text-red-700",children:["-",V.deletions]})]}):null]})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[re?n.jsx("span",{className:"max-w-72 truncate rounded border border-amber-200 bg-amber-50 px-2 py-1 text-[11px] text-amber-900",children:re}):null,n.jsxs(Z,{disabled:!d||!F,onClick:le,size:"sm",type:"button",variant:"outline",children:[n.jsx(Af,{}),"Previous"]}),n.jsxs(Z,{disabled:!d||!U,onClick:W,size:"sm",type:"button",variant:"outline",children:[n.jsx(jf,{}),"Next"]}),n.jsx(Z,{"aria-label":"Send selected file to AI input",className:"size-8",disabled:!d,onClick:()=>Ye(d),size:"icon",title:"Send selected file path to AI input",type:"button",variant:"outline",children:n.jsx(Yt,{className:"size-4"})})]})]}),n.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:A?n.jsx("div",{className:"p-4",children:n.jsx(Je,{variant:"destructive",children:A})}):d?n.jsx(Eu,{activeHunkIndex:R,diff:E||"No unstaged diff for this file."}):n.jsx("div",{className:"p-4",children:n.jsx(Je,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a changed file to inspect its diff."})})})]})]})})]})}function ZQ(){return n.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center",children:n.jsxs("div",{className:"max-w-sm",children:[n.jsx(T0,{className:"mx-auto size-8 text-muted-foreground/50"}),n.jsx("p",{className:"mt-3 text-sm font-medium",children:"No Git project registered"}),n.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Add a folder that is a Git worktree to review changes, browse files, and inspect history. Use the project switcher in the sidebar to add one."})]})})}function mC(e,t,s){const i=e.trim(),a=i.toLowerCase(),l=[],c=/\breview|check|inspect|audit\b/.test(a),h=/\btest|verify|ci\b/.test(a),f=/\bcommit\b/.test(a)||/\bship|push|pr|pull request\b/.test(a),d=/\bpush|ship|pr|pull request\b/.test(a),p=/\bpr\b|pull request/.test(a),g=JQ(a,s);return p&&l.push({kind:"action",id:"assert-pr-branch",title:"Check PR branch",op:"assert-pr-branch"}),c&&(l.push(Ch("gate-review","Approve review","Review the current changes?")),l.push(Fc("review","Review changes","Review the current git changes. Summarize risks, likely bugs, and anything that should change before committing.",Eh(g,["skills","mcpServers"])))),h&&l.push(Fc("verify","Run verification","Run the relevant tests or checks for this repository. If something fails, stop and explain the failure.",Eh(g,["skills","mcpServers","plugins"]))),f&&(l.push(Fc("commit-message","Generate commit message","Stage the appropriate changed files, inspect the staged diff briefly, and draft one conventional commit message. Do not commit.",Eh(g,["skills"]))),l.push(Ch("gate-commit","Approve commit","Commit with this generated message?")),l.push({kind:"action",id:"commit",title:"Commit with approved message",op:"commit"})),d&&(l.push(Ch("gate-push","Approve push",p?"Push and continue toward a PR?":"Push this branch?")),l.push({kind:"action",id:"push",title:"Push branch",op:"push"})),p&&(l.push(Fc("open-pr","Open PR","Open a pull request for the current branch. Use the latest commit subject as the title and summarize the commit list in the body.",Eh(g,["mcpServers","plugins"]))),l.push({kind:"action",id:"checkout-default-and-pull",title:"Return to default branch",op:"checkout-default-and-pull"})),l.length||(l.push(Ch("gate-start","Approve start","Run this workflow?")),l.push(Fc("ai-step","AI step",i||"Complete this workflow step.",g))),{id:tJ(H4(pC(a))||"custom-workflow",t),name:pC(a),description:i||"Custom AI-authored workflow.",builtin:!1,steps:eJ(l)}}function QQ(e){return["Create a NoMoreIDE workflow from this user intent:","",e.trim()||"(no intent provided)","","Return a workflow JSON object only. Use this shape:","{",' "id": "short-kebab-id",',' "name": "Human name",',' "description": "One sentence",',' "steps": [',' { kind: "gate", id: "gate-id", title: "Approve thing", message: "Question for the user?" },',' { kind: "agent", id: "ai-id", title: "AI task", prompt: "Clear instruction", capabilities: { skills: [], mcpServers: [], plugins: [], hooks: [] }, verify: "committed" },',' { kind: "action", id: "push", title: "Push", op: "push" },',' { kind: "action", id: "checkout-default-and-pull", title: "Return to default branch", op: "checkout-default-and-pull" }'," ]","}","","Use gates before mutating git or GitHub state. Prefer intent-level AI steps over direct MCP tool calls."].join(`
217
+ `)}function pC(e){const t=/\breview|check|inspect|audit\b/.test(e),s=/\bcommit\b|\bship|push|pr|pull request\b/.test(e),i=/\bpr\b|pull request/.test(e),a=/\btest|verify|ci\b/.test(e);return t&&s&&i?"Review, Commit & PR":a&&s&&i?"Verify, Commit & PR":t&&s?"Review & Commit":s&&i?"Commit & PR":s?"Commit workflow":t?"Review workflow":"Custom workflow"}function Ch(e,t,s){return{kind:"gate",id:e,title:t,message:s}}function Fc(e,t,s,i,a){return{kind:"agent",id:e,title:t,prompt:s,capabilities:Gv(i),verify:a}}function JQ(e,t){return Gv({skills:t.skills.filter(s=>e.includes(s.toLowerCase())),mcpServers:t.mcpServers.filter(s=>e.includes(s.toLowerCase())),plugins:t.plugins.filter(s=>e.includes(s.toLowerCase())),hooks:t.hooks.filter(s=>e.includes(s.toLowerCase()))})??{}}function Eh(e,t){const s={};for(const i of t){const a=e[i];a?.length&&(s[i]=a)}return Gv(s)}function Gv(e){if(!e)return;const t={};for(const s of["skills","mcpServers","plugins","hooks"]){const i=Array.from(new Set((e[s]??[]).filter(Boolean)));i.length&&(t[s]=i)}return Object.keys(t).length?t:void 0}function eJ(e){const t=new Map;return e.map(s=>{const i=H4(s.id)||s.kind,a=t.get(i)??0;return t.set(i,a+1),a===0?{...s,id:i}:{...s,id:`${i}-${a+1}`}})}function tJ(e,t){const s=new Set(t.map(l=>l.id));let i=e||"workflow",a=2;for(;s.has(i);)i=`${e}-${a}`,a++;return i}function H4(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}const Nf={"error-incident":"Error incident","service-crash":"Service crash"};function sJ({workflows:e}){const{triggers:t,pending:s,error:i,saveTrigger:a,removeTrigger:l,runPending:c,dismissPending:h}=eq(),[f,d]=y.useState(!1),p=g=>e.find(b=>b.id===g)?.name??g;return n.jsxs("section",{className:"border-t border-border px-4 py-3",children:[n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsxs("div",{children:[n.jsxs("h3",{className:"flex items-center gap-1.5 text-[12px] font-semibold",children:[n.jsx(nE,{className:"size-3.5 text-amber-500"})," Triggers"]}),n.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:"Run a workflow automatically when an error or crash is detected."})]}),n.jsxs(Z,{onClick:()=>d(g=>!g),size:"sm",type:"button",variant:"outline",children:[n.jsx(ws,{className:"size-3.5"})," Add trigger"]})]}),i?n.jsx("p",{className:"mt-2 text-[11px] text-destructive",children:i}):null,s.length>0?n.jsx("div",{className:"mt-3 space-y-1.5",children:s.map(g=>n.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-amber-500/40 bg-amber-500/5 px-2.5 py-1.5",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsxs("div",{className:"truncate text-[11px] font-medium",children:[p(g.workflowId),n.jsxs("span",{className:"ml-1.5 text-muted-foreground",children:["· ",Nf[g.event]]})]}),n.jsx("div",{className:"truncate text-[10px] text-muted-foreground",children:g.summary})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[n.jsxs(Z,{onClick:()=>c(g),size:"sm",type:"button",variant:"outline",children:[n.jsx(Mr,{className:"size-3"})," Run"]}),n.jsx(Z,{onClick:()=>{h(g.id)},size:"icon",type:"button",variant:"ghost","aria-label":"Dismiss",children:n.jsx(qt,{className:"size-3.5"})})]})]},g.id))}):null,f?n.jsx(nJ,{workflows:e,onCancel:()=>d(!1),onSave:async g=>{await a(g),d(!1)}}):null,n.jsxs("div",{className:"mt-3 space-y-1.5",children:[t.length===0&&!f?n.jsx("p",{className:"text-[11px] text-muted-foreground/70",children:"No triggers yet."}):null,t.map(g=>n.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-border px-2.5 py-1.5",children:[n.jsxs("label",{className:"flex min-w-0 items-center gap-2",children:[n.jsx("input",{checked:g.enabled,className:"size-3.5 accent-primary",onChange:b=>{a({...g,enabled:b.target.checked})},type:"checkbox"}),n.jsxs("span",{className:"min-w-0 truncate text-[11px]",children:[n.jsx("span",{className:"font-medium",children:Nf[g.event]}),g.filter?n.jsxs("span",{className:"text-muted-foreground",children:[" · “",g.filter,"”"]}):null,n.jsxs("span",{className:"text-muted-foreground",children:[" → ",p(g.workflowId)]}),g.autoRun?n.jsx("span",{className:"ml-1.5 rounded bg-amber-500/15 px-1 py-px text-[9px] font-semibold uppercase text-amber-600",children:"auto"}):null]})]}),n.jsx(Z,{onClick:()=>{l(g.id)},size:"icon",type:"button",variant:"ghost","aria-label":"Delete trigger",children:n.jsx(Oi,{className:"size-3.5"})})]},g.id))]})]})}function nJ({workflows:e,onCancel:t,onSave:s}){const[i,a]=y.useState("error-incident"),[l,c]=y.useState(e[0]?.id??""),[h,f]=y.useState(""),[d,p]=y.useState(!1),g="rounded border border-border bg-background px-2 py-1 text-[11px] outline-none focus:border-primary";return n.jsxs("div",{className:"mt-3 space-y-2 rounded-md border border-border bg-background p-3",children:[n.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[n.jsxs("label",{className:"flex flex-col gap-1 text-[10px] font-medium text-muted-foreground",children:["When",n.jsx("select",{className:g,value:i,onChange:b=>a(b.target.value),children:Object.keys(Nf).map(b=>n.jsx("option",{value:b,children:Nf[b]},b))})]}),n.jsxs("label",{className:"flex flex-col gap-1 text-[10px] font-medium text-muted-foreground",children:["Run workflow",n.jsx("select",{className:g,value:l,onChange:b=>c(b.target.value),children:e.map(b=>n.jsx("option",{value:b.id,children:b.name},b.id))})]})]}),n.jsxs("label",{className:"flex flex-col gap-1 text-[10px] font-medium text-muted-foreground",children:["Only when the service name / message contains (optional)",n.jsx("input",{className:g,value:h,onChange:b=>f(b.target.value),placeholder:"e.g. api",type:"text"})]}),n.jsxs("label",{className:"flex w-fit items-center gap-1.5 text-[11px] text-muted-foreground",children:[n.jsx("input",{checked:d,className:"size-3.5 accent-primary",onChange:b=>p(b.target.checked),type:"checkbox"}),"Start automatically (otherwise it waits for one click)"]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[n.jsx(Z,{onClick:t,size:"sm",type:"button",variant:"ghost",children:"Cancel"}),n.jsx(Z,{disabled:!l,onClick:()=>{s({id:`trigger-${Date.now().toString(36)}`,event:i,workflowId:l,filter:h.trim()||void 0,enabled:!0,autoRun:d})},size:"sm",type:"button",children:"Add"})]})]})}function iJ(){const{run:e,start:t,resume:s,approve:i,skip:a,stop:l,dismiss:c}=G3(),[h,f]=y.useState([]),[d,p]=y.useState(null),[g,b]=y.useState(null),[v,w]=y.useState(null),[k,N]=y.useState(!0),[E,T]=y.useState(!1),[A,C]=y.useState(!0);y.useEffect(()=>{let P=!0;return N(!0),Promise.all([kE(),cE().catch(()=>null)]).then(([D,G])=>{P&&(f(D),p(G))}).catch(D=>{P&&w(D instanceof Error?D.message:String(D))}).finally(()=>{P&&N(!1)}),()=>{P=!1}},[]);function R(P){T(!0),t(P,A)}async function L(P){w(null);try{const D=await JO(P);f(D),b(null)}catch(D){w(D instanceof Error?D.message:String(D))}}async function H(P){if(!P.builtin&&window.confirm(`Delete workflow "${P.name}"?`)){w(null);try{f(await e9(P.id))}catch(D){w(D instanceof Error?D.message:String(D))}}}function B(P){b({...P,id:Vv(`${P.id}-copy`,h),name:`${P.name} copy`,builtin:!1,steps:P.steps.map((D,G)=>({...D,id:`${D.id}-${G+1}`}))})}return e&&E?n.jsx(mJ,{run:e,onApprove:i,onSkip:a,onStop:l,onBack:()=>T(!1),onResume:()=>{T(!0),s(A)},onRestart:()=>{T(!0),t(e.workflow,A)}}):g?n.jsx(oJ,{agent:d?bJ(d):null,existing:h,initial:g,onCancel:()=>b(null),onSave:P=>{L(P)}}):n.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-auto bg-card/85",children:[n.jsxs("div",{className:"border-b border-border px-4 py-3",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{children:[n.jsxs("h2",{className:"flex items-center gap-1.5 text-[13px] font-semibold",children:[n.jsx(Yt,{className:"size-4"})," AI Workflows"]}),n.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:"One-click rituals that exceed the IDE — agent steps do the work, pausing at each gate for your OK."})]}),n.jsxs(Z,{onClick:()=>b(vJ(h)),size:"sm",type:"button",variant:"outline",children:[n.jsx(ws,{className:"size-3.5"})," New"]})]}),n.jsxs("label",{className:"mt-2 flex w-fit items-center gap-1.5 text-[11px] text-muted-foreground",children:[n.jsx("input",{checked:A,className:"size-3.5 accent-primary",onChange:P=>C(P.target.checked),type:"checkbox"}),"Run without step-by-step prompts",n.jsx("span",{className:"text-muted-foreground/60",children:"— gates still pause; risky shell still asks."})]})]}),v?n.jsx(Je,{variant:"destructive",className:"m-4",children:v}):k?n.jsxs("div",{className:"flex flex-1 items-center justify-center text-[12px] text-muted-foreground",children:[n.jsx(Rt,{className:"mr-2 size-4 animate-spin"})," Loading workflows…"]}):n.jsxs(n.Fragment,{children:[e?n.jsx(rJ,{onClear:c,onView:()=>T(!0),run:e}):null,n.jsx("div",{className:"grid gap-3 p-4 sm:grid-cols-2 xl:grid-cols-3",children:h.map(P=>n.jsx(aJ,{lastRun:e?.workflow.id===P.id?e:null,workflow:P,onDelete:()=>{H(P)},onDuplicate:()=>B(P),onEdit:()=>b(P),onRun:()=>R(P)},P.id))}),n.jsx(sJ,{workflows:h})]})]})}function rJ({onClear:e,onView:t,run:s}){const i=s.outcome==="running";return n.jsx("section",{className:"mx-4 mt-4 rounded-md border border-border bg-background p-3 shadow-sm",children:n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:i?"Workflow running":"Last workflow"}),n.jsx(G4,{outcome:s.outcome})]}),n.jsx("p",{className:"mt-1 truncate text-[13px] font-medium",children:s.workflow.name}),n.jsxs("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:[i?"Started":"Ran"," ",q4(s.startedAt)]})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsxs(Z,{onClick:t,size:"sm",type:"button",children:[n.jsx(kl,{className:"size-3.5"})," View run"]}),i?null:n.jsxs(Z,{onClick:e,size:"sm",type:"button",variant:"outline",children:[n.jsx(qt,{className:"size-3.5"})," Clear"]})]})]})})}function aJ({lastRun:e,workflow:t,onDelete:s,onDuplicate:i,onEdit:a,onRun:l}){const[c,h]=y.useState(!1),f=t.steps.length;return n.jsxs("div",{className:"flex flex-col rounded-lg border border-border bg-background p-3.5 shadow-sm",children:[n.jsxs("div",{className:"flex items-start justify-between gap-2",children:[n.jsx("h3",{className:"text-[13px] font-semibold",children:t.name}),t.builtin?n.jsx("span",{className:"rounded-full border border-border px-1.5 py-px text-[9px] uppercase tracking-wide text-muted-foreground",children:"Template"}):null]}),t.description?n.jsx("p",{className:"mt-1 text-[11px] leading-snug text-muted-foreground",children:t.description}):null,e?n.jsxs("p",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[n.jsx(kl,{className:"size-3"}),e.outcome==="running"?"Running now":`Last run ${q4(e.startedAt)}`]}):null,n.jsxs("button",{"aria-expanded":c,className:"mt-2.5 flex w-full items-center gap-1.5 text-[11px] text-muted-foreground transition-colors hover:text-foreground",onClick:()=>h(d=>!d),type:"button",children:[n.jsx(Dn,{className:ae("size-3 shrink-0 transition-transform",c?"rotate-90":""),"aria-hidden":!0}),n.jsxs("span",{children:[f," ",f===1?"step":"steps"]})]}),c?n.jsx("ol",{className:"mt-1.5 space-y-1",children:t.steps.map(d=>n.jsxs("li",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[n.jsx(wJ,{kind:d.kind}),n.jsx("span",{className:"truncate",children:Cf(d)})]},d.id))}):null,n.jsxs(Z,{className:"mt-3 w-full",onClick:l,size:"sm",type:"button",children:[n.jsx(Mr,{className:"size-3.5"})," Run"]}),n.jsxs("div",{className:"mt-2 grid grid-cols-3 gap-1.5",children:[n.jsxs(Z,{onClick:a,size:"sm",type:"button",variant:"outline",children:[n.jsx(YM,{className:"size-3.5"})," Edit"]}),n.jsxs(Z,{onClick:i,size:"sm",type:"button",variant:"outline",children:[n.jsx(Wh,{className:"size-3.5"})," Copy"]}),n.jsxs(Z,{disabled:t.builtin,onClick:s,size:"sm",title:t.builtin?"Duplicate or edit to create your own version first":"Delete workflow",type:"button",variant:"outline",children:[n.jsx(Oi,{className:"size-3.5"})," Delete"]})]})]})}function oJ({agent:e,existing:t,initial:s,onCancel:i,onSave:a}){const[l,c]=y.useState(()=>structuredClone(s)),[h,f]=y.useState(s.description??""),[d,p]=y.useState(!1),g=xJ(e),{sendToAgent:b}=Dt(),v=!l.id.trim()||!l.name.trim()||l.steps.length===0;function w(L,H){c(B=>({...B,steps:B.steps.map((P,D)=>D===L?H(P):P)}))}function k(L,H){c(B=>{const P=L+H;if(P<0||P>=B.steps.length)return B;const D=[...B.steps],[G]=D.splice(L,1);return D.splice(P,0,G),{...B,steps:D}})}function N(L){c(H=>({...H,steps:H.steps.filter((B,P)=>P!==L)}))}function E(L,H){c(B=>{const P=[...B.steps];return P.splice(L,0,cJ(H,B.steps)),{...B,steps:P}})}function T(L=h){const H=mC(L,t,g);c(H)}function A(L){const H=mC(L,[],g);c(B=>({...B,steps:[...B.steps,...H.steps]}))}function C(){b({prompt:QQ(h||l.description||l.name),source:{type:"workflow",label:"Workflow composer"},mode:"draft"})}function R(){const L=xl(l.id)||Vv(xl(l.name)||"workflow",t);a({...l,id:L,name:l.name.trim(),description:(h||l.description)?.trim()||void 0,builtin:!1,steps:l.steps.map(yJ)})}return n.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:[n.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border px-4 py-3",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.jsx(Yt,{className:"size-4 shrink-0"}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("input",{"aria-label":"Workflow name",className:"w-full bg-transparent text-[14px] font-semibold outline-none",onChange:L=>c(H=>({...H,name:L.target.value,id:xl(L.target.value)||H.id})),placeholder:"Name your workflow",value:l.name}),n.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:l.id})]})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[n.jsxs(Z,{onClick:()=>p(L=>!L),size:"sm",type:"button",variant:d?"default":"outline",children:[n.jsx(Li,{className:"size-3.5"})," AI compose"]}),n.jsxs(Z,{onClick:i,size:"sm",type:"button",variant:"outline",children:[n.jsx(yu,{className:"size-3.5"})," Back"]}),n.jsxs(Z,{disabled:v,onClick:R,size:"sm",type:"button",children:[n.jsx(Ws,{className:"size-3.5"})," Save"]})]})]}),d?n.jsx("section",{className:"shrink-0 border-b border-border bg-muted/20 p-4",children:n.jsxs("div",{className:"grid gap-3 xl:grid-cols-[minmax(0,1.1fr)_minmax(0,0.9fr)]",children:[n.jsxs("div",{className:"rounded-lg border border-border bg-background p-3 shadow-sm",children:[n.jsx(Tr,{children:"Describe workflow"}),n.jsx("textarea",{className:"min-h-16 w-full resize-none bg-transparent text-[13px] leading-relaxed outline-none placeholder:text-muted-foreground",onChange:L=>f(L.target.value),placeholder:"Review my changes with code-review, ask before commit, push, then open a PR with GitHub...",value:h}),n.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[n.jsxs(Z,{onClick:()=>T(),size:"sm",type:"button",children:[n.jsx(Li,{className:"size-3.5"})," Draft timeline"]}),n.jsxs(Z,{onClick:C,size:"sm",type:"button",variant:"outline",children:[n.jsx(jM,{className:"size-3.5"})," Ask AI"]}),["Commit safely","Review then push","Fix CI then PR","File issue from changes"].map(L=>n.jsx("button",{className:"rounded-md border border-border bg-muted/30 px-2 py-1 text-[11px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:()=>{f(L),T(L)},type:"button",children:L},L))]})]}),n.jsxs("div",{className:"grid gap-3",children:[n.jsx(uJ,{onAdd:A}),n.jsx(dJ,{capabilities:g})]})]})}):null,n.jsx("main",{className:"min-h-0 flex-1 overflow-auto p-4",children:n.jsxs("div",{className:"mx-auto max-w-3xl",children:[n.jsx(gC,{onInsert:L=>E(0,L)}),l.steps.length?l.steps.map((L,H)=>n.jsxs(y.Fragment,{children:[n.jsxs("div",{className:"flex gap-4",children:[n.jsxs("div",{className:"relative flex w-9 shrink-0 justify-center pt-2",children:[n.jsx("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-border"}),n.jsx(lJ,{index:H,kind:L.kind})]}),n.jsx("div",{className:"min-w-0 flex-1 pb-1",children:n.jsx(hJ,{capabilities:g,index:H,isFirst:H===0,isLast:H===l.steps.length-1,onMove:k,onRemove:N,onUpdate:w,step:L})})]}),n.jsx(gC,{onInsert:B=>E(H+1,B)})]},`${L.kind}:${L.id}`)):n.jsx("div",{className:"ml-[3.25rem] flex h-24 items-center justify-center rounded-lg border border-dashed border-border text-[12px] text-muted-foreground",children:"Pick a step kind above to start building."})]})})]})}function gC({defaultOpen:e=!1,onInsert:t}){const[s,i]=y.useState(e),a=[{kind:"gate",label:"Gate"},{kind:"agent",label:"AI"},{kind:"action",label:"Auto"}];return n.jsxs("div",{className:"flex gap-4",children:[n.jsxs("div",{className:"relative flex w-9 shrink-0 justify-center",children:[n.jsx("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-border"}),n.jsx("button",{"aria-label":s?"Cancel adding step":"Add step here",className:ae("relative z-10 my-1.5 flex size-5 items-center justify-center rounded-full border bg-card text-muted-foreground transition-colors",s?"border-primary/50 text-primary":"border-border hover:border-primary/50 hover:text-primary"),onClick:()=>i(l=>!l),type:"button",children:s?n.jsx(qt,{className:"size-3"}):n.jsx(ws,{className:"size-3"})})]}),n.jsx("div",{className:"flex-1 py-1",children:s?n.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:a.map(({kind:l,label:c})=>n.jsxs("button",{className:"flex items-center gap-1.5 rounded-md border border-border bg-background px-2 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary/40 hover:text-foreground",onClick:()=>{t(l),i(!1)},type:"button",children:[n.jsx(V4,{kind:l})," ",c]},l))}):null})]})}function lJ({index:e,kind:t}){return n.jsxs("div",{className:"relative z-10 flex size-9 items-center justify-center rounded-full border border-border bg-card shadow-sm",children:[n.jsx("span",{className:"absolute -right-1 -top-1 flex size-4 items-center justify-center rounded-full border border-border bg-background font-mono text-[9px] text-muted-foreground",children:e+1}),n.jsx(V4,{kind:t})]})}function cJ(e,t){const s=new Set(t.map(a=>a.id)),i=a=>{let l=a,c=2;for(;s.has(l);)l=`${a}-${c++}`;return l};return e==="gate"?{kind:"gate",id:i("gate"),title:"Approve step",message:"Continue?"}:e==="action"?{kind:"action",id:i("action"),title:"Commit with approved message",op:"commit"}:{kind:"agent",id:i("step"),title:"AI step",prompt:""}}function uJ({onAdd:e}){const[t,s]=y.useState("");return n.jsxs("form",{className:"rounded-lg border border-dashed border-border bg-background/70 p-3",onSubmit:i=>{i.preventDefault();const a=t.trim();a&&(e(a),s(""))},children:[n.jsx(Tr,{children:"Add a step"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{className:"min-w-0 flex-1 bg-transparent text-[12px] outline-none placeholder:text-muted-foreground",onChange:i=>s(i.target.value),placeholder:"ask before merge, run tests, open an issue...",value:t}),n.jsxs(Z,{size:"sm",type:"submit",variant:"outline",children:[n.jsx(ws,{className:"size-3.5"})," Add"]})]})]})}function dJ({capabilities:e}){const t=[...e.skills.map(s=>`@skill:${s}`),...e.mcpServers.map(s=>`@mcp:${s}`),...e.plugins.map(s=>`@plugin:${s}`)].slice(0,18);return t.length?n.jsxs("div",{className:"rounded-lg border border-border bg-background p-3",children:[n.jsx(Tr,{children:"Detected capabilities"}),n.jsx("div",{className:"flex max-h-20 flex-wrap gap-1.5 overflow-hidden",children:t.map(s=>n.jsx("span",{className:"rounded-md border border-border bg-muted/30 px-2 py-1 font-mono text-[11px] text-muted-foreground",children:s},s))})]}):null}function hJ({capabilities:e,index:t,isFirst:s,isLast:i,onMove:a,onRemove:l,onUpdate:c,step:h}){return n.jsx("section",{className:"group rounded-lg border border-border bg-background p-3 shadow-sm",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(k0,{kind:h.kind}),n.jsx("input",{className:"min-w-0 flex-1 bg-transparent text-[13px] font-semibold outline-none",onChange:f=>c(t,d=>({...d,title:f.target.value})),value:h.title})]}),h.kind==="gate"?n.jsx("textarea",{className:"mt-2 min-h-12 w-full resize-none bg-transparent text-[12px] leading-relaxed text-muted-foreground outline-none focus:text-foreground",onChange:f=>c(t,d=>d.kind==="gate"?{...d,message:f.target.value}:d),placeholder:"Question to ask before continuing…",value:h.message}):h.kind==="action"?n.jsxs("div",{className:"mt-2 space-y-1.5",children:[n.jsxs("select",{className:"w-full rounded-md border border-border bg-background px-2 py-1 text-[12px] outline-none",onChange:f=>{const d=f.target.value;c(t,p=>p.kind==="action"?{...p,op:d}:p)},value:h.op,children:[n.jsx("option",{value:"commit",children:"Commit staged changes"}),n.jsx("option",{value:"push",children:"Push branch"}),n.jsx("option",{value:"assert-pr-branch",children:"Check PR branch"}),n.jsx("option",{value:"checkout-default-and-pull",children:"Return to default branch"})]}),n.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:U4(h.op)})]}):n.jsxs(n.Fragment,{children:[n.jsx("textarea",{className:"mt-2 min-h-16 w-full resize-none bg-transparent text-[12px] leading-relaxed text-muted-foreground outline-none focus:text-foreground",onChange:f=>c(t,d=>d.kind==="agent"?{...d,prompt:f.target.value}:d),placeholder:"What should the agent do at this step?",value:h.prompt}),n.jsx(fJ,{capabilities:e,selected:h.capabilities,onToggle:(f,d)=>c(t,p=>p.kind==="agent"?{...p,capabilities:_J(p.capabilities,f,d)}:p)})]})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1 opacity-70 transition-opacity group-hover:opacity-100",children:[n.jsx(Z,{disabled:s,onClick:()=>a(t,-1),size:"sm",type:"button",variant:"ghost",children:"↑"}),n.jsx(Z,{disabled:i,onClick:()=>a(t,1),size:"sm",type:"button",variant:"ghost",children:"↓"}),n.jsx(Z,{onClick:()=>l(t),size:"sm",type:"button",variant:"ghost",children:n.jsx(Oi,{className:"size-3.5"})})]})]})})}function fJ({capabilities:e,onToggle:t,selected:s}){const i=[{key:"skills",label:"Skills",values:e.skills},{key:"mcpServers",label:"MCP",values:e.mcpServers},{key:"plugins",label:"Plugins",values:e.plugins},{key:"hooks",label:"Hooks",values:e.hooks}];return n.jsxs("div",{className:"space-y-2",children:[n.jsx(Tr,{children:"Capabilities"}),i.map(a=>n.jsxs("div",{children:[n.jsx("div",{className:"mb-1 text-[10px] text-muted-foreground",children:a.label}),a.values.length?n.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.values.map(l=>{const c=s?.[a.key]?.includes(l)??!1;return n.jsx("button",{className:ae("rounded-md border px-2 py-1 text-[11px] transition-colors",c?"border-primary/50 bg-primary/10 text-primary":"border-border bg-muted/30 text-muted-foreground hover:bg-muted"),onClick:()=>t(a.key,l),type:"button",children:l},l)})}):n.jsx("p",{className:"text-[11px] text-muted-foreground/70",children:"None detected."})]},a.key))]})}function mJ({run:e,onApprove:t,onSkip:s,onStop:i,onBack:a,onResume:l,onRestart:c}){const{sendToAgent:h}=Dt(),f=e.outcome!=="running",[d,p]=y.useState(e.index);y.useEffect(()=>{p(e.index)},[e.index]);const g=e.workflow.steps[d]??e.workflow.steps[e.index],b=e.statuses[d]??"pending",v=e.outputs[d],w=e.outputs[d-1],k=g?.kind==="gate"&&b==="waiting",N=b==="failed"||b==="blocked",E=b==="blocked"&&g?.kind==="action"&&g.op==="assert-pr-branch";return n.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsxs("h2",{className:"flex items-center gap-1.5 text-[13px] font-semibold",children:[n.jsx(Yt,{className:"size-4"})," ",e.workflow.name]}),n.jsxs("p",{className:"mt-0.5 flex items-center gap-1 text-[11px] text-muted-foreground",children:[n.jsx(kl,{className:"size-3"})," Watch the agent workflow run."]})]}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(G4,{outcome:e.outcome}),n.jsxs(Z,{onClick:a,size:"sm",type:"button",variant:"outline",children:[n.jsx(yu,{className:"size-3.5"})," Workflows"]}),f?null:n.jsxs(Z,{onClick:i,size:"sm",type:"button",variant:"outline",children:[n.jsx(fo,{className:"size-3.5"})," Stop"]})]})]}),n.jsxs("div",{className:"grid min-h-0 flex-1 overflow-hidden lg:grid-cols-[minmax(240px,320px)_minmax(0,1fr)]",children:[n.jsx("aside",{className:"min-h-0 overflow-auto border-b border-border bg-background/55 p-3 lg:border-b-0 lg:border-r",children:n.jsx("ol",{className:"space-y-1",children:e.workflow.steps.map((T,A)=>{const C=e.statuses[A],R=C==="running"||C==="waiting",L=A===d;return n.jsx("li",{children:n.jsxs("button",{className:ae("flex w-full items-center gap-2 rounded-md border px-2.5 py-2 text-left transition-colors",L?"border-primary/45 bg-primary/[0.06]":R?"border-primary/30 bg-primary/[0.03]":"border-transparent hover:border-border hover:bg-muted/40"),onClick:()=>p(A),type:"button",children:[n.jsx("span",{className:ae("flex size-7 shrink-0 items-center justify-center rounded-full border bg-card",C==="failed"?"border-destructive/50":C==="blocked"?"border-amber-500/50":R?"border-primary/50":C==="done"?"border-emerald-500/50":"border-border"),children:n.jsx(xC,{status:C,kind:T.kind})}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-[12px] font-medium",children:Cf(T)}),n.jsxs("span",{className:"mt-0.5 flex items-center gap-1.5",children:[n.jsx(k0,{kind:T.kind}),n.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground/70",children:bC(C)})]})]}),n.jsx(Dn,{className:ae("size-3.5 shrink-0 text-muted-foreground/50 transition-transform",L?"translate-x-0.5 text-primary":"")})]})},T.id)})})}),n.jsx("main",{className:"min-h-0 overflow-auto p-4",children:g?n.jsxs("section",{className:ae("min-h-full rounded-lg border bg-background p-4 shadow-sm",b==="failed"?"border-destructive/40 bg-destructive/[0.03]":b==="blocked"?"border-amber-500/40 bg-amber-500/[0.04]":b==="running"||b==="waiting"?"border-primary/40 bg-primary/[0.03]":"border-border"),children:[n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border pb-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(xC,{status:b,kind:g.kind}),n.jsx("h3",{className:"truncate text-[13px] font-semibold",children:Cf(g)})]}),n.jsxs("div",{className:"mt-1 flex items-center gap-1.5",children:[n.jsx(k0,{kind:g.kind}),n.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground/70",children:bC(b)})]})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[f&&N&&d===e.index&&!E?n.jsxs(Z,{"aria-label":"Resume the workflow from this step",onClick:l,size:"sm",type:"button",children:[n.jsx(Mr,{className:"size-3.5"})," Resume workflow"]}):null,N?n.jsxs(Z,{"aria-label":"Debug this workflow step with AI",onClick:()=>h({prompt:zF({workflowName:e.workflow.name,step:g,status:b,error:e.error,previousOutput:w,output:v}),source:{type:"workflow-debug",label:g.title},mode:"send",label:`Debug workflow step: ${g.title}`,background:!0}),size:"sm",type:"button",variant:"outline",children:[n.jsx(Yt,{className:"size-3.5"})," Debug with AI"]}):null,f?null:n.jsxs(Z,{"aria-label":"Stop workflow run from step detail",onClick:i,size:"sm",type:"button",variant:"outline",children:[n.jsx(fo,{className:"size-3.5"})," Stop after this step"]})]})]}),n.jsxs("div",{className:"py-3 text-[11px] leading-relaxed",children:[n.jsx(gJ,{output:v,previousOutput:w,status:b,step:g}),k?n.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-1.5",children:[n.jsxs(Z,{onClick:t,size:"sm",type:"button",children:[n.jsx(Ws,{className:"size-3.5"})," Approve"]}),n.jsxs(Z,{onClick:s,size:"sm",type:"button",variant:"outline",children:[n.jsx(tE,{className:"size-3.5"})," Skip"]}),n.jsxs(Z,{onClick:i,size:"sm",type:"button",variant:"outline",children:[n.jsx(qt,{className:"size-3.5"})," Stop"]})]}):null,b==="failed"&&e.error?n.jsx("p",{className:"mt-3 text-destructive",children:e.error}):null,E?n.jsx(pJ,{error:e.error,onRestart:c,workflowName:e.workflow.name}):null,b==="blocked"&&e.error?n.jsx("p",{className:"mt-3 text-amber-700 dark:text-amber-400",children:e.error}):null]})]}):null})]})]})}function pJ({error:e,onRestart:t,workflowName:s}){const{provider:i}=Dt(),[a,l]=y.useState(""),[c,h]=y.useState(!1),[f,d]=y.useState(!1),[p,g]=y.useState(null),[b,v]=y.useState(null),w=y.useRef(null),k=qF(a);y.useEffect(()=>()=>w.current?.abort(),[]);async function N(T){w.current?.abort();const A=new AbortController;w.current=A,v(null),g(null),l(""),h(!0);try{const C=await bv({prompt:[BF({workflowName:s,error:e}),T?.trim()?T.trim():""].filter(Boolean).join(`
218
+
219
+ `),provider:i?.id,signal:A.signal});A.signal.aborted||l(C)}catch(C){A.signal.aborted||v(C instanceof Error?C.message:String(C))}finally{w.current===A&&(w.current=null,h(!1))}}async function E(){if(k){d(!0),v(null);try{await TL(k),g(k)}catch(T){v(T instanceof Error?T.message:String(T))}finally{d(!1)}}}return n.jsxs("div",{className:"mt-3 rounded-md border border-border bg-muted/35 p-3",children:[n.jsx(Tr,{children:"Recover with AI"}),n.jsx("p",{className:"mb-2 text-[11px] text-muted-foreground",children:"Let the agent inspect the change and suggest a feature branch. You approve before anything changes."}),n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsxs(Z,{onClick:()=>{N()},size:"sm",type:"button",children:[n.jsx(Yt,{className:"size-3.5"})," Recommend branch with AI"]}),p?n.jsxs(Z,{onClick:t,size:"sm",type:"button",variant:"outline",children:[n.jsx(Mr,{className:"size-3.5"})," Run again"]}):null]}),c?n.jsxs("p",{className:"mt-2 flex items-center gap-1 text-[11px] text-muted-foreground",children:[n.jsx(Rt,{className:"size-3 animate-spin"})," Choosing a branch name in the background."]}):null,k?n.jsxs("div",{className:"mt-3 rounded-md border border-border bg-background p-2.5",children:[n.jsx(Tr,{children:"Recommended branch"}),n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[n.jsx("code",{className:"min-w-0 rounded bg-muted px-2 py-1 font-mono text-[12px] text-foreground",children:k}),n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsxs(Z,{disabled:f||p===k,onClick:()=>{E()},size:"sm",type:"button",children:[f?n.jsx(Rt,{className:"size-3.5 animate-spin"}):n.jsx(Ws,{className:"size-3.5"}),"Create this branch"]}),n.jsxs(Z,{disabled:f,onClick:()=>{N("Recommend a different concise branch name. Keep the same output contract with `BRANCH_NAME: <branch-name>`.")},size:"sm",type:"button",variant:"outline",children:[n.jsx(Yt,{className:"size-3.5"})," Ask for another"]})]})]})]}):a&&!c?n.jsxs("div",{className:"mt-3 rounded-md border border-border bg-background p-2.5",children:[n.jsx("p",{className:"text-[11px] text-muted-foreground",children:"The agent did not return a branch name the workflow could read."}),n.jsxs(Z,{className:"mt-2",onClick:()=>{N("Return only a concise branch suggestion using this exact line: `BRANCH_NAME: <branch-name>`.")},size:"sm",type:"button",variant:"outline",children:[n.jsx(Yt,{className:"size-3.5"})," Ask for another"]})]}):null,p?n.jsxs("p",{className:"mt-2 text-[11px] text-emerald-700 dark:text-emerald-400",children:["Branch created: ",n.jsx("code",{className:"font-mono",children:p}),". Run the workflow again from here."]}):null,b?n.jsx("p",{className:"mt-2 text-[11px] text-destructive",children:b}):null]})}function bC(e){return e==="running"?"Running":e==="waiting"?"Waiting":e==="done"?"Done":e==="blocked"?"Needs you":e==="failed"?"Failed":e==="skipped"?"Skipped":"Queued"}function gJ({output:e,previousOutput:t,status:s,step:i}){if(i.kind==="gate"){const l=i.id==="gate-commit"?t?.trim():"";return n.jsxs("div",{children:[n.jsx("p",{className:"text-muted-foreground",children:i.message}),l?n.jsxs("div",{className:"mt-3",children:[n.jsx(Tr,{children:"Generated commit message"}),n.jsx("div",{className:"whitespace-pre-wrap break-words rounded-md border border-border bg-muted/50 px-2.5 py-2 font-mono text-[11px] text-foreground",children:l})]}):null]})}if(i.kind==="action")return n.jsx("p",{className:"text-muted-foreground",children:U4(i.op)});const a=s==="done"||s==="failed"||s==="skipped";return e?n.jsxs("div",{children:[n.jsx(Tr,{children:"Result"}),n.jsx("div",{className:"whitespace-pre-wrap break-words rounded-md bg-muted/50 px-2.5 py-2 font-mono text-[11px] text-foreground",children:e})]}):n.jsxs("div",{children:[n.jsx(Tr,{children:a?"Result":"Task"}),a?n.jsx("p",{className:"italic text-muted-foreground",children:"The agent returned no text result."}):n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-muted-foreground",children:i.prompt}),s==="running"?n.jsxs("p",{className:"mt-1.5 flex items-center gap-1 text-muted-foreground/80",children:[n.jsx(Rt,{className:"size-3 animate-spin"})," Running agent step…"]}):null]})]})}function bJ(e){return e.detected.name==="codex"?e.agents.codex:e.agents["claude-code"]??e}function xJ(e){return e?{skills:Jc(e.skills.map(t=>t.name)),mcpServers:Jc(e.mcpServers.map(t=>t.name)),plugins:Jc(e.plugins.map(t=>t.name)),hooks:Jc(e.hooks.map(t=>t.matcher?`${t.event}: ${t.matcher}`:t.event))}:{skills:[],mcpServers:[],plugins:[],hooks:[]}}function vJ(e){return{id:Vv("custom-workflow",e),name:"Custom workflow",description:"A user-built workflow.",builtin:!1,steps:[{kind:"gate",id:"gate-start",title:"Approve start",message:"Run this workflow?"}]}}function yJ(e){const t=xl(e.id)||e.kind,s=e.title.trim()||Cf(e);if(e.kind==="gate")return{...e,id:t,title:s,message:e.message.trim()||"Continue?"};if(e.kind==="action")return{...e,id:t,title:s};const i=F4(e.capabilities);return{...e,id:t,title:s,prompt:e.prompt.trim()||"Complete this workflow step.",capabilities:i}}function U4(e){return e==="assert-pr-branch"?"Checks that PR workflows are running from a feature branch, not main or master.":e==="checkout-default-and-pull"?"Switches back to the default branch and pulls the latest changes.":e==="push"?"Pushes the current branch to its remote.":"Commits the staged changes with the approved generated message."}function F4(e){if(!e)return;const t={};for(const s of["skills","mcpServers","plugins","hooks"]){const i=Jc((e[s]??[]).map(a=>a.trim()).filter(Boolean));i.length&&(t[s]=i)}return Object.keys(t).length?t:void 0}function _J(e,t,s){const i=e?.[t]??[],a=i.includes(s)?i.filter(l=>l!==s):[...i,s];return F4({...e??{},[t]:a})}function Vv(e,t){const s=new Set(t.map(l=>l.id));let i=xl(e)||"workflow",a=2;for(;s.has(i);)i=`${xl(e)||"workflow"}-${a}`,a++;return i}function xl(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Jc(e){return Array.from(new Set(e.filter(Boolean)))}function Tr({children:e}){return n.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:e})}function q4(e){return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(new Date(e))}function G4({outcome:e}){const t={running:{label:"Running",className:"border-primary/40 text-primary"},done:{label:"Done",className:"border-emerald-500/40 text-emerald-600 dark:text-emerald-400"},stopped:{label:"Stopped",className:"border-border text-muted-foreground"},failed:{label:"Failed",className:"border-destructive/40 text-destructive"},blocked:{label:"Needs you",className:"border-amber-500/40 text-amber-700 dark:text-amber-400"}},{label:s,className:i}=t[e];return n.jsx("span",{className:ae("rounded-full border px-2 py-0.5 text-[10px] font-medium",i),children:s})}function V4({kind:e}){return e==="gate"?n.jsx(eE,{className:"size-4 text-amber-600 dark:text-amber-400"}):e==="agent"?n.jsx(Li,{className:"size-4 text-primary"}):n.jsx(Mr,{className:"size-4 text-muted-foreground"})}function xC({status:e,kind:t}){return e==="running"?n.jsx(Rt,{className:"size-4 shrink-0 animate-spin text-primary"}):e==="waiting"?n.jsx(eE,{className:"size-4 shrink-0 text-primary"}):e==="done"?n.jsx(Ws,{className:"size-4 shrink-0 text-emerald-600 dark:text-emerald-400"}):e==="blocked"?n.jsx(Mf,{className:"size-4 shrink-0 text-amber-600 dark:text-amber-400"}):e==="failed"?n.jsx(Rr,{className:"size-4 shrink-0 text-destructive"}):e==="skipped"?n.jsx(tE,{className:"size-4 shrink-0 text-muted-foreground/60"}):t==="agent"?n.jsx(Li,{className:"size-4 shrink-0 text-muted-foreground/50"}):n.jsx(WR,{className:"size-4 shrink-0 text-muted-foreground/50"})}function wJ(e){return n.jsx(Dn,{className:"size-3 shrink-0 text-muted-foreground/40","aria-hidden":!0})}function k0({kind:e}){const t=e==="agent"?"AI":e==="gate"?"Gate":"Auto",s=e==="agent"?"border-primary/30 text-primary":e==="gate"?"border-amber-500/40 text-amber-600 dark:text-amber-400":"border-border text-muted-foreground";return n.jsx("span",{className:ae("shrink-0 rounded-full border px-1.5 py-px text-[9px] uppercase tracking-wide",s),children:t})}function Cf(e){return e.title}const SJ={sm:"size-3.5",md:"size-4",lg:"size-6"};function Wv({size:e="md",className:t}){return n.jsx(Rt,{"aria-hidden":!0,className:ae("animate-spin",SJ[e],t)})}function om({label:e,size:t="md",fill:s=!1,className:i}){return n.jsxs("div",{className:ae("flex items-center justify-center gap-2 text-[12px] text-muted-foreground",s&&"h-full",i),role:"status",children:[n.jsx(Wv,{size:t}),e?n.jsx("span",{children:e}):null]})}function kJ(){const[e,t]=y.useState(!1),[s,i]=y.useState(!1),[a,l]=y.useState(!0),[c,h]=y.useState("checking"),[f,d]=y.useState(null),[p,g]=y.useState(null);function b(){l(!0),h("checking"),d(null),BL().then(v=>{t(v.configured),i(v.deviceFlowAvailable),h(v.status),d(v.error??null),g(v)}).catch(v=>{t(!1),i(!1),h("connection_error"),d(v instanceof Error?v.message:String(v)),g(null)}).finally(()=>l(!1))}return y.useEffect(()=>{b()},[]),{configured:e,deviceFlowAvailable:s,loading:a,status:c,error:f,info:p,isConnected:c==="connected",needsLogin:c==="not_configured"||c==="auth_error",refresh:b}}const Yb=30;function NJ(e="open"){const[t,s]=y.useState([]),[i,a]=y.useState(!0),[l,c]=y.useState(!1),[h,f]=y.useState(!1),[d,p]=y.useState(1),[g,b]=y.useState(null),[v,w]=y.useState(null),[k,N]=y.useState(null),[E,T]=y.useState(""),[A,C]=y.useState(!1),[R,L]=y.useState(null);y.useEffect(()=>{let P=!0;return a(!0),b(null),p(1),_g(e,1).then(D=>{P&&(s(D),f(D.length===Yb),D.length>0&&!D.some(G=>G.number===v)&&w(D[0]?.number??null))}).catch(D=>{P&&b(D instanceof Error?D.message:String(D))}).finally(()=>{P&&a(!1)}),()=>{P=!1}},[e]),y.useEffect(()=>{if(!v){N(null);return}let P=!0;return FL(v).then(D=>{P&&N(D)}).catch(()=>{}),()=>{P=!1}},[v]),y.useEffect(()=>{if(!v){T("");return}let P=!0;return C(!0),L(null),qL(v).then(D=>{P&&T(D)}).catch(D=>{P&&L(D instanceof Error?D.message:String(D))}).finally(()=>{P&&C(!1)}),()=>{P=!1}},[v]);function H(){if(l||!h)return;const P=d+1;c(!0),_g(e,P).then(D=>{s(G=>{const $=new Set(G.map(O=>O.number));return[...G,...D.filter(O=>!$.has(O.number))]}),f(D.length===Yb),p(P)}).catch(D=>b(D instanceof Error?D.message:String(D))).finally(()=>c(!1))}function B(){let P=!0;return a(!0),b(null),p(1),_g(e,1).then(D=>{P&&(s(D),f(D.length===Yb))}).catch(D=>{P&&b(D instanceof Error?D.message:String(D))}).finally(()=>{P&&a(!1)}),()=>{P=!1}}return{prs:t,loading:i,loadingMore:l,hasMore:h,error:g,selectedNumber:v,setSelectedNumber:w,selectedPR:k,diff:E,diffLoading:A,diffError:R,loadMore:H,refresh:B}}const Xb=30;function CJ(e="open"){const[t,s]=y.useState([]),[i,a]=y.useState(!0),[l,c]=y.useState(!1),[h,f]=y.useState(!1),[d,p]=y.useState(1),[g,b]=y.useState(null),[v,w]=y.useState(null),[k,N]=y.useState(null),[E,T]=y.useState([]),[A,C]=y.useState(!1),[R,L]=y.useState(null),[H,B]=y.useState(!1);y.useEffect(()=>{let $=!0;return a(!0),b(null),p(1),wg(e,1).then(O=>{$&&(s(O),f(O.length===Xb),O.length>0&&!O.some(V=>V.number===v)&&w(O[0]?.number??null))}).catch(O=>{$&&b(O instanceof Error?O.message:String(O))}).finally(()=>{$&&a(!1)}),()=>{$=!1}},[e]),y.useEffect(()=>{if(!v){N(null),T([]);return}let $=!0;return C(!0),Promise.all([YL(v),XL(v)]).then(([O,V])=>{$&&(N(O),T(V))}).catch(()=>{}).finally(()=>{$&&C(!1)}),()=>{$=!1}},[v]);async function P($){if(v){B(!0),L(null);try{const O=await ZL(v,$);T(V=>[...V,O])}catch(O){L(O instanceof Error?O.message:String(O))}finally{B(!1)}}}function D(){if(l||!h)return;const $=d+1;c(!0),wg(e,$).then(O=>{s(V=>{const K=new Set(V.map(I=>I.number));return[...V,...O.filter(I=>!K.has(I.number))]}),f(O.length===Xb),p($)}).catch(O=>b(O instanceof Error?O.message:String(O))).finally(()=>c(!1))}function G(){let $=!0;return a(!0),p(1),wg(e,1).then(O=>{$&&(s(O),f(O.length===Xb))}).catch(()=>{}).finally(()=>{$&&a(!1)}),()=>{$=!1}}return{issues:t,loading:i,loadingMore:l,hasMore:h,error:g,selectedNumber:v,setSelectedNumber:w,selectedIssue:k,comments:E,commentsLoading:A,commentError:R,submitting:H,addComment:P,loadMore:D,refresh:G}}function W4({deviceFlowAvailable:e,initialMode:t,onSaved:s}){const[i,a]=y.useState(()=>t==="device-pending"&&!e?"pat":t??(e?"choose":"pat"));return i==="device-pending"?n.jsx(EJ,{onSuccess:s,onCancel:()=>a("choose")}):i==="pat"?n.jsx(jJ,{onSaved:s,onBack:e?()=>a("choose"):void 0}):n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-6 p-8",children:[n.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[n.jsx("div",{className:"flex size-12 items-center justify-center rounded-xl bg-muted",children:n.jsx(Bw,{className:"size-6 text-muted-foreground"})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-base font-semibold",children:"Connect GitHub"}),n.jsx("p",{className:"mt-1 max-w-sm text-[13px] text-muted-foreground",children:"Authorize NoMoreIDE to read pull requests, issues, and CI status for your repositories."})]})]}),n.jsxs("div",{className:"flex w-full max-w-xs flex-col gap-2",children:[n.jsxs(Z,{className:"w-full",onClick:()=>a("device-pending"),type:"button",children:[n.jsx(Bw,{className:"mr-2 size-4"}),"Authorize with GitHub"]}),n.jsx("button",{className:"text-[12px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",onClick:()=>a("pat"),type:"button",children:"Use a Personal Access Token instead"})]})]})}function EJ({onSuccess:e,onCancel:t}){const[s,i]=y.useState(null),[a,l]=y.useState(null),[c,h]=y.useState(!0),[f,d]=y.useState(!1),p=y.useRef(null),g=y.useRef(5),b=y.useRef(!1);y.useEffect(()=>{let N=!0;return PL().then(E=>{if(!N)return;i(E),g.current=E.interval,h(!1);const T=E.verification_uri_complete||E.verification_uri;T&&$f(T),v(E.device_code,E.interval),setTimeout(()=>{b.current=!0},E.expires_in*1e3)}).catch(E=>{N&&(l(E instanceof Error?E.message:String(E)),h(!1))}),()=>{N=!1,p.current&&clearTimeout(p.current)}},[]);function v(N,E){p.current=setTimeout(()=>{w(N,E)},E*1e3)}async function w(N,E){if(b.current){l("Authorization expired. Please try again.");return}try{const T=await IL(N);if(T.done){e();return}const A=T.slowDown?E+5:E;g.current=A,v(N,A)}catch{v(N,g.current)}}function k(){s&&navigator.clipboard.writeText(s.user_code).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)})}return c?n.jsx("div",{className:"flex h-full items-center justify-center",children:n.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[n.jsx(Pw,{className:"size-6 animate-spin text-muted-foreground"}),n.jsx("p",{className:"text-[13px] text-muted-foreground",children:"Requesting authorization…"})]})}):a?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-4 p-8",children:[n.jsx(Je,{variant:"destructive",children:a}),n.jsx(Z,{onClick:t,variant:"outline",children:"Go back"})]}):n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-6 p-8",children:[n.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[n.jsx("div",{className:"flex size-12 items-center justify-center rounded-xl bg-emerald-100 dark:bg-emerald-500/15",children:n.jsx(Df,{className:"size-6 text-emerald-600 dark:text-emerald-400"})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-base font-semibold",children:"Authorize on GitHub"}),n.jsxs("p",{className:"mt-1 max-w-sm text-[13px] text-muted-foreground",children:["A GitHub page just opened in a new tab. Enter the code below and click"," ",n.jsx("strong",{children:"Authorize"}),"."]})]})]}),n.jsxs("div",{className:"flex flex-col items-center gap-2",children:[n.jsx("div",{className:"flex cursor-pointer select-all items-center gap-3 rounded-xl border-2 border-border bg-muted px-6 py-4 font-mono text-2xl font-bold tracking-[0.3em] transition-colors hover:border-ring",onClick:k,title:"Click to copy",children:s?.user_code}),n.jsx("button",{className:"text-[11px] text-muted-foreground transition-colors hover:text-foreground",onClick:k,type:"button",children:f?"Copied!":"Click code to copy"})]}),n.jsxs("div",{className:"flex flex-col items-center gap-2",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-muted-foreground",children:[n.jsx(Pw,{className:"size-3.5 animate-spin"}),"Waiting for authorization…"]}),n.jsx("a",{className:"text-[12px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",href:s?.verification_uri_complete||s?.verification_uri,rel:"noopener noreferrer",target:"_blank",children:"Open GitHub again"}),n.jsx("button",{className:"text-[12px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",onClick:t,type:"button",children:"Cancel"})]})]})}function jJ({onSaved:e,onBack:t}){const[s,i]=y.useState(""),[a,l]=y.useState(!1),[c,h]=y.useState(null);async function f(d){d.preventDefault();const p=s.trim();if(p){l(!0),h(null);try{await $L("github.com",p),e()}catch(g){h(g instanceof Error?g.message:String(g))}finally{l(!1)}}}return n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-6 p-8",children:[n.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[n.jsx("div",{className:"flex size-12 items-center justify-center rounded-xl bg-muted",children:n.jsx(qC,{className:"size-6 text-muted-foreground"})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-base font-semibold",children:"Personal Access Token"}),n.jsxs("p",{className:"mt-1 max-w-sm text-[13px] text-muted-foreground",children:["Create a token at"," ",n.jsx("a",{className:"underline underline-offset-2 hover:text-foreground",href:"https://github.com/settings/tokens/new?scopes=repo,workflow",rel:"noopener noreferrer",target:"_blank",children:"github.com/settings/tokens"})," ","with ",n.jsx("code",{className:"rounded bg-muted px-1 py-px text-[11px]",children:"repo"})," and"," ",n.jsx("code",{className:"rounded bg-muted px-1 py-px text-[11px]",children:"workflow"})," scopes."]})]})]}),n.jsxs("form",{className:"flex w-full max-w-sm flex-col gap-3",onSubmit:d=>{f(d)},children:[n.jsx("input",{autoComplete:"off",className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring",onChange:d=>i(d.target.value),placeholder:"ghp_...",spellCheck:!1,type:"password",value:s}),c?n.jsx(Je,{variant:"destructive",children:c}):null,n.jsx(Z,{disabled:!s.trim()||a,type:"submit",children:a?"Saving…":"Save token"}),t?n.jsx("button",{className:"text-[12px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",onClick:t,type:"button",children:"← Back"}):null]})]})}function Kv({hasMore:e,loading:t,onLoadMore:s}){return e?n.jsx("div",{className:"p-2",children:n.jsxs("button",{className:"flex w-full items-center justify-center gap-1.5 rounded-md border border-border py-1.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground disabled:opacity-60",disabled:t,onClick:s,type:"button",children:[t?n.jsx(Rt,{className:"size-3 animate-spin"}):null,t?"Loading…":"Load more"]})}):null}function AJ({prs:e,loading:t,loadingMore:s,hasMore:i,error:a,selectedNumber:l,onSelect:c,onLoadMore:h}){return t&&e.length===0?n.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading pull requests…"}):a?n.jsx("div",{className:"p-4 text-[12px] text-red-500",children:a}):e.length===0?n.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No pull requests found."}):n.jsxs(n.Fragment,{children:[n.jsx("ul",{className:"divide-y divide-border",children:e.map(f=>n.jsx("li",{children:n.jsxs("button",{className:`flex w-full items-start gap-3 px-3 py-2.5 text-left transition-colors hover:bg-muted/60 ${l===f.number?"bg-muted":""}`,onClick:()=>c(f.number),type:"button",children:[n.jsx("span",{className:"mt-0.5 shrink-0",children:n.jsx(TJ,{pr:f})}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-[13px] font-medium",children:f.title}),n.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["#",f.number," · ",f.base.ref," ← ",f.head.ref," · ",f.user.login]})]}),f.draft?n.jsx("span",{className:"shrink-0 rounded border border-border px-1.5 py-px text-[10px] text-muted-foreground",children:"Draft"}):null]})},f.number))}),n.jsx(Kv,{hasMore:i,loading:s,onLoadMore:h})]})}function TJ({pr:e}){return e.state==="merged"?n.jsx(Yh,{className:"size-4 text-purple-500"}):e.state==="closed"?n.jsx($6,{className:"size-4 text-red-500"}):n.jsx(FC,{className:"size-4 text-emerald-500"})}function K4({body:e,title:t="Description"}){const[s,i]=y.useState("rendered"),a=l=>ae("rounded px-1.5 py-0.5 text-[10px] font-medium transition-colors",l?"bg-foreground text-background":"text-muted-foreground hover:text-foreground");return n.jsxs("section",{className:"overflow-hidden rounded-md border border-border bg-muted/25",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[n.jsx("span",{className:"text-[11px] font-medium text-muted-foreground",children:t}),n.jsxs("div",{className:"flex items-center gap-0.5 rounded-md bg-background/60 p-0.5",children:[n.jsx("button",{className:a(s==="rendered"),onClick:()=>i("rendered"),type:"button",children:"Rendered"}),n.jsx("button",{className:a(s==="raw"),onClick:()=>i("raw"),type:"button",children:"Raw"})]})]}),s==="rendered"?n.jsx(Fv,{content:e}):n.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap px-3 py-3 font-mono text-[12px]",children:e})]})}function RJ({pr:e,diff:t,diffLoading:s,diffError:i,onMerged:a}){const[l,c]=y.useState("cockpit"),[h,f]=y.useState(null),[d,p]=y.useState(!1),[g,b]=y.useState(null),[v,w]=y.useState(!1),[k,N]=y.useState(null),[E,T]=y.useState(!1),[A,C]=y.useState(null),[R,L]=y.useState(!1),{sendToAgent:H}=Dt(),B=y.useMemo(()=>rH(t),[t]);y.useEffect(()=>{C(K=>K&&B.some(I=>I.path===K)?K:B[0]?.path??null)},[B]);const P=B.find(K=>K.path===A)??B[0]??null;function D(K){C(K),c("diff")}function G(K,I){e&&(L(!1),H({prompt:I?YH(e,I,K):KH(e,K),source:{type:"github-pr",label:`PR #${e.number}${I?` · ${Ef(I)}`:""}`},label:`PR #${e.number}${I?` (${Ef(I)})`:""}: ${K}`}))}if(y.useEffect(()=>{if(L(!1),!e){f(null);return}let K=!0;return p(!0),b(null),GL(e.number).then(I=>{K&&f(I)}).catch(I=>{K&&b(I instanceof Error?I.message:String(I))}).finally(()=>{K&&p(!1)}),()=>{K=!1}},[e]),!e)return n.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Select a pull request"});const $=e.state==="open"&&!e.draft;async function O(){if(!(!e||v)){w(!0),N(null);try{await KL(e.number,{method:"squash"}),T(!1),a?.()}catch(K){N(K instanceof Error?K.message:String(K)),T(!1)}finally{w(!1)}}}const V=K=>`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${K?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`;return n.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[n.jsxs("div",{className:"group flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[n.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-semibold",children:e.title}),n.jsx(er,{className:ae("shrink-0",R&&"opacity-100"),label:`Ask AI about PR #${e.number}`,onAsk:()=>L(K=>!K)}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[n.jsx("button",{className:V(l==="cockpit"),onClick:()=>c("cockpit"),type:"button",children:"Review"}),n.jsx("button",{className:V(l==="diff"),onClick:()=>c("diff"),type:"button",children:"Diff"})]}),$?n.jsxs(Z,{className:"shrink-0",disabled:v,onClick:()=>T(!0),size:"sm",title:"Squash & merge this pull request",type:"button",variant:"success",children:[n.jsx(Yh,{}),"Squash & merge"]}):null,n.jsx("a",{"aria-label":"Open on GitHub",className:"shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",href:e.html_url,rel:"noopener noreferrer",target:"_blank",title:"Open on GitHub",children:n.jsx(Sa,{className:"size-3.5"})})]}),k?n.jsx("div",{className:"shrink-0 border-b border-border bg-red-500/10 px-3 py-1.5 text-[11px] text-red-500",children:k}):null,R?n.jsx("div",{className:"shrink-0 border-b border-border px-3 py-1.5",children:n.jsx(Lr,{placeholder:"What should the agent do with this PR? (review, summarize, find regressions…)",onSubmit:K=>G(K),onCancel:()=>L(!1)})}):null,l==="cockpit"?n.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:n.jsx(MJ,{cockpit:h,error:g,loading:d,onOpenFile:D,pr:e})}):s?n.jsx(om,{className:"flex-1",label:"Loading diff…"}):i?n.jsx("div",{className:"p-4 text-[12px] text-red-500",children:i}):B.length?n.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1",children:[n.jsx(DJ,{files:B,onAsk:(K,I)=>G(I,K),onSelect:C,selected:P?.path??null}),n.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:P?n.jsx(Eu,{diff:P.diff}):null})]}):n.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No diff available."}),E?n.jsx(Al,{confirmLabel:v?n.jsxs(n.Fragment,{children:[n.jsx(Wv,{size:"sm"})," Merging…"]}):"Squash & merge",icon:n.jsx(Yh,{}),loading:v,message:n.jsxs(n.Fragment,{children:["Squash & merge PR ",n.jsxs("span",{className:"font-mono",children:["#",e.number]})," ",n.jsx("span",{className:"font-medium text-foreground",children:e.title})," into"," ",n.jsx("span",{className:"font-mono",children:e.base.ref}),"?"]}),onCancel:()=>T(!1),onConfirm:()=>{O()},title:"Squash & merge",tone:"success"}):null]})}function MJ({pr:e,cockpit:t,loading:s,error:i,onOpenFile:a}){const[l,c]=y.useState(!1),h=t?.pr??e,f=t?.files??[],d=t?.reviews??[],p=t?.comments??[],g=t?.checks??null,b=g?.runs.filter(v=>v.conclusion==="failure"||v.conclusion==="timed_out"||v.conclusion==="cancelled")??[];return n.jsxs("div",{className:"space-y-3 p-4",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 text-[12px]",children:[n.jsx(zJ,{pr:h}),n.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-border bg-muted/40 px-2 py-1 font-mono text-[11px]",children:[n.jsx(Mn,{className:"size-3 shrink-0 text-muted-foreground"}),h.base.ref,n.jsx(yu,{className:"size-3 shrink-0 text-muted-foreground"}),h.head.ref]}),n.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[n.jsx(D8,{className:"size-3 shrink-0"}),h.user.login]}),n.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[n.jsx(zR,{className:"size-3 shrink-0"}),new Date(h.created_at).toLocaleDateString()]})]}),i?n.jsx("div",{className:"rounded-md border border-red-500/30 bg-red-500/10 px-3 py-2 text-[12px] text-red-500",children:i}):null,s?n.jsx(om,{className:"justify-start",label:"Loading review cockpit…"}):null,n.jsxs("div",{className:"grid gap-2 md:grid-cols-4",children:[n.jsx(jh,{title:"Merge readiness",value:Y4(h,g),tone:LJ(h,g)}),n.jsx(jh,{title:"Review state",value:X4(d),tone:OJ(d)}),n.jsx(jh,{title:"Checks",value:g?`${g.state} (${g.totalCount})`:"unknown",tone:g?.state==="success"?"success":g?.state==="failure"||g?.state==="error"?"danger":"muted"}),n.jsx(jh,{title:"Changed files",value:String(f.length),tone:"muted"})]}),b.length>0?n.jsxs("section",{className:"rounded-md border border-red-500/25 bg-red-500/10 px-3 py-2",children:[n.jsx("div",{className:"mb-1 text-[11px] font-medium text-red-500",children:"Failing checks"}),n.jsx("div",{className:"flex flex-wrap gap-2",children:b.slice(0,4).map(v=>n.jsxs("a",{className:"inline-flex items-center gap-1 text-[11px] text-red-500 underline-offset-2 hover:underline",href:v.html_url,rel:"noopener noreferrer",target:"_blank",children:[n.jsx(E0,{className:"size-3"}),"Open failing check: ",v.name]},v.id))})]}):null,n.jsxs("section",{className:"rounded-md border border-border bg-muted/25 p-3",children:[n.jsxs("button",{className:"flex w-full items-center gap-2 text-[12px] font-medium",onClick:()=>c(v=>!v),type:"button",children:[l?n.jsx(Jn,{className:"size-3.5 text-muted-foreground"}):n.jsx(Dn,{className:"size-3.5 text-muted-foreground"}),n.jsx(A0,{className:"size-3.5 text-muted-foreground"}),"Changed files",f.length?n.jsxs("span",{className:"font-mono text-[11px] text-muted-foreground",children:["(",f.length,")"]}):null]}),l?f.length?n.jsx("ul",{className:"mt-2 divide-y divide-border",children:f.slice(0,12).map(v=>n.jsx("li",{children:n.jsxs("button",{className:"flex w-full items-center gap-2 py-1.5 text-left text-[12px] transition-colors hover:text-foreground",onClick:()=>a(v.path),title:`View diff for ${v.path}`,type:"button",children:[n.jsx("span",{className:"w-16 shrink-0 font-mono text-[10px] uppercase text-muted-foreground",children:v.status}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:v.path}),n.jsxs("span",{className:"shrink-0 font-mono text-[11px] text-emerald-600",children:["+",v.additions]}),n.jsxs("span",{className:"shrink-0 font-mono text-[11px] text-red-500",children:["-",v.deletions]})]})},v.path))}):n.jsx("p",{className:"mt-2 text-[12px] text-muted-foreground",children:"No changed file metadata available."}):null]}),n.jsxs("section",{className:"rounded-md border border-border bg-muted/25 p-3",children:[n.jsxs("div",{className:"mb-2 flex items-center gap-2 text-[12px] font-medium",children:[n.jsx(TM,{className:"size-3.5 text-muted-foreground"}),"Review state"]}),d.length||p.length?n.jsxs("div",{className:"space-y-2",children:[d.slice(-4).map(v=>n.jsx(vC,{href:v.html_url,meta:`${v.user.login} - ${v.state.toLowerCase()}`,text:v.body||"No review summary."},`review:${v.id}`)),p.slice(-4).map(v=>n.jsx(vC,{href:v.html_url,meta:`${v.user.login} - comment`,text:v.body},`comment:${v.id}`))]}):n.jsx("p",{className:"text-[12px] text-muted-foreground",children:"No reviews or PR comments yet."})]}),h.body?n.jsx(K4,{body:h.body}):n.jsx("p",{className:"text-[12px] italic text-muted-foreground",children:"No description provided."})]})}function DJ({files:e,selected:t,onSelect:s,onAsk:i}){const[a,l]=y.useState(null);return n.jsx("div",{className:"w-44 shrink-0 overflow-y-auto border-r border-border bg-card/60",children:n.jsx("ul",{className:"py-1",children:e.map(c=>n.jsxs("li",{className:"group flex flex-col",children:[n.jsxs("div",{className:ae("flex items-center transition-colors",c.path===t?"bg-muted":"hover:bg-muted/60"),children:[n.jsxs("button",{className:ae("flex min-w-0 flex-1 items-center gap-1.5 px-2.5 py-1.5 text-left text-[11px]",c.path===t?"text-foreground":"text-muted-foreground group-hover:text-foreground"),onClick:()=>s(c.path),title:c.path,type:"button",children:[n.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:Ef(c.path)}),n.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-emerald-600",children:["+",c.additions]}),n.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-red-500",children:["-",c.deletions]})]}),n.jsx(er,{className:ae("mr-1 shrink-0",a===c.path&&"opacity-100"),label:`Ask AI about ${Ef(c.path)}`,onAsk:()=>l(h=>h===c.path?null:c.path)})]}),a===c.path?n.jsx("div",{className:"px-2 pb-1.5 pt-0.5",children:n.jsx(Lr,{placeholder:"What about this file? (review, explain, find bugs…)",onSubmit:h=>{l(null),i(c.path,h)},onCancel:()=>l(null)})}):null]},c.path))})})}function Ef(e){const t=e.split("/");return t[t.length-1]||e}function jh({title:e,value:t,tone:s}){const i=s==="success"?"bg-emerald-500":s==="warning"?"bg-amber-500":s==="danger"?"bg-red-500":"bg-muted-foreground";return n.jsxs("div",{className:"rounded-md border border-border bg-card px-3 py-2",children:[n.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:e}),n.jsxs("div",{className:"mt-1 flex items-center gap-1.5 text-[12px] font-medium",children:[n.jsx("span",{className:`size-1.5 rounded-full ${i}`}),t]})]})}function vC({meta:e,text:t,href:s}){return n.jsxs("a",{className:"block rounded border border-border bg-card px-2.5 py-2 text-[12px] transition-colors hover:bg-muted/60",href:s,rel:"noopener noreferrer",target:"_blank",children:[n.jsxs("span",{className:"mb-1 flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[n.jsx(Sa,{className:"size-3"}),e]}),n.jsx("span",{className:"line-clamp-2 whitespace-pre-wrap",children:t})]})}function Y4(e,t){return e.state!=="open"?e.state:e.draft?"draft":e.mergeable===!1?"blocked":t?.state==="failure"||t?.state==="error"?"checks failing":t?.state==="pending"?"checks pending":e.mergeable===!0?"ready":"unknown"}function LJ(e,t){const s=Y4(e,t);return s==="ready"?"success":s==="blocked"||s==="checks failing"?"danger":s==="draft"||s==="checks pending"?"warning":"muted"}function X4(e){return e.some(t=>t.state==="CHANGES_REQUESTED")?"changes requested":e.some(t=>t.state==="APPROVED")?"approved":e.some(t=>t.state==="COMMENTED")?"commented":"no reviews"}function OJ(e){const t=X4(e);return t==="approved"?"success":t==="changes requested"?"danger":t==="commented"?"warning":"muted"}function zJ({pr:e}){const{label:t,dot:s}=e.state==="merged"?{label:"Merged",dot:"bg-violet-500"}:e.state==="closed"?{label:"Closed",dot:"bg-red-500"}:e.draft?{label:"Draft",dot:"bg-muted-foreground"}:{label:"Open",dot:"bg-emerald-500"};return n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[n.jsx("span",{className:`size-1.5 rounded-full ${s}`}),t==="Merged"?n.jsx(Yh,{className:"size-3"}):t==="Open"?n.jsx(Df,{className:"size-3"}):n.jsx(vl,{className:"size-3"}),t]})}function Z4({label:e}){return n.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5 text-[10px] font-medium text-muted-foreground",title:e.name,children:[n.jsx("span",{className:"size-2 shrink-0 rounded-sm",style:{backgroundColor:`#${e.color}`}}),n.jsx("span",{className:"truncate",children:e.name})]})}function BJ({issues:e,loading:t,loadingMore:s,hasMore:i,error:a,selectedNumber:l,onSelect:c,onLoadMore:h}){return t&&e.length===0?n.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading issues…"}):a?n.jsx("div",{className:"p-4 text-[12px] text-red-500",children:a}):e.length===0?n.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No issues found."}):n.jsxs(n.Fragment,{children:[n.jsx("ul",{className:"divide-y divide-border",children:e.map(f=>n.jsx("li",{children:n.jsxs("button",{className:`flex w-full items-start gap-3 px-3 py-2.5 text-left transition-colors hover:bg-muted/60 ${l===f.number?"bg-muted":""}`,onClick:()=>c(f.number),type:"button",children:[n.jsx(YR,{className:`mt-0.5 size-4 shrink-0 ${f.state==="open"?"text-emerald-500":"text-red-500"}`}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-[13px] font-medium",children:f.title}),n.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["#",f.number," · ",f.user.login," · ",f.comments," comment",f.comments!==1?"s":""]})]}),f.labels.length>0?n.jsx("span",{className:"flex max-w-40 shrink-0 flex-wrap justify-end gap-x-2 gap-y-0.5",children:f.labels.slice(0,3).map(d=>n.jsx(Z4,{label:d},d.name))}):null]})},f.number))}),n.jsx(Kv,{hasMore:i,loading:s,onLoadMore:h})]})}const Ah=6,PJ=6,IJ=8;function $J(e,t,s,i){const a=Math.max(0,Math.min(PJ,e/2,t/2)),l=Math.max(0,Math.min(IJ,s-a,i-a));return[`M ${a} 0`,`H ${e-a}`,`A ${a} ${a} 0 0 1 ${e} ${a}`,`V ${t-i-a}`,`A ${a} ${a} 0 0 1 ${e-a} ${t-i}`,`H ${e-s+l}`,`A ${l} ${l} 0 0 0 ${e-s} ${t-i+l}`,`V ${t-a}`,`A ${a} ${a} 0 0 1 ${e-s-a} ${t}`,`H ${a}`,`A ${a} ${a} 0 0 1 0 ${t-a}`,`V ${a}`,`A ${a} ${a} 0 0 1 ${a} 0`,"Z"].join(" ")}function HJ({value:e,onChange:t,placeholder:s,rows:i=3,action:a}){const l=y.useRef(null),c=y.useRef(null),[h,f]=y.useState(null),[d,p]=y.useState({w:0,h:0});y.useLayoutEffect(()=>{const b=l.current,v=c.current;if(!b||!v)return;const w=()=>{f({w:b.clientWidth,h:b.clientHeight}),p({w:v.offsetWidth+Ah*2,h:v.offsetHeight+Ah*2})};w();const k=new ResizeObserver(w);return k.observe(b),k.observe(v),()=>k.disconnect()},[]);const g=h&&d.w&&d.h?$J(h.w,h.h,d.w,d.h):null;return n.jsxs("div",{className:"relative",ref:l,children:[n.jsx("textarea",{className:"peer block w-full resize-none bg-background px-3 pt-2 font-mono text-[12px] placeholder:text-muted-foreground focus:outline-none",onChange:b=>t(b.target.value),placeholder:s,rows:i,style:{clipPath:g?`path('${g}')`:void 0,paddingBottom:d.h||44},value:e}),h&&g?n.jsxs("svg",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 overflow-visible text-border transition-colors peer-focus:text-foreground/40",fill:"none",height:h.h,viewBox:`0 0 ${h.w} ${h.h}`,width:h.w,children:[n.jsx("title",{children:"Comment field border"}),n.jsx("path",{d:g,stroke:"currentColor",strokeWidth:1})]}):null,n.jsx("div",{className:"absolute",ref:c,style:{bottom:Ah,right:Ah},children:a})]})}function UJ({issue:e,comments:t,commentsLoading:s,commentError:i,submitting:a,onAddComment:l}){const[c,h]=y.useState(""),[f,d]=y.useState(!1),{sendToAgent:p}=Dt();y.useEffect(()=>{d(!1)},[e?.number]);function g(v){e&&(d(!1),p({prompt:XH(e,v),source:{type:"github-issue",label:`Issue #${e.number}`},label:`Issue #${e.number}: ${v}`}))}if(!e)return n.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Select an issue"});async function b(v){v.preventDefault();const w=c.trim();w&&(await l(w),h(""))}return n.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[n.jsxs("div",{className:"group flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[n.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-semibold",children:e.title}),n.jsx(er,{className:ae("shrink-0",f&&"opacity-100"),label:`Ask AI about issue #${e.number}`,onAsk:()=>d(v=>!v)}),n.jsx("a",{"aria-label":"Open on GitHub",className:"shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",href:e.html_url,rel:"noopener noreferrer",target:"_blank",children:n.jsx(Sa,{className:"size-3.5"})})]}),f?n.jsx("div",{className:"shrink-0 border-b border-border px-3 py-1.5",children:n.jsx(Lr,{placeholder:"What should the agent do with this issue? (summarize, draft a fix plan, reproduce…)",onSubmit:g,onCancel:()=>d(!1)})}):null,n.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:n.jsxs("div",{className:"space-y-3 p-4",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[12px]",children:[n.jsxs("span",{className:"text-[11px]",children:[n.jsx("span",{className:"text-muted-foreground",children:"Author: "}),n.jsx("span",{className:"font-medium",children:e.user.login})]}),n.jsxs("span",{className:"text-[11px]",children:[n.jsx("span",{className:"text-muted-foreground",children:"Opened: "}),n.jsx("span",{className:"font-medium",children:new Date(e.created_at).toLocaleDateString()})]}),e.labels.map(v=>n.jsx(Z4,{label:v},v.name))]}),e.body?n.jsx(K4,{body:e.body}):n.jsx("p",{className:"text-[12px] text-muted-foreground italic",children:"No description provided."}),s?n.jsx(om,{className:"justify-start",label:"Loading comments…"}):n.jsx("div",{className:"space-y-2",children:t.map(v=>n.jsxs("div",{className:"rounded-md border border-border bg-muted/20 p-3",children:[n.jsxs("div",{className:"mb-1 flex items-baseline gap-2",children:[n.jsx("span",{className:"text-[11px] font-semibold",children:v.user.login}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:new Date(v.created_at).toLocaleDateString()})]}),n.jsx(Fv,{content:v.body})]},v.id))})]})}),n.jsx("div",{className:"shrink-0 border-t border-border p-3",children:n.jsxs("form",{className:"flex flex-col gap-2",onSubmit:v=>{b(v)},children:[n.jsx(HJ,{action:n.jsx(Z,{disabled:!c.trim()||a,size:"sm",type:"submit",children:a?n.jsxs(n.Fragment,{children:[n.jsx(Wv,{size:"sm"})," Posting…"]}):"Comment"}),onChange:h,placeholder:"Add a comment…",value:c}),i?n.jsx(Je,{variant:"destructive",children:i}):null]})})]})}const yC=30,FJ=4e3;function qJ(e){return e.status==="in_progress"||e.status==="queued"}function _C(e){return e.map(t=>`${t.id}:${t.status}:${t.conclusion}`).join("|")}function wC(e){return e.map(t=>`${t.id}:${t.status}:${t.conclusion}:`+t.steps.map(s=>`${s.number}:${s.status}:${s.conclusion}`).join(",")).join("|")}function GJ(e,t){if(e.length===0)return t;const s=new Map(t.map(c=>[c.id,c])),i=new Set(e.map(c=>c.id)),a=t.filter(c=>!i.has(c.id)),l=e.map(c=>s.get(c.id)??c);return[...a,...l]}function VJ(e){const[t,s]=y.useState([]),[i,a]=y.useState(null),[l,c]=y.useState([]),[h,f]=y.useState(!0),[d,p]=y.useState(!1),[g,b]=y.useState(!1),[v,w]=y.useState(1),[k,N]=y.useState(!1),[E,T]=y.useState(null),[A,C]=y.useState(null);function R(){let P=!0;return f(!0),T(null),w(1),Th(e,1).then(D=>{P&&(s(D),b(D.length===yC))}).catch(D=>{P&&T(D instanceof Error?D.message:String(D))}).finally(()=>{P&&f(!1)}),()=>{P=!1}}function L(){if(d||!g)return;const P=v+1;p(!0),Th(e,P).then(D=>{s(G=>{const $=new Set(G.map(O=>O.id));return[...G,...D.filter(O=>!$.has(O.id))]}),b(D.length===yC),w(P)}).catch(D=>T(D instanceof Error?D.message:String(D))).finally(()=>p(!1))}const H=y.useCallback(()=>{Th(e,1).then(P=>s(D=>{const G=GJ(D,P);return _C(D)===_C(G)?D:G})).catch(()=>{}),i&&Jw(i).then(P=>c(D=>wC(D)===wC(P)?D:P)).catch(()=>{})},[e,i]);y.useEffect(R,[e]),y.useEffect(()=>{a(P=>P&&t.some(D=>D.id===P)?P:t[0]?.id??null)},[t]),y.useEffect(()=>{if(!i){c([]);return}let P=!0;return N(!0),C(null),Jw(i).then(D=>{P&&c(D)}).catch(D=>{P&&C(D instanceof Error?D.message:String(D))}).finally(()=>{P&&N(!1)}),()=>{P=!1}},[i]);const B=t.some(qJ);return y.useEffect(()=>{if(!B)return;const P=window.setInterval(()=>{document.visibilityState==="visible"&&H()},FJ);return()=>window.clearInterval(P)},[B,H]),{runs:t,selectedRunId:i,jobs:l,loading:h,loadingMore:d,hasMore:g,jobsLoading:k,error:E,jobsError:A,loadMore:L,refresh:R,syncLatest:H,setSelectedRunId:a}}function Q4(e){return e.conclusion==="failure"||e.conclusion==="timed_out"||e.conclusion==="cancelled"}function WJ({branch:e,onClearBranch:t}){const{runs:s,selectedRunId:i,jobs:a,loading:l,loadingMore:c,hasMore:h,jobsLoading:f,error:d,jobsError:p,loadMore:g,refresh:b,syncLatest:v,setSelectedRunId:w}=VJ(e);jl(v);const k=s.find(C=>C.id===i)??null,{sendToAgent:N}=Dt(),[E,T]=y.useState(null);function A(C,R){T(null),N({prompt:ZH(C,R),source:{type:"github-run",label:`Run #${C.run_number}`},label:`Run #${C.run_number}: ${R??"fix failing run"}`})}return n.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("h2",{className:"text-[13px] font-semibold",children:"Workflow Runs"}),e?n.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground",children:[n.jsx("span",{className:"shrink-0",children:"Filtered to"}),n.jsx("span",{className:"min-w-0 truncate font-mono",children:e}),t?n.jsx("button",{"aria-label":"Clear branch filter",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:t,title:"Clear branch filter",type:"button",children:n.jsx(qt,{className:"size-3"})}):null]}):null]}),n.jsxs(Z,{disabled:l,onClick:()=>{b()},size:"sm",type:"button",variant:"outline",children:[n.jsx(Dr,{className:`mr-1 size-3.5 ${l?"animate-spin":""}`}),"Refresh"]})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:d?n.jsx("div",{className:"p-4 text-[12px] text-red-500",children:d}):l&&s.length===0?n.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading workflow runs…"}):s.length===0?n.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No workflow runs found."}):n.jsxs("div",{className:"grid h-full min-h-0 grid-cols-[minmax(280px,380px)_minmax(0,1fr)] divide-x divide-border",children:[n.jsxs("div",{className:"min-h-0 overflow-auto",children:[n.jsx("ul",{className:"divide-y divide-border",children:s.map(C=>n.jsxs("li",{className:"group flex flex-col",children:[n.jsxs("div",{className:`flex items-center transition-colors hover:bg-muted/60 ${C.id===i?"bg-muted/70":""}`,children:[n.jsxs("button",{className:"flex min-w-0 flex-1 items-center gap-3 px-3 py-2.5 text-left",onClick:()=>w(C.id),type:"button",children:[n.jsx(KJ,{run:C}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-[13px] font-medium",children:C.name}),n.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["#",C.run_number," · ",C.head_branch," · ",C.event," ·"," ",n.jsx("span",{title:new Date(C.created_at).toLocaleString(),children:HE(C.created_at)})]})]}),n.jsx(YJ,{run:C})]}),Q4(C)?n.jsx(er,{className:`mr-2 shrink-0 ${E===C.id?"opacity-100":""}`,label:`Fix failing run #${C.run_number} with AI`,onAsk:()=>T(R=>R===C.id?null:C.id)}):null]}),E===C.id?n.jsx("div",{className:"px-3 pb-2 pt-0.5",children:n.jsx(Lr,{onCancel:()=>T(null),onSubmit:R=>A(C,R),placeholder:"What should the agent do? (fix it, explain the failure, find the broken step…)"})}):null]},C.id))}),n.jsx(Kv,{hasMore:h,loading:c,onLoadMore:g})]}),n.jsx(XJ,{error:p,jobs:a,loading:f,onFix:C=>A(C),run:k})]})})]})}function KJ({run:e}){return e.status==="in_progress"||e.status==="queued"?n.jsx(vl,{className:"size-4 shrink-0 animate-pulse text-amber-400"}):e.conclusion==="success"?n.jsx(Df,{className:"size-4 shrink-0 text-emerald-500"}):e.conclusion==="failure"||e.conclusion==="timed_out"?n.jsx(E0,{className:"size-4 shrink-0 text-red-500"}):n.jsx(vl,{className:"size-4 shrink-0 text-zinc-400"})}function YJ({run:e}){const t=e.status==="completed"?e.conclusion??"completed":e.status,s=t==="success"?"bg-emerald-500":t==="failure"||t==="timed_out"?"bg-red-500":t==="in_progress"||t==="queued"?"bg-amber-500":"bg-muted-foreground";return n.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1.5 text-[10px] font-medium text-muted-foreground",children:[n.jsx("span",{className:`size-1.5 rounded-full ${s}`}),t]})}function XJ({run:e,jobs:t,loading:s,error:i,onFix:a}){return e?n.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[n.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-[13px] font-semibold",children:e.name}),n.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["Run #",e.run_number," · ",e.head_branch," · ",e.head_sha.slice(0,7)]})]}),Q4(e)?n.jsxs(Z,{className:"shrink-0 gap-1",onClick:()=>a(e),size:"sm",title:"Send this failing run to the agent to investigate and fix",type:"button",variant:"outline",children:[n.jsx(Yt,{className:"size-3.5"}),"Fix with AI"]}):null,n.jsx("a",{"aria-label":"Open run on GitHub",className:"shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",href:e.html_url,rel:"noopener noreferrer",target:"_blank",title:"Open run on GitHub",children:n.jsx(Sa,{className:"size-3.5"})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:i?n.jsx("div",{className:"p-4 text-[12px] text-red-500",children:i}):s?n.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading jobs…"}):t.length===0?n.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No jobs found for this run."}):n.jsx("ul",{className:"divide-y divide-border",children:t.map(l=>n.jsxs("li",{className:"px-3 py-3",children:[n.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[n.jsx(SC,{item:l}),n.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium",children:l.name}),n.jsx("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground",children:kC(l.started_at,l.completed_at)}),n.jsx("a",{"aria-label":`Open ${l.name} job on GitHub`,className:"shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",href:l.html_url,rel:"noopener noreferrer",target:"_blank",title:"Open job on GitHub",children:n.jsx(Sa,{className:"size-3.5"})})]}),l.steps.length?n.jsx("ol",{className:"space-y-1.5 pl-6",children:l.steps.map(c=>n.jsxs("li",{className:"flex items-center gap-2 text-[12px]",children:[n.jsx(SC,{item:c}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:c.name}),n.jsx("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground",children:kC(c.started_at,c.completed_at)})]},`${l.id}:${c.number}`))}):n.jsx("p",{className:"pl-6 text-[12px] text-muted-foreground",children:"No step details available."})]},l.id))})})]}):n.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Select a workflow run"})}function SC({item:e}){return e.status==="in_progress"||e.status==="queued"?n.jsx(vl,{className:"size-3.5 shrink-0 animate-pulse text-amber-400"}):e.conclusion==="success"||e.conclusion==="skipped"?n.jsx(Df,{className:"size-3.5 shrink-0 text-emerald-500"}):e.conclusion==="failure"||e.conclusion==="timed_out"||e.conclusion==="cancelled"?n.jsx(E0,{className:"size-3.5 shrink-0 text-red-500"}):n.jsx(vl,{className:"size-3.5 shrink-0 text-zinc-400"})}function kC(e,t){if(!e)return"-";const s=Date.parse(e),i=t?Date.parse(t):Date.now();if(!Number.isFinite(s)||!Number.isFinite(i)||i<s)return"-";const a=Math.max(0,Math.round((i-s)/1e3));if(a<60)return`${a}s`;const l=Math.floor(a/60),c=a%60;return c?`${l}m ${c}s`:`${l}m`}function ZJ({onCreatePR:e,onViewRuns:t}){const[s,i]=y.useState(null),[a,l]=y.useState(!0),[c,h]=y.useState(null);function f(){let p=!0;return l(!0),h(null),UL().then(g=>{p&&i(g)}).catch(g=>{p&&h(g instanceof Error?g.message:String(g))}).finally(()=>{p&&l(!1)}),()=>{p=!1}}y.useEffect(f,[]),jl(()=>{f()});const d=y.useMemo(()=>[...s?.branches??[]].sort((g,b)=>{const v=CC(g,s),w=CC(b,s);return v-w||g.name.localeCompare(b.name)}),[s]);return n.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("h2",{className:"text-[13px] font-semibold",children:"Branches"}),n.jsx("p",{className:"truncate text-[11px] text-muted-foreground",children:s?.repository.full_name??"Selected repository"})]}),n.jsxs(Z,{disabled:a,onClick:()=>{f()},size:"sm",type:"button",variant:"outline",children:[n.jsx(Dr,{className:`mr-1 size-3.5 ${a?"animate-spin":""}`}),"Refresh"]})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:c?n.jsx("div",{className:"p-4 text-[12px] text-red-500",children:c}):a&&!s?n.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading branches..."}):d.length===0?n.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No branches found."}):n.jsx("ul",{className:"divide-y divide-border",children:d.map(p=>n.jsx(QJ,{branch:p,currentBranch:s?.currentBranch??null,defaultBranch:s?.defaultBranch??null,onCreatePR:e,onViewRuns:t},p.name))})})]})}function QJ({branch:e,defaultBranch:t,currentBranch:s,onCreatePR:i,onViewRuns:a}){const l=e.name===t,c=e.name===s,h=!l;return n.jsxs("li",{className:"flex flex-wrap items-center gap-3 px-3 py-2.5",children:[n.jsx(Mn,{className:"size-4 shrink-0 text-muted-foreground"}),n.jsxs("div",{className:"min-w-48 flex-1",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.jsx("span",{className:"truncate font-mono text-[13px] font-medium",children:e.name}),l?n.jsx(NC,{label:"Default",tone:"success"}):null,c?n.jsx(NC,{label:"Current",tone:"warning"}):null,e.protected?n.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 text-[10px] text-muted-foreground",children:[n.jsx(JC,{className:"size-3"}),"protected"]}):null]}),n.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-muted-foreground",children:e.commit.sha.slice(0,7)})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[n.jsxs(Z,{onClick:()=>a(e.name),size:"sm",title:`View workflow runs for ${e.name}`,type:"button",variant:"outline",children:[n.jsx(ZR,{className:"size-3.5"}),"View runs"]}),n.jsxs(Z,{disabled:!h,onClick:()=>i(e.name),size:"sm",title:h?`Open PR from ${e.name}`:"Default branch does not need a PR",type:"button",variant:"outline",children:[n.jsx(FC,{className:"size-3.5"}),"Open PR"]})]})]})}function NC({label:e,tone:t}){const s=t==="success"?"bg-emerald-500":"bg-amber-500";return n.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 text-[10px] text-muted-foreground",children:[n.jsx("span",{className:`size-1.5 rounded-full ${s}`}),e]})}function CC(e,t){return e.name===t?.currentBranch?0:e.name===t?.defaultBranch?1:e.protected?2:3}function JJ(){const e=kJ();let t;return e.loading||e.status==="checking"?t=n.jsx(om,{fill:!0,label:"Loading…"}):e.status==="not_configured"?t=n.jsx(W4,{deviceFlowAvailable:e.deviceFlowAvailable,onSaved:e.refresh}):e.status==="auth_error"||e.status==="connection_error"?t=n.jsx(eee,{token:e}):t=n.jsx(tee,{token:e}),n.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:t})}function eee({token:e}){const[t,s]=y.useState(null);if(t)return n.jsx(W4,{deviceFlowAvailable:e.deviceFlowAvailable,initialMode:t,onSaved:e.refresh});const i=e.status==="auth_error";return n.jsx("div",{className:"flex h-full items-center justify-center p-8",children:n.jsxs("div",{className:"w-full max-w-lg space-y-4 rounded-md border border-border bg-card p-5",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(em,{className:"size-5"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("h2",{className:"text-sm font-semibold",children:"GitHub connection failed"}),n.jsx("p",{className:"text-[12px] text-muted-foreground",children:i?"The saved GitHub token is no longer accepted.":"NoMoreIDE could not validate the GitHub connection."})]}),n.jsx(J4,{label:i?"Needs re-login":"Connection problem",tone:i?"danger":"warning"})]}),e.error?n.jsx(Je,{variant:"destructive",children:e.error}):null,n.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.jsxs(Z,{onClick:e.refresh,type:"button",variant:i?"outline":"default",children:[n.jsx(Dr,{}),"Refresh"]}),n.jsx(Z,{onClick:()=>s(e.deviceFlowAvailable?"device-pending":"pat"),type:"button",variant:i?"default":"outline",children:"Reconnect GitHub"}),n.jsx(Z,{onClick:()=>s("pat"),type:"button",variant:"outline",children:"Use token instead"})]})]})})}function tee({token:e}){const[t,s]=gl("github:tab","prs"),[i,a]=gl("github:pr-state","open"),[l,c]=gl("github:issue-state","open"),[h,f]=y.useState(null),[d,p]=y.useState(null),[g,b]=y.useState(!1),[v,w]=y.useState(null),k=NJ(i),N=CJ(l);jl(()=>{t==="prs"?k.refresh():t==="issues"&&N.refresh()});const E=C=>`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${C?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,T=C=>`rounded px-2 py-0.5 text-[10px] font-medium transition-colors ${C?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`;async function A(){b(!0),w(null);try{await HL("github.com"),e.refresh()}catch(C){w(C instanceof Error?C.message:String(C))}finally{b(!1)}}return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card/95 px-3 py-1",children:[n.jsx("button",{className:E(t==="prs"),onClick:()=>s("prs"),type:"button",children:"Pull Requests"}),n.jsx("button",{className:E(t==="issues"),onClick:()=>s("issues"),type:"button",children:"Issues"}),n.jsx("button",{className:E(t==="branches"),onClick:()=>s("branches"),type:"button",children:"Branches"}),n.jsx("button",{className:E(t==="actions"),onClick:()=>s("actions"),type:"button",children:"Actions"}),n.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-2",children:[n.jsx(see,{token:e}),n.jsxs(Z,{onClick:e.refresh,size:"sm",title:"Re-check the GitHub connection",type:"button",variant:"outline",children:[n.jsx(Dr,{}),"Reconnect"]}),n.jsx(Z,{disabled:g,onClick:()=>{A()},size:"sm",type:"button",variant:"outline",children:g?"Disconnecting…":"Disconnect"})]}),t==="prs"?n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5",children:[n.jsx("button",{className:T(i==="open"),onClick:()=>a("open"),type:"button",children:"Open"}),n.jsx("button",{className:T(i==="closed"),onClick:()=>a("closed"),type:"button",children:"Closed"})]}),n.jsx(Z,{onClick:()=>f(""),size:"sm",type:"button",variant:"outline",children:"New PR"})]}):t==="issues"?n.jsxs("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5",children:[n.jsx("button",{className:T(l==="open"),onClick:()=>c("open"),type:"button",children:"Open"}),n.jsx("button",{className:T(l==="closed"),onClick:()=>c("closed"),type:"button",children:"Closed"})]}):null]}),v?n.jsx(Je,{variant:"destructive",className:"m-3",children:v}):null,h!==null?n.jsx(nee,{initialHead:h,onCreated:C=>{f(null),s("prs"),k.setSelectedNumber(C.number),k.refresh()},onCancel:()=>f(null)}):n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:t==="prs"?n.jsxs("div",{className:"grid h-full min-h-0 grid-cols-[minmax(0,1fr)_minmax(0,2fr)] divide-x divide-border",children:[n.jsx("div",{className:"min-h-0 overflow-auto",children:n.jsx(AJ,{error:k.error,hasMore:k.hasMore,loading:k.loading,loadingMore:k.loadingMore,onLoadMore:k.loadMore,onSelect:k.setSelectedNumber,prs:k.prs,selectedNumber:k.selectedNumber})}),n.jsx("div",{className:"flex min-h-0 min-w-0 flex-col overflow-hidden",children:n.jsx(RJ,{diff:k.diff,diffError:k.diffError,diffLoading:k.diffLoading,onMerged:()=>k.refresh(),pr:k.selectedPR})})]}):t==="issues"?n.jsxs("div",{className:"grid h-full min-h-0 grid-cols-[minmax(0,1fr)_minmax(0,2fr)] divide-x divide-border",children:[n.jsx("div",{className:"min-h-0 overflow-auto",children:n.jsx(BJ,{error:N.error,hasMore:N.hasMore,issues:N.issues,loading:N.loading,loadingMore:N.loadingMore,onLoadMore:N.loadMore,onSelect:N.setSelectedNumber,selectedNumber:N.selectedNumber})}),n.jsx("div",{className:"flex min-h-0 min-w-0 flex-col overflow-hidden",children:n.jsx(UJ,{commentError:N.commentError,comments:N.comments,commentsLoading:N.commentsLoading,issue:N.selectedIssue,onAddComment:N.addComment,submitting:N.submitting})})]}):t==="branches"?n.jsx(ZJ,{onCreatePR:C=>f(C),onViewRuns:C=>{p(C),s("actions")}}):n.jsx(WJ,{branch:d??void 0,onClearBranch:()=>p(null)})})]})}function see({token:e}){const t=e.info?.repository?.full_name??(e.info?.user?`@${e.info.user.login}`:"GitHub");return n.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 border-r border-border pr-2",children:[n.jsx(em,{className:"size-4 shrink-0 text-foreground"}),n.jsx(J4,{label:"Connected",tone:"success"}),n.jsx("span",{className:"max-w-48 truncate font-mono text-[10px] text-muted-foreground",children:t})]})}function J4({label:e,tone:t}){const s=t==="success"?"bg-emerald-500":t==="danger"?"bg-red-500":"bg-amber-500";return n.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[n.jsx("span",{className:`size-1.5 rounded-full ${s}`}),e]})}function nee({initialHead:e,onCreated:t,onCancel:s}){const[i,a]=y.useState(""),[l,c]=y.useState(""),[h,f]=y.useState(""),[d,p]=y.useState("main"),[g,b]=y.useState(!1),[v,w]=y.useState(null),[k,N]=y.useState(!0),[E,T]=y.useState(!1),[A,C]=y.useState(null);y.useEffect(()=>{let B=!0;return N(!0),C(null),VL().then(P=>{B&&(w(P),a(P.title),c(P.body),f(e||P.head),p(P.base||P.suggestedBase||"main"),b(P.draft))}).catch(P=>{B&&C(P instanceof Error?P.message:String(P))}).finally(()=>{B&&N(!1)}),()=>{B=!1}},[e]);async function R(B){if(B.preventDefault(),!(!i.trim()||!h.trim()||!d.trim())){T(!0),C(null);try{const P=await WL({title:i.trim(),body:l.trim()||void 0,head:h.trim(),base:d.trim(),draft:g});t(P)}catch(P){C(P instanceof Error?P.message:String(P))}finally{T(!1)}}}const L="w-full rounded-md border border-border bg-background px-3 py-2 text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring",H=v?.warnings??[];return n.jsxs("form",{className:"flex min-h-0 flex-col gap-3 overflow-auto bg-muted/20 p-4",onSubmit:B=>{R(B)},children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("h3",{className:"text-[13px] font-semibold",children:"Branch to PR Assistant"}),n.jsxs("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:[v?.repository?.full_name??"Selected repository",v?.currentBranch?` - ${v.currentBranch}`:""]})]}),n.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground",children:k?"Detecting branch...":"Editable draft"})]}),n.jsx(iee,{template:v,loading:k}),H.length>0?n.jsx("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[12px] text-amber-700 dark:text-amber-300",children:H[0]}):null,n.jsx("input",{className:L,disabled:k,onChange:B=>a(B.target.value),placeholder:"Title",required:!0,value:i}),n.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[n.jsxs("label",{className:"space-y-1",children:[n.jsx("span",{className:"text-[10px] uppercase text-muted-foreground",children:"Head"}),n.jsx("input",{className:L,disabled:k,onChange:B=>f(B.target.value),placeholder:"Head branch",required:!0,value:h})]}),n.jsxs("label",{className:"space-y-1",children:[n.jsx("span",{className:"text-[10px] uppercase text-muted-foreground",children:"Base"}),n.jsx("input",{className:L,disabled:k,onChange:B=>p(B.target.value),placeholder:"Base branch",required:!0,value:d})]})]}),n.jsx("textarea",{className:`${L} resize-none`,disabled:k,onChange:B=>c(B.target.value),placeholder:"Description (optional)",rows:7,value:l}),n.jsxs("label",{className:"flex items-center gap-2 text-[12px]",children:[n.jsx("input",{checked:g,className:"size-3.5",disabled:k,onChange:B=>b(B.target.checked),type:"checkbox"}),"Create as draft"]}),A?n.jsx(Je,{variant:"destructive",children:A}):null,n.jsxs("div",{className:"flex gap-2",children:[n.jsx(Z,{disabled:k||E||!i.trim()||!h.trim()||!d.trim(),type:"submit",children:E?"Creating…":"Create PR"}),n.jsx(Z,{onClick:s,type:"button",variant:"outline",children:"Cancel"})]})]})}function iee({template:e,loading:t}){const s=e?.compare,i=s?.ciStatus,a=[{label:"base branch",value:s?.base||e?.base||"main"},{label:"head branch",value:s?.head||e?.head||"manual"},{label:"commits ahead",value:t?"...":String(s?.aheadBy??0)},{label:"changed files",value:t?"...":String(s?.files.length??0)},{label:"head CI",value:i?`${i.state} (${i.totalCount})`:"unavailable"}];return n.jsxs("div",{className:"rounded-md border border-border bg-card px-3 py-2",children:[n.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[n.jsx("span",{className:"text-[11px] font-medium text-foreground",children:"Compare summary"}),s?.headSha?n.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:s.headSha.slice(0,7)}):null]}),n.jsx("div",{className:"grid grid-cols-5 gap-2",children:a.map(l=>n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"truncate text-[10px] uppercase text-muted-foreground",children:l.label}),n.jsx("div",{className:"truncate font-mono text-[11px] text-foreground",children:l.value})]},l.label))}),s?.files.length?n.jsx("div",{className:"mt-2 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted-foreground",children:s.files.slice(0,4).map(l=>n.jsxs("span",{className:"max-w-52 truncate",children:[l.status," ",l.path]},`${l.status}:${l.path}`))}):null]})}function ree({data:e,docked:t,scopeAll:s,onScopeChange:i,onRefresh:a,onClose:l,onManage:c}){const{error:h,success:f}=hs(),d=e.git.selectedRepository;async function p(w){l();try{await bE(w),i(!1),await a(),f(`Switched to ${w}.`)}catch(k){h(k instanceof Error?k.message:String(k))}}function g(){l(),i(!0),f("Showing all projects.")}const b=w=>ae("grid h-8 grid-cols-[48px_minmax(0,1fr)] items-center overflow-hidden rounded-md text-left transition-[background-color,width] duration-150 hover:bg-muted",t?"w-full":"w-12 group-hover/sidebar:w-full",w&&"bg-muted/60"),v=ae("flex min-w-0 items-center gap-2 overflow-hidden whitespace-pre pr-2 text-xs transition duration-150",t?"translate-x-1 opacity-100":"opacity-0 group-hover/sidebar:translate-x-1 group-hover/sidebar:opacity-100");return n.jsxs("div",{className:"mt-1 grid gap-0.5",children:[n.jsxs("button",{className:b(s),onClick:g,title:"All projects",type:"button",children:[n.jsx("span",{className:"flex h-8 w-12 items-center justify-center",children:n.jsx(Kh,{className:"size-4 text-muted-foreground"})}),n.jsxs("span",{className:v,children:[n.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:"All projects"}),s?n.jsx(Ws,{className:"size-3.5 shrink-0"}):null]})]}),e.config.gitRepositories.map(w=>{const k=!s&&w.name===d?.name;return n.jsxs("button",{className:b(k),onClick:()=>{p(w.name)},title:w.path,type:"button",children:[n.jsx("span",{className:"flex h-8 w-12 items-center justify-center",children:n.jsx(Tf,{className:"size-4 text-muted-foreground"})}),n.jsxs("span",{className:v,children:[n.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:w.name}),k?n.jsx(Ws,{className:"size-3.5 shrink-0"}):null]})]},w.name)}),n.jsxs("button",{className:ae("grid h-8 grid-cols-[48px_minmax(0,1fr)] items-center overflow-hidden rounded-md text-left text-muted-foreground transition-[background-color,color,width] duration-150 hover:bg-muted hover:text-foreground",t?"w-full":"w-12 group-hover/sidebar:w-full"),onClick:()=>{l(),c()},title:"Add or manage projects",type:"button",children:[n.jsx("span",{className:"flex h-8 w-12 items-center justify-center",children:n.jsx(R0,{className:"size-4"})}),n.jsx("span",{className:v,children:n.jsx("span",{className:"min-w-0 flex-1 truncate",children:"Add or manage projects…"})})]})]})}function aee({data:e,docked:t,scopeAll:s,onScopeChange:i,onRefresh:a}){const[l,c]=y.useState(!1),[h,f]=y.useState(!1),d=e.git.selectedRepository,p=s?"All projects":d?.name??"Pick a project",g=e.config.gitRepositories.length,b=s?`${g} project${g===1?"":"s"}`:d?e.git.status?.branch??d.path:"set the context";return n.jsxs(n.Fragment,{children:[n.jsxs("button",{"aria-label":`Project scope: ${p}`,className:ae("relative grid h-11 grid-cols-[48px_minmax(0,1fr)] items-center overflow-hidden rounded-md text-left transition-[background-color,width] duration-150 hover:bg-muted",t?"w-full":"w-12 group-hover/sidebar:w-full"),"aria-expanded":l,onClick:()=>c(v=>!v),title:`Project scope: ${p}`,type:"button",children:[n.jsx("span",{className:"flex h-11 w-12 items-center justify-center",children:n.jsx("span",{className:"flex size-8 items-center justify-center rounded-lg border border-border bg-background text-[13px] font-semibold text-foreground",children:s?n.jsx(Kh,{className:"size-4 text-muted-foreground"}):d?p.charAt(0).toUpperCase():n.jsx(Tf,{className:"size-4 text-muted-foreground"})})}),n.jsxs("span",{className:ae("min-w-0 overflow-hidden whitespace-pre pr-8 transition duration-150",t?"translate-x-1 opacity-100":"opacity-0 group-hover/sidebar:translate-x-1 group-hover/sidebar:opacity-100"),children:[n.jsx("span",{className:"block truncate text-[13px] font-semibold leading-tight",children:p}),n.jsx("span",{className:"block truncate text-[10px] leading-tight text-muted-foreground",children:b})]}),n.jsx(Jn,{className:ae("absolute right-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground transition-[opacity,transform] duration-150",t?"opacity-100":"opacity-0 group-hover/sidebar:opacity-100",l&&"rotate-180")})]}),l?n.jsx(ree,{data:e,docked:t,onClose:()=>c(!1),onManage:()=>f(!0),onRefresh:a,onScopeChange:i,scopeAll:s}):null,h?n.jsx(oee,{data:e,onClose:()=>f(!1),onRefresh:a,onScopeChange:i,scopeAll:s}):null]})}function oee({data:e,onClose:t,onRefresh:s,onScopeChange:i,scopeAll:a}){const[l,c]=y.useState("path"),[h,f]=y.useState(e.git.cwd),[d,p]=y.useState(""),[g,b]=y.useState(!1),[v,w]=y.useState(null),[k,N]=y.useState(!1),[E,T]=y.useState(e.git.cwd),A=e.git.selectedRepository,{error:C,success:R}=hs();async function L($){try{await bE($),i(!1),t(),await s(),R(`Switched to ${$}.`)}catch(O){C(O instanceof Error?O.message:String(O))}}function H(){i(!0),t(),R("Showing all projects.")}async function B($){const O=$.trim();if(!O.startsWith("/")){const V="Please add an absolute path. Paths beginning with ~ are not expanded here.";return w(V),C(V),!1}try{const V=P4(O);return await ML(V,O),w(null),await s(),R(`Added Git project ${V}.`),!0}catch(V){const K=V instanceof Error?V.message:String(V);return w(K),C(K),!1}}async function P($){try{await RL($),await s(),R(`Removed Git project ${$}.`)}catch(O){C(O instanceof Error?O.message:String(O))}}async function D($){$.preventDefault(),await B(h)&&t()}async function G($){$.preventDefault();const O=d.trim();if(O){b(!0),w(null);try{const{name:V}=await DL(O);p(""),await s(),R(`Cloned and added ${V}.`),t()}catch(V){const K=V instanceof Error?V.message:String(V);w(K),C(K)}finally{b(!1)}}}return nr.createPortal(n.jsxs("div",{className:"fixed inset-0 z-[1000] grid place-items-center bg-black/35 px-4",onMouseDown:$=>{$.target===$.currentTarget&&t()},children:[n.jsxs("div",{className:"w-full max-w-md overflow-hidden rounded-xl border border-border bg-card shadow-xl",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-4 py-3",children:[n.jsx(Kh,{className:"size-4 text-muted-foreground"}),n.jsx("div",{className:"text-sm font-semibold",children:"Projects"}),n.jsx(We,{className:"h-5 px-1.5 text-[10px]",variant:"outline",children:e.config.gitRepositories.length}),n.jsx(Z,{"aria-label":"Close project switcher",className:"ml-auto size-7",onClick:t,size:"icon",variant:"ghost",children:n.jsx(qt,{className:"size-4"})})]}),n.jsxs("div",{className:"max-h-80 overflow-auto",children:[n.jsxs("button",{className:ae("grid w-full grid-cols-[1fr_auto] items-center gap-2 border-b border-border px-4 py-2.5 text-left transition-colors hover:bg-muted",a&&"bg-muted/70"),onClick:H,type:"button",children:[n.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[n.jsx(Kh,{className:"size-3.5 shrink-0 text-muted-foreground"}),n.jsxs("span",{className:"min-w-0",children:[n.jsx("span",{className:"block truncate text-sm font-medium leading-tight",children:"All projects"}),n.jsx("span",{className:"block truncate text-[10px] leading-tight text-muted-foreground",children:"Everything the daemon runs, across every repo"})]})]}),a?n.jsx(Ws,{className:"size-3.5"}):n.jsx("span",{className:"size-3.5"})]}),e.config.gitRepositories.length?n.jsx("div",{className:"divide-y divide-border",children:e.config.gitRepositories.map($=>{const O=!a&&$.name===A?.name;return n.jsxs("div",{className:ae("group grid w-full grid-cols-[1fr_auto_auto] items-center gap-2 px-4 py-2 text-left transition-colors hover:bg-muted",O&&"bg-muted/70"),children:[n.jsxs("button",{className:"min-w-0 text-left",onClick:()=>{L($.name)},type:"button",children:[n.jsx("span",{className:"block truncate text-sm font-medium leading-tight",children:$.name}),n.jsx("span",{className:"block truncate font-mono text-[10px] leading-tight text-muted-foreground",children:$.path})]}),O?n.jsx(Ws,{className:"size-3.5"}):n.jsx("span",{className:"size-3.5"}),n.jsx(Z,{"aria-label":`Remove ${$.name}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>{P($.name)},size:"icon",title:`Remove ${$.name}`,type:"button",variant:"ghost",children:n.jsx(Oi,{className:"size-3.5 text-destructive"})})]},$.name)})}):n.jsx("div",{className:"px-4 py-6 text-center text-xs text-muted-foreground",children:"No saved Git projects yet."})]}),n.jsxs("div",{className:"border-t border-border bg-muted/20 p-3",children:[n.jsxs("div",{className:"mb-1.5 flex gap-1 text-[11px]",children:[n.jsxs("button",{className:ae("flex items-center gap-1 rounded px-2 py-0.5 transition-colors",l==="path"?"bg-muted font-medium text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>{c("path"),w(null)},type:"button",children:[n.jsx(xo,{className:"size-3"}),"Local path"]}),n.jsxs("button",{className:ae("flex items-center gap-1 rounded px-2 py-0.5 transition-colors",l==="url"?"bg-muted font-medium text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>{c("url"),w(null)},type:"button",children:[n.jsx(cu,{className:"size-3"}),"Clone URL"]})]}),l==="path"?n.jsxs("form",{className:"flex gap-1.5",onSubmit:D,children:[n.jsx(ft,{"aria-label":"Paste absolute path",className:"h-7 flex-1 px-2 font-mono text-[11px]",onChange:$=>{f($.target.value),w(null)},placeholder:"/absolute/path",value:h}),n.jsxs(Z,{className:"h-7 px-2 text-[11px]",size:"sm",type:"submit",children:[n.jsx(ws,{className:"size-3"}),"Add"]}),n.jsx(Z,{"aria-label":"Browse and add Git project",className:"h-7 px-2",onClick:()=>{w(null),T(e.git.cwd),N(!0)},size:"sm",type:"button",variant:"outline",children:n.jsx(R0,{className:"size-3"})})]}):n.jsxs("form",{className:"flex gap-1.5",onSubmit:G,children:[n.jsx(ft,{"aria-label":"Git remote URL",className:"h-7 flex-1 px-2 font-mono text-[11px]",onChange:$=>{p($.target.value),w(null)},placeholder:"https://… or git@host:owner/repo.git",value:d}),n.jsxs(Z,{className:"h-7 px-2 text-[11px]",disabled:g||!d.trim(),size:"sm",type:"submit",children:[n.jsx(cu,{className:"size-3"}),g?"Cloning…":"Clone"]})]}),v?n.jsx("div",{className:"mt-1.5 truncate text-[10px] text-destructive",children:v}):null,l==="url"?n.jsx("div",{className:"mt-1 text-[10px] text-muted-foreground",children:"Private github.com repos reuse your GitHub login; SSH uses your machine's keys. Clones into ~/.nomoreide/repos."}):null]})]}),k?n.jsx(I4,{confirmLabel:"Add Git project",errorMessage:v,initialPath:e.git.cwd,selectedPath:E,title:"Add Git Project",onCancel:()=>N(!1),onSelect:T,onUse:async()=>{await B(E)&&(N(!1),t())}}):null]}),document.body)}function lee({ahead:e=0,behind:t=0,branches:s,currentBranch:i,disabled:a,onRefresh:l,upstream:c}){const[h,f]=y.useState(!1),[d,p]=y.useState(""),[g,b]=y.useState(null),[v,w]=y.useState(null),[k,N]=y.useState(null),E=s.filter(P=>!P.remote),T=s.filter(P=>P.remote);async function A(P,D){b(P),N(null),w(null);try{await D(),await l()}catch(G){N(G instanceof Error?G.message:String(G))}finally{b(null)}}async function C(P){await A(`switch:${P}`,async()=>{await Mi("/api/git/branches/switch",{name:P}),f(!1)})}async function R(){await A("fetch",async()=>{await Mi("/api/git/fetch",{}),w("Fetched latest branch refs.")})}async function L(){await A("push",async()=>{const P=await Hf();w(P.setUpstream?`Pushed ${P.branch} and set upstream.`:`Pushed ${P.branch}.`)})}const H=!!i&&(e>0||!c&&t===0);async function B(P){P.preventDefault();const D=d.trim();if(!D){N("Branch name is required.");return}await A("create",async()=>{await Mi("/api/git/branches",{name:D}),p(""),f(!1)})}return n.jsxs("div",{className:"fixed bottom-12 right-4 z-50 flex items-end",children:[h?n.jsxs("div",{"aria-label":"Switch Git branch",className:"mb-11 w-[min(460px,calc(100vw-2rem))] rounded-lg border border-border bg-card shadow-xl",role:"dialog",children:[n.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border p-3",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.jsx(Mn,{className:"size-4 text-muted-foreground"}),n.jsx("span",{className:"truncate text-sm font-semibold",children:i||"Branches"})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[H?n.jsxs(Z,{"aria-label":"Push current branch",className:"gap-1.5 px-2 text-xs",disabled:a||g!==null,onClick:()=>{L()},size:"sm",title:c?`Push ${e} commit${e===1?"":"s"} to ${c}`:"Push and set upstream",type:"button",variant:"default",children:[n.jsx(Pf,{className:ae("size-3.5",g==="push"&&"animate-pulse")}),"Push",e>0?` ${e}`:""]}):null,n.jsx(Z,{"aria-label":"Fetch branches",disabled:a||g!==null,onClick:()=>{R()},size:"icon",title:"Fetch branches",type:"button",variant:"ghost",children:n.jsx(Dr,{className:ae(g==="fetch"&&"animate-spin")})}),n.jsx(Z,{"aria-label":"Close branch dialog",onClick:()=>f(!1),size:"icon",type:"button",variant:"ghost",children:n.jsx(qt,{})})]})]}),n.jsx("div",{className:"max-h-72 overflow-auto",children:s.length?n.jsxs(n.Fragment,{children:[n.jsx(EC,{branches:E,busy:g!==null,disabled:a,label:"Local",onSwitch:C}),n.jsx(EC,{branches:T,busy:g!==null,disabled:a,label:"Remote",onSwitch:C})]}):n.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"No branches found."})}),n.jsxs("div",{className:"border-t border-border p-3",children:[n.jsxs("form",{className:"grid gap-2 sm:grid-cols-[1fr_auto]",onSubmit:B,children:[n.jsx(ft,{"aria-label":"New branch name",disabled:a||g!==null,onChange:P=>{p(P.target.value),N(null),w(null)},placeholder:"feature/new-work",value:d}),n.jsxs(Z,{disabled:a||g!==null,type:"submit",children:[n.jsx(U6,{}),"Create"]})]}),k||v?n.jsx(Je,{className:"mt-3 px-3 py-2 text-xs",variant:k?"destructive":"muted",children:k??v}):null]})]}):null,n.jsxs(Z,{className:"h-8 max-w-[260px] gap-2 rounded-md shadow-lg",disabled:a,onClick:()=>f(P=>!P),size:"sm",title:"Switch Git branch",type:"button",variant:"default",children:[n.jsx(Mn,{className:"size-4"}),n.jsx("span",{className:"truncate font-mono text-xs",children:i||"No branch"}),i&&(e>0||t>0)?n.jsxs("span",{className:"flex items-center gap-1 font-mono text-[11px] tabular-nums",title:c?`${e} ahead / ${t} behind ${c}`:`${e} ahead / ${t} behind`,children:[t>0?n.jsxs("span",{className:"flex items-center",children:[n.jsx(jf,{className:"size-3"}),t]}):null,e>0?n.jsxs("span",{className:"flex items-center",children:[n.jsx(Af,{className:"size-3"}),e]}):null]}):null,n.jsx(Jn,{className:ae("size-4 transition-transform",h&&"rotate-180")})]})]})}function EC({branches:e,busy:t,disabled:s,label:i,onSwitch:a}){return n.jsxs("section",{children:[n.jsx("div",{className:"border-b border-border bg-muted/60 px-3 py-1.5 text-[11px] font-semibold uppercase text-muted-foreground",children:i}),e.length?e.map(l=>n.jsxs("button",{className:ae("grid w-full grid-cols-[1fr_auto] items-center gap-2 border-b border-border px-3 py-2 text-left text-sm last:border-b-0 hover:bg-muted",l.current&&"bg-muted/70"),disabled:s||t||l.current,onClick:()=>{a(l.name)},type:"button",children:[n.jsxs("span",{className:"min-w-0",children:[n.jsx("span",{className:"block truncate font-medium",children:l.name}),l.upstream?n.jsxs("span",{className:"block truncate font-mono text-[11px] text-muted-foreground",children:["tracks ",l.upstream]}):null]}),n.jsx(We,{variant:l.current?"success":l.remote?"outline":"secondary",children:l.current?"current":l.remote?"remote":"local"})]},`${l.remote?"remote":"local"}:${l.name}`)):n.jsxs("div",{className:"border-b border-border px-3 py-3 text-sm text-muted-foreground",children:["No ",i.toLowerCase()," branches."]})]})}function cee(){const[,e]=U5(),t=ZW(),s=y.useRef(null),i=y.useCallback(()=>{const a=t==="dark"?"light":"dark",l=s.current,c=document;if(!l||!c.startViewTransition||window.matchMedia("(prefers-reduced-motion: reduce)").matches){e(a);return}const h=l.getBoundingClientRect(),f=h.left+h.width/2,d=h.top+h.height/2,p=Math.hypot(Math.max(f,window.innerWidth-f),Math.max(d,window.innerHeight-d));c.startViewTransition(()=>{e(a)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${f}px ${d}px)`,`circle(${p}px at ${f}px ${d}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},[t,e]);return n.jsxs("button",{ref:s,type:"button",onClick:i,title:t==="dark"?"Switch to light mode":"Switch to dark mode","aria-label":"Toggle theme",className:lf(),children:[n.jsx("span",{className:cf(),children:t==="dark"?n.jsx(C8,{}):n.jsx(LM,{})}),n.jsx("span",{className:uf(),children:"Theme"})]})}function uee(){return $s()?n.jsxs("div",{className:"flex items-center justify-between h-8 bg-background border-b border-border select-none",style:{WebkitAppRegion:"drag"},onMouseDown:()=>V8(),children:[n.jsx("span",{className:"px-3 text-xs font-medium text-muted-foreground",children:"NoMoreIDE"}),n.jsxs("div",{className:"flex items-center",style:{WebkitAppRegion:"no-drag"},children:[n.jsx("button",{type:"button",onClick:F8,className:"h-8 w-10 flex items-center justify-center hover:bg-muted transition-colors","aria-label":"Minimize",children:n.jsx(VC,{className:"h-3 w-3"})}),n.jsx("button",{type:"button",onClick:q8,className:"h-8 w-10 flex items-center justify-center hover:bg-muted transition-colors","aria-label":"Maximize",children:n.jsx(fo,{className:"h-3 w-3"})}),n.jsx("button",{type:"button",onClick:G8,className:"h-8 w-10 flex items-center justify-center hover:bg-destructive hover:text-destructive-foreground transition-colors","aria-label":"Close",children:n.jsx(qt,{className:"h-3 w-3"})})]})]}):null}const eA={services:"/",git:"/git",github:"/github",workflows:"/workflows",errors:"/errors",database:"/database",terminal:"/terminal",agent:"/agent","agent-env":"/agent-env",settings:"/settings"},dee={services:"Services",git:"Git Review",github:"GitHub",workflows:"Workflows",errors:"Error Inbox",database:"Database",terminal:"Terminal",agent:"Agent Console","agent-env":"Agent Environments",settings:"Settings"},hee=Object.entries(eA).filter(([,e])=>e!=="/").sort(([,e],[,t])=>t.length-e.length);function fee(e){for(const[t,s]of hee)if(e.startsWith(s))return t;return"services"}const mee=[{label:"Run",items:[{page:"services",label:"Services",icon:n.jsx(Bf,{})},{page:"errors",label:"Error Inbox",icon:n.jsx(uu,{})},{page:"terminal",label:"Terminal",icon:n.jsx(_u,{})}]},{label:"Code",items:[{page:"git",label:"Git Review",icon:n.jsx(Mn,{})},{page:"github",label:"GitHub",icon:n.jsx(em,{})},{page:"workflows",label:"Workflows",icon:n.jsx(Xh,{})}]},{label:"Data",items:[{page:"database",label:"Database",icon:n.jsx(Qn,{})}]},{label:"Agent",items:[{page:"agent",label:"Console",icon:n.jsx(C0,{})},{page:"agent-env",label:"Environments",icon:n.jsx(O0,{})}]}];function pee(e=!1){return ae("group/sidebar hidden h-full shrink-0 overflow-x-hidden overflow-y-auto border-r border-border bg-card/85 py-4 backdrop-blur transition-[width,padding] duration-200 md:flex md:flex-col",e?"w-64 px-4":"w-16 px-2 hover:w-64 hover:px-4")}function gee(e,t=!1){return ae("relative grid h-10 grid-cols-[48px_minmax(0,1fr)] items-center justify-start gap-0 overflow-hidden rounded-md px-0 text-sm font-medium transition-[background-color,color,width] duration-150",t?"w-full":"w-12 group-hover/sidebar:w-full",e?"bg-primary text-primary-foreground hover:bg-primary/90":"hover:bg-muted")}function bee(e=!1,t=!1){return ae("min-w-0 overflow-hidden text-left text-current transition duration-150 whitespace-pre",e?"translate-x-1 opacity-100":"opacity-0 group-hover/sidebar:translate-x-1 group-hover/sidebar:opacity-100",t?"pr-10":"pr-3")}function xee(e=!1){return ae("flex h-10 w-12 items-center justify-center text-current transition-transform duration-150 [&_svg]:size-5",e?"translate-x-0":"-translate-x-px group-hover/sidebar:translate-x-0")}function vee({docked:e,onToggleDock:t}){return n.jsxs("div",{className:ae("mt-auto flex h-10 min-w-0 items-center overflow-hidden border-t border-border/60 text-[11px] text-muted-foreground transition-[height,opacity,width] duration-150",e?"w-full justify-start opacity-100":"w-12 justify-center group-hover/sidebar:w-full group-hover/sidebar:justify-start group-hover/sidebar:opacity-100"),children:[n.jsxs("span",{className:ae("flex min-w-0 items-center gap-1.5 overflow-hidden whitespace-pre transition-[opacity,width] duration-150",e?"flex-1 opacity-100":"w-0 flex-none opacity-0 group-hover/sidebar:w-auto group-hover/sidebar:flex-1 group-hover/sidebar:opacity-100"),children:[n.jsx("span",{children:"Made with"}),n.jsx(K6,{"aria-label":"love",className:"size-3 shrink-0 fill-red-500 text-red-500"}),n.jsx("span",{children:"by Robert Wang"}),n.jsx("a",{"aria-label":"Robert Wang on LinkedIn",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:bg-muted hover:text-[#0A66C2]",href:"https://www.linkedin.com/in/robert-wang-cs/",rel:"noopener noreferrer",target:"_blank",title:"LinkedIn",children:n.jsxs("svg",{className:"size-3 fill-current",role:"img",viewBox:"0 0 24 24",children:[n.jsx("title",{children:"LinkedIn"}),n.jsx("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.063 2.063 0 1 1 0-4.126 2.063 2.063 0 0 1 0 4.126zM7.119 20.452H3.554V9h3.565v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.225 0z"})]})})]}),n.jsx("button",{"aria-label":e?"Undock sidebar":"Dock sidebar","aria-pressed":e,className:ae("flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground [&_svg]:size-4",e?"ml-auto bg-muted text-foreground":"group-hover/sidebar:ml-auto"),onClick:t,title:e?"Undock sidebar":"Dock sidebar",type:"button",children:e?n.jsx(HM,{}):n.jsx(FM,{})})]})}function yee({className:e}){return n.jsxs("div",{className:ae("min-w-0",e),children:[n.jsxs("div",{className:"flex items-baseline gap-1.5",children:[n.jsx("div",{className:"text-sm font-semibold",children:"NoMoreIDE"}),n.jsxs("div",{className:"font-mono text-[10px] text-muted-foreground",children:["v","0.1.77"]})]}),n.jsx("div",{className:"font-mono text-[11px] text-muted-foreground",children:"127.0.0.1 console"})]})}function _ee({syncLocation:e=!0}={}){return n.jsx(rK,{children:n.jsx(See,{syncLocation:e})})}function wee({projectPath:e,selectProject:t}){return y.useEffect(()=>{t(e)},[e,t]),null}function See({syncLocation:e}){const[t,s]=y.useState(()=>e?fee(window.location.pathname):"services"),[i,a]=y.useState(null),[l,c]=y.useState(null),[h,f]=y.useState(null),[d,p]=y.useState(0),[g,b]=y.useState(null),[v,w]=y.useState(!0),{error:k,message:N,success:E}=hs(),{ui:T,updateUi:A,selectProject:C}=sm(),R=T.sidebarDocked,L=T.projectScope==="all",H=y.useCallback(Y=>A({projectScope:Y?"all":"project"}),[A]),B=IU(),P=y.useCallback(async(Y={})=>{Y.silent||w(!0),b(null);try{a(await hO()),Y.notify&&E("Dashboard refreshed.")}catch(W){const le=W instanceof Error?W.message:String(W);b(le),k(le)}finally{w(!1)}},[k,E]),D=y.useCallback(()=>{P({notify:!0}),B.runActive()},[P,B]);y.useEffect(()=>{P()},[P]),y.useEffect(()=>{function Y(){document.visibilityState==="visible"&&(P({silent:!0}),B.runActive())}const W=window.setInterval(Y,5e3);return window.addEventListener("focus",Y),document.addEventListener("visibilitychange",Y),()=>{window.clearInterval(W),window.removeEventListener("focus",Y),document.removeEventListener("visibilitychange",Y)}},[t,P,B.runActive]),y.useEffect(()=>{if(!e)return;const Y=eA[t];window.location.pathname!==Y&&window.history.pushState(null,"",Y)},[t,e]);const G=!L&&i?.git.selectedRepository||null,$=y.useMemo(()=>i&&G?dK(i,G):i,[i,G]),O=y.useMemo(()=>G&&$?new Set($.config.services.map(Y=>Y.name)):null,[G,$]),V=y.useMemo(()=>$?Object.values($.runtime.services).filter(Y=>Y.state==="running").length:0,[$]),K=i?.git.selectedRepository?.name??i?.git.cwd??"no-git-repository",I=i?.git.selectedRepository?.path??null;return n.jsxs(bH,{children:[n.jsx(wee,{projectPath:I,selectProject:C}),n.jsx($U,{value:B,children:n.jsx(QF,{onRefresh:()=>{P({silent:!0})},children:n.jsx(JF,{children:n.jsxs("div",{className:"flex flex-col h-screen overflow-hidden",children:[n.jsx(uee,{}),n.jsxs("div",{className:"flex-1 overflow-hidden pb-9",children:[n.jsxs("div",{className:"mx-auto flex h-full max-w-[1500px]",children:[n.jsxs("aside",{className:pee(R),children:[n.jsxs("div",{className:ae("grid h-12 grid-cols-[48px_minmax(0,1fr)] items-center overflow-hidden transition-[width] duration-150",R?"w-full":"w-12 group-hover/sidebar:w-full"),children:[n.jsx("div",{className:"flex size-12 items-center justify-center",children:n.jsx("div",{className:"flex size-9 items-center justify-center overflow-hidden rounded-md bg-primary text-primary-foreground",children:n.jsxs("svg",{"aria-label":"NoMoreIDE",className:"size-6",fill:"none",role:"img",viewBox:"0 0 64 64",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("path",{d:"M5 17C5 13.69 7.69 11 11 11H25L31 17H53C56.31 17 59 19.69 59 23V53C59 56.31 56.31 59 53 59H11C7.69 59 5 56.31 5 53V17Z",fill:"currentColor"}),n.jsx("path",{d:"M22 31L30 39L22 47",stroke:"hsl(var(--primary))",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"4.5"}),n.jsx("path",{d:"M36 47H48",stroke:"hsl(var(--primary))",strokeLinecap:"round",strokeWidth:"4.5"})]})})}),n.jsx(yee,{className:ae("min-w-0 translate-x-1 overflow-hidden transition-opacity duration-200",R?"opacity-100":"opacity-0 group-hover/sidebar:opacity-100")})]}),i?n.jsx("div",{className:"mt-3 border-b border-border/60 pb-2",children:n.jsx(aee,{data:i,docked:R,onRefresh:()=>P({silent:!0}),onScopeChange:H,scopeAll:L})}):null,n.jsx("nav",{className:"mt-2 flex-1 content-start overflow-y-auto overflow-x-hidden",children:mee.map((Y,W)=>n.jsxs("div",{className:ae(W>0&&"mt-2 border-t border-border/60 pt-2"),children:[n.jsx(kee,{docked:R,label:Y.label}),n.jsx("div",{className:"grid gap-0.5",children:Y.items.map(le=>n.jsx(jC,{active:t===le.page,badge:le.page==="services"?V:void 0,docked:R,icon:le.icon,label:le.label,onClick:()=>s(le.page)},le.page))})]},Y.label))}),n.jsx("div",{className:"mb-1 border-t border-border/60 pt-1",children:n.jsx(jC,{active:t==="settings",docked:R,icon:n.jsx(QC,{}),label:"Settings",onClick:()=>s("settings")})}),n.jsx(vee,{docked:R,onToggleDock:()=>A({sidebarDocked:!R})})]}),n.jsxs("main",{className:"flex h-full min-w-0 flex-1 flex-col px-0 py-0",children:[n.jsxs("header",{className:ae("relative z-40 flex shrink-0 flex-wrap items-center justify-between gap-3 border border-border bg-card/90 px-4 py-3 backdrop-blur","border-x-0 border-t-0 border-b"),children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(GM,{className:"size-4 text-muted-foreground md:hidden"}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:dee[t]}),n.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:t==="git"||t==="github"?i?.git.selectedRepository?.name??i?.git.cwd??"Local workspace":G?.name??"All projects"})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[g?n.jsx(We,{variant:"danger",children:g}):null,n.jsxs("div",{"aria-label":"Dashboard quick actions",className:"flex items-center gap-1 rounded-lg border border-border bg-background p-px",role:"toolbar",children:[n.jsxs("button",{"aria-label":"Refresh",className:lf(),onClick:D,title:"Refresh this page",type:"button",children:[n.jsx("span",{className:cf(),children:n.jsx(Dr,{className:ae(v&&"animate-spin")})}),n.jsx("span",{className:uf(),children:"Refresh"})]}),n.jsx(cee,{}),n.jsxs("a",{"aria-label":"Open NoMoreIDE documentation",className:lf(),href:"https://www.nomoreide.com/docs",rel:"noreferrer",target:"_blank",title:"Open NoMoreIDE documentation",children:[n.jsx("span",{className:cf(),children:n.jsx(MC,{})}),n.jsx("span",{className:uf(),children:"Docs"})]}),i?n.jsx(DF,{data:i}):null]})]})]}),i?n.jsx(mX,{data:i,onOpenService:Y=>{O&&!O.has(Y)&&(H(!0),N({text:"Service is outside the current project — showing all projects."})),c(Y),s("services"),P({silent:!0})}}):null,v&&!i?n.jsx(Je,{variant:"muted",children:"Loading NoMoreIDE state..."}):null,n.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden",children:[$&&t==="services"?n.jsx(dX,{data:$,onRefresh:P,focusService:l,onServiceFocused:()=>c(null),scopeName:G?.name??null}):null,i&&t==="git"?n.jsx(XQ,{data:i,onRefresh:()=>{P({silent:!0})}}):null,t==="github"?n.jsx(JJ,{},K):null,t==="workflows"?n.jsx(iJ,{}):null,t==="agent"?n.jsx(PU,{focusChanges:d,onOpenAgentEnv:()=>s("agent-env")}):null,t==="agent-env"?n.jsx(oF,{}):null,t==="errors"?n.jsx(ZK,{inScope:O?Y=>O.has(Y):void 0,onReviewChanges:()=>{p(Y=>Y+1),s("agent")}}):null,t==="database"?n.jsx(PK,{projects:i?.config.gitRepositories??[],scopePath:G?.path??null,staged:h,onStageConsumed:()=>f(null)}):null,t==="terminal"?n.jsx(yX,{}):null,t==="settings"?n.jsx(KK,{activeProject:i?.git.selectedRepository??null,onNavigate:Y=>s(Y)}):null]})]})]}),i&&t==="git"?n.jsx(lee,{ahead:i.git.status?.ahead??0,behind:i.git.status?.behind??0,branches:i.git.branches,currentBranch:i.git.status?.branch||void 0,disabled:!i.git.status,onRefresh:P,upstream:i.git.status?.upstream}):null,n.jsx(cK,{currentPage:t,git:i?.git,onNavigate:Y=>s(Y),onGitRefresh:()=>{P({silent:!0})}})]})]})})})})]})}function kee({docked:e,label:t}){return n.jsx("div",{className:"flex h-5 items-center overflow-hidden px-3",children:n.jsx("span",{className:ae("whitespace-pre text-[10px] font-semibold uppercase tracking-widest text-muted-foreground transition-opacity duration-150",e?"opacity-100":"opacity-0 group-hover/sidebar:opacity-100"),children:t})})}function jC({active:e,badge:t,docked:s,icon:i,label:a,onClick:l}){const c=t!==void 0&&t>0;return n.jsxs(Z,{"aria-label":a,title:a,className:gee(e,s),variant:"ghost",onClick:l,type:"button",children:[n.jsx("span",{className:xee(s),children:i}),n.jsx("span",{className:bee(s,c),children:a}),t!==void 0&&t>0?n.jsx(We,{appearance:t>0?"solid":"outline",className:ae("min-w-6 justify-center px-1.5 font-mono shadow-none",e?"border-primary-foreground/40 bg-primary-foreground/15 text-primary-foreground dark:border-primary-foreground/40 dark:bg-primary-foreground/15 dark:text-primary-foreground":t>0?"":"border-border bg-background text-muted-foreground","absolute right-1.5 top-1.5 h-4 min-w-4 rounded-full px-1 text-[10px] leading-none shadow-none group-hover/sidebar:right-2 group-hover/sidebar:top-1/2 group-hover/sidebar:-translate-y-1/2 group-hover/sidebar:text-xs",s&&"right-2 top-1/2 -translate-y-1/2 text-xs"),size:"small",variant:t>0?"success":"outline",children:t}):null]})}TC.createRoot(document.getElementById("root")).render(n.jsx(y.StrictMode,{children:n.jsx(_ee,{})}));export{n as j,y as r};