nomoreide 0.1.46 → 0.1.48
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.
- package/dist/core/config-store.d.ts +2 -0
- package/dist/core/config-store.js +12 -0
- package/dist/core/config-store.js.map +1 -1
- package/dist/core/db/driver.d.ts +59 -1
- package/dist/core/db/driver.js +60 -0
- package/dist/core/db/driver.js.map +1 -1
- package/dist/core/db/mysql-driver.d.ts +11 -5
- package/dist/core/db/mysql-driver.js +60 -4
- package/dist/core/db/mysql-driver.js.map +1 -1
- package/dist/core/db/postgres-driver.d.ts +12 -5
- package/dist/core/db/postgres-driver.js +55 -6
- package/dist/core/db/postgres-driver.js.map +1 -1
- package/dist/core/db/sqlite-driver.d.ts +8 -3
- package/dist/core/db/sqlite-driver.js +64 -3
- package/dist/core/db/sqlite-driver.js.map +1 -1
- package/dist/core/db-peek.d.ts +7 -1
- package/dist/core/db-peek.js +8 -0
- package/dist/core/db-peek.js.map +1 -1
- package/dist/core/db-write.d.ts +34 -0
- package/dist/core/db-write.js +72 -0
- package/dist/core/db-write.js.map +1 -0
- package/dist/core/types.d.ts +5 -0
- package/dist/core/workflows.d.ts +76 -6
- package/dist/core/workflows.js +18 -2
- package/dist/core/workflows.js.map +1 -1
- package/dist/mcp/tools/database.d.ts +4 -3
- package/dist/mcp/tools/database.js +67 -2
- package/dist/mcp/tools/database.js.map +1 -1
- package/dist/mcp/tools/index.d.ts +1 -1
- package/dist/web/agent-info.d.ts +12 -0
- package/dist/web/agent-info.js +101 -2
- package/dist/web/agent-info.js.map +1 -1
- package/dist/web/client/assets/{code-editor-o1tS7fpw.js → code-editor-DH7Sl3iw.js} +1 -1
- package/dist/web/client/assets/index-DWPlVWVN.js +211 -0
- package/dist/web/client/assets/index-vGzOmeUL.css +1 -0
- package/dist/web/client/index.html +2 -2
- package/dist/web/routes/context.d.ts +2 -0
- package/dist/web/routes/context.js.map +1 -1
- package/dist/web/routes/database-routes.js +57 -2
- package/dist/web/routes/database-routes.js.map +1 -1
- package/dist/web/server.js +3 -0
- package/dist/web/server.js.map +1 -1
- package/package.json +1 -1
- package/dist/web/client/assets/index-CFZyk7FD.js +0 -201
- package/dist/web/client/assets/index-Dcqu3Z0L.css +0 -1
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
(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 u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).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 lA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var wp={exports:{}},fc={};var ky;function cA(){if(ky)return fc;ky=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(i,a,l){var u=null;if(l!==void 0&&(u=""+l),a.key!==void 0&&(u=""+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:u,ref:a!==void 0?a:null,props:l}}return fc.Fragment=t,fc.jsx=s,fc.jsxs=s,fc}var Cy;function uA(){return Cy||(Cy=1,wp.exports=cA()),wp.exports}var o=uA(),kp={exports:{}},Ve={};var Ny;function dA(){if(Ny)return Ve;Ny=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"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),v=Symbol.iterator;function _(O){return O===null||typeof O!="object"?null:(O=v&&O[v]||O["@@iterator"],typeof O=="function"?O:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,C={};function E(O,Z,ie){this.props=O,this.context=Z,this.refs=C,this.updater=ie||S}E.prototype.isReactComponent={},E.prototype.setState=function(O,Z){if(typeof O!="object"&&typeof O!="function"&&O!=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,O,Z,"setState")},E.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function T(){}T.prototype=E.prototype;function N(O,Z,ie){this.props=O,this.context=Z,this.refs=C,this.updater=ie||S}var j=N.prototype=new T;j.constructor=N,w(j,E.prototype),j.isPureReactComponent=!0;var R=Array.isArray;function z(){}var D={H:null,A:null,T:null,S:null},M=Object.prototype.hasOwnProperty;function $(O,Z,ie){var de=ie.ref;return{$$typeof:e,type:O,key:Z,ref:de!==void 0?de:null,props:ie}}function L(O,Z){return $(O.type,Z,O.props)}function B(O){return typeof O=="object"&&O!==null&&O.$$typeof===e}function P(O){var Z={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(ie){return Z[ie]})}var F=/\/+/g;function V(O,Z){return typeof O=="object"&&O!==null&&O.key!=null?P(""+O.key):Z.toString(36)}function G(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then(z,z):(O.status="pending",O.then(function(Z){O.status==="pending"&&(O.status="fulfilled",O.value=Z)},function(Z){O.status==="pending"&&(O.status="rejected",O.reason=Z)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function I(O,Z,ie,de,fe){var pe=typeof O;(pe==="undefined"||pe==="boolean")&&(O=null);var Se=!1;if(O===null)Se=!0;else switch(pe){case"bigint":case"string":case"number":Se=!0;break;case"object":switch(O.$$typeof){case e:case t:Se=!0;break;case p:return Se=O._init,I(Se(O._payload),Z,ie,de,fe)}}if(Se)return fe=fe(O),Se=de===""?"."+V(O,0):de,R(fe)?(ie="",Se!=null&&(ie=Se.replace(F,"$&/")+"/"),I(fe,Z,ie,"",function(Ge){return Ge})):fe!=null&&(B(fe)&&(fe=L(fe,ie+(fe.key==null||O&&O.key===fe.key?"":(""+fe.key).replace(F,"$&/")+"/")+Se)),Z.push(fe)),1;Se=0;var Le=de===""?".":de+":";if(R(O))for(var ve=0;ve<O.length;ve++)de=O[ve],pe=Le+V(de,ve),Se+=I(de,Z,ie,pe,fe);else if(ve=_(O),typeof ve=="function")for(O=ve.call(O),ve=0;!(de=O.next()).done;)de=de.value,pe=Le+V(de,ve++),Se+=I(de,Z,ie,pe,fe);else if(pe==="object"){if(typeof O.then=="function")return I(G(O),Z,ie,de,fe);throw Z=String(O),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.")}return Se}function Y(O,Z,ie){if(O==null)return O;var de=[],fe=0;return I(O,de,"","",function(pe){return Z.call(ie,pe,fe++)}),de}function X(O){if(O._status===-1){var Z=O._result;Z=Z(),Z.then(function(ie){(O._status===0||O._status===-1)&&(O._status=1,O._result=ie)},function(ie){(O._status===0||O._status===-1)&&(O._status=2,O._result=ie)}),O._status===-1&&(O._status=0,O._result=Z)}if(O._status===1)return O._result.default;throw O._result}var W=typeof reportError=="function"?reportError:function(O){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof O=="object"&&O!==null&&typeof O.message=="string"?String(O.message):String(O),error:O});if(!window.dispatchEvent(Z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",O);return}console.error(O)},ee={map:Y,forEach:function(O,Z,ie){Y(O,function(){Z.apply(this,arguments)},ie)},count:function(O){var Z=0;return Y(O,function(){Z++}),Z},toArray:function(O){return Y(O,function(Z){return Z})||[]},only:function(O){if(!B(O))throw Error("React.Children.only expected to receive a single React element child.");return O}};return Ve.Activity=g,Ve.Children=ee,Ve.Component=E,Ve.Fragment=s,Ve.Profiler=a,Ve.PureComponent=N,Ve.StrictMode=i,Ve.Suspense=m,Ve.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,Ve.__COMPILER_RUNTIME={__proto__:null,c:function(O){return D.H.useMemoCache(O)}},Ve.cache=function(O){return function(){return O.apply(null,arguments)}},Ve.cacheSignal=function(){return null},Ve.cloneElement=function(O,Z,ie){if(O==null)throw Error("The argument must be a React element, but you passed "+O+".");var de=w({},O.props),fe=O.key;if(Z!=null)for(pe in Z.key!==void 0&&(fe=""+Z.key),Z)!M.call(Z,pe)||pe==="key"||pe==="__self"||pe==="__source"||pe==="ref"&&Z.ref===void 0||(de[pe]=Z[pe]);var pe=arguments.length-2;if(pe===1)de.children=ie;else if(1<pe){for(var Se=Array(pe),Le=0;Le<pe;Le++)Se[Le]=arguments[Le+2];de.children=Se}return $(O.type,fe,de)},Ve.createContext=function(O){return O={$$typeof:u,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null},O.Provider=O,O.Consumer={$$typeof:l,_context:O},O},Ve.createElement=function(O,Z,ie){var de,fe={},pe=null;if(Z!=null)for(de in Z.key!==void 0&&(pe=""+Z.key),Z)M.call(Z,de)&&de!=="key"&&de!=="__self"&&de!=="__source"&&(fe[de]=Z[de]);var Se=arguments.length-2;if(Se===1)fe.children=ie;else if(1<Se){for(var Le=Array(Se),ve=0;ve<Se;ve++)Le[ve]=arguments[ve+2];fe.children=Le}if(O&&O.defaultProps)for(de in Se=O.defaultProps,Se)fe[de]===void 0&&(fe[de]=Se[de]);return $(O,pe,fe)},Ve.createRef=function(){return{current:null}},Ve.forwardRef=function(O){return{$$typeof:h,render:O}},Ve.isValidElement=B,Ve.lazy=function(O){return{$$typeof:p,_payload:{_status:-1,_result:O},_init:X}},Ve.memo=function(O,Z){return{$$typeof:d,type:O,compare:Z===void 0?null:Z}},Ve.startTransition=function(O){var Z=D.T,ie={};D.T=ie;try{var de=O(),fe=D.S;fe!==null&&fe(ie,de),typeof de=="object"&&de!==null&&typeof de.then=="function"&&de.then(z,W)}catch(pe){W(pe)}finally{Z!==null&&ie.types!==null&&(Z.types=ie.types),D.T=Z}},Ve.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},Ve.use=function(O){return D.H.use(O)},Ve.useActionState=function(O,Z,ie){return D.H.useActionState(O,Z,ie)},Ve.useCallback=function(O,Z){return D.H.useCallback(O,Z)},Ve.useContext=function(O){return D.H.useContext(O)},Ve.useDebugValue=function(){},Ve.useDeferredValue=function(O,Z){return D.H.useDeferredValue(O,Z)},Ve.useEffect=function(O,Z){return D.H.useEffect(O,Z)},Ve.useEffectEvent=function(O){return D.H.useEffectEvent(O)},Ve.useId=function(){return D.H.useId()},Ve.useImperativeHandle=function(O,Z,ie){return D.H.useImperativeHandle(O,Z,ie)},Ve.useInsertionEffect=function(O,Z){return D.H.useInsertionEffect(O,Z)},Ve.useLayoutEffect=function(O,Z){return D.H.useLayoutEffect(O,Z)},Ve.useMemo=function(O,Z){return D.H.useMemo(O,Z)},Ve.useOptimistic=function(O,Z){return D.H.useOptimistic(O,Z)},Ve.useReducer=function(O,Z,ie){return D.H.useReducer(O,Z,ie)},Ve.useRef=function(O){return D.H.useRef(O)},Ve.useState=function(O){return D.H.useState(O)},Ve.useSyncExternalStore=function(O,Z,ie){return D.H.useSyncExternalStore(O,Z,ie)},Ve.useTransition=function(){return D.H.useTransition()},Ve.version="19.2.6",Ve}var Ey;function Tb(){return Ey||(Ey=1,kp.exports=dA()),kp.exports}var y=Tb(),Cp={exports:{}},mc={},Np={exports:{}},Ep={};var Ty;function hA(){return Ty||(Ty=1,(function(e){function t(I,Y){var X=I.length;I.push(Y);e:for(;0<X;){var W=X-1>>>1,ee=I[W];if(0<a(ee,Y))I[W]=Y,I[X]=ee,X=W;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],X=I.pop();if(X!==Y){I[0]=X;e:for(var W=0,ee=I.length,O=ee>>>1;W<O;){var Z=2*(W+1)-1,ie=I[Z],de=Z+1,fe=I[de];if(0>a(ie,X))de<ee&&0>a(fe,ie)?(I[W]=fe,I[de]=X,W=de):(I[W]=ie,I[Z]=X,W=Z);else if(de<ee&&0>a(fe,X))I[W]=fe,I[de]=X,W=de;else break e}}return Y}function a(I,Y){var X=I.sortIndex-Y.sortIndex;return X!==0?X: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 u=Date,h=u.now();e.unstable_now=function(){return u.now()-h}}var m=[],d=[],p=1,g=null,v=3,_=!1,S=!1,w=!1,C=!1,E=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function j(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(m,Y);else break;Y=s(d)}}function R(I){if(w=!1,j(I),!S)if(s(m)!==null)S=!0,z||(z=!0,P());else{var Y=s(d);Y!==null&&G(R,Y.startTime-I)}}var z=!1,D=-1,M=5,$=-1;function L(){return C?!0:!(e.unstable_now()-$<M)}function B(){if(C=!1,z){var I=e.unstable_now();$=I;var Y=!0;try{e:{S=!1,w&&(w=!1,T(D),D=-1),_=!0;var X=v;try{t:{for(j(I),g=s(m);g!==null&&!(g.expirationTime>I&&L());){var W=g.callback;if(typeof W=="function"){g.callback=null,v=g.priorityLevel;var ee=W(g.expirationTime<=I);if(I=e.unstable_now(),typeof ee=="function"){g.callback=ee,j(I),Y=!0;break t}g===s(m)&&i(m),j(I)}else i(m);g=s(m)}if(g!==null)Y=!0;else{var O=s(d);O!==null&&G(R,O.startTime-I),Y=!1}}break e}finally{g=null,v=X,_=!1}Y=void 0}}finally{Y?P():z=!1}}}var P;if(typeof N=="function")P=function(){N(B)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,V=F.port2;F.port1.onmessage=B,P=function(){V.postMessage(null)}}else P=function(){E(B,0)};function G(I,Y){D=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"):M=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(I){switch(v){case 1:case 2:case 3:var Y=3;break;default:Y=v}var X=v;v=Y;try{return I()}finally{v=X}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(I,Y){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var X=v;v=I;try{return Y()}finally{v=X}},e.unstable_scheduleCallback=function(I,Y,X){var W=e.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?W+X:W):X=W,I){case 1:var ee=-1;break;case 2:ee=250;break;case 5:ee=1073741823;break;case 4:ee=1e4;break;default:ee=5e3}return ee=X+ee,I={id:p++,callback:Y,priorityLevel:I,startTime:X,expirationTime:ee,sortIndex:-1},X>W?(I.sortIndex=X,t(d,I),s(m)===null&&I===s(d)&&(w?(T(D),D=-1):w=!0,G(R,X-W))):(I.sortIndex=ee,t(m,I),S||_||(S=!0,z||(z=!0,P()))),I},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(I){var Y=v;return function(){var X=v;v=Y;try{return I.apply(this,arguments)}finally{v=X}}}})(Ep)),Ep}var jy;function fA(){return jy||(jy=1,Np.exports=hA()),Np.exports}var Tp={exports:{}},Us={};var Ay;function mA(){if(Ay)return Us;Ay=1;var e=Tb();function t(m){var d="https://react.dev/errors/"+m;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 #"+m+"; 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(m,d,p){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:g==null?null:""+g,children:m,containerInfo:d,implementation:p}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(m,d){if(m==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Us.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Us.createPortal=function(m,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(m,d,null,p)},Us.flushSync=function(m){var d=u.T,p=i.p;try{if(u.T=null,i.p=2,m)return m()}finally{u.T=d,i.p=p,i.d.f()}},Us.preconnect=function(m,d){typeof m=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,i.d.C(m,d))},Us.prefetchDNS=function(m){typeof m=="string"&&i.d.D(m)},Us.preinit=function(m,d){if(typeof m=="string"&&d&&typeof d.as=="string"){var p=d.as,g=h(p,d.crossOrigin),v=typeof d.integrity=="string"?d.integrity:void 0,_=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?i.d.S(m,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:v,fetchPriority:_}):p==="script"&&i.d.X(m,{crossOrigin:g,integrity:v,fetchPriority:_,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Us.preinitModule=function(m,d){if(typeof m=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var p=h(d.as,d.crossOrigin);i.d.M(m,{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(m)},Us.preload=function(m,d){if(typeof m=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,g=h(p,d.crossOrigin);i.d.L(m,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})}},Us.preloadModule=function(m,d){if(typeof m=="string")if(d){var p=h(d.as,d.crossOrigin);i.d.m(m,{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(m)},Us.requestFormReset=function(m){i.d.r(m)},Us.unstable_batchedUpdates=function(m,d){return m(d)},Us.useFormState=function(m,d,p){return u.H.useFormState(m,d,p)},Us.useFormStatus=function(){return u.H.useHostTransitionStatus()},Us.version="19.2.6",Us}var My;function nC(){if(My)return Tp.exports;My=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(),Tp.exports=mA(),Tp.exports}var Ry;function pA(){if(Ry)return mc;Ry=1;var e=fA(),t=Tb(),s=nC();function i(n){var r="https://react.dev/errors/"+n;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)r+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+n+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function l(n){var r=n,c=n;if(n.alternate)for(;r.return;)r=r.return;else{n=r;do r=n,(r.flags&4098)!==0&&(c=r.return),n=r.return;while(n)}return r.tag===3?c:null}function u(n){if(n.tag===13){var r=n.memoizedState;if(r===null&&(n=n.alternate,n!==null&&(r=n.memoizedState)),r!==null)return r.dehydrated}return null}function h(n){if(n.tag===31){var r=n.memoizedState;if(r===null&&(n=n.alternate,n!==null&&(r=n.memoizedState)),r!==null)return r.dehydrated}return null}function m(n){if(l(n)!==n)throw Error(i(188))}function d(n){var r=n.alternate;if(!r){if(r=l(n),r===null)throw Error(i(188));return r!==n?null:n}for(var c=n,f=r;;){var b=c.return;if(b===null)break;var x=b.alternate;if(x===null){if(f=b.return,f!==null){c=f;continue}break}if(b.child===x.child){for(x=b.child;x;){if(x===c)return m(b),n;if(x===f)return m(b),r;x=x.sibling}throw Error(i(188))}if(c.return!==f.return)c=b,f=x;else{for(var k=!1,A=b.child;A;){if(A===c){k=!0,c=b,f=x;break}if(A===f){k=!0,f=b,c=x;break}A=A.sibling}if(!k){for(A=x.child;A;){if(A===c){k=!0,c=x,f=b;break}if(A===f){k=!0,f=x,c=b;break}A=A.sibling}if(!k)throw Error(i(189))}}if(c.alternate!==f)throw Error(i(190))}if(c.tag!==3)throw Error(i(188));return c.stateNode.current===c?n:r}function p(n){var r=n.tag;if(r===5||r===26||r===27||r===6)return n;for(n=n.child;n!==null;){if(r=p(n),r!==null)return r;n=n.sibling}return null}var g=Object.assign,v=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),N=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),$=Symbol.for("react.activity"),L=Symbol.for("react.memo_cache_sentinel"),B=Symbol.iterator;function P(n){return n===null||typeof n!="object"?null:(n=B&&n[B]||n["@@iterator"],typeof n=="function"?n:null)}var F=Symbol.for("react.client.reference");function V(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===F?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case w:return"Fragment";case E:return"Profiler";case C:return"StrictMode";case R:return"Suspense";case z:return"SuspenseList";case $:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case S:return"Portal";case N:return n.displayName||"Context";case T:return(n._context.displayName||"Context")+".Consumer";case j:var r=n.render;return n=n.displayName,n||(n=r.displayName||r.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case D:return r=n.displayName||null,r!==null?r:V(n.type)||"Memo";case M:r=n._payload,n=n._init;try{return V(n(r))}catch{}}return null}var G=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,X={pending:!1,data:null,method:null,action:null},W=[],ee=-1;function O(n){return{current:n}}function Z(n){0>ee||(n.current=W[ee],W[ee]=null,ee--)}function ie(n,r){ee++,W[ee]=n.current,n.current=r}var de=O(null),fe=O(null),pe=O(null),Se=O(null);function Le(n,r){switch(ie(pe,r),ie(fe,n),ie(de,null),r.nodeType){case 9:case 11:n=(n=r.documentElement)&&(n=n.namespaceURI)?W_(n):0;break;default:if(n=r.tagName,r=r.namespaceURI)r=W_(r),n=K_(r,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}Z(de),ie(de,n)}function ve(){Z(de),Z(fe),Z(pe)}function Ge(n){n.memoizedState!==null&&ie(Se,n);var r=de.current,c=K_(r,n.type);r!==c&&(ie(fe,n),ie(de,c))}function ge(n){fe.current===n&&(Z(de),Z(fe)),Se.current===n&&(Z(Se),cc._currentValue=X)}var Te,Ae;function It(n){if(Te===void 0)try{throw Error()}catch(c){var r=c.stack.trim().match(/\n( *(at )?)/);Te=r&&r[1]||"",Ae=-1<c.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+Te+n+Ae}var Pi=!1;function ti(n,r){if(!n||Pi)return"";Pi=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(r){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(ne){var te=ne}Reflect.construct(n,[],ce)}else{try{ce.call()}catch(ne){te=ne}n.call(ce.prototype)}}else{try{throw Error()}catch(ne){te=ne}(ce=n())&&typeof ce.catch=="function"&&ce.catch(function(){})}}catch(ne){if(ne&&te&&typeof ne.stack=="string")return[ne.stack,te.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var b=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");b&&b.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=f.DetermineComponentFrameRoot(),k=x[0],A=x[1];if(k&&A){var H=k.split(`
|
|
4
|
+
`),J=A.split(`
|
|
5
|
+
`);for(b=f=0;f<H.length&&!H[f].includes("DetermineComponentFrameRoot");)f++;for(;b<J.length&&!J[b].includes("DetermineComponentFrameRoot");)b++;if(f===H.length||b===J.length)for(f=H.length-1,b=J.length-1;1<=f&&0<=b&&H[f]!==J[b];)b--;for(;1<=f&&0<=b;f--,b--)if(H[f]!==J[b]){if(f!==1||b!==1)do if(f--,b--,0>b||H[f]!==J[b]){var re=`
|
|
6
|
+
`+H[f].replace(" at new "," at ");return n.displayName&&re.includes("<anonymous>")&&(re=re.replace("<anonymous>",n.displayName)),re}while(1<=f&&0<=b);break}}}finally{Pi=!1,Error.prepareStackTrace=c}return(c=n?n.displayName||n.name:"")?It(c):""}function vr(n,r){switch(n.tag){case 26:case 27:case 5:return It(n.type);case 16:return It("Lazy");case 13:return n.child!==r&&r!==null?It("Suspense Fallback"):It("Suspense");case 19:return It("SuspenseList");case 0:case 15:return ti(n.type,!1);case 11:return ti(n.type.render,!1);case 1:return ti(n.type,!0);case 31:return It("Activity");default:return""}}function $i(n){try{var r="",c=null;do r+=vr(n,c),c=n,n=n.return;while(n);return r}catch(f){return`
|
|
7
|
+
Error generating stack: `+f.message+`
|
|
8
|
+
`+f.stack}}var Hi=Object.prototype.hasOwnProperty,_e=e.unstable_scheduleCallback,ht=e.unstable_cancelCallback,gn=e.unstable_shouldYield,Ts=e.unstable_requestPaint,gt=e.unstable_now,si=e.unstable_getCurrentPriorityLevel,ds=e.unstable_ImmediatePriority,Ui=e.unstable_UserBlockingPriority,Fi=e.unstable_NormalPriority,io=e.unstable_LowPriority,_r=e.unstable_IdlePriority,xl=e.log,ro=e.unstable_setDisableYieldValue,qi=null,vs=null;function Rn(n){if(typeof xl=="function"&&ro(n),vs&&typeof vs.setStrictMode=="function")try{vs.setStrictMode(qi,n)}catch{}}var js=Math.clz32?Math.clz32:ao,vl=Math.log,fa=Math.LN2;function ao(n){return n>>>=0,n===0?32:31-(vl(n)/fa|0)|0}var lt=256,ni=262144,bn=4194304;function Ps(n){var r=n&42;if(r!==0)return r;switch(n&-n){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 n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function U(n,r,c){var f=n.pendingLanes;if(f===0)return 0;var b=0,x=n.suspendedLanes,k=n.pingedLanes;n=n.warmLanes;var A=f&134217727;return A!==0?(f=A&~x,f!==0?b=Ps(f):(k&=A,k!==0?b=Ps(k):c||(c=A&~n,c!==0&&(b=Ps(c))))):(A=f&~x,A!==0?b=Ps(A):k!==0?b=Ps(k):c||(c=f&~n,c!==0&&(b=Ps(c)))),b===0?0:r!==0&&r!==b&&(r&x)===0&&(x=b&-b,c=r&-r,x>=c||x===32&&(c&4194048)!==0)?r:b}function ae(n,r){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&r)===0}function ye(n,r){switch(n){case 1:case 2:case 4:case 8:case 64:return r+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 r+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 Fe(){var n=bn;return bn<<=1,(bn&62914560)===0&&(bn=4194304),n}function jt(n){for(var r=[],c=0;31>c;c++)r.push(n);return r}function Ct(n,r){n.pendingLanes|=r,r!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Me(n,r,c,f,b,x){var k=n.pendingLanes;n.pendingLanes=c,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=c,n.entangledLanes&=c,n.errorRecoveryDisabledLanes&=c,n.shellSuspendCounter=0;var A=n.entanglements,H=n.expirationTimes,J=n.hiddenUpdates;for(c=k&~c;0<c;){var re=31-js(c),ce=1<<re;A[re]=0,H[re]=-1;var te=J[re];if(te!==null)for(J[re]=null,re=0;re<te.length;re++){var ne=te[re];ne!==null&&(ne.lane&=-536870913)}c&=~ce}f!==0&&ke(n,f,0),x!==0&&b===0&&n.tag!==0&&(n.suspendedLanes|=x&~(k&~r))}function ke(n,r,c){n.pendingLanes|=r,n.suspendedLanes&=~r;var f=31-js(r);n.entangledLanes|=r,n.entanglements[f]=n.entanglements[f]|1073741824|c&261930}function Ue(n,r){var c=n.entangledLanes|=r;for(n=n.entanglements;c;){var f=31-js(c),b=1<<f;b&r|n[f]&r&&(n[f]|=r),c&=~b}}function Kt(n,r){var c=r&-r;return c=(c&42)!==0?1:Ot(c),(c&(n.suspendedLanes|r))!==0?0:c}function Ot(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function Vi(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function oo(){var n=Y.p;return n!==0?n:(n=window.event,n===void 0?32:by(n.type))}function lo(n,r){var c=Y.p;try{return Y.p=n,r()}finally{Y.p=c}}var bi=Math.random().toString(36).slice(2),Yt="__reactFiber$"+bi,$s="__reactProps$"+bi,yr="__reactContainer$"+bi,_l="__reactEvents$"+bi,wu="__reactListeners$"+bi,co="__reactHandles$"+bi,ku="__reactResources$"+bi,ma="__reactMarker$"+bi;function yl(n){delete n[Yt],delete n[$s],delete n[_l],delete n[wu],delete n[co]}function Ks(n){var r=n[Yt];if(r)return r;for(var c=n.parentNode;c;){if(r=c[yr]||c[Yt]){if(c=r.alternate,r.child!==null||c!==null&&c.child!==null)for(n=ty(n);n!==null;){if(c=n[Yt])return c;n=ty(n)}return r}n=c,c=n.parentNode}return null}function Gi(n){if(n=n[Yt]||n[yr]){var r=n.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return n}return null}function Sr(n){var r=n.tag;if(r===5||r===26||r===27||r===6)return n.stateNode;throw Error(i(33))}function wr(n){var r=n[ku];return r||(r=n[ku]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function es(n){n[ma]=!0}var Cu=new Set,pa={};function Wi(n,r){me(n,r),me(n+"Capture",r)}function me(n,r){for(pa[n]=r,n=0;n<r.length;n++)Cu.add(r[n])}var ze=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]*$"),et={},bt={};function Xt(n){return Hi.call(bt,n)?!0:Hi.call(et,n)?!1:ze.test(n)?bt[n]=!0:(et[n]=!0,!1)}function Hs(n,r,c){if(Xt(r))if(c===null)n.removeAttribute(r);else{switch(typeof c){case"undefined":case"function":case"symbol":n.removeAttribute(r);return;case"boolean":var f=r.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){n.removeAttribute(r);return}}n.setAttribute(r,""+c)}}function xn(n,r,c){if(c===null)n.removeAttribute(r);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(r);return}n.setAttribute(r,""+c)}}function sn(n,r,c,f){if(f===null)n.removeAttribute(c);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(c);return}n.setAttributeNS(r,c,""+f)}}function Tt(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function vn(n){var r=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function Nu(n,r,c){var f=Object.getOwnPropertyDescriptor(n.constructor.prototype,r);if(!n.hasOwnProperty(r)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var b=f.get,x=f.set;return Object.defineProperty(n,r,{configurable:!0,get:function(){return b.call(this)},set:function(k){c=""+k,x.call(this,k)}}),Object.defineProperty(n,r,{enumerable:f.enumerable}),{getValue:function(){return c},setValue:function(k){c=""+k},stopTracking:function(){n._valueTracker=null,delete n[r]}}}}function uo(n){if(!n._valueTracker){var r=vn(n)?"checked":"value";n._valueTracker=Nu(n,r,""+n[r])}}function Sl(n){if(!n)return!1;var r=n._valueTracker;if(!r)return!0;var c=r.getValue(),f="";return n&&(f=vn(n)?n.checked?"true":"false":n.value),n=f,n!==c?(r.setValue(n),!0):!1}function ho(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var Sf=/[\n"\\]/g;function nn(n){return n.replace(Sf,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function wl(n,r,c,f,b,x,k,A){n.name="",k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?n.type=k:n.removeAttribute("type"),r!=null?k==="number"?(r===0&&n.value===""||n.value!=r)&&(n.value=""+Tt(r)):n.value!==""+Tt(r)&&(n.value=""+Tt(r)):k!=="submit"&&k!=="reset"||n.removeAttribute("value"),r!=null?fo(n,k,Tt(r)):c!=null?fo(n,k,Tt(c)):f!=null&&n.removeAttribute("value"),b==null&&x!=null&&(n.defaultChecked=!!x),b!=null&&(n.checked=b&&typeof b!="function"&&typeof b!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?n.name=""+Tt(A):n.removeAttribute("name")}function ga(n,r,c,f,b,x,k,A){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(n.type=x),r!=null||c!=null){if(!(x!=="submit"&&x!=="reset"||r!=null)){uo(n);return}c=c!=null?""+Tt(c):"",r=r!=null?""+Tt(r):c,A||r===n.value||(n.value=r),n.defaultValue=r}f=f??b,f=typeof f!="function"&&typeof f!="symbol"&&!!f,n.checked=A?n.checked:!!f,n.defaultChecked=!!f,k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(n.name=k),uo(n)}function fo(n,r,c){r==="number"&&ho(n.ownerDocument)===n||n.defaultValue===""+c||(n.defaultValue=""+c)}function As(n,r,c,f){if(n=n.options,r){r={};for(var b=0;b<c.length;b++)r["$"+c[b]]=!0;for(c=0;c<n.length;c++)b=r.hasOwnProperty("$"+n[c].value),n[c].selected!==b&&(n[c].selected=b),b&&f&&(n[c].defaultSelected=!0)}else{for(c=""+Tt(c),r=null,b=0;b<n.length;b++){if(n[b].value===c){n[b].selected=!0,f&&(n[b].defaultSelected=!0);return}r!==null||n[b].disabled||(r=n[b])}r!==null&&(r.selected=!0)}}function Eu(n,r,c){if(r!=null&&(r=""+Tt(r),r!==n.value&&(n.value=r),c==null)){n.defaultValue!==r&&(n.defaultValue=r);return}n.defaultValue=c!=null?""+Tt(c):""}function mo(n,r,c,f){if(r==null){if(f!=null){if(c!=null)throw Error(i(92));if(G(f)){if(1<f.length)throw Error(i(93));f=f[0]}c=f}c==null&&(c=""),r=c}c=Tt(r),n.defaultValue=c,f=n.textContent,f===c&&f!==""&&f!==null&&(n.value=f),uo(n)}function He(n,r){if(r){var c=n.firstChild;if(c&&c===n.lastChild&&c.nodeType===3){c.nodeValue=r;return}}n.textContent=r}var Tu=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 ts(n,r,c){var f=r.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?f?n.setProperty(r,""):r==="float"?n.cssFloat="":n[r]="":f?n.setProperty(r,c):typeof c!="number"||c===0||Tu.has(r)?r==="float"?n.cssFloat=c:n[r]=(""+c).trim():n[r]=c+"px"}function xt(n,r,c){if(r!=null&&typeof r!="object")throw Error(i(62));if(n=n.style,c!=null){for(var f in c)!c.hasOwnProperty(f)||r!=null&&r.hasOwnProperty(f)||(f.indexOf("--")===0?n.setProperty(f,""):f==="float"?n.cssFloat="":n[f]="");for(var b in r)f=r[b],r.hasOwnProperty(b)&&c[b]!==f&&ts(n,b,f)}else for(var x in r)r.hasOwnProperty(x)&&ts(n,x,r[x])}function kr(n){if(n.indexOf("-")===-1)return!1;switch(n){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 Ki=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"]]),kl=/^[\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 Cr(n){return kl.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function xe(){}var Re=null;function We(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var it=null,Pt=null;function Dn(n){var r=Gi(n);if(r&&(n=r.stateNode)){var c=n[$s]||null;e:switch(n=r.stateNode,r.type){case"input":if(wl(n,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),r=c.name,c.type==="radio"&&r!=null){for(c=n;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+nn(""+r)+'"][type="radio"]'),r=0;r<c.length;r++){var f=c[r];if(f!==n&&f.form===n.form){var b=f[$s]||null;if(!b)throw Error(i(90));wl(f,b.value,b.defaultValue,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name)}}for(r=0;r<c.length;r++)f=c[r],f.form===n.form&&Sl(f)}break e;case"textarea":Eu(n,c.value,c.defaultValue);break e;case"select":r=c.value,r!=null&&As(n,!!c.multiple,r,!1)}}}var Cl=!1;function ju(n,r,c){if(Cl)return n(r,c);Cl=!0;try{var f=n(r);return f}finally{if(Cl=!1,(it!==null||Pt!==null)&&(gd(),it&&(r=it,n=Pt,Pt=it=null,Dn(r),n)))for(r=0;r<n.length;r++)Dn(n[r])}}function Nl(n,r){var c=n.stateNode;if(c===null)return null;var f=c[$s]||null;if(f===null)return null;c=f[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(n=n.type,f=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!f;break e;default:n=!1}if(n)return null;if(c&&typeof c!="function")throw Error(i(231,r,typeof c));return c}var Yi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),wf=!1;if(Yi)try{var El={};Object.defineProperty(El,"passive",{get:function(){wf=!0}}),window.addEventListener("test",El,El),window.removeEventListener("test",El,El)}catch{wf=!1}var Nr=null,kf=null,Au=null;function Kx(){if(Au)return Au;var n,r=kf,c=r.length,f,b="value"in Nr?Nr.value:Nr.textContent,x=b.length;for(n=0;n<c&&r[n]===b[n];n++);var k=c-n;for(f=1;f<=k&&r[c-f]===b[x-f];f++);return Au=b.slice(n,1<f?1-f:void 0)}function Mu(n){var r=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&r===13&&(n=13)):n=r,n===10&&(n=13),32<=n||n===13?n:0}function Ru(){return!0}function Yx(){return!1}function rn(n){function r(c,f,b,x,k){this._reactName=c,this._targetInst=b,this.type=f,this.nativeEvent=x,this.target=k,this.currentTarget=null;for(var A in n)n.hasOwnProperty(A)&&(c=n[A],this[A]=c?c(x):x[A]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Ru:Yx,this.isPropagationStopped=Yx,this}return g(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Ru)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Ru)},persist:function(){},isPersistent:Ru}),r}var ba={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Du=rn(ba),Tl=g({},ba,{view:0,detail:0}),aT=rn(Tl),Cf,Nf,jl,Ou=g({},Tl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Tf,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==jl&&(jl&&n.type==="mousemove"?(Cf=n.screenX-jl.screenX,Nf=n.screenY-jl.screenY):Nf=Cf=0,jl=n),Cf)},movementY:function(n){return"movementY"in n?n.movementY:Nf}}),Xx=rn(Ou),oT=g({},Ou,{dataTransfer:0}),lT=rn(oT),cT=g({},Tl,{relatedTarget:0}),Ef=rn(cT),uT=g({},ba,{animationName:0,elapsedTime:0,pseudoElement:0}),dT=rn(uT),hT=g({},ba,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),fT=rn(hT),mT=g({},ba,{data:0}),Zx=rn(mT),pT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},gT={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"},bT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function xT(n){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(n):(n=bT[n])?!!r[n]:!1}function Tf(){return xT}var vT=g({},Tl,{key:function(n){if(n.key){var r=pT[n.key]||n.key;if(r!=="Unidentified")return r}return n.type==="keypress"?(n=Mu(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?gT[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Tf,charCode:function(n){return n.type==="keypress"?Mu(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Mu(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),_T=rn(vT),yT=g({},Ou,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Qx=rn(yT),ST=g({},Tl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Tf}),wT=rn(ST),kT=g({},ba,{propertyName:0,elapsedTime:0,pseudoElement:0}),CT=rn(kT),NT=g({},Ou,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),ET=rn(NT),TT=g({},ba,{newState:0,oldState:0}),jT=rn(TT),AT=[9,13,27,32],jf=Yi&&"CompositionEvent"in window,Al=null;Yi&&"documentMode"in document&&(Al=document.documentMode);var MT=Yi&&"TextEvent"in window&&!Al,Jx=Yi&&(!jf||Al&&8<Al&&11>=Al),ev=" ",tv=!1;function sv(n,r){switch(n){case"keyup":return AT.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function nv(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var po=!1;function RT(n,r){switch(n){case"compositionend":return nv(r);case"keypress":return r.which!==32?null:(tv=!0,ev);case"textInput":return n=r.data,n===ev&&tv?null:n;default:return null}}function DT(n,r){if(po)return n==="compositionend"||!jf&&sv(n,r)?(n=Kx(),Au=kf=Nr=null,po=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return Jx&&r.locale!=="ko"?null:r.data;default:return null}}var OT={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 iv(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r==="input"?!!OT[n.type]:r==="textarea"}function rv(n,r,c,f){it?Pt?Pt.push(f):Pt=[f]:it=f,r=wd(r,"onChange"),0<r.length&&(c=new Du("onChange","change",null,c,f),n.push({event:c,listeners:r}))}var Ml=null,Rl=null;function LT(n){H_(n,0)}function Lu(n){var r=Sr(n);if(Sl(r))return n}function av(n,r){if(n==="change")return r}var ov=!1;if(Yi){var Af;if(Yi){var Mf="oninput"in document;if(!Mf){var lv=document.createElement("div");lv.setAttribute("oninput","return;"),Mf=typeof lv.oninput=="function"}Af=Mf}else Af=!1;ov=Af&&(!document.documentMode||9<document.documentMode)}function cv(){Ml&&(Ml.detachEvent("onpropertychange",uv),Rl=Ml=null)}function uv(n){if(n.propertyName==="value"&&Lu(Rl)){var r=[];rv(r,Rl,n,We(n)),ju(LT,r)}}function zT(n,r,c){n==="focusin"?(cv(),Ml=r,Rl=c,Ml.attachEvent("onpropertychange",uv)):n==="focusout"&&cv()}function BT(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Lu(Rl)}function IT(n,r){if(n==="click")return Lu(r)}function PT(n,r){if(n==="input"||n==="change")return Lu(r)}function $T(n,r){return n===r&&(n!==0||1/n===1/r)||n!==n&&r!==r}var _n=typeof Object.is=="function"?Object.is:$T;function Dl(n,r){if(_n(n,r))return!0;if(typeof n!="object"||n===null||typeof r!="object"||r===null)return!1;var c=Object.keys(n),f=Object.keys(r);if(c.length!==f.length)return!1;for(f=0;f<c.length;f++){var b=c[f];if(!Hi.call(r,b)||!_n(n[b],r[b]))return!1}return!0}function dv(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function hv(n,r){var c=dv(n);n=0;for(var f;c;){if(c.nodeType===3){if(f=n+c.textContent.length,n<=r&&f>=r)return{node:c,offset:r-n};n=f}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=dv(c)}}function fv(n,r){return n&&r?n===r?!0:n&&n.nodeType===3?!1:r&&r.nodeType===3?fv(n,r.parentNode):"contains"in n?n.contains(r):n.compareDocumentPosition?!!(n.compareDocumentPosition(r)&16):!1:!1}function mv(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var r=ho(n.document);r instanceof n.HTMLIFrameElement;){try{var c=typeof r.contentWindow.location.href=="string"}catch{c=!1}if(c)n=r.contentWindow;else break;r=ho(n.document)}return r}function Rf(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r&&(r==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||r==="textarea"||n.contentEditable==="true")}var HT=Yi&&"documentMode"in document&&11>=document.documentMode,go=null,Df=null,Ol=null,Of=!1;function pv(n,r,c){var f=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Of||go==null||go!==ho(f)||(f=go,"selectionStart"in f&&Rf(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),Ol&&Dl(Ol,f)||(Ol=f,f=wd(Df,"onSelect"),0<f.length&&(r=new Du("onSelect","select",null,r,c),n.push({event:r,listeners:f}),r.target=go)))}function xa(n,r){var c={};return c[n.toLowerCase()]=r.toLowerCase(),c["Webkit"+n]="webkit"+r,c["Moz"+n]="moz"+r,c}var bo={animationend:xa("Animation","AnimationEnd"),animationiteration:xa("Animation","AnimationIteration"),animationstart:xa("Animation","AnimationStart"),transitionrun:xa("Transition","TransitionRun"),transitionstart:xa("Transition","TransitionStart"),transitioncancel:xa("Transition","TransitionCancel"),transitionend:xa("Transition","TransitionEnd")},Lf={},gv={};Yi&&(gv=document.createElement("div").style,"AnimationEvent"in window||(delete bo.animationend.animation,delete bo.animationiteration.animation,delete bo.animationstart.animation),"TransitionEvent"in window||delete bo.transitionend.transition);function va(n){if(Lf[n])return Lf[n];if(!bo[n])return n;var r=bo[n],c;for(c in r)if(r.hasOwnProperty(c)&&c in gv)return Lf[n]=r[c];return n}var bv=va("animationend"),xv=va("animationiteration"),vv=va("animationstart"),UT=va("transitionrun"),FT=va("transitionstart"),qT=va("transitioncancel"),_v=va("transitionend"),yv=new Map,zf="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(" ");zf.push("scrollEnd");function ii(n,r){yv.set(n,r),Wi(r,[n])}var zu=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},On=[],xo=0,Bf=0;function Bu(){for(var n=xo,r=Bf=xo=0;r<n;){var c=On[r];On[r++]=null;var f=On[r];On[r++]=null;var b=On[r];On[r++]=null;var x=On[r];if(On[r++]=null,f!==null&&b!==null){var k=f.pending;k===null?b.next=b:(b.next=k.next,k.next=b),f.pending=b}x!==0&&Sv(c,b,x)}}function Iu(n,r,c,f){On[xo++]=n,On[xo++]=r,On[xo++]=c,On[xo++]=f,Bf|=f,n.lanes|=f,n=n.alternate,n!==null&&(n.lanes|=f)}function If(n,r,c,f){return Iu(n,r,c,f),Pu(n)}function _a(n,r){return Iu(n,null,null,r),Pu(n)}function Sv(n,r,c){n.lanes|=c;var f=n.alternate;f!==null&&(f.lanes|=c);for(var b=!1,x=n.return;x!==null;)x.childLanes|=c,f=x.alternate,f!==null&&(f.childLanes|=c),x.tag===22&&(n=x.stateNode,n===null||n._visibility&1||(b=!0)),n=x,x=x.return;return n.tag===3?(x=n.stateNode,b&&r!==null&&(b=31-js(c),n=x.hiddenUpdates,f=n[b],f===null?n[b]=[r]:f.push(r),r.lane=c|536870912),x):null}function Pu(n){if(50<sc)throw sc=0,Wm=null,Error(i(185));for(var r=n.return;r!==null;)n=r,r=n.return;return n.tag===3?n.stateNode:null}var vo={};function VT(n,r,c,f){this.tag=n,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yn(n,r,c,f){return new VT(n,r,c,f)}function Pf(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Xi(n,r){var c=n.alternate;return c===null?(c=yn(n.tag,r,n.key,n.mode),c.elementType=n.elementType,c.type=n.type,c.stateNode=n.stateNode,c.alternate=n,n.alternate=c):(c.pendingProps=r,c.type=n.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=n.flags&65011712,c.childLanes=n.childLanes,c.lanes=n.lanes,c.child=n.child,c.memoizedProps=n.memoizedProps,c.memoizedState=n.memoizedState,c.updateQueue=n.updateQueue,r=n.dependencies,c.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},c.sibling=n.sibling,c.index=n.index,c.ref=n.ref,c.refCleanup=n.refCleanup,c}function wv(n,r){n.flags&=65011714;var c=n.alternate;return c===null?(n.childLanes=0,n.lanes=r,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=c.childLanes,n.lanes=c.lanes,n.child=c.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=c.memoizedProps,n.memoizedState=c.memoizedState,n.updateQueue=c.updateQueue,n.type=c.type,r=c.dependencies,n.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),n}function $u(n,r,c,f,b,x){var k=0;if(f=n,typeof n=="function")Pf(n)&&(k=1);else if(typeof n=="string")k=Xj(n,c,de.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case $:return n=yn(31,c,r,b),n.elementType=$,n.lanes=x,n;case w:return ya(c.children,b,x,r);case C:k=8,b|=24;break;case E:return n=yn(12,c,r,b|2),n.elementType=E,n.lanes=x,n;case R:return n=yn(13,c,r,b),n.elementType=R,n.lanes=x,n;case z:return n=yn(19,c,r,b),n.elementType=z,n.lanes=x,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case N:k=10;break e;case T:k=9;break e;case j:k=11;break e;case D:k=14;break e;case M:k=16,f=null;break e}k=29,c=Error(i(130,n===null?"null":typeof n,"")),f=null}return r=yn(k,c,r,b),r.elementType=n,r.type=f,r.lanes=x,r}function ya(n,r,c,f){return n=yn(7,n,f,r),n.lanes=c,n}function $f(n,r,c){return n=yn(6,n,null,r),n.lanes=c,n}function kv(n){var r=yn(18,null,null,0);return r.stateNode=n,r}function Hf(n,r,c){return r=yn(4,n.children!==null?n.children:[],n.key,r),r.lanes=c,r.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},r}var Cv=new WeakMap;function Ln(n,r){if(typeof n=="object"&&n!==null){var c=Cv.get(n);return c!==void 0?c:(r={value:n,source:r,stack:$i(r)},Cv.set(n,r),r)}return{value:n,source:r,stack:$i(r)}}var _o=[],yo=0,Hu=null,Ll=0,zn=[],Bn=0,Er=null,xi=1,vi="";function Zi(n,r){_o[yo++]=Ll,_o[yo++]=Hu,Hu=n,Ll=r}function Nv(n,r,c){zn[Bn++]=xi,zn[Bn++]=vi,zn[Bn++]=Er,Er=n;var f=xi;n=vi;var b=32-js(f)-1;f&=~(1<<b),c+=1;var x=32-js(r)+b;if(30<x){var k=b-b%5;x=(f&(1<<k)-1).toString(32),f>>=k,b-=k,xi=1<<32-js(r)+b|c<<b|f,vi=x+n}else xi=1<<x|c<<b|f,vi=n}function Uf(n){n.return!==null&&(Zi(n,1),Nv(n,1,0))}function Ff(n){for(;n===Hu;)Hu=_o[--yo],_o[yo]=null,Ll=_o[--yo],_o[yo]=null;for(;n===Er;)Er=zn[--Bn],zn[Bn]=null,vi=zn[--Bn],zn[Bn]=null,xi=zn[--Bn],zn[Bn]=null}function Ev(n,r){zn[Bn++]=xi,zn[Bn++]=vi,zn[Bn++]=Er,xi=r.id,vi=r.overflow,Er=n}var Ms=null,At=null,ot=!1,Tr=null,In=!1,qf=Error(i(519));function jr(n){var r=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw zl(Ln(r,n)),qf}function Tv(n){var r=n.stateNode,c=n.type,f=n.memoizedProps;switch(r[Yt]=n,r[$s]=f,c){case"dialog":st("cancel",r),st("close",r);break;case"iframe":case"object":case"embed":st("load",r);break;case"video":case"audio":for(c=0;c<ic.length;c++)st(ic[c],r);break;case"source":st("error",r);break;case"img":case"image":case"link":st("error",r),st("load",r);break;case"details":st("toggle",r);break;case"input":st("invalid",r),ga(r,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":st("invalid",r);break;case"textarea":st("invalid",r),mo(r,f.value,f.defaultValue,f.children)}c=f.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||r.textContent===""+c||f.suppressHydrationWarning===!0||V_(r.textContent,c)?(f.popover!=null&&(st("beforetoggle",r),st("toggle",r)),f.onScroll!=null&&st("scroll",r),f.onScrollEnd!=null&&st("scrollend",r),f.onClick!=null&&(r.onclick=xe),r=!0):r=!1,r||jr(n,!0)}function jv(n){for(Ms=n.return;Ms;)switch(Ms.tag){case 5:case 31:case 13:In=!1;return;case 27:case 3:In=!0;return;default:Ms=Ms.return}}function So(n){if(n!==Ms)return!1;if(!ot)return jv(n),ot=!0,!1;var r=n.tag,c;if((c=r!==3&&r!==27)&&((c=r===5)&&(c=n.type,c=!(c!=="form"&&c!=="button")||lp(n.type,n.memoizedProps)),c=!c),c&&At&&jr(n),jv(n),r===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(317));At=ey(n)}else if(r===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(317));At=ey(n)}else r===27?(r=At,Fr(n.type)?(n=fp,fp=null,At=n):At=r):At=Ms?$n(n.stateNode.nextSibling):null;return!0}function Sa(){At=Ms=null,ot=!1}function Vf(){var n=Tr;return n!==null&&(cn===null?cn=n:cn.push.apply(cn,n),Tr=null),n}function zl(n){Tr===null?Tr=[n]:Tr.push(n)}var Gf=O(null),wa=null,Qi=null;function Ar(n,r,c){ie(Gf,r._currentValue),r._currentValue=c}function Ji(n){n._currentValue=Gf.current,Z(Gf)}function Wf(n,r,c){for(;n!==null;){var f=n.alternate;if((n.childLanes&r)!==r?(n.childLanes|=r,f!==null&&(f.childLanes|=r)):f!==null&&(f.childLanes&r)!==r&&(f.childLanes|=r),n===c)break;n=n.return}}function Kf(n,r,c,f){var b=n.child;for(b!==null&&(b.return=n);b!==null;){var x=b.dependencies;if(x!==null){var k=b.child;x=x.firstContext;e:for(;x!==null;){var A=x;x=b;for(var H=0;H<r.length;H++)if(A.context===r[H]){x.lanes|=c,A=x.alternate,A!==null&&(A.lanes|=c),Wf(x.return,c,n),f||(k=null);break e}x=A.next}}else if(b.tag===18){if(k=b.return,k===null)throw Error(i(341));k.lanes|=c,x=k.alternate,x!==null&&(x.lanes|=c),Wf(k,c,n),k=null}else k=b.child;if(k!==null)k.return=b;else for(k=b;k!==null;){if(k===n){k=null;break}if(b=k.sibling,b!==null){b.return=k.return,k=b;break}k=k.return}b=k}}function wo(n,r,c,f){n=null;for(var b=r,x=!1;b!==null;){if(!x){if((b.flags&524288)!==0)x=!0;else if((b.flags&262144)!==0)break}if(b.tag===10){var k=b.alternate;if(k===null)throw Error(i(387));if(k=k.memoizedProps,k!==null){var A=b.type;_n(b.pendingProps.value,k.value)||(n!==null?n.push(A):n=[A])}}else if(b===Se.current){if(k=b.alternate,k===null)throw Error(i(387));k.memoizedState.memoizedState!==b.memoizedState.memoizedState&&(n!==null?n.push(cc):n=[cc])}b=b.return}n!==null&&Kf(r,n,c,f),r.flags|=262144}function Uu(n){for(n=n.firstContext;n!==null;){if(!_n(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function ka(n){wa=n,Qi=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Rs(n){return Av(wa,n)}function Fu(n,r){return wa===null&&ka(n),Av(n,r)}function Av(n,r){var c=r._currentValue;if(r={context:r,memoizedValue:c,next:null},Qi===null){if(n===null)throw Error(i(308));Qi=r,n.dependencies={lanes:0,firstContext:r},n.flags|=524288}else Qi=Qi.next=r;return c}var GT=typeof AbortController<"u"?AbortController:function(){var n=[],r=this.signal={aborted:!1,addEventListener:function(c,f){n.push(f)}};this.abort=function(){r.aborted=!0,n.forEach(function(c){return c()})}},WT=e.unstable_scheduleCallback,KT=e.unstable_NormalPriority,ss={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Yf(){return{controller:new GT,data:new Map,refCount:0}}function Bl(n){n.refCount--,n.refCount===0&&WT(KT,function(){n.controller.abort()})}var Il=null,Xf=0,ko=0,Co=null;function YT(n,r){if(Il===null){var c=Il=[];Xf=0,ko=Jm(),Co={status:"pending",value:void 0,then:function(f){c.push(f)}}}return Xf++,r.then(Mv,Mv),r}function Mv(){if(--Xf===0&&Il!==null){Co!==null&&(Co.status="fulfilled");var n=Il;Il=null,ko=0,Co=null;for(var r=0;r<n.length;r++)(0,n[r])()}}function XT(n,r){var c=[],f={status:"pending",value:null,reason:null,then:function(b){c.push(b)}};return n.then(function(){f.status="fulfilled",f.value=r;for(var b=0;b<c.length;b++)(0,c[b])(r)},function(b){for(f.status="rejected",f.reason=b,b=0;b<c.length;b++)(0,c[b])(void 0)}),f}var Rv=I.S;I.S=function(n,r){p_=gt(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&YT(n,r),Rv!==null&&Rv(n,r)};var Ca=O(null);function Zf(){var n=Ca.current;return n!==null?n:Nt.pooledCache}function qu(n,r){r===null?ie(Ca,Ca.current):ie(Ca,r.pool)}function Dv(){var n=Zf();return n===null?null:{parent:ss._currentValue,pool:n}}var No=Error(i(460)),Qf=Error(i(474)),Vu=Error(i(542)),Gu={then:function(){}};function Ov(n){return n=n.status,n==="fulfilled"||n==="rejected"}function Lv(n,r,c){switch(c=n[c],c===void 0?n.push(r):c!==r&&(r.then(xe,xe),r=c),r.status){case"fulfilled":return r.value;case"rejected":throw n=r.reason,Bv(n),n;default:if(typeof r.status=="string")r.then(xe,xe);else{if(n=Nt,n!==null&&100<n.shellSuspendCounter)throw Error(i(482));n=r,n.status="pending",n.then(function(f){if(r.status==="pending"){var b=r;b.status="fulfilled",b.value=f}},function(f){if(r.status==="pending"){var b=r;b.status="rejected",b.reason=f}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw n=r.reason,Bv(n),n}throw Ea=r,No}}function Na(n){try{var r=n._init;return r(n._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Ea=c,No):c}}var Ea=null;function zv(){if(Ea===null)throw Error(i(459));var n=Ea;return Ea=null,n}function Bv(n){if(n===No||n===Vu)throw Error(i(483))}var Eo=null,Pl=0;function Wu(n){var r=Pl;return Pl+=1,Eo===null&&(Eo=[]),Lv(Eo,n,r)}function $l(n,r){r=r.props.ref,n.ref=r!==void 0?r:null}function Ku(n,r){throw r.$$typeof===v?Error(i(525)):(n=Object.prototype.toString.call(r),Error(i(31,n==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":n)))}function Iv(n){function r(K,q){if(n){var Q=K.deletions;Q===null?(K.deletions=[q],K.flags|=16):Q.push(q)}}function c(K,q){if(!n)return null;for(;q!==null;)r(K,q),q=q.sibling;return null}function f(K){for(var q=new Map;K!==null;)K.key!==null?q.set(K.key,K):q.set(K.index,K),K=K.sibling;return q}function b(K,q){return K=Xi(K,q),K.index=0,K.sibling=null,K}function x(K,q,Q){return K.index=Q,n?(Q=K.alternate,Q!==null?(Q=Q.index,Q<q?(K.flags|=67108866,q):Q):(K.flags|=67108866,q)):(K.flags|=1048576,q)}function k(K){return n&&K.alternate===null&&(K.flags|=67108866),K}function A(K,q,Q,oe){return q===null||q.tag!==6?(q=$f(Q,K.mode,oe),q.return=K,q):(q=b(q,Q),q.return=K,q)}function H(K,q,Q,oe){var Ie=Q.type;return Ie===w?re(K,q,Q.props.children,oe,Q.key):q!==null&&(q.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===M&&Na(Ie)===q.type)?(q=b(q,Q.props),$l(q,Q),q.return=K,q):(q=$u(Q.type,Q.key,Q.props,null,K.mode,oe),$l(q,Q),q.return=K,q)}function J(K,q,Q,oe){return q===null||q.tag!==4||q.stateNode.containerInfo!==Q.containerInfo||q.stateNode.implementation!==Q.implementation?(q=Hf(Q,K.mode,oe),q.return=K,q):(q=b(q,Q.children||[]),q.return=K,q)}function re(K,q,Q,oe,Ie){return q===null||q.tag!==7?(q=ya(Q,K.mode,oe,Ie),q.return=K,q):(q=b(q,Q),q.return=K,q)}function ce(K,q,Q){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=$f(""+q,K.mode,Q),q.return=K,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case _:return Q=$u(q.type,q.key,q.props,null,K.mode,Q),$l(Q,q),Q.return=K,Q;case S:return q=Hf(q,K.mode,Q),q.return=K,q;case M:return q=Na(q),ce(K,q,Q)}if(G(q)||P(q))return q=ya(q,K.mode,Q,null),q.return=K,q;if(typeof q.then=="function")return ce(K,Wu(q),Q);if(q.$$typeof===N)return ce(K,Fu(K,q),Q);Ku(K,q)}return null}function te(K,q,Q,oe){var Ie=q!==null?q.key:null;if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Ie!==null?null:A(K,q,""+Q,oe);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case _:return Q.key===Ie?H(K,q,Q,oe):null;case S:return Q.key===Ie?J(K,q,Q,oe):null;case M:return Q=Na(Q),te(K,q,Q,oe)}if(G(Q)||P(Q))return Ie!==null?null:re(K,q,Q,oe,null);if(typeof Q.then=="function")return te(K,q,Wu(Q),oe);if(Q.$$typeof===N)return te(K,q,Fu(K,Q),oe);Ku(K,Q)}return null}function ne(K,q,Q,oe,Ie){if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return K=K.get(Q)||null,A(q,K,""+oe,Ie);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case _:return K=K.get(oe.key===null?Q:oe.key)||null,H(q,K,oe,Ie);case S:return K=K.get(oe.key===null?Q:oe.key)||null,J(q,K,oe,Ie);case M:return oe=Na(oe),ne(K,q,Q,oe,Ie)}if(G(oe)||P(oe))return K=K.get(Q)||null,re(q,K,oe,Ie,null);if(typeof oe.then=="function")return ne(K,q,Q,Wu(oe),Ie);if(oe.$$typeof===N)return ne(K,q,Q,Fu(q,oe),Ie);Ku(q,oe)}return null}function Ee(K,q,Q,oe){for(var Ie=null,ut=null,De=q,Ye=q=0,at=null;De!==null&&Ye<Q.length;Ye++){De.index>Ye?(at=De,De=null):at=De.sibling;var dt=te(K,De,Q[Ye],oe);if(dt===null){De===null&&(De=at);break}n&&De&&dt.alternate===null&&r(K,De),q=x(dt,q,Ye),ut===null?Ie=dt:ut.sibling=dt,ut=dt,De=at}if(Ye===Q.length)return c(K,De),ot&&Zi(K,Ye),Ie;if(De===null){for(;Ye<Q.length;Ye++)De=ce(K,Q[Ye],oe),De!==null&&(q=x(De,q,Ye),ut===null?Ie=De:ut.sibling=De,ut=De);return ot&&Zi(K,Ye),Ie}for(De=f(De);Ye<Q.length;Ye++)at=ne(De,K,Ye,Q[Ye],oe),at!==null&&(n&&at.alternate!==null&&De.delete(at.key===null?Ye:at.key),q=x(at,q,Ye),ut===null?Ie=at:ut.sibling=at,ut=at);return n&&De.forEach(function(Kr){return r(K,Kr)}),ot&&Zi(K,Ye),Ie}function $e(K,q,Q,oe){if(Q==null)throw Error(i(151));for(var Ie=null,ut=null,De=q,Ye=q=0,at=null,dt=Q.next();De!==null&&!dt.done;Ye++,dt=Q.next()){De.index>Ye?(at=De,De=null):at=De.sibling;var Kr=te(K,De,dt.value,oe);if(Kr===null){De===null&&(De=at);break}n&&De&&Kr.alternate===null&&r(K,De),q=x(Kr,q,Ye),ut===null?Ie=Kr:ut.sibling=Kr,ut=Kr,De=at}if(dt.done)return c(K,De),ot&&Zi(K,Ye),Ie;if(De===null){for(;!dt.done;Ye++,dt=Q.next())dt=ce(K,dt.value,oe),dt!==null&&(q=x(dt,q,Ye),ut===null?Ie=dt:ut.sibling=dt,ut=dt);return ot&&Zi(K,Ye),Ie}for(De=f(De);!dt.done;Ye++,dt=Q.next())dt=ne(De,K,Ye,dt.value,oe),dt!==null&&(n&&dt.alternate!==null&&De.delete(dt.key===null?Ye:dt.key),q=x(dt,q,Ye),ut===null?Ie=dt:ut.sibling=dt,ut=dt);return n&&De.forEach(function(oA){return r(K,oA)}),ot&&Zi(K,Ye),Ie}function wt(K,q,Q,oe){if(typeof Q=="object"&&Q!==null&&Q.type===w&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case _:e:{for(var Ie=Q.key;q!==null;){if(q.key===Ie){if(Ie=Q.type,Ie===w){if(q.tag===7){c(K,q.sibling),oe=b(q,Q.props.children),oe.return=K,K=oe;break e}}else if(q.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===M&&Na(Ie)===q.type){c(K,q.sibling),oe=b(q,Q.props),$l(oe,Q),oe.return=K,K=oe;break e}c(K,q);break}else r(K,q);q=q.sibling}Q.type===w?(oe=ya(Q.props.children,K.mode,oe,Q.key),oe.return=K,K=oe):(oe=$u(Q.type,Q.key,Q.props,null,K.mode,oe),$l(oe,Q),oe.return=K,K=oe)}return k(K);case S:e:{for(Ie=Q.key;q!==null;){if(q.key===Ie)if(q.tag===4&&q.stateNode.containerInfo===Q.containerInfo&&q.stateNode.implementation===Q.implementation){c(K,q.sibling),oe=b(q,Q.children||[]),oe.return=K,K=oe;break e}else{c(K,q);break}else r(K,q);q=q.sibling}oe=Hf(Q,K.mode,oe),oe.return=K,K=oe}return k(K);case M:return Q=Na(Q),wt(K,q,Q,oe)}if(G(Q))return Ee(K,q,Q,oe);if(P(Q)){if(Ie=P(Q),typeof Ie!="function")throw Error(i(150));return Q=Ie.call(Q),$e(K,q,Q,oe)}if(typeof Q.then=="function")return wt(K,q,Wu(Q),oe);if(Q.$$typeof===N)return wt(K,q,Fu(K,Q),oe);Ku(K,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,q!==null&&q.tag===6?(c(K,q.sibling),oe=b(q,Q),oe.return=K,K=oe):(c(K,q),oe=$f(Q,K.mode,oe),oe.return=K,K=oe),k(K)):c(K,q)}return function(K,q,Q,oe){try{Pl=0;var Ie=wt(K,q,Q,oe);return Eo=null,Ie}catch(De){if(De===No||De===Vu)throw De;var ut=yn(29,De,null,K.mode);return ut.lanes=oe,ut.return=K,ut}}}var Ta=Iv(!0),Pv=Iv(!1),Mr=!1;function Jf(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function em(n,r){n=n.updateQueue,r.updateQueue===n&&(r.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function Rr(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function Dr(n,r,c){var f=n.updateQueue;if(f===null)return null;if(f=f.shared,(ft&2)!==0){var b=f.pending;return b===null?r.next=r:(r.next=b.next,b.next=r),f.pending=r,r=Pu(n),Sv(n,null,c),r}return Iu(n,f,r,c),Pu(n)}function Hl(n,r,c){if(r=r.updateQueue,r!==null&&(r=r.shared,(c&4194048)!==0)){var f=r.lanes;f&=n.pendingLanes,c|=f,r.lanes=c,Ue(n,c)}}function tm(n,r){var c=n.updateQueue,f=n.alternate;if(f!==null&&(f=f.updateQueue,c===f)){var b=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var k={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};x===null?b=x=k:x=x.next=k,c=c.next}while(c!==null);x===null?b=x=r:x=x.next=r}else b=x=r;c={baseState:f.baseState,firstBaseUpdate:b,lastBaseUpdate:x,shared:f.shared,callbacks:f.callbacks},n.updateQueue=c;return}n=c.lastBaseUpdate,n===null?c.firstBaseUpdate=r:n.next=r,c.lastBaseUpdate=r}var sm=!1;function Ul(){if(sm){var n=Co;if(n!==null)throw n}}function Fl(n,r,c,f){sm=!1;var b=n.updateQueue;Mr=!1;var x=b.firstBaseUpdate,k=b.lastBaseUpdate,A=b.shared.pending;if(A!==null){b.shared.pending=null;var H=A,J=H.next;H.next=null,k===null?x=J:k.next=J,k=H;var re=n.alternate;re!==null&&(re=re.updateQueue,A=re.lastBaseUpdate,A!==k&&(A===null?re.firstBaseUpdate=J:A.next=J,re.lastBaseUpdate=H))}if(x!==null){var ce=b.baseState;k=0,re=J=H=null,A=x;do{var te=A.lane&-536870913,ne=te!==A.lane;if(ne?(rt&te)===te:(f&te)===te){te!==0&&te===ko&&(sm=!0),re!==null&&(re=re.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var Ee=n,$e=A;te=r;var wt=c;switch($e.tag){case 1:if(Ee=$e.payload,typeof Ee=="function"){ce=Ee.call(wt,ce,te);break e}ce=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=$e.payload,te=typeof Ee=="function"?Ee.call(wt,ce,te):Ee,te==null)break e;ce=g({},ce,te);break e;case 2:Mr=!0}}te=A.callback,te!==null&&(n.flags|=64,ne&&(n.flags|=8192),ne=b.callbacks,ne===null?b.callbacks=[te]:ne.push(te))}else ne={lane:te,tag:A.tag,payload:A.payload,callback:A.callback,next:null},re===null?(J=re=ne,H=ce):re=re.next=ne,k|=te;if(A=A.next,A===null){if(A=b.shared.pending,A===null)break;ne=A,A=ne.next,ne.next=null,b.lastBaseUpdate=ne,b.shared.pending=null}}while(!0);re===null&&(H=ce),b.baseState=H,b.firstBaseUpdate=J,b.lastBaseUpdate=re,x===null&&(b.shared.lanes=0),Ir|=k,n.lanes=k,n.memoizedState=ce}}function $v(n,r){if(typeof n!="function")throw Error(i(191,n));n.call(r)}function Hv(n,r){var c=n.callbacks;if(c!==null)for(n.callbacks=null,n=0;n<c.length;n++)$v(c[n],r)}var To=O(null),Yu=O(0);function Uv(n,r){n=lr,ie(Yu,n),ie(To,r),lr=n|r.baseLanes}function nm(){ie(Yu,lr),ie(To,To.current)}function im(){lr=Yu.current,Z(To),Z(Yu)}var Sn=O(null),Pn=null;function Or(n){var r=n.alternate;ie(Zt,Zt.current&1),ie(Sn,n),Pn===null&&(r===null||To.current!==null||r.memoizedState!==null)&&(Pn=n)}function rm(n){ie(Zt,Zt.current),ie(Sn,n),Pn===null&&(Pn=n)}function Fv(n){n.tag===22?(ie(Zt,Zt.current),ie(Sn,n),Pn===null&&(Pn=n)):Lr()}function Lr(){ie(Zt,Zt.current),ie(Sn,Sn.current)}function wn(n){Z(Sn),Pn===n&&(Pn=null),Z(Zt)}var Zt=O(0);function Xu(n){for(var r=n;r!==null;){if(r.tag===13){var c=r.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||dp(c)||hp(c)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===n)break;for(;r.sibling===null;){if(r.return===null||r.return===n)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var er=0,Ke=null,yt=null,ns=null,Zu=!1,jo=!1,ja=!1,Qu=0,ql=0,Ao=null,ZT=0;function Ut(){throw Error(i(321))}function am(n,r){if(r===null)return!1;for(var c=0;c<r.length&&c<n.length;c++)if(!_n(n[c],r[c]))return!1;return!0}function om(n,r,c,f,b,x){return er=x,Ke=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,I.H=n===null||n.memoizedState===null?N1:Sm,ja=!1,x=c(f,b),ja=!1,jo&&(x=Vv(r,c,f,b)),qv(n),x}function qv(n){I.H=Wl;var r=yt!==null&&yt.next!==null;if(er=0,ns=yt=Ke=null,Zu=!1,ql=0,Ao=null,r)throw Error(i(300));n===null||is||(n=n.dependencies,n!==null&&Uu(n)&&(is=!0))}function Vv(n,r,c,f){Ke=n;var b=0;do{if(jo&&(Ao=null),ql=0,jo=!1,25<=b)throw Error(i(301));if(b+=1,ns=yt=null,n.updateQueue!=null){var x=n.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}I.H=E1,x=r(c,f)}while(jo);return x}function QT(){var n=I.H,r=n.useState()[0];return r=typeof r.then=="function"?Vl(r):r,n=n.useState()[0],(yt!==null?yt.memoizedState:null)!==n&&(Ke.flags|=1024),r}function lm(){var n=Qu!==0;return Qu=0,n}function cm(n,r,c){r.updateQueue=n.updateQueue,r.flags&=-2053,n.lanes&=~c}function um(n){if(Zu){for(n=n.memoizedState;n!==null;){var r=n.queue;r!==null&&(r.pending=null),n=n.next}Zu=!1}er=0,ns=yt=Ke=null,jo=!1,ql=Qu=0,Ao=null}function Ys(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ns===null?Ke.memoizedState=ns=n:ns=ns.next=n,ns}function Qt(){if(yt===null){var n=Ke.alternate;n=n!==null?n.memoizedState:null}else n=yt.next;var r=ns===null?Ke.memoizedState:ns.next;if(r!==null)ns=r,yt=n;else{if(n===null)throw Ke.alternate===null?Error(i(467)):Error(i(310));yt=n,n={memoizedState:yt.memoizedState,baseState:yt.baseState,baseQueue:yt.baseQueue,queue:yt.queue,next:null},ns===null?Ke.memoizedState=ns=n:ns=ns.next=n}return ns}function Ju(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Vl(n){var r=ql;return ql+=1,Ao===null&&(Ao=[]),n=Lv(Ao,n,r),r=Ke,(ns===null?r.memoizedState:ns.next)===null&&(r=r.alternate,I.H=r===null||r.memoizedState===null?N1:Sm),n}function ed(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Vl(n);if(n.$$typeof===N)return Rs(n)}throw Error(i(438,String(n)))}function dm(n){var r=null,c=Ke.updateQueue;if(c!==null&&(r=c.memoCache),r==null){var f=Ke.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(r={data:f.data.map(function(b){return b.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),c===null&&(c=Ju(),Ke.updateQueue=c),c.memoCache=r,c=r.data[r.index],c===void 0)for(c=r.data[r.index]=Array(n),f=0;f<n;f++)c[f]=L;return r.index++,c}function tr(n,r){return typeof r=="function"?r(n):r}function td(n){var r=Qt();return hm(r,yt,n)}function hm(n,r,c){var f=n.queue;if(f===null)throw Error(i(311));f.lastRenderedReducer=c;var b=n.baseQueue,x=f.pending;if(x!==null){if(b!==null){var k=b.next;b.next=x.next,x.next=k}r.baseQueue=b=x,f.pending=null}if(x=n.baseState,b===null)n.memoizedState=x;else{r=b.next;var A=k=null,H=null,J=r,re=!1;do{var ce=J.lane&-536870913;if(ce!==J.lane?(rt&ce)===ce:(er&ce)===ce){var te=J.revertLane;if(te===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null}),ce===ko&&(re=!0);else if((er&te)===te){J=J.next,te===ko&&(re=!0);continue}else ce={lane:0,revertLane:J.revertLane,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},H===null?(A=H=ce,k=x):H=H.next=ce,Ke.lanes|=te,Ir|=te;ce=J.action,ja&&c(x,ce),x=J.hasEagerState?J.eagerState:c(x,ce)}else te={lane:ce,revertLane:J.revertLane,gesture:J.gesture,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},H===null?(A=H=te,k=x):H=H.next=te,Ke.lanes|=ce,Ir|=ce;J=J.next}while(J!==null&&J!==r);if(H===null?k=x:H.next=A,!_n(x,n.memoizedState)&&(is=!0,re&&(c=Co,c!==null)))throw c;n.memoizedState=x,n.baseState=k,n.baseQueue=H,f.lastRenderedState=x}return b===null&&(f.lanes=0),[n.memoizedState,f.dispatch]}function fm(n){var r=Qt(),c=r.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=n;var f=c.dispatch,b=c.pending,x=r.memoizedState;if(b!==null){c.pending=null;var k=b=b.next;do x=n(x,k.action),k=k.next;while(k!==b);_n(x,r.memoizedState)||(is=!0),r.memoizedState=x,r.baseQueue===null&&(r.baseState=x),c.lastRenderedState=x}return[x,f]}function Gv(n,r,c){var f=Ke,b=Qt(),x=ot;if(x){if(c===void 0)throw Error(i(407));c=c()}else c=r();var k=!_n((yt||b).memoizedState,c);if(k&&(b.memoizedState=c,is=!0),b=b.queue,gm(Yv.bind(null,f,b,n),[n]),b.getSnapshot!==r||k||ns!==null&&ns.memoizedState.tag&1){if(f.flags|=2048,Mo(9,{destroy:void 0},Kv.bind(null,f,b,c,r),null),Nt===null)throw Error(i(349));x||(er&127)!==0||Wv(f,r,c)}return c}function Wv(n,r,c){n.flags|=16384,n={getSnapshot:r,value:c},r=Ke.updateQueue,r===null?(r=Ju(),Ke.updateQueue=r,r.stores=[n]):(c=r.stores,c===null?r.stores=[n]:c.push(n))}function Kv(n,r,c,f){r.value=c,r.getSnapshot=f,Xv(r)&&Zv(n)}function Yv(n,r,c){return c(function(){Xv(r)&&Zv(n)})}function Xv(n){var r=n.getSnapshot;n=n.value;try{var c=r();return!_n(n,c)}catch{return!0}}function Zv(n){var r=_a(n,2);r!==null&&un(r,n,2)}function mm(n){var r=Ys();if(typeof n=="function"){var c=n;if(n=c(),ja){Rn(!0);try{c()}finally{Rn(!1)}}}return r.memoizedState=r.baseState=n,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tr,lastRenderedState:n},r}function Qv(n,r,c,f){return n.baseState=c,hm(n,yt,typeof f=="function"?f:tr)}function JT(n,r,c,f,b){if(id(n))throw Error(i(485));if(n=r.action,n!==null){var x={payload:b,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(k){x.listeners.push(k)}};I.T!==null?c(!0):x.isTransition=!1,f(x),c=r.pending,c===null?(x.next=r.pending=x,Jv(r,x)):(x.next=c.next,r.pending=c.next=x)}}function Jv(n,r){var c=r.action,f=r.payload,b=n.state;if(r.isTransition){var x=I.T,k={};I.T=k;try{var A=c(b,f),H=I.S;H!==null&&H(k,A),e1(n,r,A)}catch(J){pm(n,r,J)}finally{x!==null&&k.types!==null&&(x.types=k.types),I.T=x}}else try{x=c(b,f),e1(n,r,x)}catch(J){pm(n,r,J)}}function e1(n,r,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(f){t1(n,r,f)},function(f){return pm(n,r,f)}):t1(n,r,c)}function t1(n,r,c){r.status="fulfilled",r.value=c,s1(r),n.state=c,r=n.pending,r!==null&&(c=r.next,c===r?n.pending=null:(c=c.next,r.next=c,Jv(n,c)))}function pm(n,r,c){var f=n.pending;if(n.pending=null,f!==null){f=f.next;do r.status="rejected",r.reason=c,s1(r),r=r.next;while(r!==f)}n.action=null}function s1(n){n=n.listeners;for(var r=0;r<n.length;r++)(0,n[r])()}function n1(n,r){return r}function i1(n,r){if(ot){var c=Nt.formState;if(c!==null){e:{var f=Ke;if(ot){if(At){t:{for(var b=At,x=In;b.nodeType!==8;){if(!x){b=null;break t}if(b=$n(b.nextSibling),b===null){b=null;break t}}x=b.data,b=x==="F!"||x==="F"?b:null}if(b){At=$n(b.nextSibling),f=b.data==="F!";break e}}jr(f)}f=!1}f&&(r=c[0])}}return c=Ys(),c.memoizedState=c.baseState=r,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n1,lastRenderedState:r},c.queue=f,c=w1.bind(null,Ke,f),f.dispatch=c,f=mm(!1),x=ym.bind(null,Ke,!1,f.queue),f=Ys(),b={state:r,dispatch:null,action:n,pending:null},f.queue=b,c=JT.bind(null,Ke,b,x,c),b.dispatch=c,f.memoizedState=n,[r,c,!1]}function r1(n){var r=Qt();return a1(r,yt,n)}function a1(n,r,c){if(r=hm(n,r,n1)[0],n=td(tr)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var f=Vl(r)}catch(k){throw k===No?Vu:k}else f=r;r=Qt();var b=r.queue,x=b.dispatch;return c!==r.memoizedState&&(Ke.flags|=2048,Mo(9,{destroy:void 0},ej.bind(null,b,c),null)),[f,x,n]}function ej(n,r){n.action=r}function o1(n){var r=Qt(),c=yt;if(c!==null)return a1(r,c,n);Qt(),r=r.memoizedState,c=Qt();var f=c.queue.dispatch;return c.memoizedState=n,[r,f,!1]}function Mo(n,r,c,f){return n={tag:n,create:c,deps:f,inst:r,next:null},r=Ke.updateQueue,r===null&&(r=Ju(),Ke.updateQueue=r),c=r.lastEffect,c===null?r.lastEffect=n.next=n:(f=c.next,c.next=n,n.next=f,r.lastEffect=n),n}function l1(){return Qt().memoizedState}function sd(n,r,c,f){var b=Ys();Ke.flags|=n,b.memoizedState=Mo(1|r,{destroy:void 0},c,f===void 0?null:f)}function nd(n,r,c,f){var b=Qt();f=f===void 0?null:f;var x=b.memoizedState.inst;yt!==null&&f!==null&&am(f,yt.memoizedState.deps)?b.memoizedState=Mo(r,x,c,f):(Ke.flags|=n,b.memoizedState=Mo(1|r,x,c,f))}function c1(n,r){sd(8390656,8,n,r)}function gm(n,r){nd(2048,8,n,r)}function tj(n){Ke.flags|=4;var r=Ke.updateQueue;if(r===null)r=Ju(),Ke.updateQueue=r,r.events=[n];else{var c=r.events;c===null?r.events=[n]:c.push(n)}}function u1(n){var r=Qt().memoizedState;return tj({ref:r,nextImpl:n}),function(){if((ft&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}function d1(n,r){return nd(4,2,n,r)}function h1(n,r){return nd(4,4,n,r)}function f1(n,r){if(typeof r=="function"){n=n();var c=r(n);return function(){typeof c=="function"?c():r(null)}}if(r!=null)return n=n(),r.current=n,function(){r.current=null}}function m1(n,r,c){c=c!=null?c.concat([n]):null,nd(4,4,f1.bind(null,r,n),c)}function bm(){}function p1(n,r){var c=Qt();r=r===void 0?null:r;var f=c.memoizedState;return r!==null&&am(r,f[1])?f[0]:(c.memoizedState=[n,r],n)}function g1(n,r){var c=Qt();r=r===void 0?null:r;var f=c.memoizedState;if(r!==null&&am(r,f[1]))return f[0];if(f=n(),ja){Rn(!0);try{n()}finally{Rn(!1)}}return c.memoizedState=[f,r],f}function xm(n,r,c){return c===void 0||(er&1073741824)!==0&&(rt&261930)===0?n.memoizedState=r:(n.memoizedState=c,n=b_(),Ke.lanes|=n,Ir|=n,c)}function b1(n,r,c,f){return _n(c,r)?c:To.current!==null?(n=xm(n,c,f),_n(n,r)||(is=!0),n):(er&42)===0||(er&1073741824)!==0&&(rt&261930)===0?(is=!0,n.memoizedState=c):(n=b_(),Ke.lanes|=n,Ir|=n,r)}function x1(n,r,c,f,b){var x=Y.p;Y.p=x!==0&&8>x?x:8;var k=I.T,A={};I.T=A,ym(n,!1,r,c);try{var H=b(),J=I.S;if(J!==null&&J(A,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var re=XT(H,f);Gl(n,r,re,Nn(n))}else Gl(n,r,f,Nn(n))}catch(ce){Gl(n,r,{then:function(){},status:"rejected",reason:ce},Nn())}finally{Y.p=x,k!==null&&A.types!==null&&(k.types=A.types),I.T=k}}function sj(){}function vm(n,r,c,f){if(n.tag!==5)throw Error(i(476));var b=v1(n).queue;x1(n,b,r,X,c===null?sj:function(){return _1(n),c(f)})}function v1(n){var r=n.memoizedState;if(r!==null)return r;r={memoizedState:X,baseState:X,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:tr,lastRenderedState:X},next:null};var c={};return r.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:tr,lastRenderedState:c},next:null},n.memoizedState=r,n=n.alternate,n!==null&&(n.memoizedState=r),r}function _1(n){var r=v1(n);r.next===null&&(r=n.alternate.memoizedState),Gl(n,r.next.queue,{},Nn())}function _m(){return Rs(cc)}function y1(){return Qt().memoizedState}function S1(){return Qt().memoizedState}function nj(n){for(var r=n.return;r!==null;){switch(r.tag){case 24:case 3:var c=Nn();n=Rr(c);var f=Dr(r,n,c);f!==null&&(un(f,r,c),Hl(f,r,c)),r={cache:Yf()},n.payload=r;return}r=r.return}}function ij(n,r,c){var f=Nn();c={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},id(n)?k1(r,c):(c=If(n,r,c,f),c!==null&&(un(c,n,f),C1(c,r,f)))}function w1(n,r,c){var f=Nn();Gl(n,r,c,f)}function Gl(n,r,c,f){var b={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(id(n))k1(r,b);else{var x=n.alternate;if(n.lanes===0&&(x===null||x.lanes===0)&&(x=r.lastRenderedReducer,x!==null))try{var k=r.lastRenderedState,A=x(k,c);if(b.hasEagerState=!0,b.eagerState=A,_n(A,k))return Iu(n,r,b,0),Nt===null&&Bu(),!1}catch{}if(c=If(n,r,b,f),c!==null)return un(c,n,f),C1(c,r,f),!0}return!1}function ym(n,r,c,f){if(f={lane:2,revertLane:Jm(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},id(n)){if(r)throw Error(i(479))}else r=If(n,c,f,2),r!==null&&un(r,n,2)}function id(n){var r=n.alternate;return n===Ke||r!==null&&r===Ke}function k1(n,r){jo=Zu=!0;var c=n.pending;c===null?r.next=r:(r.next=c.next,c.next=r),n.pending=r}function C1(n,r,c){if((c&4194048)!==0){var f=r.lanes;f&=n.pendingLanes,c|=f,r.lanes=c,Ue(n,c)}}var Wl={readContext:Rs,use:ed,useCallback:Ut,useContext:Ut,useEffect:Ut,useImperativeHandle:Ut,useLayoutEffect:Ut,useInsertionEffect:Ut,useMemo:Ut,useReducer:Ut,useRef:Ut,useState:Ut,useDebugValue:Ut,useDeferredValue:Ut,useTransition:Ut,useSyncExternalStore:Ut,useId:Ut,useHostTransitionStatus:Ut,useFormState:Ut,useActionState:Ut,useOptimistic:Ut,useMemoCache:Ut,useCacheRefresh:Ut};Wl.useEffectEvent=Ut;var N1={readContext:Rs,use:ed,useCallback:function(n,r){return Ys().memoizedState=[n,r===void 0?null:r],n},useContext:Rs,useEffect:c1,useImperativeHandle:function(n,r,c){c=c!=null?c.concat([n]):null,sd(4194308,4,f1.bind(null,r,n),c)},useLayoutEffect:function(n,r){return sd(4194308,4,n,r)},useInsertionEffect:function(n,r){sd(4,2,n,r)},useMemo:function(n,r){var c=Ys();r=r===void 0?null:r;var f=n();if(ja){Rn(!0);try{n()}finally{Rn(!1)}}return c.memoizedState=[f,r],f},useReducer:function(n,r,c){var f=Ys();if(c!==void 0){var b=c(r);if(ja){Rn(!0);try{c(r)}finally{Rn(!1)}}}else b=r;return f.memoizedState=f.baseState=b,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:b},f.queue=n,n=n.dispatch=ij.bind(null,Ke,n),[f.memoizedState,n]},useRef:function(n){var r=Ys();return n={current:n},r.memoizedState=n},useState:function(n){n=mm(n);var r=n.queue,c=w1.bind(null,Ke,r);return r.dispatch=c,[n.memoizedState,c]},useDebugValue:bm,useDeferredValue:function(n,r){var c=Ys();return xm(c,n,r)},useTransition:function(){var n=mm(!1);return n=x1.bind(null,Ke,n.queue,!0,!1),Ys().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,r,c){var f=Ke,b=Ys();if(ot){if(c===void 0)throw Error(i(407));c=c()}else{if(c=r(),Nt===null)throw Error(i(349));(rt&127)!==0||Wv(f,r,c)}b.memoizedState=c;var x={value:c,getSnapshot:r};return b.queue=x,c1(Yv.bind(null,f,x,n),[n]),f.flags|=2048,Mo(9,{destroy:void 0},Kv.bind(null,f,x,c,r),null),c},useId:function(){var n=Ys(),r=Nt.identifierPrefix;if(ot){var c=vi,f=xi;c=(f&~(1<<32-js(f)-1)).toString(32)+c,r="_"+r+"R_"+c,c=Qu++,0<c&&(r+="H"+c.toString(32)),r+="_"}else c=ZT++,r="_"+r+"r_"+c.toString(32)+"_";return n.memoizedState=r},useHostTransitionStatus:_m,useFormState:i1,useActionState:i1,useOptimistic:function(n){var r=Ys();r.memoizedState=r.baseState=n;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=c,r=ym.bind(null,Ke,!0,c),c.dispatch=r,[n,r]},useMemoCache:dm,useCacheRefresh:function(){return Ys().memoizedState=nj.bind(null,Ke)},useEffectEvent:function(n){var r=Ys(),c={impl:n};return r.memoizedState=c,function(){if((ft&2)!==0)throw Error(i(440));return c.impl.apply(void 0,arguments)}}},Sm={readContext:Rs,use:ed,useCallback:p1,useContext:Rs,useEffect:gm,useImperativeHandle:m1,useInsertionEffect:d1,useLayoutEffect:h1,useMemo:g1,useReducer:td,useRef:l1,useState:function(){return td(tr)},useDebugValue:bm,useDeferredValue:function(n,r){var c=Qt();return b1(c,yt.memoizedState,n,r)},useTransition:function(){var n=td(tr)[0],r=Qt().memoizedState;return[typeof n=="boolean"?n:Vl(n),r]},useSyncExternalStore:Gv,useId:y1,useHostTransitionStatus:_m,useFormState:r1,useActionState:r1,useOptimistic:function(n,r){var c=Qt();return Qv(c,yt,n,r)},useMemoCache:dm,useCacheRefresh:S1};Sm.useEffectEvent=u1;var E1={readContext:Rs,use:ed,useCallback:p1,useContext:Rs,useEffect:gm,useImperativeHandle:m1,useInsertionEffect:d1,useLayoutEffect:h1,useMemo:g1,useReducer:fm,useRef:l1,useState:function(){return fm(tr)},useDebugValue:bm,useDeferredValue:function(n,r){var c=Qt();return yt===null?xm(c,n,r):b1(c,yt.memoizedState,n,r)},useTransition:function(){var n=fm(tr)[0],r=Qt().memoizedState;return[typeof n=="boolean"?n:Vl(n),r]},useSyncExternalStore:Gv,useId:y1,useHostTransitionStatus:_m,useFormState:o1,useActionState:o1,useOptimistic:function(n,r){var c=Qt();return yt!==null?Qv(c,yt,n,r):(c.baseState=n,[n,c.queue.dispatch])},useMemoCache:dm,useCacheRefresh:S1};E1.useEffectEvent=u1;function wm(n,r,c,f){r=n.memoizedState,c=c(f,r),c=c==null?r:g({},r,c),n.memoizedState=c,n.lanes===0&&(n.updateQueue.baseState=c)}var km={enqueueSetState:function(n,r,c){n=n._reactInternals;var f=Nn(),b=Rr(f);b.payload=r,c!=null&&(b.callback=c),r=Dr(n,b,f),r!==null&&(un(r,n,f),Hl(r,n,f))},enqueueReplaceState:function(n,r,c){n=n._reactInternals;var f=Nn(),b=Rr(f);b.tag=1,b.payload=r,c!=null&&(b.callback=c),r=Dr(n,b,f),r!==null&&(un(r,n,f),Hl(r,n,f))},enqueueForceUpdate:function(n,r){n=n._reactInternals;var c=Nn(),f=Rr(c);f.tag=2,r!=null&&(f.callback=r),r=Dr(n,f,c),r!==null&&(un(r,n,c),Hl(r,n,c))}};function T1(n,r,c,f,b,x,k){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(f,x,k):r.prototype&&r.prototype.isPureReactComponent?!Dl(c,f)||!Dl(b,x):!0}function j1(n,r,c,f){n=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(c,f),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(c,f),r.state!==n&&km.enqueueReplaceState(r,r.state,null)}function Aa(n,r){var c=r;if("ref"in r){c={};for(var f in r)f!=="ref"&&(c[f]=r[f])}if(n=n.defaultProps){c===r&&(c=g({},c));for(var b in n)c[b]===void 0&&(c[b]=n[b])}return c}function A1(n){zu(n)}function M1(n){console.error(n)}function R1(n){zu(n)}function rd(n,r){try{var c=n.onUncaughtError;c(r.value,{componentStack:r.stack})}catch(f){setTimeout(function(){throw f})}}function D1(n,r,c){try{var f=n.onCaughtError;f(c.value,{componentStack:c.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(b){setTimeout(function(){throw b})}}function Cm(n,r,c){return c=Rr(c),c.tag=3,c.payload={element:null},c.callback=function(){rd(n,r)},c}function O1(n){return n=Rr(n),n.tag=3,n}function L1(n,r,c,f){var b=c.type.getDerivedStateFromError;if(typeof b=="function"){var x=f.value;n.payload=function(){return b(x)},n.callback=function(){D1(r,c,f)}}var k=c.stateNode;k!==null&&typeof k.componentDidCatch=="function"&&(n.callback=function(){D1(r,c,f),typeof b!="function"&&(Pr===null?Pr=new Set([this]):Pr.add(this));var A=f.stack;this.componentDidCatch(f.value,{componentStack:A!==null?A:""})})}function rj(n,r,c,f,b){if(c.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(r=c.alternate,r!==null&&wo(r,c,b,!0),c=Sn.current,c!==null){switch(c.tag){case 31:case 13:return Pn===null?bd():c.alternate===null&&Ft===0&&(Ft=3),c.flags&=-257,c.flags|=65536,c.lanes=b,f===Gu?c.flags|=16384:(r=c.updateQueue,r===null?c.updateQueue=new Set([f]):r.add(f),Xm(n,f,b)),!1;case 22:return c.flags|=65536,f===Gu?c.flags|=16384:(r=c.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([f])},c.updateQueue=r):(c=r.retryQueue,c===null?r.retryQueue=new Set([f]):c.add(f)),Xm(n,f,b)),!1}throw Error(i(435,c.tag))}return Xm(n,f,b),bd(),!1}if(ot)return r=Sn.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=b,f!==qf&&(n=Error(i(422),{cause:f}),zl(Ln(n,c)))):(f!==qf&&(r=Error(i(423),{cause:f}),zl(Ln(r,c))),n=n.current.alternate,n.flags|=65536,b&=-b,n.lanes|=b,f=Ln(f,c),b=Cm(n.stateNode,f,b),tm(n,b),Ft!==4&&(Ft=2)),!1;var x=Error(i(520),{cause:f});if(x=Ln(x,c),tc===null?tc=[x]:tc.push(x),Ft!==4&&(Ft=2),r===null)return!0;f=Ln(f,c),c=r;do{switch(c.tag){case 3:return c.flags|=65536,n=b&-b,c.lanes|=n,n=Cm(c.stateNode,f,n),tm(c,n),!1;case 1:if(r=c.type,x=c.stateNode,(c.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Pr===null||!Pr.has(x))))return c.flags|=65536,b&=-b,c.lanes|=b,b=O1(b),L1(b,n,c,f),tm(c,b),!1}c=c.return}while(c!==null);return!1}var Nm=Error(i(461)),is=!1;function Ds(n,r,c,f){r.child=n===null?Pv(r,null,c,f):Ta(r,n.child,c,f)}function z1(n,r,c,f,b){c=c.render;var x=r.ref;if("ref"in f){var k={};for(var A in f)A!=="ref"&&(k[A]=f[A])}else k=f;return ka(r),f=om(n,r,c,k,x,b),A=lm(),n!==null&&!is?(cm(n,r,b),sr(n,r,b)):(ot&&A&&Uf(r),r.flags|=1,Ds(n,r,f,b),r.child)}function B1(n,r,c,f,b){if(n===null){var x=c.type;return typeof x=="function"&&!Pf(x)&&x.defaultProps===void 0&&c.compare===null?(r.tag=15,r.type=x,I1(n,r,x,f,b)):(n=$u(c.type,null,f,r,r.mode,b),n.ref=r.ref,n.return=r,r.child=n)}if(x=n.child,!Om(n,b)){var k=x.memoizedProps;if(c=c.compare,c=c!==null?c:Dl,c(k,f)&&n.ref===r.ref)return sr(n,r,b)}return r.flags|=1,n=Xi(x,f),n.ref=r.ref,n.return=r,r.child=n}function I1(n,r,c,f,b){if(n!==null){var x=n.memoizedProps;if(Dl(x,f)&&n.ref===r.ref)if(is=!1,r.pendingProps=f=x,Om(n,b))(n.flags&131072)!==0&&(is=!0);else return r.lanes=n.lanes,sr(n,r,b)}return Em(n,r,c,f,b)}function P1(n,r,c,f){var b=f.children,x=n!==null?n.memoizedState:null;if(n===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((r.flags&128)!==0){if(x=x!==null?x.baseLanes|c:c,n!==null){for(f=r.child=n.child,b=0;f!==null;)b=b|f.lanes|f.childLanes,f=f.sibling;f=b&~x}else f=0,r.child=null;return $1(n,r,x,c,f)}if((c&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},n!==null&&qu(r,x!==null?x.cachePool:null),x!==null?Uv(r,x):nm(),Fv(r);else return f=r.lanes=536870912,$1(n,r,x!==null?x.baseLanes|c:c,c,f)}else x!==null?(qu(r,x.cachePool),Uv(r,x),Lr(),r.memoizedState=null):(n!==null&&qu(r,null),nm(),Lr());return Ds(n,r,b,c),r.child}function Kl(n,r){return n!==null&&n.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function $1(n,r,c,f,b){var x=Zf();return x=x===null?null:{parent:ss._currentValue,pool:x},r.memoizedState={baseLanes:c,cachePool:x},n!==null&&qu(r,null),nm(),Fv(r),n!==null&&wo(n,r,f,!0),r.childLanes=b,null}function ad(n,r){return r=ld({mode:r.mode,children:r.children},n.mode),r.ref=n.ref,n.child=r,r.return=n,r}function H1(n,r,c){return Ta(r,n.child,null,c),n=ad(r,r.pendingProps),n.flags|=2,wn(r),r.memoizedState=null,n}function aj(n,r,c){var f=r.pendingProps,b=(r.flags&128)!==0;if(r.flags&=-129,n===null){if(ot){if(f.mode==="hidden")return n=ad(r,f),r.lanes=536870912,Kl(null,n);if(rm(r),(n=At)?(n=J_(n,In),n=n!==null&&n.data==="&"?n:null,n!==null&&(r.memoizedState={dehydrated:n,treeContext:Er!==null?{id:xi,overflow:vi}:null,retryLane:536870912,hydrationErrors:null},c=kv(n),c.return=r,r.child=c,Ms=r,At=null)):n=null,n===null)throw jr(r);return r.lanes=536870912,null}return ad(r,f)}var x=n.memoizedState;if(x!==null){var k=x.dehydrated;if(rm(r),b)if(r.flags&256)r.flags&=-257,r=H1(n,r,c);else if(r.memoizedState!==null)r.child=n.child,r.flags|=128,r=null;else throw Error(i(558));else if(is||wo(n,r,c,!1),b=(c&n.childLanes)!==0,is||b){if(f=Nt,f!==null&&(k=Kt(f,c),k!==0&&k!==x.retryLane))throw x.retryLane=k,_a(n,k),un(f,n,k),Nm;bd(),r=H1(n,r,c)}else n=x.treeContext,At=$n(k.nextSibling),Ms=r,ot=!0,Tr=null,In=!1,n!==null&&Ev(r,n),r=ad(r,f),r.flags|=4096;return r}return n=Xi(n.child,{mode:f.mode,children:f.children}),n.ref=r.ref,r.child=n,n.return=r,n}function od(n,r){var c=r.ref;if(c===null)n!==null&&n.ref!==null&&(r.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(i(284));(n===null||n.ref!==c)&&(r.flags|=4194816)}}function Em(n,r,c,f,b){return ka(r),c=om(n,r,c,f,void 0,b),f=lm(),n!==null&&!is?(cm(n,r,b),sr(n,r,b)):(ot&&f&&Uf(r),r.flags|=1,Ds(n,r,c,b),r.child)}function U1(n,r,c,f,b,x){return ka(r),r.updateQueue=null,c=Vv(r,f,c,b),qv(n),f=lm(),n!==null&&!is?(cm(n,r,x),sr(n,r,x)):(ot&&f&&Uf(r),r.flags|=1,Ds(n,r,c,x),r.child)}function F1(n,r,c,f,b){if(ka(r),r.stateNode===null){var x=vo,k=c.contextType;typeof k=="object"&&k!==null&&(x=Rs(k)),x=new c(f,x),r.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=km,r.stateNode=x,x._reactInternals=r,x=r.stateNode,x.props=f,x.state=r.memoizedState,x.refs={},Jf(r),k=c.contextType,x.context=typeof k=="object"&&k!==null?Rs(k):vo,x.state=r.memoizedState,k=c.getDerivedStateFromProps,typeof k=="function"&&(wm(r,c,k,f),x.state=r.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(k=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),k!==x.state&&km.enqueueReplaceState(x,x.state,null),Fl(r,f,x,b),Ul(),x.state=r.memoizedState),typeof x.componentDidMount=="function"&&(r.flags|=4194308),f=!0}else if(n===null){x=r.stateNode;var A=r.memoizedProps,H=Aa(c,A);x.props=H;var J=x.context,re=c.contextType;k=vo,typeof re=="object"&&re!==null&&(k=Rs(re));var ce=c.getDerivedStateFromProps;re=typeof ce=="function"||typeof x.getSnapshotBeforeUpdate=="function",A=r.pendingProps!==A,re||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(A||J!==k)&&j1(r,x,f,k),Mr=!1;var te=r.memoizedState;x.state=te,Fl(r,f,x,b),Ul(),J=r.memoizedState,A||te!==J||Mr?(typeof ce=="function"&&(wm(r,c,ce,f),J=r.memoizedState),(H=Mr||T1(r,c,H,f,te,J,k))?(re||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(r.flags|=4194308)):(typeof x.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=f,r.memoizedState=J),x.props=f,x.state=J,x.context=k,f=H):(typeof x.componentDidMount=="function"&&(r.flags|=4194308),f=!1)}else{x=r.stateNode,em(n,r),k=r.memoizedProps,re=Aa(c,k),x.props=re,ce=r.pendingProps,te=x.context,J=c.contextType,H=vo,typeof J=="object"&&J!==null&&(H=Rs(J)),A=c.getDerivedStateFromProps,(J=typeof A=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(k!==ce||te!==H)&&j1(r,x,f,H),Mr=!1,te=r.memoizedState,x.state=te,Fl(r,f,x,b),Ul();var ne=r.memoizedState;k!==ce||te!==ne||Mr||n!==null&&n.dependencies!==null&&Uu(n.dependencies)?(typeof A=="function"&&(wm(r,c,A,f),ne=r.memoizedState),(re=Mr||T1(r,c,re,f,te,ne,H)||n!==null&&n.dependencies!==null&&Uu(n.dependencies))?(J||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(f,ne,H),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(f,ne,H)),typeof x.componentDidUpdate=="function"&&(r.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof x.componentDidUpdate!="function"||k===n.memoizedProps&&te===n.memoizedState||(r.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||k===n.memoizedProps&&te===n.memoizedState||(r.flags|=1024),r.memoizedProps=f,r.memoizedState=ne),x.props=f,x.state=ne,x.context=H,f=re):(typeof x.componentDidUpdate!="function"||k===n.memoizedProps&&te===n.memoizedState||(r.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||k===n.memoizedProps&&te===n.memoizedState||(r.flags|=1024),f=!1)}return x=f,od(n,r),f=(r.flags&128)!==0,x||f?(x=r.stateNode,c=f&&typeof c.getDerivedStateFromError!="function"?null:x.render(),r.flags|=1,n!==null&&f?(r.child=Ta(r,n.child,null,b),r.child=Ta(r,null,c,b)):Ds(n,r,c,b),r.memoizedState=x.state,n=r.child):n=sr(n,r,b),n}function q1(n,r,c,f){return Sa(),r.flags|=256,Ds(n,r,c,f),r.child}var Tm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function jm(n){return{baseLanes:n,cachePool:Dv()}}function Am(n,r,c){return n=n!==null?n.childLanes&~c:0,r&&(n|=Cn),n}function V1(n,r,c){var f=r.pendingProps,b=!1,x=(r.flags&128)!==0,k;if((k=x)||(k=n!==null&&n.memoizedState===null?!1:(Zt.current&2)!==0),k&&(b=!0,r.flags&=-129),k=(r.flags&32)!==0,r.flags&=-33,n===null){if(ot){if(b?Or(r):Lr(),(n=At)?(n=J_(n,In),n=n!==null&&n.data!=="&"?n:null,n!==null&&(r.memoizedState={dehydrated:n,treeContext:Er!==null?{id:xi,overflow:vi}:null,retryLane:536870912,hydrationErrors:null},c=kv(n),c.return=r,r.child=c,Ms=r,At=null)):n=null,n===null)throw jr(r);return hp(n)?r.lanes=32:r.lanes=536870912,null}var A=f.children;return f=f.fallback,b?(Lr(),b=r.mode,A=ld({mode:"hidden",children:A},b),f=ya(f,b,c,null),A.return=r,f.return=r,A.sibling=f,r.child=A,f=r.child,f.memoizedState=jm(c),f.childLanes=Am(n,k,c),r.memoizedState=Tm,Kl(null,f)):(Or(r),Mm(r,A))}var H=n.memoizedState;if(H!==null&&(A=H.dehydrated,A!==null)){if(x)r.flags&256?(Or(r),r.flags&=-257,r=Rm(n,r,c)):r.memoizedState!==null?(Lr(),r.child=n.child,r.flags|=128,r=null):(Lr(),A=f.fallback,b=r.mode,f=ld({mode:"visible",children:f.children},b),A=ya(A,b,c,null),A.flags|=2,f.return=r,A.return=r,f.sibling=A,r.child=f,Ta(r,n.child,null,c),f=r.child,f.memoizedState=jm(c),f.childLanes=Am(n,k,c),r.memoizedState=Tm,r=Kl(null,f));else if(Or(r),hp(A)){if(k=A.nextSibling&&A.nextSibling.dataset,k)var J=k.dgst;k=J,f=Error(i(419)),f.stack="",f.digest=k,zl({value:f,source:null,stack:null}),r=Rm(n,r,c)}else if(is||wo(n,r,c,!1),k=(c&n.childLanes)!==0,is||k){if(k=Nt,k!==null&&(f=Kt(k,c),f!==0&&f!==H.retryLane))throw H.retryLane=f,_a(n,f),un(k,n,f),Nm;dp(A)||bd(),r=Rm(n,r,c)}else dp(A)?(r.flags|=192,r.child=n.child,r=null):(n=H.treeContext,At=$n(A.nextSibling),Ms=r,ot=!0,Tr=null,In=!1,n!==null&&Ev(r,n),r=Mm(r,f.children),r.flags|=4096);return r}return b?(Lr(),A=f.fallback,b=r.mode,H=n.child,J=H.sibling,f=Xi(H,{mode:"hidden",children:f.children}),f.subtreeFlags=H.subtreeFlags&65011712,J!==null?A=Xi(J,A):(A=ya(A,b,c,null),A.flags|=2),A.return=r,f.return=r,f.sibling=A,r.child=f,Kl(null,f),f=r.child,A=n.child.memoizedState,A===null?A=jm(c):(b=A.cachePool,b!==null?(H=ss._currentValue,b=b.parent!==H?{parent:H,pool:H}:b):b=Dv(),A={baseLanes:A.baseLanes|c,cachePool:b}),f.memoizedState=A,f.childLanes=Am(n,k,c),r.memoizedState=Tm,Kl(n.child,f)):(Or(r),c=n.child,n=c.sibling,c=Xi(c,{mode:"visible",children:f.children}),c.return=r,c.sibling=null,n!==null&&(k=r.deletions,k===null?(r.deletions=[n],r.flags|=16):k.push(n)),r.child=c,r.memoizedState=null,c)}function Mm(n,r){return r=ld({mode:"visible",children:r},n.mode),r.return=n,n.child=r}function ld(n,r){return n=yn(22,n,null,r),n.lanes=0,n}function Rm(n,r,c){return Ta(r,n.child,null,c),n=Mm(r,r.pendingProps.children),n.flags|=2,r.memoizedState=null,n}function G1(n,r,c){n.lanes|=r;var f=n.alternate;f!==null&&(f.lanes|=r),Wf(n.return,r,c)}function Dm(n,r,c,f,b,x){var k=n.memoizedState;k===null?n.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:f,tail:c,tailMode:b,treeForkCount:x}:(k.isBackwards=r,k.rendering=null,k.renderingStartTime=0,k.last=f,k.tail=c,k.tailMode=b,k.treeForkCount=x)}function W1(n,r,c){var f=r.pendingProps,b=f.revealOrder,x=f.tail;f=f.children;var k=Zt.current,A=(k&2)!==0;if(A?(k=k&1|2,r.flags|=128):k&=1,ie(Zt,k),Ds(n,r,f,c),f=ot?Ll:0,!A&&n!==null&&(n.flags&128)!==0)e:for(n=r.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&G1(n,c,r);else if(n.tag===19)G1(n,c,r);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===r)break e;for(;n.sibling===null;){if(n.return===null||n.return===r)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(b){case"forwards":for(c=r.child,b=null;c!==null;)n=c.alternate,n!==null&&Xu(n)===null&&(b=c),c=c.sibling;c=b,c===null?(b=r.child,r.child=null):(b=c.sibling,c.sibling=null),Dm(r,!1,b,c,x,f);break;case"backwards":case"unstable_legacy-backwards":for(c=null,b=r.child,r.child=null;b!==null;){if(n=b.alternate,n!==null&&Xu(n)===null){r.child=b;break}n=b.sibling,b.sibling=c,c=b,b=n}Dm(r,!0,c,null,x,f);break;case"together":Dm(r,!1,null,null,void 0,f);break;default:r.memoizedState=null}return r.child}function sr(n,r,c){if(n!==null&&(r.dependencies=n.dependencies),Ir|=r.lanes,(c&r.childLanes)===0)if(n!==null){if(wo(n,r,c,!1),(c&r.childLanes)===0)return null}else return null;if(n!==null&&r.child!==n.child)throw Error(i(153));if(r.child!==null){for(n=r.child,c=Xi(n,n.pendingProps),r.child=c,c.return=r;n.sibling!==null;)n=n.sibling,c=c.sibling=Xi(n,n.pendingProps),c.return=r;c.sibling=null}return r.child}function Om(n,r){return(n.lanes&r)!==0?!0:(n=n.dependencies,!!(n!==null&&Uu(n)))}function oj(n,r,c){switch(r.tag){case 3:Le(r,r.stateNode.containerInfo),Ar(r,ss,n.memoizedState.cache),Sa();break;case 27:case 5:Ge(r);break;case 4:Le(r,r.stateNode.containerInfo);break;case 10:Ar(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,rm(r),null;break;case 13:var f=r.memoizedState;if(f!==null)return f.dehydrated!==null?(Or(r),r.flags|=128,null):(c&r.child.childLanes)!==0?V1(n,r,c):(Or(r),n=sr(n,r,c),n!==null?n.sibling:null);Or(r);break;case 19:var b=(n.flags&128)!==0;if(f=(c&r.childLanes)!==0,f||(wo(n,r,c,!1),f=(c&r.childLanes)!==0),b){if(f)return W1(n,r,c);r.flags|=128}if(b=r.memoizedState,b!==null&&(b.rendering=null,b.tail=null,b.lastEffect=null),ie(Zt,Zt.current),f)break;return null;case 22:return r.lanes=0,P1(n,r,c,r.pendingProps);case 24:Ar(r,ss,n.memoizedState.cache)}return sr(n,r,c)}function K1(n,r,c){if(n!==null)if(n.memoizedProps!==r.pendingProps)is=!0;else{if(!Om(n,c)&&(r.flags&128)===0)return is=!1,oj(n,r,c);is=(n.flags&131072)!==0}else is=!1,ot&&(r.flags&1048576)!==0&&Nv(r,Ll,r.index);switch(r.lanes=0,r.tag){case 16:e:{var f=r.pendingProps;if(n=Na(r.elementType),r.type=n,typeof n=="function")Pf(n)?(f=Aa(n,f),r.tag=1,r=F1(null,r,n,f,c)):(r.tag=0,r=Em(null,r,n,f,c));else{if(n!=null){var b=n.$$typeof;if(b===j){r.tag=11,r=z1(null,r,n,f,c);break e}else if(b===D){r.tag=14,r=B1(null,r,n,f,c);break e}}throw r=V(n)||n,Error(i(306,r,""))}}return r;case 0:return Em(n,r,r.type,r.pendingProps,c);case 1:return f=r.type,b=Aa(f,r.pendingProps),F1(n,r,f,b,c);case 3:e:{if(Le(r,r.stateNode.containerInfo),n===null)throw Error(i(387));f=r.pendingProps;var x=r.memoizedState;b=x.element,em(n,r),Fl(r,f,null,c);var k=r.memoizedState;if(f=k.cache,Ar(r,ss,f),f!==x.cache&&Kf(r,[ss],c,!0),Ul(),f=k.element,x.isDehydrated)if(x={element:f,isDehydrated:!1,cache:k.cache},r.updateQueue.baseState=x,r.memoizedState=x,r.flags&256){r=q1(n,r,f,c);break e}else if(f!==b){b=Ln(Error(i(424)),r),zl(b),r=q1(n,r,f,c);break e}else for(n=r.stateNode.containerInfo,n.nodeType===9?n=n.body:n=n.nodeName==="HTML"?n.ownerDocument.body:n,At=$n(n.firstChild),Ms=r,ot=!0,Tr=null,In=!0,c=Pv(r,null,f,c),r.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(Sa(),f===b){r=sr(n,r,c);break e}Ds(n,r,f,c)}r=r.child}return r;case 26:return od(n,r),n===null?(c=ry(r.type,null,r.pendingProps,null))?r.memoizedState=c:ot||(c=r.type,n=r.pendingProps,f=kd(pe.current).createElement(c),f[Yt]=r,f[$s]=n,Os(f,c,n),es(f),r.stateNode=f):r.memoizedState=ry(r.type,n.memoizedProps,r.pendingProps,n.memoizedState),null;case 27:return Ge(r),n===null&&ot&&(f=r.stateNode=sy(r.type,r.pendingProps,pe.current),Ms=r,In=!0,b=At,Fr(r.type)?(fp=b,At=$n(f.firstChild)):At=b),Ds(n,r,r.pendingProps.children,c),od(n,r),n===null&&(r.flags|=4194304),r.child;case 5:return n===null&&ot&&((b=f=At)&&(f=Bj(f,r.type,r.pendingProps,In),f!==null?(r.stateNode=f,Ms=r,At=$n(f.firstChild),In=!1,b=!0):b=!1),b||jr(r)),Ge(r),b=r.type,x=r.pendingProps,k=n!==null?n.memoizedProps:null,f=x.children,lp(b,x)?f=null:k!==null&&lp(b,k)&&(r.flags|=32),r.memoizedState!==null&&(b=om(n,r,QT,null,null,c),cc._currentValue=b),od(n,r),Ds(n,r,f,c),r.child;case 6:return n===null&&ot&&((n=c=At)&&(c=Ij(c,r.pendingProps,In),c!==null?(r.stateNode=c,Ms=r,At=null,n=!0):n=!1),n||jr(r)),null;case 13:return V1(n,r,c);case 4:return Le(r,r.stateNode.containerInfo),f=r.pendingProps,n===null?r.child=Ta(r,null,f,c):Ds(n,r,f,c),r.child;case 11:return z1(n,r,r.type,r.pendingProps,c);case 7:return Ds(n,r,r.pendingProps,c),r.child;case 8:return Ds(n,r,r.pendingProps.children,c),r.child;case 12:return Ds(n,r,r.pendingProps.children,c),r.child;case 10:return f=r.pendingProps,Ar(r,r.type,f.value),Ds(n,r,f.children,c),r.child;case 9:return b=r.type._context,f=r.pendingProps.children,ka(r),b=Rs(b),f=f(b),r.flags|=1,Ds(n,r,f,c),r.child;case 14:return B1(n,r,r.type,r.pendingProps,c);case 15:return I1(n,r,r.type,r.pendingProps,c);case 19:return W1(n,r,c);case 31:return aj(n,r,c);case 22:return P1(n,r,c,r.pendingProps);case 24:return ka(r),f=Rs(ss),n===null?(b=Zf(),b===null&&(b=Nt,x=Yf(),b.pooledCache=x,x.refCount++,x!==null&&(b.pooledCacheLanes|=c),b=x),r.memoizedState={parent:f,cache:b},Jf(r),Ar(r,ss,b)):((n.lanes&c)!==0&&(em(n,r),Fl(r,null,null,c),Ul()),b=n.memoizedState,x=r.memoizedState,b.parent!==f?(b={parent:f,cache:f},r.memoizedState=b,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=b),Ar(r,ss,f)):(f=x.cache,Ar(r,ss,f),f!==b.cache&&Kf(r,[ss],c,!0))),Ds(n,r,r.pendingProps.children,c),r.child;case 29:throw r.pendingProps}throw Error(i(156,r.tag))}function nr(n){n.flags|=4}function Lm(n,r,c,f,b){if((r=(n.mode&32)!==0)&&(r=!1),r){if(n.flags|=16777216,(b&335544128)===b)if(n.stateNode.complete)n.flags|=8192;else if(y_())n.flags|=8192;else throw Ea=Gu,Qf}else n.flags&=-16777217}function Y1(n,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!uy(r))if(y_())n.flags|=8192;else throw Ea=Gu,Qf}function cd(n,r){r!==null&&(n.flags|=4),n.flags&16384&&(r=n.tag!==22?Fe():536870912,n.lanes|=r,Lo|=r)}function Yl(n,r){if(!ot)switch(n.tailMode){case"hidden":r=n.tail;for(var c=null;r!==null;)r.alternate!==null&&(c=r),r=r.sibling;c===null?n.tail=null:c.sibling=null;break;case"collapsed":c=n.tail;for(var f=null;c!==null;)c.alternate!==null&&(f=c),c=c.sibling;f===null?r||n.tail===null?n.tail=null:n.tail.sibling=null:f.sibling=null}}function Mt(n){var r=n.alternate!==null&&n.alternate.child===n.child,c=0,f=0;if(r)for(var b=n.child;b!==null;)c|=b.lanes|b.childLanes,f|=b.subtreeFlags&65011712,f|=b.flags&65011712,b.return=n,b=b.sibling;else for(b=n.child;b!==null;)c|=b.lanes|b.childLanes,f|=b.subtreeFlags,f|=b.flags,b.return=n,b=b.sibling;return n.subtreeFlags|=f,n.childLanes=c,r}function lj(n,r,c){var f=r.pendingProps;switch(Ff(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mt(r),null;case 1:return Mt(r),null;case 3:return c=r.stateNode,f=null,n!==null&&(f=n.memoizedState.cache),r.memoizedState.cache!==f&&(r.flags|=2048),Ji(ss),ve(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(n===null||n.child===null)&&(So(r)?nr(r):n===null||n.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,Vf())),Mt(r),null;case 26:var b=r.type,x=r.memoizedState;return n===null?(nr(r),x!==null?(Mt(r),Y1(r,x)):(Mt(r),Lm(r,b,null,f,c))):x?x!==n.memoizedState?(nr(r),Mt(r),Y1(r,x)):(Mt(r),r.flags&=-16777217):(n=n.memoizedProps,n!==f&&nr(r),Mt(r),Lm(r,b,n,f,c)),null;case 27:if(ge(r),c=pe.current,b=r.type,n!==null&&r.stateNode!=null)n.memoizedProps!==f&&nr(r);else{if(!f){if(r.stateNode===null)throw Error(i(166));return Mt(r),null}n=de.current,So(r)?Tv(r):(n=sy(b,f,c),r.stateNode=n,nr(r))}return Mt(r),null;case 5:if(ge(r),b=r.type,n!==null&&r.stateNode!=null)n.memoizedProps!==f&&nr(r);else{if(!f){if(r.stateNode===null)throw Error(i(166));return Mt(r),null}if(x=de.current,So(r))Tv(r);else{var k=kd(pe.current);switch(x){case 1:x=k.createElementNS("http://www.w3.org/2000/svg",b);break;case 2:x=k.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;default:switch(b){case"svg":x=k.createElementNS("http://www.w3.org/2000/svg",b);break;case"math":x=k.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;case"script":x=k.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof f.is=="string"?k.createElement("select",{is:f.is}):k.createElement("select"),f.multiple?x.multiple=!0:f.size&&(x.size=f.size);break;default:x=typeof f.is=="string"?k.createElement(b,{is:f.is}):k.createElement(b)}}x[Yt]=r,x[$s]=f;e:for(k=r.child;k!==null;){if(k.tag===5||k.tag===6)x.appendChild(k.stateNode);else if(k.tag!==4&&k.tag!==27&&k.child!==null){k.child.return=k,k=k.child;continue}if(k===r)break e;for(;k.sibling===null;){if(k.return===null||k.return===r)break e;k=k.return}k.sibling.return=k.return,k=k.sibling}r.stateNode=x;e:switch(Os(x,b,f),b){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&nr(r)}}return Mt(r),Lm(r,r.type,n===null?null:n.memoizedProps,r.pendingProps,c),null;case 6:if(n&&r.stateNode!=null)n.memoizedProps!==f&&nr(r);else{if(typeof f!="string"&&r.stateNode===null)throw Error(i(166));if(n=pe.current,So(r)){if(n=r.stateNode,c=r.memoizedProps,f=null,b=Ms,b!==null)switch(b.tag){case 27:case 5:f=b.memoizedProps}n[Yt]=r,n=!!(n.nodeValue===c||f!==null&&f.suppressHydrationWarning===!0||V_(n.nodeValue,c)),n||jr(r,!0)}else n=kd(n).createTextNode(f),n[Yt]=r,r.stateNode=n}return Mt(r),null;case 31:if(c=r.memoizedState,n===null||n.memoizedState!==null){if(f=So(r),c!==null){if(n===null){if(!f)throw Error(i(318));if(n=r.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(557));n[Yt]=r}else Sa(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;Mt(r),n=!1}else c=Vf(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=c),n=!0;if(!n)return r.flags&256?(wn(r),r):(wn(r),null);if((r.flags&128)!==0)throw Error(i(558))}return Mt(r),null;case 13:if(f=r.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(b=So(r),f!==null&&f.dehydrated!==null){if(n===null){if(!b)throw Error(i(318));if(b=r.memoizedState,b=b!==null?b.dehydrated:null,!b)throw Error(i(317));b[Yt]=r}else Sa(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;Mt(r),b=!1}else b=Vf(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=b),b=!0;if(!b)return r.flags&256?(wn(r),r):(wn(r),null)}return wn(r),(r.flags&128)!==0?(r.lanes=c,r):(c=f!==null,n=n!==null&&n.memoizedState!==null,c&&(f=r.child,b=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(b=f.alternate.memoizedState.cachePool.pool),x=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(x=f.memoizedState.cachePool.pool),x!==b&&(f.flags|=2048)),c!==n&&c&&(r.child.flags|=8192),cd(r,r.updateQueue),Mt(r),null);case 4:return ve(),n===null&&np(r.stateNode.containerInfo),Mt(r),null;case 10:return Ji(r.type),Mt(r),null;case 19:if(Z(Zt),f=r.memoizedState,f===null)return Mt(r),null;if(b=(r.flags&128)!==0,x=f.rendering,x===null)if(b)Yl(f,!1);else{if(Ft!==0||n!==null&&(n.flags&128)!==0)for(n=r.child;n!==null;){if(x=Xu(n),x!==null){for(r.flags|=128,Yl(f,!1),n=x.updateQueue,r.updateQueue=n,cd(r,n),r.subtreeFlags=0,n=c,c=r.child;c!==null;)wv(c,n),c=c.sibling;return ie(Zt,Zt.current&1|2),ot&&Zi(r,f.treeForkCount),r.child}n=n.sibling}f.tail!==null&>()>md&&(r.flags|=128,b=!0,Yl(f,!1),r.lanes=4194304)}else{if(!b)if(n=Xu(x),n!==null){if(r.flags|=128,b=!0,n=n.updateQueue,r.updateQueue=n,cd(r,n),Yl(f,!0),f.tail===null&&f.tailMode==="hidden"&&!x.alternate&&!ot)return Mt(r),null}else 2*gt()-f.renderingStartTime>md&&c!==536870912&&(r.flags|=128,b=!0,Yl(f,!1),r.lanes=4194304);f.isBackwards?(x.sibling=r.child,r.child=x):(n=f.last,n!==null?n.sibling=x:r.child=x,f.last=x)}return f.tail!==null?(n=f.tail,f.rendering=n,f.tail=n.sibling,f.renderingStartTime=gt(),n.sibling=null,c=Zt.current,ie(Zt,b?c&1|2:c&1),ot&&Zi(r,f.treeForkCount),n):(Mt(r),null);case 22:case 23:return wn(r),im(),f=r.memoizedState!==null,n!==null?n.memoizedState!==null!==f&&(r.flags|=8192):f&&(r.flags|=8192),f?(c&536870912)!==0&&(r.flags&128)===0&&(Mt(r),r.subtreeFlags&6&&(r.flags|=8192)):Mt(r),c=r.updateQueue,c!==null&&cd(r,c.retryQueue),c=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),f=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(f=r.memoizedState.cachePool.pool),f!==c&&(r.flags|=2048),n!==null&&Z(Ca),null;case 24:return c=null,n!==null&&(c=n.memoizedState.cache),r.memoizedState.cache!==c&&(r.flags|=2048),Ji(ss),Mt(r),null;case 25:return null;case 30:return null}throw Error(i(156,r.tag))}function cj(n,r){switch(Ff(r),r.tag){case 1:return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 3:return Ji(ss),ve(),n=r.flags,(n&65536)!==0&&(n&128)===0?(r.flags=n&-65537|128,r):null;case 26:case 27:case 5:return ge(r),null;case 31:if(r.memoizedState!==null){if(wn(r),r.alternate===null)throw Error(i(340));Sa()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 13:if(wn(r),n=r.memoizedState,n!==null&&n.dehydrated!==null){if(r.alternate===null)throw Error(i(340));Sa()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 19:return Z(Zt),null;case 4:return ve(),null;case 10:return Ji(r.type),null;case 22:case 23:return wn(r),im(),n!==null&&Z(Ca),n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 24:return Ji(ss),null;case 25:return null;default:return null}}function X1(n,r){switch(Ff(r),r.tag){case 3:Ji(ss),ve();break;case 26:case 27:case 5:ge(r);break;case 4:ve();break;case 31:r.memoizedState!==null&&wn(r);break;case 13:wn(r);break;case 19:Z(Zt);break;case 10:Ji(r.type);break;case 22:case 23:wn(r),im(),n!==null&&Z(Ca);break;case 24:Ji(ss)}}function Xl(n,r){try{var c=r.updateQueue,f=c!==null?c.lastEffect:null;if(f!==null){var b=f.next;c=b;do{if((c.tag&n)===n){f=void 0;var x=c.create,k=c.inst;f=x(),k.destroy=f}c=c.next}while(c!==b)}}catch(A){_t(r,r.return,A)}}function zr(n,r,c){try{var f=r.updateQueue,b=f!==null?f.lastEffect:null;if(b!==null){var x=b.next;f=x;do{if((f.tag&n)===n){var k=f.inst,A=k.destroy;if(A!==void 0){k.destroy=void 0,b=r;var H=c,J=A;try{J()}catch(re){_t(b,H,re)}}}f=f.next}while(f!==x)}}catch(re){_t(r,r.return,re)}}function Z1(n){var r=n.updateQueue;if(r!==null){var c=n.stateNode;try{Hv(r,c)}catch(f){_t(n,n.return,f)}}}function Q1(n,r,c){c.props=Aa(n.type,n.memoizedProps),c.state=n.memoizedState;try{c.componentWillUnmount()}catch(f){_t(n,r,f)}}function Zl(n,r){try{var c=n.ref;if(c!==null){switch(n.tag){case 26:case 27:case 5:var f=n.stateNode;break;case 30:f=n.stateNode;break;default:f=n.stateNode}typeof c=="function"?n.refCleanup=c(f):c.current=f}}catch(b){_t(n,r,b)}}function _i(n,r){var c=n.ref,f=n.refCleanup;if(c!==null)if(typeof f=="function")try{f()}catch(b){_t(n,r,b)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(b){_t(n,r,b)}else c.current=null}function J1(n){var r=n.type,c=n.memoizedProps,f=n.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":c.autoFocus&&f.focus();break e;case"img":c.src?f.src=c.src:c.srcSet&&(f.srcset=c.srcSet)}}catch(b){_t(n,n.return,b)}}function zm(n,r,c){try{var f=n.stateNode;Mj(f,n.type,c,r),f[$s]=r}catch(b){_t(n,n.return,b)}}function e_(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Fr(n.type)||n.tag===4}function Bm(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||e_(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&Fr(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Im(n,r,c){var f=n.tag;if(f===5||f===6)n=n.stateNode,r?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(n,r):(r=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,r.appendChild(n),c=c._reactRootContainer,c!=null||r.onclick!==null||(r.onclick=xe));else if(f!==4&&(f===27&&Fr(n.type)&&(c=n.stateNode,r=null),n=n.child,n!==null))for(Im(n,r,c),n=n.sibling;n!==null;)Im(n,r,c),n=n.sibling}function ud(n,r,c){var f=n.tag;if(f===5||f===6)n=n.stateNode,r?c.insertBefore(n,r):c.appendChild(n);else if(f!==4&&(f===27&&Fr(n.type)&&(c=n.stateNode),n=n.child,n!==null))for(ud(n,r,c),n=n.sibling;n!==null;)ud(n,r,c),n=n.sibling}function t_(n){var r=n.stateNode,c=n.memoizedProps;try{for(var f=n.type,b=r.attributes;b.length;)r.removeAttributeNode(b[0]);Os(r,f,c),r[Yt]=n,r[$s]=c}catch(x){_t(n,n.return,x)}}var ir=!1,rs=!1,Pm=!1,s_=typeof WeakSet=="function"?WeakSet:Set,_s=null;function uj(n,r){if(n=n.containerInfo,ap=Md,n=mv(n),Rf(n)){if("selectionStart"in n)var c={start:n.selectionStart,end:n.selectionEnd};else e:{c=(c=n.ownerDocument)&&c.defaultView||window;var f=c.getSelection&&c.getSelection();if(f&&f.rangeCount!==0){c=f.anchorNode;var b=f.anchorOffset,x=f.focusNode;f=f.focusOffset;try{c.nodeType,x.nodeType}catch{c=null;break e}var k=0,A=-1,H=-1,J=0,re=0,ce=n,te=null;t:for(;;){for(var ne;ce!==c||b!==0&&ce.nodeType!==3||(A=k+b),ce!==x||f!==0&&ce.nodeType!==3||(H=k+f),ce.nodeType===3&&(k+=ce.nodeValue.length),(ne=ce.firstChild)!==null;)te=ce,ce=ne;for(;;){if(ce===n)break t;if(te===c&&++J===b&&(A=k),te===x&&++re===f&&(H=k),(ne=ce.nextSibling)!==null)break;ce=te,te=ce.parentNode}ce=ne}c=A===-1||H===-1?null:{start:A,end:H}}else c=null}c=c||{start:0,end:0}}else c=null;for(op={focusedElem:n,selectionRange:c},Md=!1,_s=r;_s!==null;)if(r=_s,n=r.child,(r.subtreeFlags&1028)!==0&&n!==null)n.return=r,_s=n;else for(;_s!==null;){switch(r=_s,x=r.alternate,n=r.flags,r.tag){case 0:if((n&4)!==0&&(n=r.updateQueue,n=n!==null?n.events:null,n!==null))for(c=0;c<n.length;c++)b=n[c],b.ref.impl=b.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&x!==null){n=void 0,c=r,b=x.memoizedProps,x=x.memoizedState,f=c.stateNode;try{var Ee=Aa(c.type,b);n=f.getSnapshotBeforeUpdate(Ee,x),f.__reactInternalSnapshotBeforeUpdate=n}catch($e){_t(c,c.return,$e)}}break;case 3:if((n&1024)!==0){if(n=r.stateNode.containerInfo,c=n.nodeType,c===9)up(n);else if(c===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":up(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(i(163))}if(n=r.sibling,n!==null){n.return=r.return,_s=n;break}_s=r.return}}function n_(n,r,c){var f=c.flags;switch(c.tag){case 0:case 11:case 15:ar(n,c),f&4&&Xl(5,c);break;case 1:if(ar(n,c),f&4)if(n=c.stateNode,r===null)try{n.componentDidMount()}catch(k){_t(c,c.return,k)}else{var b=Aa(c.type,r.memoizedProps);r=r.memoizedState;try{n.componentDidUpdate(b,r,n.__reactInternalSnapshotBeforeUpdate)}catch(k){_t(c,c.return,k)}}f&64&&Z1(c),f&512&&Zl(c,c.return);break;case 3:if(ar(n,c),f&64&&(n=c.updateQueue,n!==null)){if(r=null,c.child!==null)switch(c.child.tag){case 27:case 5:r=c.child.stateNode;break;case 1:r=c.child.stateNode}try{Hv(n,r)}catch(k){_t(c,c.return,k)}}break;case 27:r===null&&f&4&&t_(c);case 26:case 5:ar(n,c),r===null&&f&4&&J1(c),f&512&&Zl(c,c.return);break;case 12:ar(n,c);break;case 31:ar(n,c),f&4&&a_(n,c);break;case 13:ar(n,c),f&4&&o_(n,c),f&64&&(n=c.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(c=vj.bind(null,c),Pj(n,c))));break;case 22:if(f=c.memoizedState!==null||ir,!f){r=r!==null&&r.memoizedState!==null||rs,b=ir;var x=rs;ir=f,(rs=r)&&!x?or(n,c,(c.subtreeFlags&8772)!==0):ar(n,c),ir=b,rs=x}break;case 30:break;default:ar(n,c)}}function i_(n){var r=n.alternate;r!==null&&(n.alternate=null,i_(r)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(r=n.stateNode,r!==null&&yl(r)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Lt=null,an=!1;function rr(n,r,c){for(c=c.child;c!==null;)r_(n,r,c),c=c.sibling}function r_(n,r,c){if(vs&&typeof vs.onCommitFiberUnmount=="function")try{vs.onCommitFiberUnmount(qi,c)}catch{}switch(c.tag){case 26:rs||_i(c,r),rr(n,r,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:rs||_i(c,r);var f=Lt,b=an;Fr(c.type)&&(Lt=c.stateNode,an=!1),rr(n,r,c),ac(c.stateNode),Lt=f,an=b;break;case 5:rs||_i(c,r);case 6:if(f=Lt,b=an,Lt=null,rr(n,r,c),Lt=f,an=b,Lt!==null)if(an)try{(Lt.nodeType===9?Lt.body:Lt.nodeName==="HTML"?Lt.ownerDocument.body:Lt).removeChild(c.stateNode)}catch(x){_t(c,r,x)}else try{Lt.removeChild(c.stateNode)}catch(x){_t(c,r,x)}break;case 18:Lt!==null&&(an?(n=Lt,Z_(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,c.stateNode),Fo(n)):Z_(Lt,c.stateNode));break;case 4:f=Lt,b=an,Lt=c.stateNode.containerInfo,an=!0,rr(n,r,c),Lt=f,an=b;break;case 0:case 11:case 14:case 15:zr(2,c,r),rs||zr(4,c,r),rr(n,r,c);break;case 1:rs||(_i(c,r),f=c.stateNode,typeof f.componentWillUnmount=="function"&&Q1(c,r,f)),rr(n,r,c);break;case 21:rr(n,r,c);break;case 22:rs=(f=rs)||c.memoizedState!==null,rr(n,r,c),rs=f;break;default:rr(n,r,c)}}function a_(n,r){if(r.memoizedState===null&&(n=r.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Fo(n)}catch(c){_t(r,r.return,c)}}}function o_(n,r){if(r.memoizedState===null&&(n=r.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Fo(n)}catch(c){_t(r,r.return,c)}}function dj(n){switch(n.tag){case 31:case 13:case 19:var r=n.stateNode;return r===null&&(r=n.stateNode=new s_),r;case 22:return n=n.stateNode,r=n._retryCache,r===null&&(r=n._retryCache=new s_),r;default:throw Error(i(435,n.tag))}}function dd(n,r){var c=dj(n);r.forEach(function(f){if(!c.has(f)){c.add(f);var b=_j.bind(null,n,f);f.then(b,b)}})}function on(n,r){var c=r.deletions;if(c!==null)for(var f=0;f<c.length;f++){var b=c[f],x=n,k=r,A=k;e:for(;A!==null;){switch(A.tag){case 27:if(Fr(A.type)){Lt=A.stateNode,an=!1;break e}break;case 5:Lt=A.stateNode,an=!1;break e;case 3:case 4:Lt=A.stateNode.containerInfo,an=!0;break e}A=A.return}if(Lt===null)throw Error(i(160));r_(x,k,b),Lt=null,an=!1,x=b.alternate,x!==null&&(x.return=null),b.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)l_(r,n),r=r.sibling}var ri=null;function l_(n,r){var c=n.alternate,f=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:on(r,n),ln(n),f&4&&(zr(3,n,n.return),Xl(3,n),zr(5,n,n.return));break;case 1:on(r,n),ln(n),f&512&&(rs||c===null||_i(c,c.return)),f&64&&ir&&(n=n.updateQueue,n!==null&&(f=n.callbacks,f!==null&&(c=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=c===null?f:c.concat(f))));break;case 26:var b=ri;if(on(r,n),ln(n),f&512&&(rs||c===null||_i(c,c.return)),f&4){var x=c!==null?c.memoizedState:null;if(f=n.memoizedState,c===null)if(f===null)if(n.stateNode===null){e:{f=n.type,c=n.memoizedProps,b=b.ownerDocument||b;t:switch(f){case"title":x=b.getElementsByTagName("title")[0],(!x||x[ma]||x[Yt]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=b.createElement(f),b.head.insertBefore(x,b.querySelector("head > title"))),Os(x,f,c),x[Yt]=n,es(x),f=x;break e;case"link":var k=ly("link","href",b).get(f+(c.href||""));if(k){for(var A=0;A<k.length;A++)if(x=k[A],x.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&x.getAttribute("rel")===(c.rel==null?null:c.rel)&&x.getAttribute("title")===(c.title==null?null:c.title)&&x.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){k.splice(A,1);break t}}x=b.createElement(f),Os(x,f,c),b.head.appendChild(x);break;case"meta":if(k=ly("meta","content",b).get(f+(c.content||""))){for(A=0;A<k.length;A++)if(x=k[A],x.getAttribute("content")===(c.content==null?null:""+c.content)&&x.getAttribute("name")===(c.name==null?null:c.name)&&x.getAttribute("property")===(c.property==null?null:c.property)&&x.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&x.getAttribute("charset")===(c.charSet==null?null:c.charSet)){k.splice(A,1);break t}}x=b.createElement(f),Os(x,f,c),b.head.appendChild(x);break;default:throw Error(i(468,f))}x[Yt]=n,es(x),f=x}n.stateNode=f}else cy(b,n.type,n.stateNode);else n.stateNode=oy(b,f,n.memoizedProps);else x!==f?(x===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):x.count--,f===null?cy(b,n.type,n.stateNode):oy(b,f,n.memoizedProps)):f===null&&n.stateNode!==null&&zm(n,n.memoizedProps,c.memoizedProps)}break;case 27:on(r,n),ln(n),f&512&&(rs||c===null||_i(c,c.return)),c!==null&&f&4&&zm(n,n.memoizedProps,c.memoizedProps);break;case 5:if(on(r,n),ln(n),f&512&&(rs||c===null||_i(c,c.return)),n.flags&32){b=n.stateNode;try{He(b,"")}catch(Ee){_t(n,n.return,Ee)}}f&4&&n.stateNode!=null&&(b=n.memoizedProps,zm(n,b,c!==null?c.memoizedProps:b)),f&1024&&(Pm=!0);break;case 6:if(on(r,n),ln(n),f&4){if(n.stateNode===null)throw Error(i(162));f=n.memoizedProps,c=n.stateNode;try{c.nodeValue=f}catch(Ee){_t(n,n.return,Ee)}}break;case 3:if(Ed=null,b=ri,ri=Cd(r.containerInfo),on(r,n),ri=b,ln(n),f&4&&c!==null&&c.memoizedState.isDehydrated)try{Fo(r.containerInfo)}catch(Ee){_t(n,n.return,Ee)}Pm&&(Pm=!1,c_(n));break;case 4:f=ri,ri=Cd(n.stateNode.containerInfo),on(r,n),ln(n),ri=f;break;case 12:on(r,n),ln(n);break;case 31:on(r,n),ln(n),f&4&&(f=n.updateQueue,f!==null&&(n.updateQueue=null,dd(n,f)));break;case 13:on(r,n),ln(n),n.child.flags&8192&&n.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(fd=gt()),f&4&&(f=n.updateQueue,f!==null&&(n.updateQueue=null,dd(n,f)));break;case 22:b=n.memoizedState!==null;var H=c!==null&&c.memoizedState!==null,J=ir,re=rs;if(ir=J||b,rs=re||H,on(r,n),rs=re,ir=J,ln(n),f&8192)e:for(r=n.stateNode,r._visibility=b?r._visibility&-2:r._visibility|1,b&&(c===null||H||ir||rs||Ma(n)),c=null,r=n;;){if(r.tag===5||r.tag===26){if(c===null){H=c=r;try{if(x=H.stateNode,b)k=x.style,typeof k.setProperty=="function"?k.setProperty("display","none","important"):k.display="none";else{A=H.stateNode;var ce=H.memoizedProps.style,te=ce!=null&&ce.hasOwnProperty("display")?ce.display:null;A.style.display=te==null||typeof te=="boolean"?"":(""+te).trim()}}catch(Ee){_t(H,H.return,Ee)}}}else if(r.tag===6){if(c===null){H=r;try{H.stateNode.nodeValue=b?"":H.memoizedProps}catch(Ee){_t(H,H.return,Ee)}}}else if(r.tag===18){if(c===null){H=r;try{var ne=H.stateNode;b?Q_(ne,!0):Q_(H.stateNode,!1)}catch(Ee){_t(H,H.return,Ee)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===n)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===n)break e;for(;r.sibling===null;){if(r.return===null||r.return===n)break e;c===r&&(c=null),r=r.return}c===r&&(c=null),r.sibling.return=r.return,r=r.sibling}f&4&&(f=n.updateQueue,f!==null&&(c=f.retryQueue,c!==null&&(f.retryQueue=null,dd(n,c))));break;case 19:on(r,n),ln(n),f&4&&(f=n.updateQueue,f!==null&&(n.updateQueue=null,dd(n,f)));break;case 30:break;case 21:break;default:on(r,n),ln(n)}}function ln(n){var r=n.flags;if(r&2){try{for(var c,f=n.return;f!==null;){if(e_(f)){c=f;break}f=f.return}if(c==null)throw Error(i(160));switch(c.tag){case 27:var b=c.stateNode,x=Bm(n);ud(n,x,b);break;case 5:var k=c.stateNode;c.flags&32&&(He(k,""),c.flags&=-33);var A=Bm(n);ud(n,A,k);break;case 3:case 4:var H=c.stateNode.containerInfo,J=Bm(n);Im(n,J,H);break;default:throw Error(i(161))}}catch(re){_t(n,n.return,re)}n.flags&=-3}r&4096&&(n.flags&=-4097)}function c_(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var r=n;c_(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),n=n.sibling}}function ar(n,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)n_(n,r.alternate,r),r=r.sibling}function Ma(n){for(n=n.child;n!==null;){var r=n;switch(r.tag){case 0:case 11:case 14:case 15:zr(4,r,r.return),Ma(r);break;case 1:_i(r,r.return);var c=r.stateNode;typeof c.componentWillUnmount=="function"&&Q1(r,r.return,c),Ma(r);break;case 27:ac(r.stateNode);case 26:case 5:_i(r,r.return),Ma(r);break;case 22:r.memoizedState===null&&Ma(r);break;case 30:Ma(r);break;default:Ma(r)}n=n.sibling}}function or(n,r,c){for(c=c&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var f=r.alternate,b=n,x=r,k=x.flags;switch(x.tag){case 0:case 11:case 15:or(b,x,c),Xl(4,x);break;case 1:if(or(b,x,c),f=x,b=f.stateNode,typeof b.componentDidMount=="function")try{b.componentDidMount()}catch(J){_t(f,f.return,J)}if(f=x,b=f.updateQueue,b!==null){var A=f.stateNode;try{var H=b.shared.hiddenCallbacks;if(H!==null)for(b.shared.hiddenCallbacks=null,b=0;b<H.length;b++)$v(H[b],A)}catch(J){_t(f,f.return,J)}}c&&k&64&&Z1(x),Zl(x,x.return);break;case 27:t_(x);case 26:case 5:or(b,x,c),c&&f===null&&k&4&&J1(x),Zl(x,x.return);break;case 12:or(b,x,c);break;case 31:or(b,x,c),c&&k&4&&a_(b,x);break;case 13:or(b,x,c),c&&k&4&&o_(b,x);break;case 22:x.memoizedState===null&&or(b,x,c),Zl(x,x.return);break;case 30:break;default:or(b,x,c)}r=r.sibling}}function $m(n,r){var c=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),n=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(n=r.memoizedState.cachePool.pool),n!==c&&(n!=null&&n.refCount++,c!=null&&Bl(c))}function Hm(n,r){n=null,r.alternate!==null&&(n=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==n&&(r.refCount++,n!=null&&Bl(n))}function ai(n,r,c,f){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)u_(n,r,c,f),r=r.sibling}function u_(n,r,c,f){var b=r.flags;switch(r.tag){case 0:case 11:case 15:ai(n,r,c,f),b&2048&&Xl(9,r);break;case 1:ai(n,r,c,f);break;case 3:ai(n,r,c,f),b&2048&&(n=null,r.alternate!==null&&(n=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==n&&(r.refCount++,n!=null&&Bl(n)));break;case 12:if(b&2048){ai(n,r,c,f),n=r.stateNode;try{var x=r.memoizedProps,k=x.id,A=x.onPostCommit;typeof A=="function"&&A(k,r.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(H){_t(r,r.return,H)}}else ai(n,r,c,f);break;case 31:ai(n,r,c,f);break;case 13:ai(n,r,c,f);break;case 23:break;case 22:x=r.stateNode,k=r.alternate,r.memoizedState!==null?x._visibility&2?ai(n,r,c,f):Ql(n,r):x._visibility&2?ai(n,r,c,f):(x._visibility|=2,Ro(n,r,c,f,(r.subtreeFlags&10256)!==0||!1)),b&2048&&$m(k,r);break;case 24:ai(n,r,c,f),b&2048&&Hm(r.alternate,r);break;default:ai(n,r,c,f)}}function Ro(n,r,c,f,b){for(b=b&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var x=n,k=r,A=c,H=f,J=k.flags;switch(k.tag){case 0:case 11:case 15:Ro(x,k,A,H,b),Xl(8,k);break;case 23:break;case 22:var re=k.stateNode;k.memoizedState!==null?re._visibility&2?Ro(x,k,A,H,b):Ql(x,k):(re._visibility|=2,Ro(x,k,A,H,b)),b&&J&2048&&$m(k.alternate,k);break;case 24:Ro(x,k,A,H,b),b&&J&2048&&Hm(k.alternate,k);break;default:Ro(x,k,A,H,b)}r=r.sibling}}function Ql(n,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var c=n,f=r,b=f.flags;switch(f.tag){case 22:Ql(c,f),b&2048&&$m(f.alternate,f);break;case 24:Ql(c,f),b&2048&&Hm(f.alternate,f);break;default:Ql(c,f)}r=r.sibling}}var Jl=8192;function Do(n,r,c){if(n.subtreeFlags&Jl)for(n=n.child;n!==null;)d_(n,r,c),n=n.sibling}function d_(n,r,c){switch(n.tag){case 26:Do(n,r,c),n.flags&Jl&&n.memoizedState!==null&&Zj(c,ri,n.memoizedState,n.memoizedProps);break;case 5:Do(n,r,c);break;case 3:case 4:var f=ri;ri=Cd(n.stateNode.containerInfo),Do(n,r,c),ri=f;break;case 22:n.memoizedState===null&&(f=n.alternate,f!==null&&f.memoizedState!==null?(f=Jl,Jl=16777216,Do(n,r,c),Jl=f):Do(n,r,c));break;default:Do(n,r,c)}}function h_(n){var r=n.alternate;if(r!==null&&(n=r.child,n!==null)){r.child=null;do r=n.sibling,n.sibling=null,n=r;while(n!==null)}}function ec(n){var r=n.deletions;if((n.flags&16)!==0){if(r!==null)for(var c=0;c<r.length;c++){var f=r[c];_s=f,m_(f,n)}h_(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)f_(n),n=n.sibling}function f_(n){switch(n.tag){case 0:case 11:case 15:ec(n),n.flags&2048&&zr(9,n,n.return);break;case 3:ec(n);break;case 12:ec(n);break;case 22:var r=n.stateNode;n.memoizedState!==null&&r._visibility&2&&(n.return===null||n.return.tag!==13)?(r._visibility&=-3,hd(n)):ec(n);break;default:ec(n)}}function hd(n){var r=n.deletions;if((n.flags&16)!==0){if(r!==null)for(var c=0;c<r.length;c++){var f=r[c];_s=f,m_(f,n)}h_(n)}for(n=n.child;n!==null;){switch(r=n,r.tag){case 0:case 11:case 15:zr(8,r,r.return),hd(r);break;case 22:c=r.stateNode,c._visibility&2&&(c._visibility&=-3,hd(r));break;default:hd(r)}n=n.sibling}}function m_(n,r){for(;_s!==null;){var c=_s;switch(c.tag){case 0:case 11:case 15:zr(8,c,r);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var f=c.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:Bl(c.memoizedState.cache)}if(f=c.child,f!==null)f.return=c,_s=f;else e:for(c=n;_s!==null;){f=_s;var b=f.sibling,x=f.return;if(i_(f),f===c){_s=null;break e}if(b!==null){b.return=x,_s=b;break e}_s=x}}}var hj={getCacheForType:function(n){var r=Rs(ss),c=r.data.get(n);return c===void 0&&(c=n(),r.data.set(n,c)),c},cacheSignal:function(){return Rs(ss).controller.signal}},fj=typeof WeakMap=="function"?WeakMap:Map,ft=0,Nt=null,tt=null,rt=0,vt=0,kn=null,Br=!1,Oo=!1,Um=!1,lr=0,Ft=0,Ir=0,Ra=0,Fm=0,Cn=0,Lo=0,tc=null,cn=null,qm=!1,fd=0,p_=0,md=1/0,pd=null,Pr=null,hs=0,$r=null,zo=null,cr=0,Vm=0,Gm=null,g_=null,sc=0,Wm=null;function Nn(){return(ft&2)!==0&&rt!==0?rt&-rt:I.T!==null?Jm():oo()}function b_(){if(Cn===0)if((rt&536870912)===0||ot){var n=ni;ni<<=1,(ni&3932160)===0&&(ni=262144),Cn=n}else Cn=536870912;return n=Sn.current,n!==null&&(n.flags|=32),Cn}function un(n,r,c){(n===Nt&&(vt===2||vt===9)||n.cancelPendingCommit!==null)&&(Bo(n,0),Hr(n,rt,Cn,!1)),Ct(n,c),((ft&2)===0||n!==Nt)&&(n===Nt&&((ft&2)===0&&(Ra|=c),Ft===4&&Hr(n,rt,Cn,!1)),yi(n))}function x_(n,r,c){if((ft&6)!==0)throw Error(i(327));var f=!c&&(r&127)===0&&(r&n.expiredLanes)===0||ae(n,r),b=f?gj(n,r):Ym(n,r,!0),x=f;do{if(b===0){Oo&&!f&&Hr(n,r,0,!1);break}else{if(c=n.current.alternate,x&&!mj(c)){b=Ym(n,r,!1),x=!1;continue}if(b===2){if(x=r,n.errorRecoveryDisabledLanes&x)var k=0;else k=n.pendingLanes&-536870913,k=k!==0?k:k&536870912?536870912:0;if(k!==0){r=k;e:{var A=n;b=tc;var H=A.current.memoizedState.isDehydrated;if(H&&(Bo(A,k).flags|=256),k=Ym(A,k,!1),k!==2){if(Um&&!H){A.errorRecoveryDisabledLanes|=x,Ra|=x,b=4;break e}x=cn,cn=b,x!==null&&(cn===null?cn=x:cn.push.apply(cn,x))}b=k}if(x=!1,b!==2)continue}}if(b===1){Bo(n,0),Hr(n,r,0,!0);break}e:{switch(f=n,x=b,x){case 0:case 1:throw Error(i(345));case 4:if((r&4194048)!==r)break;case 6:Hr(f,r,Cn,!Br);break e;case 2:cn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((r&62914560)===r&&(b=fd+300-gt(),10<b)){if(Hr(f,r,Cn,!Br),U(f,0,!0)!==0)break e;cr=r,f.timeoutHandle=Y_(v_.bind(null,f,c,cn,pd,qm,r,Cn,Ra,Lo,Br,x,"Throttled",-0,0),b);break e}v_(f,c,cn,pd,qm,r,Cn,Ra,Lo,Br,x,null,-0,0)}}break}while(!0);yi(n)}function v_(n,r,c,f,b,x,k,A,H,J,re,ce,te,ne){if(n.timeoutHandle=-1,ce=r.subtreeFlags,ce&8192||(ce&16785408)===16785408){ce={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:xe},d_(r,x,ce);var Ee=(x&62914560)===x?fd-gt():(x&4194048)===x?p_-gt():0;if(Ee=Qj(ce,Ee),Ee!==null){cr=x,n.cancelPendingCommit=Ee(E_.bind(null,n,r,x,c,f,b,k,A,H,re,ce,null,te,ne)),Hr(n,x,k,!J);return}}E_(n,r,x,c,f,b,k,A,H)}function mj(n){for(var r=n;;){var c=r.tag;if((c===0||c===11||c===15)&&r.flags&16384&&(c=r.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var f=0;f<c.length;f++){var b=c[f],x=b.getSnapshot;b=b.value;try{if(!_n(x(),b))return!1}catch{return!1}}if(c=r.child,r.subtreeFlags&16384&&c!==null)c.return=r,r=c;else{if(r===n)break;for(;r.sibling===null;){if(r.return===null||r.return===n)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function Hr(n,r,c,f){r&=~Fm,r&=~Ra,n.suspendedLanes|=r,n.pingedLanes&=~r,f&&(n.warmLanes|=r),f=n.expirationTimes;for(var b=r;0<b;){var x=31-js(b),k=1<<x;f[x]=-1,b&=~k}c!==0&&ke(n,c,r)}function gd(){return(ft&6)===0?(nc(0),!1):!0}function Km(){if(tt!==null){if(vt===0)var n=tt.return;else n=tt,Qi=wa=null,um(n),Eo=null,Pl=0,n=tt;for(;n!==null;)X1(n.alternate,n),n=n.return;tt=null}}function Bo(n,r){var c=n.timeoutHandle;c!==-1&&(n.timeoutHandle=-1,Oj(c)),c=n.cancelPendingCommit,c!==null&&(n.cancelPendingCommit=null,c()),cr=0,Km(),Nt=n,tt=c=Xi(n.current,null),rt=r,vt=0,kn=null,Br=!1,Oo=ae(n,r),Um=!1,Lo=Cn=Fm=Ra=Ir=Ft=0,cn=tc=null,qm=!1,(r&8)!==0&&(r|=r&32);var f=n.entangledLanes;if(f!==0)for(n=n.entanglements,f&=r;0<f;){var b=31-js(f),x=1<<b;r|=n[b],f&=~x}return lr=r,Bu(),c}function __(n,r){Ke=null,I.H=Wl,r===No||r===Vu?(r=zv(),vt=3):r===Qf?(r=zv(),vt=4):vt=r===Nm?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,kn=r,tt===null&&(Ft=1,rd(n,Ln(r,n.current)))}function y_(){var n=Sn.current;return n===null?!0:(rt&4194048)===rt?Pn===null:(rt&62914560)===rt||(rt&536870912)!==0?n===Pn:!1}function S_(){var n=I.H;return I.H=Wl,n===null?Wl:n}function w_(){var n=I.A;return I.A=hj,n}function bd(){Ft=4,Br||(rt&4194048)!==rt&&Sn.current!==null||(Oo=!0),(Ir&134217727)===0&&(Ra&134217727)===0||Nt===null||Hr(Nt,rt,Cn,!1)}function Ym(n,r,c){var f=ft;ft|=2;var b=S_(),x=w_();(Nt!==n||rt!==r)&&(pd=null,Bo(n,r)),r=!1;var k=Ft;e:do try{if(vt!==0&&tt!==null){var A=tt,H=kn;switch(vt){case 8:Km(),k=6;break e;case 3:case 2:case 9:case 6:Sn.current===null&&(r=!0);var J=vt;if(vt=0,kn=null,Io(n,A,H,J),c&&Oo){k=0;break e}break;default:J=vt,vt=0,kn=null,Io(n,A,H,J)}}pj(),k=Ft;break}catch(re){__(n,re)}while(!0);return r&&n.shellSuspendCounter++,Qi=wa=null,ft=f,I.H=b,I.A=x,tt===null&&(Nt=null,rt=0,Bu()),k}function pj(){for(;tt!==null;)k_(tt)}function gj(n,r){var c=ft;ft|=2;var f=S_(),b=w_();Nt!==n||rt!==r?(pd=null,md=gt()+500,Bo(n,r)):Oo=ae(n,r);e:do try{if(vt!==0&&tt!==null){r=tt;var x=kn;t:switch(vt){case 1:vt=0,kn=null,Io(n,r,x,1);break;case 2:case 9:if(Ov(x)){vt=0,kn=null,C_(r);break}r=function(){vt!==2&&vt!==9||Nt!==n||(vt=7),yi(n)},x.then(r,r);break e;case 3:vt=7;break e;case 4:vt=5;break e;case 7:Ov(x)?(vt=0,kn=null,C_(r)):(vt=0,kn=null,Io(n,r,x,7));break;case 5:var k=null;switch(tt.tag){case 26:k=tt.memoizedState;case 5:case 27:var A=tt;if(k?uy(k):A.stateNode.complete){vt=0,kn=null;var H=A.sibling;if(H!==null)tt=H;else{var J=A.return;J!==null?(tt=J,xd(J)):tt=null}break t}}vt=0,kn=null,Io(n,r,x,5);break;case 6:vt=0,kn=null,Io(n,r,x,6);break;case 8:Km(),Ft=6;break e;default:throw Error(i(462))}}bj();break}catch(re){__(n,re)}while(!0);return Qi=wa=null,I.H=f,I.A=b,ft=c,tt!==null?0:(Nt=null,rt=0,Bu(),Ft)}function bj(){for(;tt!==null&&!gn();)k_(tt)}function k_(n){var r=K1(n.alternate,n,lr);n.memoizedProps=n.pendingProps,r===null?xd(n):tt=r}function C_(n){var r=n,c=r.alternate;switch(r.tag){case 15:case 0:r=U1(c,r,r.pendingProps,r.type,void 0,rt);break;case 11:r=U1(c,r,r.pendingProps,r.type.render,r.ref,rt);break;case 5:um(r);default:X1(c,r),r=tt=wv(r,lr),r=K1(c,r,lr)}n.memoizedProps=n.pendingProps,r===null?xd(n):tt=r}function Io(n,r,c,f){Qi=wa=null,um(r),Eo=null,Pl=0;var b=r.return;try{if(rj(n,b,r,c,rt)){Ft=1,rd(n,Ln(c,n.current)),tt=null;return}}catch(x){if(b!==null)throw tt=b,x;Ft=1,rd(n,Ln(c,n.current)),tt=null;return}r.flags&32768?(ot||f===1?n=!0:Oo||(rt&536870912)!==0?n=!1:(Br=n=!0,(f===2||f===9||f===3||f===6)&&(f=Sn.current,f!==null&&f.tag===13&&(f.flags|=16384))),N_(r,n)):xd(r)}function xd(n){var r=n;do{if((r.flags&32768)!==0){N_(r,Br);return}n=r.return;var c=lj(r.alternate,r,lr);if(c!==null){tt=c;return}if(r=r.sibling,r!==null){tt=r;return}tt=r=n}while(r!==null);Ft===0&&(Ft=5)}function N_(n,r){do{var c=cj(n.alternate,n);if(c!==null){c.flags&=32767,tt=c;return}if(c=n.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!r&&(n=n.sibling,n!==null)){tt=n;return}tt=n=c}while(n!==null);Ft=6,tt=null}function E_(n,r,c,f,b,x,k,A,H){n.cancelPendingCommit=null;do vd();while(hs!==0);if((ft&6)!==0)throw Error(i(327));if(r!==null){if(r===n.current)throw Error(i(177));if(x=r.lanes|r.childLanes,x|=Bf,Me(n,c,x,k,A,H),n===Nt&&(tt=Nt=null,rt=0),zo=r,$r=n,cr=c,Vm=x,Gm=b,g_=f,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,yj(Fi,function(){return R_(),null})):(n.callbackNode=null,n.callbackPriority=0),f=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||f){f=I.T,I.T=null,b=Y.p,Y.p=2,k=ft,ft|=4;try{uj(n,r,c)}finally{ft=k,Y.p=b,I.T=f}}hs=1,T_(),j_(),A_()}}function T_(){if(hs===1){hs=0;var n=$r,r=zo,c=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||c){c=I.T,I.T=null;var f=Y.p;Y.p=2;var b=ft;ft|=4;try{l_(r,n);var x=op,k=mv(n.containerInfo),A=x.focusedElem,H=x.selectionRange;if(k!==A&&A&&A.ownerDocument&&fv(A.ownerDocument.documentElement,A)){if(H!==null&&Rf(A)){var J=H.start,re=H.end;if(re===void 0&&(re=J),"selectionStart"in A)A.selectionStart=J,A.selectionEnd=Math.min(re,A.value.length);else{var ce=A.ownerDocument||document,te=ce&&ce.defaultView||window;if(te.getSelection){var ne=te.getSelection(),Ee=A.textContent.length,$e=Math.min(H.start,Ee),wt=H.end===void 0?$e:Math.min(H.end,Ee);!ne.extend&&$e>wt&&(k=wt,wt=$e,$e=k);var K=hv(A,$e),q=hv(A,wt);if(K&&q&&(ne.rangeCount!==1||ne.anchorNode!==K.node||ne.anchorOffset!==K.offset||ne.focusNode!==q.node||ne.focusOffset!==q.offset)){var Q=ce.createRange();Q.setStart(K.node,K.offset),ne.removeAllRanges(),$e>wt?(ne.addRange(Q),ne.extend(q.node,q.offset)):(Q.setEnd(q.node,q.offset),ne.addRange(Q))}}}}for(ce=[],ne=A;ne=ne.parentNode;)ne.nodeType===1&&ce.push({element:ne,left:ne.scrollLeft,top:ne.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<ce.length;A++){var oe=ce[A];oe.element.scrollLeft=oe.left,oe.element.scrollTop=oe.top}}Md=!!ap,op=ap=null}finally{ft=b,Y.p=f,I.T=c}}n.current=r,hs=2}}function j_(){if(hs===2){hs=0;var n=$r,r=zo,c=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||c){c=I.T,I.T=null;var f=Y.p;Y.p=2;var b=ft;ft|=4;try{n_(n,r.alternate,r)}finally{ft=b,Y.p=f,I.T=c}}hs=3}}function A_(){if(hs===4||hs===3){hs=0,Ts();var n=$r,r=zo,c=cr,f=g_;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?hs=5:(hs=0,zo=$r=null,M_(n,n.pendingLanes));var b=n.pendingLanes;if(b===0&&(Pr=null),Vi(c),r=r.stateNode,vs&&typeof vs.onCommitFiberRoot=="function")try{vs.onCommitFiberRoot(qi,r,void 0,(r.current.flags&128)===128)}catch{}if(f!==null){r=I.T,b=Y.p,Y.p=2,I.T=null;try{for(var x=n.onRecoverableError,k=0;k<f.length;k++){var A=f[k];x(A.value,{componentStack:A.stack})}}finally{I.T=r,Y.p=b}}(cr&3)!==0&&vd(),yi(n),b=n.pendingLanes,(c&261930)!==0&&(b&42)!==0?n===Wm?sc++:(sc=0,Wm=n):sc=0,nc(0)}}function M_(n,r){(n.pooledCacheLanes&=r)===0&&(r=n.pooledCache,r!=null&&(n.pooledCache=null,Bl(r)))}function vd(){return T_(),j_(),A_(),R_()}function R_(){if(hs!==5)return!1;var n=$r,r=Vm;Vm=0;var c=Vi(cr),f=I.T,b=Y.p;try{Y.p=32>c?32:c,I.T=null,c=Gm,Gm=null;var x=$r,k=cr;if(hs=0,zo=$r=null,cr=0,(ft&6)!==0)throw Error(i(331));var A=ft;if(ft|=4,f_(x.current),u_(x,x.current,k,c),ft=A,nc(0,!1),vs&&typeof vs.onPostCommitFiberRoot=="function")try{vs.onPostCommitFiberRoot(qi,x)}catch{}return!0}finally{Y.p=b,I.T=f,M_(n,r)}}function D_(n,r,c){r=Ln(c,r),r=Cm(n.stateNode,r,2),n=Dr(n,r,2),n!==null&&(Ct(n,2),yi(n))}function _t(n,r,c){if(n.tag===3)D_(n,n,c);else for(;r!==null;){if(r.tag===3){D_(r,n,c);break}else if(r.tag===1){var f=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(Pr===null||!Pr.has(f))){n=Ln(c,n),c=O1(2),f=Dr(r,c,2),f!==null&&(L1(c,f,r,n),Ct(f,2),yi(f));break}}r=r.return}}function Xm(n,r,c){var f=n.pingCache;if(f===null){f=n.pingCache=new fj;var b=new Set;f.set(r,b)}else b=f.get(r),b===void 0&&(b=new Set,f.set(r,b));b.has(c)||(Um=!0,b.add(c),n=xj.bind(null,n,r,c),r.then(n,n))}function xj(n,r,c){var f=n.pingCache;f!==null&&f.delete(r),n.pingedLanes|=n.suspendedLanes&c,n.warmLanes&=~c,Nt===n&&(rt&c)===c&&(Ft===4||Ft===3&&(rt&62914560)===rt&&300>gt()-fd?(ft&2)===0&&Bo(n,0):Fm|=c,Lo===rt&&(Lo=0)),yi(n)}function O_(n,r){r===0&&(r=Fe()),n=_a(n,r),n!==null&&(Ct(n,r),yi(n))}function vj(n){var r=n.memoizedState,c=0;r!==null&&(c=r.retryLane),O_(n,c)}function _j(n,r){var c=0;switch(n.tag){case 31:case 13:var f=n.stateNode,b=n.memoizedState;b!==null&&(c=b.retryLane);break;case 19:f=n.stateNode;break;case 22:f=n.stateNode._retryCache;break;default:throw Error(i(314))}f!==null&&f.delete(r),O_(n,c)}function yj(n,r){return _e(n,r)}var _d=null,Po=null,Zm=!1,yd=!1,Qm=!1,Ur=0;function yi(n){n!==Po&&n.next===null&&(Po===null?_d=Po=n:Po=Po.next=n),yd=!0,Zm||(Zm=!0,wj())}function nc(n,r){if(!Qm&&yd){Qm=!0;do for(var c=!1,f=_d;f!==null;){if(n!==0){var b=f.pendingLanes;if(b===0)var x=0;else{var k=f.suspendedLanes,A=f.pingedLanes;x=(1<<31-js(42|n)+1)-1,x&=b&~(k&~A),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(c=!0,I_(f,x))}else x=rt,x=U(f,f===Nt?x:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(x&3)===0||ae(f,x)||(c=!0,I_(f,x));f=f.next}while(c);Qm=!1}}function Sj(){L_()}function L_(){yd=Zm=!1;var n=0;Ur!==0&&Dj()&&(n=Ur);for(var r=gt(),c=null,f=_d;f!==null;){var b=f.next,x=z_(f,r);x===0?(f.next=null,c===null?_d=b:c.next=b,b===null&&(Po=c)):(c=f,(n!==0||(x&3)!==0)&&(yd=!0)),f=b}hs!==0&&hs!==5||nc(n),Ur!==0&&(Ur=0)}function z_(n,r){for(var c=n.suspendedLanes,f=n.pingedLanes,b=n.expirationTimes,x=n.pendingLanes&-62914561;0<x;){var k=31-js(x),A=1<<k,H=b[k];H===-1?((A&c)===0||(A&f)!==0)&&(b[k]=ye(A,r)):H<=r&&(n.expiredLanes|=A),x&=~A}if(r=Nt,c=rt,c=U(n,n===r?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),f=n.callbackNode,c===0||n===r&&(vt===2||vt===9)||n.cancelPendingCommit!==null)return f!==null&&f!==null&&ht(f),n.callbackNode=null,n.callbackPriority=0;if((c&3)===0||ae(n,c)){if(r=c&-c,r===n.callbackPriority)return r;switch(f!==null&&ht(f),Vi(c)){case 2:case 8:c=Ui;break;case 32:c=Fi;break;case 268435456:c=_r;break;default:c=Fi}return f=B_.bind(null,n),c=_e(c,f),n.callbackPriority=r,n.callbackNode=c,r}return f!==null&&f!==null&&ht(f),n.callbackPriority=2,n.callbackNode=null,2}function B_(n,r){if(hs!==0&&hs!==5)return n.callbackNode=null,n.callbackPriority=0,null;var c=n.callbackNode;if(vd()&&n.callbackNode!==c)return null;var f=rt;return f=U(n,n===Nt?f:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),f===0?null:(x_(n,f,r),z_(n,gt()),n.callbackNode!=null&&n.callbackNode===c?B_.bind(null,n):null)}function I_(n,r){if(vd())return null;x_(n,r,!0)}function wj(){Lj(function(){(ft&6)!==0?_e(ds,Sj):L_()})}function Jm(){if(Ur===0){var n=ko;n===0&&(n=lt,lt<<=1,(lt&261888)===0&&(lt=256)),Ur=n}return Ur}function P_(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Cr(""+n)}function $_(n,r){var c=r.ownerDocument.createElement("input");return c.name=r.name,c.value=r.value,n.id&&c.setAttribute("form",n.id),r.parentNode.insertBefore(c,r),n=new FormData(n),c.parentNode.removeChild(c),n}function kj(n,r,c,f,b){if(r==="submit"&&c&&c.stateNode===b){var x=P_((b[$s]||null).action),k=f.submitter;k&&(r=(r=k[$s]||null)?P_(r.formAction):k.getAttribute("formAction"),r!==null&&(x=r,k=null));var A=new Du("action","action",null,f,b);n.push({event:A,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(Ur!==0){var H=k?$_(b,k):new FormData(b);vm(c,{pending:!0,data:H,method:b.method,action:x},null,H)}}else typeof x=="function"&&(A.preventDefault(),H=k?$_(b,k):new FormData(b),vm(c,{pending:!0,data:H,method:b.method,action:x},x,H))},currentTarget:b}]})}}for(var ep=0;ep<zf.length;ep++){var tp=zf[ep],Cj=tp.toLowerCase(),Nj=tp[0].toUpperCase()+tp.slice(1);ii(Cj,"on"+Nj)}ii(bv,"onAnimationEnd"),ii(xv,"onAnimationIteration"),ii(vv,"onAnimationStart"),ii("dblclick","onDoubleClick"),ii("focusin","onFocus"),ii("focusout","onBlur"),ii(UT,"onTransitionRun"),ii(FT,"onTransitionStart"),ii(qT,"onTransitionCancel"),ii(_v,"onTransitionEnd"),me("onMouseEnter",["mouseout","mouseover"]),me("onMouseLeave",["mouseout","mouseover"]),me("onPointerEnter",["pointerout","pointerover"]),me("onPointerLeave",["pointerout","pointerover"]),Wi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Wi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Wi("onBeforeInput",["compositionend","keypress","textInput","paste"]),Wi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Wi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Wi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ic="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(" "),Ej=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ic));function H_(n,r){r=(r&4)!==0;for(var c=0;c<n.length;c++){var f=n[c],b=f.event;f=f.listeners;e:{var x=void 0;if(r)for(var k=f.length-1;0<=k;k--){var A=f[k],H=A.instance,J=A.currentTarget;if(A=A.listener,H!==x&&b.isPropagationStopped())break e;x=A,b.currentTarget=J;try{x(b)}catch(re){zu(re)}b.currentTarget=null,x=H}else for(k=0;k<f.length;k++){if(A=f[k],H=A.instance,J=A.currentTarget,A=A.listener,H!==x&&b.isPropagationStopped())break e;x=A,b.currentTarget=J;try{x(b)}catch(re){zu(re)}b.currentTarget=null,x=H}}}}function st(n,r){var c=r[_l];c===void 0&&(c=r[_l]=new Set);var f=n+"__bubble";c.has(f)||(U_(r,n,2,!1),c.add(f))}function sp(n,r,c){var f=0;r&&(f|=4),U_(c,n,f,r)}var Sd="_reactListening"+Math.random().toString(36).slice(2);function np(n){if(!n[Sd]){n[Sd]=!0,Cu.forEach(function(c){c!=="selectionchange"&&(Ej.has(c)||sp(c,!1,n),sp(c,!0,n))});var r=n.nodeType===9?n:n.ownerDocument;r===null||r[Sd]||(r[Sd]=!0,sp("selectionchange",!1,r))}}function U_(n,r,c,f){switch(by(r)){case 2:var b=tA;break;case 8:b=sA;break;default:b=xp}c=b.bind(null,r,c,n),b=void 0,!wf||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(b=!0),f?b!==void 0?n.addEventListener(r,c,{capture:!0,passive:b}):n.addEventListener(r,c,!0):b!==void 0?n.addEventListener(r,c,{passive:b}):n.addEventListener(r,c,!1)}function ip(n,r,c,f,b){var x=f;if((r&1)===0&&(r&2)===0&&f!==null)e:for(;;){if(f===null)return;var k=f.tag;if(k===3||k===4){var A=f.stateNode.containerInfo;if(A===b)break;if(k===4)for(k=f.return;k!==null;){var H=k.tag;if((H===3||H===4)&&k.stateNode.containerInfo===b)return;k=k.return}for(;A!==null;){if(k=Ks(A),k===null)return;if(H=k.tag,H===5||H===6||H===26||H===27){f=x=k;continue e}A=A.parentNode}}f=f.return}ju(function(){var J=x,re=We(c),ce=[];e:{var te=yv.get(n);if(te!==void 0){var ne=Du,Ee=n;switch(n){case"keypress":if(Mu(c)===0)break e;case"keydown":case"keyup":ne=_T;break;case"focusin":Ee="focus",ne=Ef;break;case"focusout":Ee="blur",ne=Ef;break;case"beforeblur":case"afterblur":ne=Ef;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ne=Xx;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ne=lT;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ne=wT;break;case bv:case xv:case vv:ne=dT;break;case _v:ne=CT;break;case"scroll":case"scrollend":ne=aT;break;case"wheel":ne=ET;break;case"copy":case"cut":case"paste":ne=fT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ne=Qx;break;case"toggle":case"beforetoggle":ne=jT}var $e=(r&4)!==0,wt=!$e&&(n==="scroll"||n==="scrollend"),K=$e?te!==null?te+"Capture":null:te;$e=[];for(var q=J,Q;q!==null;){var oe=q;if(Q=oe.stateNode,oe=oe.tag,oe!==5&&oe!==26&&oe!==27||Q===null||K===null||(oe=Nl(q,K),oe!=null&&$e.push(rc(q,oe,Q))),wt)break;q=q.return}0<$e.length&&(te=new ne(te,Ee,null,c,re),ce.push({event:te,listeners:$e}))}}if((r&7)===0){e:{if(te=n==="mouseover"||n==="pointerover",ne=n==="mouseout"||n==="pointerout",te&&c!==Re&&(Ee=c.relatedTarget||c.fromElement)&&(Ks(Ee)||Ee[yr]))break e;if((ne||te)&&(te=re.window===re?re:(te=re.ownerDocument)?te.defaultView||te.parentWindow:window,ne?(Ee=c.relatedTarget||c.toElement,ne=J,Ee=Ee?Ks(Ee):null,Ee!==null&&(wt=l(Ee),$e=Ee.tag,Ee!==wt||$e!==5&&$e!==27&&$e!==6)&&(Ee=null)):(ne=null,Ee=J),ne!==Ee)){if($e=Xx,oe="onMouseLeave",K="onMouseEnter",q="mouse",(n==="pointerout"||n==="pointerover")&&($e=Qx,oe="onPointerLeave",K="onPointerEnter",q="pointer"),wt=ne==null?te:Sr(ne),Q=Ee==null?te:Sr(Ee),te=new $e(oe,q+"leave",ne,c,re),te.target=wt,te.relatedTarget=Q,oe=null,Ks(re)===J&&($e=new $e(K,q+"enter",Ee,c,re),$e.target=Q,$e.relatedTarget=wt,oe=$e),wt=oe,ne&&Ee)t:{for($e=Tj,K=ne,q=Ee,Q=0,oe=K;oe;oe=$e(oe))Q++;oe=0;for(var Ie=q;Ie;Ie=$e(Ie))oe++;for(;0<Q-oe;)K=$e(K),Q--;for(;0<oe-Q;)q=$e(q),oe--;for(;Q--;){if(K===q||q!==null&&K===q.alternate){$e=K;break t}K=$e(K),q=$e(q)}$e=null}else $e=null;ne!==null&&F_(ce,te,ne,$e,!1),Ee!==null&&wt!==null&&F_(ce,wt,Ee,$e,!0)}}e:{if(te=J?Sr(J):window,ne=te.nodeName&&te.nodeName.toLowerCase(),ne==="select"||ne==="input"&&te.type==="file")var ut=av;else if(iv(te))if(ov)ut=PT;else{ut=BT;var De=zT}else ne=te.nodeName,!ne||ne.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?J&&kr(J.elementType)&&(ut=av):ut=IT;if(ut&&(ut=ut(n,J))){rv(ce,ut,c,re);break e}De&&De(n,te,J),n==="focusout"&&J&&te.type==="number"&&J.memoizedProps.value!=null&&fo(te,"number",te.value)}switch(De=J?Sr(J):window,n){case"focusin":(iv(De)||De.contentEditable==="true")&&(go=De,Df=J,Ol=null);break;case"focusout":Ol=Df=go=null;break;case"mousedown":Of=!0;break;case"contextmenu":case"mouseup":case"dragend":Of=!1,pv(ce,c,re);break;case"selectionchange":if(HT)break;case"keydown":case"keyup":pv(ce,c,re)}var Ye;if(jf)e:{switch(n){case"compositionstart":var at="onCompositionStart";break e;case"compositionend":at="onCompositionEnd";break e;case"compositionupdate":at="onCompositionUpdate";break e}at=void 0}else po?sv(n,c)&&(at="onCompositionEnd"):n==="keydown"&&c.keyCode===229&&(at="onCompositionStart");at&&(Jx&&c.locale!=="ko"&&(po||at!=="onCompositionStart"?at==="onCompositionEnd"&&po&&(Ye=Kx()):(Nr=re,kf="value"in Nr?Nr.value:Nr.textContent,po=!0)),De=wd(J,at),0<De.length&&(at=new Zx(at,n,null,c,re),ce.push({event:at,listeners:De}),Ye?at.data=Ye:(Ye=nv(c),Ye!==null&&(at.data=Ye)))),(Ye=MT?RT(n,c):DT(n,c))&&(at=wd(J,"onBeforeInput"),0<at.length&&(De=new Zx("onBeforeInput","beforeinput",null,c,re),ce.push({event:De,listeners:at}),De.data=Ye)),kj(ce,n,J,c,re)}H_(ce,r)})}function rc(n,r,c){return{instance:n,listener:r,currentTarget:c}}function wd(n,r){for(var c=r+"Capture",f=[];n!==null;){var b=n,x=b.stateNode;if(b=b.tag,b!==5&&b!==26&&b!==27||x===null||(b=Nl(n,c),b!=null&&f.unshift(rc(n,b,x)),b=Nl(n,r),b!=null&&f.push(rc(n,b,x))),n.tag===3)return f;n=n.return}return[]}function Tj(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function F_(n,r,c,f,b){for(var x=r._reactName,k=[];c!==null&&c!==f;){var A=c,H=A.alternate,J=A.stateNode;if(A=A.tag,H!==null&&H===f)break;A!==5&&A!==26&&A!==27||J===null||(H=J,b?(J=Nl(c,x),J!=null&&k.unshift(rc(c,J,H))):b||(J=Nl(c,x),J!=null&&k.push(rc(c,J,H)))),c=c.return}k.length!==0&&n.push({event:r,listeners:k})}var jj=/\r\n?/g,Aj=/\u0000|\uFFFD/g;function q_(n){return(typeof n=="string"?n:""+n).replace(jj,`
|
|
9
|
+
`).replace(Aj,"")}function V_(n,r){return r=q_(r),q_(n)===r}function St(n,r,c,f,b,x){switch(c){case"children":typeof f=="string"?r==="body"||r==="textarea"&&f===""||He(n,f):(typeof f=="number"||typeof f=="bigint")&&r!=="body"&&He(n,""+f);break;case"className":xn(n,"class",f);break;case"tabIndex":xn(n,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":xn(n,c,f);break;case"style":xt(n,f,x);break;case"data":if(r!=="object"){xn(n,"data",f);break}case"src":case"href":if(f===""&&(r!=="a"||c!=="href")){n.removeAttribute(c);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){n.removeAttribute(c);break}f=Cr(""+f),n.setAttribute(c,f);break;case"action":case"formAction":if(typeof f=="function"){n.setAttribute(c,"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 x=="function"&&(c==="formAction"?(r!=="input"&&St(n,r,"name",b.name,b,null),St(n,r,"formEncType",b.formEncType,b,null),St(n,r,"formMethod",b.formMethod,b,null),St(n,r,"formTarget",b.formTarget,b,null)):(St(n,r,"encType",b.encType,b,null),St(n,r,"method",b.method,b,null),St(n,r,"target",b.target,b,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){n.removeAttribute(c);break}f=Cr(""+f),n.setAttribute(c,f);break;case"onClick":f!=null&&(n.onclick=xe);break;case"onScroll":f!=null&&st("scroll",n);break;case"onScrollEnd":f!=null&&st("scrollend",n);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(i(61));if(c=f.__html,c!=null){if(b.children!=null)throw Error(i(60));n.innerHTML=c}}break;case"multiple":n.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":n.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){n.removeAttribute("xlink:href");break}c=Cr(""+f),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?n.setAttribute(c,""+f):n.removeAttribute(c);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":f&&typeof f!="function"&&typeof f!="symbol"?n.setAttribute(c,""):n.removeAttribute(c);break;case"capture":case"download":f===!0?n.setAttribute(c,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?n.setAttribute(c,f):n.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?n.setAttribute(c,f):n.removeAttribute(c);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?n.removeAttribute(c):n.setAttribute(c,f);break;case"popover":st("beforetoggle",n),st("toggle",n),Hs(n,"popover",f);break;case"xlinkActuate":sn(n,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":sn(n,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":sn(n,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":sn(n,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":sn(n,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":sn(n,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":sn(n,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":sn(n,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":sn(n,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":Hs(n,"is",f);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=Ki.get(c)||c,Hs(n,c,f))}}function rp(n,r,c,f,b,x){switch(c){case"style":xt(n,f,x);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(i(61));if(c=f.__html,c!=null){if(b.children!=null)throw Error(i(60));n.innerHTML=c}}break;case"children":typeof f=="string"?He(n,f):(typeof f=="number"||typeof f=="bigint")&&He(n,""+f);break;case"onScroll":f!=null&&st("scroll",n);break;case"onScrollEnd":f!=null&&st("scrollend",n);break;case"onClick":f!=null&&(n.onclick=xe);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!pa.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(b=c.endsWith("Capture"),r=c.slice(2,b?c.length-7:void 0),x=n[$s]||null,x=x!=null?x[c]:null,typeof x=="function"&&n.removeEventListener(r,x,b),typeof f=="function")){typeof x!="function"&&x!==null&&(c in n?n[c]=null:n.hasAttribute(c)&&n.removeAttribute(c)),n.addEventListener(r,f,b);break e}c in n?n[c]=f:f===!0?n.setAttribute(c,""):Hs(n,c,f)}}}function Os(n,r,c){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":st("error",n),st("load",n);var f=!1,b=!1,x;for(x in c)if(c.hasOwnProperty(x)){var k=c[x];if(k!=null)switch(x){case"src":f=!0;break;case"srcSet":b=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:St(n,r,x,k,c,null)}}b&&St(n,r,"srcSet",c.srcSet,c,null),f&&St(n,r,"src",c.src,c,null);return;case"input":st("invalid",n);var A=x=k=b=null,H=null,J=null;for(f in c)if(c.hasOwnProperty(f)){var re=c[f];if(re!=null)switch(f){case"name":b=re;break;case"type":k=re;break;case"checked":H=re;break;case"defaultChecked":J=re;break;case"value":x=re;break;case"defaultValue":A=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(i(137,r));break;default:St(n,r,f,re,c,null)}}ga(n,x,A,H,J,k,b,!1);return;case"select":st("invalid",n),f=k=x=null;for(b in c)if(c.hasOwnProperty(b)&&(A=c[b],A!=null))switch(b){case"value":x=A;break;case"defaultValue":k=A;break;case"multiple":f=A;default:St(n,r,b,A,c,null)}r=x,c=k,n.multiple=!!f,r!=null?As(n,!!f,r,!1):c!=null&&As(n,!!f,c,!0);return;case"textarea":st("invalid",n),x=b=f=null;for(k in c)if(c.hasOwnProperty(k)&&(A=c[k],A!=null))switch(k){case"value":f=A;break;case"defaultValue":b=A;break;case"children":x=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(i(91));break;default:St(n,r,k,A,c,null)}mo(n,f,b,x);return;case"option":for(H in c)c.hasOwnProperty(H)&&(f=c[H],f!=null)&&(H==="selected"?n.selected=f&&typeof f!="function"&&typeof f!="symbol":St(n,r,H,f,c,null));return;case"dialog":st("beforetoggle",n),st("toggle",n),st("cancel",n),st("close",n);break;case"iframe":case"object":st("load",n);break;case"video":case"audio":for(f=0;f<ic.length;f++)st(ic[f],n);break;case"image":st("error",n),st("load",n);break;case"details":st("toggle",n);break;case"embed":case"source":case"link":st("error",n),st("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(J in c)if(c.hasOwnProperty(J)&&(f=c[J],f!=null))switch(J){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:St(n,r,J,f,c,null)}return;default:if(kr(r)){for(re in c)c.hasOwnProperty(re)&&(f=c[re],f!==void 0&&rp(n,r,re,f,c,void 0));return}}for(A in c)c.hasOwnProperty(A)&&(f=c[A],f!=null&&St(n,r,A,f,c,null))}function Mj(n,r,c,f){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var b=null,x=null,k=null,A=null,H=null,J=null,re=null;for(ne in c){var ce=c[ne];if(c.hasOwnProperty(ne)&&ce!=null)switch(ne){case"checked":break;case"value":break;case"defaultValue":H=ce;default:f.hasOwnProperty(ne)||St(n,r,ne,null,f,ce)}}for(var te in f){var ne=f[te];if(ce=c[te],f.hasOwnProperty(te)&&(ne!=null||ce!=null))switch(te){case"type":x=ne;break;case"name":b=ne;break;case"checked":J=ne;break;case"defaultChecked":re=ne;break;case"value":k=ne;break;case"defaultValue":A=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(i(137,r));break;default:ne!==ce&&St(n,r,te,ne,f,ce)}}wl(n,k,A,H,J,re,x,b);return;case"select":ne=k=A=te=null;for(x in c)if(H=c[x],c.hasOwnProperty(x)&&H!=null)switch(x){case"value":break;case"multiple":ne=H;default:f.hasOwnProperty(x)||St(n,r,x,null,f,H)}for(b in f)if(x=f[b],H=c[b],f.hasOwnProperty(b)&&(x!=null||H!=null))switch(b){case"value":te=x;break;case"defaultValue":A=x;break;case"multiple":k=x;default:x!==H&&St(n,r,b,x,f,H)}r=A,c=k,f=ne,te!=null?As(n,!!c,te,!1):!!f!=!!c&&(r!=null?As(n,!!c,r,!0):As(n,!!c,c?[]:"",!1));return;case"textarea":ne=te=null;for(A in c)if(b=c[A],c.hasOwnProperty(A)&&b!=null&&!f.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:St(n,r,A,null,f,b)}for(k in f)if(b=f[k],x=c[k],f.hasOwnProperty(k)&&(b!=null||x!=null))switch(k){case"value":te=b;break;case"defaultValue":ne=b;break;case"children":break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(i(91));break;default:b!==x&&St(n,r,k,b,f,x)}Eu(n,te,ne);return;case"option":for(var Ee in c)te=c[Ee],c.hasOwnProperty(Ee)&&te!=null&&!f.hasOwnProperty(Ee)&&(Ee==="selected"?n.selected=!1:St(n,r,Ee,null,f,te));for(H in f)te=f[H],ne=c[H],f.hasOwnProperty(H)&&te!==ne&&(te!=null||ne!=null)&&(H==="selected"?n.selected=te&&typeof te!="function"&&typeof te!="symbol":St(n,r,H,te,f,ne));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 $e in c)te=c[$e],c.hasOwnProperty($e)&&te!=null&&!f.hasOwnProperty($e)&&St(n,r,$e,null,f,te);for(J in f)if(te=f[J],ne=c[J],f.hasOwnProperty(J)&&te!==ne&&(te!=null||ne!=null))switch(J){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(i(137,r));break;default:St(n,r,J,te,f,ne)}return;default:if(kr(r)){for(var wt in c)te=c[wt],c.hasOwnProperty(wt)&&te!==void 0&&!f.hasOwnProperty(wt)&&rp(n,r,wt,void 0,f,te);for(re in f)te=f[re],ne=c[re],!f.hasOwnProperty(re)||te===ne||te===void 0&&ne===void 0||rp(n,r,re,te,f,ne);return}}for(var K in c)te=c[K],c.hasOwnProperty(K)&&te!=null&&!f.hasOwnProperty(K)&&St(n,r,K,null,f,te);for(ce in f)te=f[ce],ne=c[ce],!f.hasOwnProperty(ce)||te===ne||te==null&&ne==null||St(n,r,ce,te,f,ne)}function G_(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Rj(){if(typeof performance.getEntriesByType=="function"){for(var n=0,r=0,c=performance.getEntriesByType("resource"),f=0;f<c.length;f++){var b=c[f],x=b.transferSize,k=b.initiatorType,A=b.duration;if(x&&A&&G_(k)){for(k=0,A=b.responseEnd,f+=1;f<c.length;f++){var H=c[f],J=H.startTime;if(J>A)break;var re=H.transferSize,ce=H.initiatorType;re&&G_(ce)&&(H=H.responseEnd,k+=re*(H<A?1:(A-J)/(H-J)))}if(--f,r+=8*(x+k)/(b.duration/1e3),n++,10<n)break}}if(0<n)return r/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var ap=null,op=null;function kd(n){return n.nodeType===9?n:n.ownerDocument}function W_(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function K_(n,r){if(n===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&r==="foreignObject"?0:n}function lp(n,r){return n==="textarea"||n==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var cp=null;function Dj(){var n=window.event;return n&&n.type==="popstate"?n===cp?!1:(cp=n,!0):(cp=null,!1)}var Y_=typeof setTimeout=="function"?setTimeout:void 0,Oj=typeof clearTimeout=="function"?clearTimeout:void 0,X_=typeof Promise=="function"?Promise:void 0,Lj=typeof queueMicrotask=="function"?queueMicrotask:typeof X_<"u"?function(n){return X_.resolve(null).then(n).catch(zj)}:Y_;function zj(n){setTimeout(function(){throw n})}function Fr(n){return n==="head"}function Z_(n,r){var c=r,f=0;do{var b=c.nextSibling;if(n.removeChild(c),b&&b.nodeType===8)if(c=b.data,c==="/$"||c==="/&"){if(f===0){n.removeChild(b),Fo(r);return}f--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")f++;else if(c==="html")ac(n.ownerDocument.documentElement);else if(c==="head"){c=n.ownerDocument.head,ac(c);for(var x=c.firstChild;x;){var k=x.nextSibling,A=x.nodeName;x[ma]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&x.rel.toLowerCase()==="stylesheet"||c.removeChild(x),x=k}}else c==="body"&&ac(n.ownerDocument.body);c=b}while(c);Fo(r)}function Q_(n,r){var c=n;n=0;do{var f=c.nextSibling;if(c.nodeType===1?r?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(r?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),f&&f.nodeType===8)if(c=f.data,c==="/$"){if(n===0)break;n--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||n++;c=f}while(c)}function up(n){var r=n.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var c=r;switch(r=r.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":up(c),yl(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}n.removeChild(c)}}function Bj(n,r,c,f){for(;n.nodeType===1;){var b=c;if(n.nodeName.toLowerCase()!==r.toLowerCase()){if(!f&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(f){if(!n[ma])switch(r){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(x=n.getAttribute("rel"),x==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(x!==b.rel||n.getAttribute("href")!==(b.href==null||b.href===""?null:b.href)||n.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin)||n.getAttribute("title")!==(b.title==null?null:b.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(x=n.getAttribute("src"),(x!==(b.src==null?null:b.src)||n.getAttribute("type")!==(b.type==null?null:b.type)||n.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin))&&x&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(r==="input"&&n.type==="hidden"){var x=b.name==null?null:""+b.name;if(b.type==="hidden"&&n.getAttribute("name")===x)return n}else return n;if(n=$n(n.nextSibling),n===null)break}return null}function Ij(n,r,c){if(r==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!c||(n=$n(n.nextSibling),n===null))return null;return n}function J_(n,r){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!r||(n=$n(n.nextSibling),n===null))return null;return n}function dp(n){return n.data==="$?"||n.data==="$~"}function hp(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function Pj(n,r){var c=n.ownerDocument;if(n.data==="$~")n._reactRetry=r;else if(n.data!=="$?"||c.readyState!=="loading")r();else{var f=function(){r(),c.removeEventListener("DOMContentLoaded",f)};c.addEventListener("DOMContentLoaded",f),n._reactRetry=f}}function $n(n){for(;n!=null;n=n.nextSibling){var r=n.nodeType;if(r===1||r===3)break;if(r===8){if(r=n.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return n}var fp=null;function ey(n){n=n.nextSibling;for(var r=0;n;){if(n.nodeType===8){var c=n.data;if(c==="/$"||c==="/&"){if(r===0)return $n(n.nextSibling);r--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||r++}n=n.nextSibling}return null}function ty(n){n=n.previousSibling;for(var r=0;n;){if(n.nodeType===8){var c=n.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(r===0)return n;r--}else c!=="/$"&&c!=="/&"||r++}n=n.previousSibling}return null}function sy(n,r,c){switch(r=kd(c),n){case"html":if(n=r.documentElement,!n)throw Error(i(452));return n;case"head":if(n=r.head,!n)throw Error(i(453));return n;case"body":if(n=r.body,!n)throw Error(i(454));return n;default:throw Error(i(451))}}function ac(n){for(var r=n.attributes;r.length;)n.removeAttributeNode(r[0]);yl(n)}var Hn=new Map,ny=new Set;function Cd(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var ur=Y.d;Y.d={f:$j,r:Hj,D:Uj,C:Fj,L:qj,m:Vj,X:Wj,S:Gj,M:Kj};function $j(){var n=ur.f(),r=gd();return n||r}function Hj(n){var r=Gi(n);r!==null&&r.tag===5&&r.type==="form"?_1(r):ur.r(n)}var $o=typeof document>"u"?null:document;function iy(n,r,c){var f=$o;if(f&&typeof r=="string"&&r){var b=nn(r);b='link[rel="'+n+'"][href="'+b+'"]',typeof c=="string"&&(b+='[crossorigin="'+c+'"]'),ny.has(b)||(ny.add(b),n={rel:n,crossOrigin:c,href:r},f.querySelector(b)===null&&(r=f.createElement("link"),Os(r,"link",n),es(r),f.head.appendChild(r)))}}function Uj(n){ur.D(n),iy("dns-prefetch",n,null)}function Fj(n,r){ur.C(n,r),iy("preconnect",n,r)}function qj(n,r,c){ur.L(n,r,c);var f=$o;if(f&&n&&r){var b='link[rel="preload"][as="'+nn(r)+'"]';r==="image"&&c&&c.imageSrcSet?(b+='[imagesrcset="'+nn(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(b+='[imagesizes="'+nn(c.imageSizes)+'"]')):b+='[href="'+nn(n)+'"]';var x=b;switch(r){case"style":x=Ho(n);break;case"script":x=Uo(n)}Hn.has(x)||(n=g({rel:"preload",href:r==="image"&&c&&c.imageSrcSet?void 0:n,as:r},c),Hn.set(x,n),f.querySelector(b)!==null||r==="style"&&f.querySelector(oc(x))||r==="script"&&f.querySelector(lc(x))||(r=f.createElement("link"),Os(r,"link",n),es(r),f.head.appendChild(r)))}}function Vj(n,r){ur.m(n,r);var c=$o;if(c&&n){var f=r&&typeof r.as=="string"?r.as:"script",b='link[rel="modulepreload"][as="'+nn(f)+'"][href="'+nn(n)+'"]',x=b;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Uo(n)}if(!Hn.has(x)&&(n=g({rel:"modulepreload",href:n},r),Hn.set(x,n),c.querySelector(b)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(lc(x)))return}f=c.createElement("link"),Os(f,"link",n),es(f),c.head.appendChild(f)}}}function Gj(n,r,c){ur.S(n,r,c);var f=$o;if(f&&n){var b=wr(f).hoistableStyles,x=Ho(n);r=r||"default";var k=b.get(x);if(!k){var A={loading:0,preload:null};if(k=f.querySelector(oc(x)))A.loading=5;else{n=g({rel:"stylesheet",href:n,"data-precedence":r},c),(c=Hn.get(x))&&mp(n,c);var H=k=f.createElement("link");es(H),Os(H,"link",n),H._p=new Promise(function(J,re){H.onload=J,H.onerror=re}),H.addEventListener("load",function(){A.loading|=1}),H.addEventListener("error",function(){A.loading|=2}),A.loading|=4,Nd(k,r,f)}k={type:"stylesheet",instance:k,count:1,state:A},b.set(x,k)}}}function Wj(n,r){ur.X(n,r);var c=$o;if(c&&n){var f=wr(c).hoistableScripts,b=Uo(n),x=f.get(b);x||(x=c.querySelector(lc(b)),x||(n=g({src:n,async:!0},r),(r=Hn.get(b))&&pp(n,r),x=c.createElement("script"),es(x),Os(x,"link",n),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},f.set(b,x))}}function Kj(n,r){ur.M(n,r);var c=$o;if(c&&n){var f=wr(c).hoistableScripts,b=Uo(n),x=f.get(b);x||(x=c.querySelector(lc(b)),x||(n=g({src:n,async:!0,type:"module"},r),(r=Hn.get(b))&&pp(n,r),x=c.createElement("script"),es(x),Os(x,"link",n),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},f.set(b,x))}}function ry(n,r,c,f){var b=(b=pe.current)?Cd(b):null;if(!b)throw Error(i(446));switch(n){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(r=Ho(c.href),c=wr(b).hoistableStyles,f=c.get(r),f||(f={type:"style",instance:null,count:0,state:null},c.set(r,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){n=Ho(c.href);var x=wr(b).hoistableStyles,k=x.get(n);if(k||(b=b.ownerDocument||b,k={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(n,k),(x=b.querySelector(oc(n)))&&!x._p&&(k.instance=x,k.state.loading=5),Hn.has(n)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Hn.set(n,c),x||Yj(b,n,c,k.state))),r&&f===null)throw Error(i(528,""));return k}if(r&&f!==null)throw Error(i(529,""));return null;case"script":return r=c.async,c=c.src,typeof c=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Uo(c),c=wr(b).hoistableScripts,f=c.get(r),f||(f={type:"script",instance:null,count:0,state:null},c.set(r,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,n))}}function Ho(n){return'href="'+nn(n)+'"'}function oc(n){return'link[rel="stylesheet"]['+n+"]"}function ay(n){return g({},n,{"data-precedence":n.precedence,precedence:null})}function Yj(n,r,c,f){n.querySelector('link[rel="preload"][as="style"]['+r+"]")?f.loading=1:(r=n.createElement("link"),f.preload=r,r.addEventListener("load",function(){return f.loading|=1}),r.addEventListener("error",function(){return f.loading|=2}),Os(r,"link",c),es(r),n.head.appendChild(r))}function Uo(n){return'[src="'+nn(n)+'"]'}function lc(n){return"script[async]"+n}function oy(n,r,c){if(r.count++,r.instance===null)switch(r.type){case"style":var f=n.querySelector('style[data-href~="'+nn(c.href)+'"]');if(f)return r.instance=f,es(f),f;var b=g({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return f=(n.ownerDocument||n).createElement("style"),es(f),Os(f,"style",b),Nd(f,c.precedence,n),r.instance=f;case"stylesheet":b=Ho(c.href);var x=n.querySelector(oc(b));if(x)return r.state.loading|=4,r.instance=x,es(x),x;f=ay(c),(b=Hn.get(b))&&mp(f,b),x=(n.ownerDocument||n).createElement("link"),es(x);var k=x;return k._p=new Promise(function(A,H){k.onload=A,k.onerror=H}),Os(x,"link",f),r.state.loading|=4,Nd(x,c.precedence,n),r.instance=x;case"script":return x=Uo(c.src),(b=n.querySelector(lc(x)))?(r.instance=b,es(b),b):(f=c,(b=Hn.get(x))&&(f=g({},c),pp(f,b)),n=n.ownerDocument||n,b=n.createElement("script"),es(b),Os(b,"link",f),n.head.appendChild(b),r.instance=b);case"void":return null;default:throw Error(i(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(f=r.instance,r.state.loading|=4,Nd(f,c.precedence,n));return r.instance}function Nd(n,r,c){for(var f=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),b=f.length?f[f.length-1]:null,x=b,k=0;k<f.length;k++){var A=f[k];if(A.dataset.precedence===r)x=A;else if(x!==b)break}x?x.parentNode.insertBefore(n,x.nextSibling):(r=c.nodeType===9?c.head:c,r.insertBefore(n,r.firstChild))}function mp(n,r){n.crossOrigin==null&&(n.crossOrigin=r.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=r.referrerPolicy),n.title==null&&(n.title=r.title)}function pp(n,r){n.crossOrigin==null&&(n.crossOrigin=r.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=r.referrerPolicy),n.integrity==null&&(n.integrity=r.integrity)}var Ed=null;function ly(n,r,c){if(Ed===null){var f=new Map,b=Ed=new Map;b.set(c,f)}else b=Ed,f=b.get(c),f||(f=new Map,b.set(c,f));if(f.has(n))return f;for(f.set(n,null),c=c.getElementsByTagName(n),b=0;b<c.length;b++){var x=c[b];if(!(x[ma]||x[Yt]||n==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var k=x.getAttribute(r)||"";k=n+k;var A=f.get(k);A?A.push(x):f.set(k,[x])}}return f}function cy(n,r,c){n=n.ownerDocument||n,n.head.insertBefore(c,r==="title"?n.querySelector("head > title"):null)}function Xj(n,r,c){if(c===1||r.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;return r.rel==="stylesheet"?(n=r.disabled,typeof r.precedence=="string"&&n==null):!0;case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function uy(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function Zj(n,r,c,f){if(c.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var b=Ho(f.href),x=r.querySelector(oc(b));if(x){r=x._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(n.count++,n=Td.bind(n),r.then(n,n)),c.state.loading|=4,c.instance=x,es(x);return}x=r.ownerDocument||r,f=ay(f),(b=Hn.get(b))&&mp(f,b),x=x.createElement("link"),es(x);var k=x;k._p=new Promise(function(A,H){k.onload=A,k.onerror=H}),Os(x,"link",f),c.instance=x}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(c,r),(r=c.state.preload)&&(c.state.loading&3)===0&&(n.count++,c=Td.bind(n),r.addEventListener("load",c),r.addEventListener("error",c))}}var gp=0;function Qj(n,r){return n.stylesheets&&n.count===0&&Ad(n,n.stylesheets),0<n.count||0<n.imgCount?function(c){var f=setTimeout(function(){if(n.stylesheets&&Ad(n,n.stylesheets),n.unsuspend){var x=n.unsuspend;n.unsuspend=null,x()}},6e4+r);0<n.imgBytes&&gp===0&&(gp=62500*Rj());var b=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&Ad(n,n.stylesheets),n.unsuspend)){var x=n.unsuspend;n.unsuspend=null,x()}},(n.imgBytes>gp?50:800)+r);return n.unsuspend=c,function(){n.unsuspend=null,clearTimeout(f),clearTimeout(b)}}:null}function Td(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ad(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var jd=null;function Ad(n,r){n.stylesheets=null,n.unsuspend!==null&&(n.count++,jd=new Map,r.forEach(Jj,n),jd=null,Td.call(n))}function Jj(n,r){if(!(r.state.loading&4)){var c=jd.get(n);if(c)var f=c.get(null);else{c=new Map,jd.set(n,c);for(var b=n.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<b.length;x++){var k=b[x];(k.nodeName==="LINK"||k.getAttribute("media")!=="not all")&&(c.set(k.dataset.precedence,k),f=k)}f&&c.set(null,f)}b=r.instance,k=b.getAttribute("data-precedence"),x=c.get(k)||f,x===f&&c.set(null,b),c.set(k,b),this.count++,f=Td.bind(this),b.addEventListener("load",f),b.addEventListener("error",f),x?x.parentNode.insertBefore(b,x.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(b,n.firstChild)),r.state.loading|=4}}var cc={$$typeof:N,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function eA(n,r,c,f,b,x,k,A,H){this.tag=1,this.containerInfo=n,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=jt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=jt(0),this.hiddenUpdates=jt(null),this.identifierPrefix=f,this.onUncaughtError=b,this.onCaughtError=x,this.onRecoverableError=k,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function dy(n,r,c,f,b,x,k,A,H,J,re,ce){return n=new eA(n,r,c,k,H,J,re,ce,A),r=1,x===!0&&(r|=24),x=yn(3,null,null,r),n.current=x,x.stateNode=n,r=Yf(),r.refCount++,n.pooledCache=r,r.refCount++,x.memoizedState={element:f,isDehydrated:c,cache:r},Jf(x),n}function hy(n){return n?(n=vo,n):vo}function fy(n,r,c,f,b,x){b=hy(b),f.context===null?f.context=b:f.pendingContext=b,f=Rr(r),f.payload={element:c},x=x===void 0?null:x,x!==null&&(f.callback=x),c=Dr(n,f,r),c!==null&&(un(c,n,r),Hl(c,n,r))}function my(n,r){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var c=n.retryLane;n.retryLane=c!==0&&c<r?c:r}}function bp(n,r){my(n,r),(n=n.alternate)&&my(n,r)}function py(n){if(n.tag===13||n.tag===31){var r=_a(n,67108864);r!==null&&un(r,n,67108864),bp(n,67108864)}}function gy(n){if(n.tag===13||n.tag===31){var r=Nn();r=Ot(r);var c=_a(n,r);c!==null&&un(c,n,r),bp(n,r)}}var Md=!0;function tA(n,r,c,f){var b=I.T;I.T=null;var x=Y.p;try{Y.p=2,xp(n,r,c,f)}finally{Y.p=x,I.T=b}}function sA(n,r,c,f){var b=I.T;I.T=null;var x=Y.p;try{Y.p=8,xp(n,r,c,f)}finally{Y.p=x,I.T=b}}function xp(n,r,c,f){if(Md){var b=vp(f);if(b===null)ip(n,r,f,Rd,c),xy(n,f);else if(iA(b,n,r,c,f))f.stopPropagation();else if(xy(n,f),r&4&&-1<nA.indexOf(n)){for(;b!==null;){var x=Gi(b);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var k=Ps(x.pendingLanes);if(k!==0){var A=x;for(A.pendingLanes|=2,A.entangledLanes|=2;k;){var H=1<<31-js(k);A.entanglements[1]|=H,k&=~H}yi(x),(ft&6)===0&&(md=gt()+500,nc(0))}}break;case 31:case 13:A=_a(x,2),A!==null&&un(A,x,2),gd(),bp(x,2)}if(x=vp(f),x===null&&ip(n,r,f,Rd,c),x===b)break;b=x}b!==null&&f.stopPropagation()}else ip(n,r,f,null,c)}}function vp(n){return n=We(n),_p(n)}var Rd=null;function _p(n){if(Rd=null,n=Ks(n),n!==null){var r=l(n);if(r===null)n=null;else{var c=r.tag;if(c===13){if(n=u(r),n!==null)return n;n=null}else if(c===31){if(n=h(r),n!==null)return n;n=null}else if(c===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;n=null}else r!==n&&(n=null)}}return Rd=n,null}function by(n){switch(n){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(si()){case ds:return 2;case Ui:return 8;case Fi:case io:return 32;case _r:return 268435456;default:return 32}default:return 32}}var yp=!1,qr=null,Vr=null,Gr=null,uc=new Map,dc=new Map,Wr=[],nA="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 xy(n,r){switch(n){case"focusin":case"focusout":qr=null;break;case"dragenter":case"dragleave":Vr=null;break;case"mouseover":case"mouseout":Gr=null;break;case"pointerover":case"pointerout":uc.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":dc.delete(r.pointerId)}}function hc(n,r,c,f,b,x){return n===null||n.nativeEvent!==x?(n={blockedOn:r,domEventName:c,eventSystemFlags:f,nativeEvent:x,targetContainers:[b]},r!==null&&(r=Gi(r),r!==null&&py(r)),n):(n.eventSystemFlags|=f,r=n.targetContainers,b!==null&&r.indexOf(b)===-1&&r.push(b),n)}function iA(n,r,c,f,b){switch(r){case"focusin":return qr=hc(qr,n,r,c,f,b),!0;case"dragenter":return Vr=hc(Vr,n,r,c,f,b),!0;case"mouseover":return Gr=hc(Gr,n,r,c,f,b),!0;case"pointerover":var x=b.pointerId;return uc.set(x,hc(uc.get(x)||null,n,r,c,f,b)),!0;case"gotpointercapture":return x=b.pointerId,dc.set(x,hc(dc.get(x)||null,n,r,c,f,b)),!0}return!1}function vy(n){var r=Ks(n.target);if(r!==null){var c=l(r);if(c!==null){if(r=c.tag,r===13){if(r=u(c),r!==null){n.blockedOn=r,lo(n.priority,function(){gy(c)});return}}else if(r===31){if(r=h(c),r!==null){n.blockedOn=r,lo(n.priority,function(){gy(c)});return}}else if(r===3&&c.stateNode.current.memoizedState.isDehydrated){n.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Dd(n){if(n.blockedOn!==null)return!1;for(var r=n.targetContainers;0<r.length;){var c=vp(n.nativeEvent);if(c===null){c=n.nativeEvent;var f=new c.constructor(c.type,c);Re=f,c.target.dispatchEvent(f),Re=null}else return r=Gi(c),r!==null&&py(r),n.blockedOn=c,!1;r.shift()}return!0}function _y(n,r,c){Dd(n)&&c.delete(r)}function rA(){yp=!1,qr!==null&&Dd(qr)&&(qr=null),Vr!==null&&Dd(Vr)&&(Vr=null),Gr!==null&&Dd(Gr)&&(Gr=null),uc.forEach(_y),dc.forEach(_y)}function Od(n,r){n.blockedOn===r&&(n.blockedOn=null,yp||(yp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,rA)))}var Ld=null;function yy(n){Ld!==n&&(Ld=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Ld===n&&(Ld=null);for(var r=0;r<n.length;r+=3){var c=n[r],f=n[r+1],b=n[r+2];if(typeof f!="function"){if(_p(f||c)===null)continue;break}var x=Gi(c);x!==null&&(n.splice(r,3),r-=3,vm(x,{pending:!0,data:b,method:c.method,action:f},f,b))}}))}function Fo(n){function r(H){return Od(H,n)}qr!==null&&Od(qr,n),Vr!==null&&Od(Vr,n),Gr!==null&&Od(Gr,n),uc.forEach(r),dc.forEach(r);for(var c=0;c<Wr.length;c++){var f=Wr[c];f.blockedOn===n&&(f.blockedOn=null)}for(;0<Wr.length&&(c=Wr[0],c.blockedOn===null);)vy(c),c.blockedOn===null&&Wr.shift();if(c=(n.ownerDocument||n).$$reactFormReplay,c!=null)for(f=0;f<c.length;f+=3){var b=c[f],x=c[f+1],k=b[$s]||null;if(typeof x=="function")k||yy(c);else if(k){var A=null;if(x&&x.hasAttribute("formAction")){if(b=x,k=x[$s]||null)A=k.formAction;else if(_p(b)!==null)continue}else A=k.action;typeof A=="function"?c[f+1]=A:(c.splice(f,3),f-=3),yy(c)}}}function Sy(){function n(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(k){return b=k})},focusReset:"manual",scroll:"manual"})}function r(){b!==null&&(b(),b=null),f||setTimeout(c,20)}function c(){if(!f&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,b=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(c,100),function(){f=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),b!==null&&(b(),b=null)}}}function Sp(n){this._internalRoot=n}zd.prototype.render=Sp.prototype.render=function(n){var r=this._internalRoot;if(r===null)throw Error(i(409));var c=r.current,f=Nn();fy(c,f,n,r,null,null)},zd.prototype.unmount=Sp.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var r=n.containerInfo;fy(n.current,2,null,n,null,null),gd(),r[yr]=null}};function zd(n){this._internalRoot=n}zd.prototype.unstable_scheduleHydration=function(n){if(n){var r=oo();n={blockedOn:null,target:n,priority:r};for(var c=0;c<Wr.length&&r!==0&&r<Wr[c].priority;c++);Wr.splice(c,0,n),c===0&&vy(n)}};var wy=t.version;if(wy!=="19.2.6")throw Error(i(527,wy,"19.2.6"));Y.findDOMNode=function(n){var r=n._reactInternals;if(r===void 0)throw typeof n.render=="function"?Error(i(188)):(n=Object.keys(n).join(","),Error(i(268,n)));return n=d(r),n=n!==null?p(n):null,n=n===null?null:n.stateNode,n};var aA={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Bd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bd.isDisabled&&Bd.supportsFiber)try{qi=Bd.inject(aA),vs=Bd}catch{}}return mc.createRoot=function(n,r){if(!a(n))throw Error(i(299));var c=!1,f="",b=A1,x=M1,k=R1;return r!=null&&(r.unstable_strictMode===!0&&(c=!0),r.identifierPrefix!==void 0&&(f=r.identifierPrefix),r.onUncaughtError!==void 0&&(b=r.onUncaughtError),r.onCaughtError!==void 0&&(x=r.onCaughtError),r.onRecoverableError!==void 0&&(k=r.onRecoverableError)),r=dy(n,1,!1,null,null,c,f,null,b,x,k,Sy),n[yr]=r.current,np(n),new Sp(r)},mc.hydrateRoot=function(n,r,c){if(!a(n))throw Error(i(299));var f=!1,b="",x=A1,k=M1,A=R1,H=null;return c!=null&&(c.unstable_strictMode===!0&&(f=!0),c.identifierPrefix!==void 0&&(b=c.identifierPrefix),c.onUncaughtError!==void 0&&(x=c.onUncaughtError),c.onCaughtError!==void 0&&(k=c.onCaughtError),c.onRecoverableError!==void 0&&(A=c.onRecoverableError),c.formState!==void 0&&(H=c.formState)),r=dy(n,1,!0,r,c??null,f,b,H,x,k,A,Sy),r.context=hy(null),c=r.current,f=Nn(),f=Ot(f),b=Rr(f),b.callback=null,Dr(c,b,f),c=f,r.current.lanes=c,Ct(r,c),yi(r),n[yr]=r.current,np(n),new zd(r)},mc.version="19.2.6",mc}var Dy;function gA(){if(Dy)return Cp.exports;Dy=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(),Cp.exports=pA(),Cp.exports}var iC=gA();const rC=(...e)=>e.filter((t,s,i)=>!!t&&t.trim()!==""&&i.indexOf(t)===s).join(" ").trim();const bA=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const xA=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,s,i)=>i?i.toUpperCase():s.toLowerCase());const Oy=e=>{const t=xA(e);return t.charAt(0).toUpperCase()+t.slice(1)};var jp={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 vA=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},_A=y.createContext({}),yA=()=>y.useContext(_A),SA=y.forwardRef(({color:e,size:t,strokeWidth:s,absoluteStrokeWidth:i,className:a="",children:l,iconNode:u,...h},m)=>{const{size:d=24,strokeWidth:p=2,absoluteStrokeWidth:g=!1,color:v="currentColor",className:_=""}=yA()??{},S=i??g?Number(s??p)*24/Number(t??d):s??p;return y.createElement("svg",{ref:m,...jp,width:t??d??jp.width,height:t??d??jp.height,stroke:e??v,strokeWidth:S,className:rC("lucide",_,a),...!l&&!vA(h)&&{"aria-hidden":"true"},...h},[...u.map(([w,C])=>y.createElement(w,C)),...Array.isArray(l)?l:[l]])});const he=(e,t)=>{const s=y.forwardRef(({className:i,...a},l)=>y.createElement(SA,{ref:l,iconNode:t,className:rC(`lucide-${bA(Oy(e))}`,`lucide-${e}`,i),...a}));return s.displayName=Oy(e),s};const wA=[["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"}]],qa=he("activity",wA);const kA=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],jb=he("arrow-down",kA);const CA=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],au=he("arrow-left",CA);const NA=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Ab=he("arrow-up",NA);const EA=[["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"}]],TA=he("blocks",EA);const jA=[["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"}]],AA=he("book-open",jA);const MA=[["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"}]],RA=he("bot",MA);const DA=[["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"}]],aC=he("box",DA);const OA=[["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"}]],LA=he("braces",OA);const zA=[["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"}]],oC=he("brain",zA);const BA=[["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"}]],IA=he("calendar",BA);const PA=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],hi=he("check",PA);const $A=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Mn=he("chevron-down",$A);const HA=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],UA=he("chevron-left",HA);const FA=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Li=he("chevron-right",FA);const qA=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],nf=he("chevron-up",qA);const VA=[["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"}]],GA=he("circle-alert",VA);const WA=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Mb=he("circle-check-big",WA);const KA=[["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"}]],YA=he("circle-dashed",KA);const XA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],ZA=he("circle-dot",XA);const QA=[["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"}]],lC=he("circle-x",QA);const JA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],wh=he("circle",JA);const e4=[["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"}]],cC=he("code-xml",e4);const t4=[["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"}]],kh=he("copy",t4);const s4=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],n4=he("corner-down-left",s4);const i4=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],r4=he("corner-down-right",i4);const a4=[["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"}]],o4=he("cpu",a4);const l4=[["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"}]],Xn=he("database",l4);const c4=[["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"}]],uC=he("download",c4);const u4=[["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"}]],d4=he("earth",u4);const h4=[["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"}]],dC=he("ellipsis",h4);const f4=[["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"}]],aa=he("external-link",f4);const m4=[["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"}]],hC=he("eye-off",m4);const p4=[["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"}]],Rb=he("eye",p4);const g4=[["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"}]],fC=he("file-code-corner",g4);const b4=[["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"}]],mC=he("file-exclamation-point",b4);const x4=[["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"}]],v4=he("file-spreadsheet",x4);const _4=[["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"}]],pC=he("file-text",_4);const y4=[["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"}]],gC=he("file",y4);const S4=[["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"}]],w4=he("flask-conical",S4);const k4=[["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"}]],C4=he("folder-git-2",k4);const N4=[["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"}]],rf=he("folder-open",N4);const E4=[["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"}]],T4=he("folder-plus",E4);const j4=[["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"}]],Ja=he("folder",j4);const A4=[["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"}]],M4=he("funnel",A4);const R4=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],bC=he("gauge",R4);const D4=[["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"}]],pn=he("git-branch",D4);const O4=[["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"}]],L4=he("git-commit-horizontal",O4);const z4=[["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"}]],Ly=he("git-fork",z4);const B4=[["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"}]],Db=he("git-merge",B4);const I4=[["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"}]],P4=he("git-pull-request-closed",I4);const $4=[["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"}]],H4=he("git-pull-request-create",$4);const U4=[["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"}]],F4=he("git-pull-request",U4);const q4=[["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"}]],V4=he("heart",q4);const G4=[["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"}]],W4=he("image",G4);const K4=[["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"}]],Ch=he("inbox",K4);const Y4=[["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"}]],xC=he("key-round",Y4);const X4=[["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"}]],Z4=he("list-collapse",X4);const Q4=[["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"}]],J4=he("list-tree",Q4);const eM=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],pt=he("loader-circle",eM);const tM=[["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"}]],zy=he("loader",tM);const sM=[["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"}]],nM=he("lock-keyhole",sM);const iM=[["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"}]],vC=he("lock-open",iM);const rM=[["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"}]],aM=he("lock",rM);const oM=[["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"}]],_C=he("maximize-2",oM);const lM=[["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=he("memory-stick",lM);const uM=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],dM=he("message-circle-warning",uM);const hM=[["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"}]],fM=he("message-square-plus",hM);const mM=[["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"}]],yC=he("minimize-2",mM);const pM=[["path",{d:"M5 12h14",key:"1ays0h"}]],gM=he("minus",pM);const bM=[["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"}]],xM=he("moon",bM);const vM=[["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"}]],_M=he("network",vM);const yM=[["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"}]],SM=he("palette",yM);const wM=[["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"}]],kM=he("panel-left-close",wM);const CM=[["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"}]],NM=he("panel-left-open",CM);const EM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],TM=he("panel-left",EM);const jM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]],AM=he("panel-top",jM);const MM=[["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"}]],RM=he("paperclip",MM);const DM=[["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"}]],OM=he("pen-line",DM);const LM=[["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"}]],Gc=he("pencil",LM);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"}]],eo=he("play",zM);const BM=[["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"}]],SC=he("plug",BM);const IM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Cs=he("plus",IM);const PM=[["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"}]],$M=he("radio",PM);const HM=[["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"}]],ou=he("refresh-cw",HM);const UM=[["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"}]],Ob=he("rotate-ccw",UM);const FM=[["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"}]],wC=he("save",FM);const qM=[["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"}]],kC=he("scroll-text",qM);const VM=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],GM=he("search",VM);const WM=[["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"}]],KM=he("send-horizontal",WM);const YM=[["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"}]],CC=he("server",YM);const XM=[["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"}]],ZM=he("settings-2",XM);const QM=[["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"}]],NC=he("shield-alert",QM);const JM=[["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"}]],EC=he("shield-question-mark",JM);const e6=[["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"}]],TC=he("skip-forward",e6);const t6=[["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"}]],zi=he("sparkles",t6);const s6=[["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"}]],n6=he("square-terminal",s6);const i6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],lu=he("square",i6);const r6=[["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"}]],a6=he("sun",r6);const o6=[["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"}]],jC=he("table-2",o6);const l6=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],af=he("terminal",l6);const c6=[["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"}]],ua=he("trash-2",c6);const u6=[["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"}]],cu=he("triangle-alert",u6);const d6=[["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"}]],Lb=he("upload",d6);const h6=[["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"}]],f6=he("user",h6);const m6=[["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"}]],p6=he("wand-sparkles",m6);const g6=[["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"}]],b6=he("webhook",g6);const x6=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],v6=he("wrench",x6);const _6=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Gs=he("x",_6);const y6=[["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"}]],S6=he("zap",y6);class AC extends Error{conflict;constructor(t,s){super(t),this.name="PortConflictResponseError",this.conflict=s}}async function Oe(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 AC(i?.error||"Port already in use",i.conflict):new Error(i?.error||s.statusText);return i}async function mn(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 Oe(e,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s})}async function Bi(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 Oe(e,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s})}async function MC(){return(await Oe("/api/agent")).agent}async function w6(e){return(await Oe(`/api/agent/mcp-status?agent=${encodeURIComponent(e)}`)).statuses}async function k6(){return(await Oe("/api/agent/usage")).usage}async function C6(){return(await Oe("/api/agent/claude-settings")).settings}async function N6(e){return(await Oe("/api/agent/claude-settings",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).settings}async function E6(){const e=await Oe("/api/agent/chat/status");return{configured:e.configured,approvals:e.approvals,provider:e.provider}}async function T6(e,t,s){await Oe("/api/agent/chat/approve",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sessionId:e,requestId:t,decision:s})})}async function j6(e,t,s,i,a){const l=await fetch("/api/agent/chat",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({message:e,resumeSessionId:t,autoApprove:a}),signal:i});if(!l.ok||!l.body){const d=await l.json().catch(()=>{});throw new Error(d?.error||l.statusText||"Agent request failed")}const u=l.body.getReader(),h=new TextDecoder;let m="";for(;;){const{done:d,value:p}=await u.read();if(d)break;m+=h.decode(p,{stream:!0});let g=m.indexOf(`
|
|
10
|
+
|
|
11
|
+
`);for(;g!==-1;){const v=m.slice(0,g);m=m.slice(g+2);const _=v.split(`
|
|
12
|
+
`).find(S=>S.startsWith("data:"));if(_){const S=_.slice(5).trim();if(S)try{s(JSON.parse(S))}catch{}}g=m.indexOf(`
|
|
13
|
+
|
|
14
|
+
`)}}}async function RC(){return(await Oe("/api/databases")).connections}async function A6(){return(await Oe("/api/databases/detect")).detected}async function M6(e){await Bi("/api/databases",e)}async function R6(e){return Bi("/api/databases/test",e)}async function D6(e){await Oe(`/api/databases/${encodeURIComponent(e)}`,{method:"DELETE"})}async function DC(e){return(await Oe(`/api/databases/${encodeURIComponent(e)}/tables`)).tables}async function O6(e,t,s=100){return Bi(`/api/databases/${encodeURIComponent(e)}/query`,{sql:t,limit:s})}async function L6(e,t){await Bi(`/api/databases/${encodeURIComponent(e)}/write-access`,{unlocked:String(t)})}async function By(e,t,s){return Bi(`/api/databases/${encodeURIComponent(e)}/execute`,{sql:t,mode:s})}async function z6(e,t,s=100,i=0){return Oe(`/api/databases/${encodeURIComponent(e)}/rows?table=${encodeURIComponent(t)}&limit=${s}&offset=${i}`)}async function OC(e=100){return(await Oe(`/api/errors?limit=${e}`)).incidents}async function B6(e){return Oe(`/api/errors/${e}/prompt`)}async function I6(e=200){return(await Oe(`/api/git/graph?limit=${e}`)).commits}async function P6(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 function $6(e){return(await Oe(`/api/git/commit/files?hash=${encodeURIComponent(e)}`)).files}async function H6(){return(await Oe("/api/git/files")).files}async function U6(){return(await Oe("/api/git/file-sizes")).files}async function F6(e){const t=await Oe(`/api/git/file?path=${encodeURIComponent(e)}`);return{content:t.content,truncated:t.truncated,binary:t.binary,size:t.size}}async function q6(e,t){await Oe("/api/git/file",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({path:e,content:t})})}async function V6(e){const t=await fetch(`/api/git/diff?file=${encodeURIComponent(e)}`);if(!t.ok){const s=await t.json().catch(()=>({error:t.statusText}));throw new Error(s.error||"Unable to load diff")}return t.text()}async function LC(e){await Oe("/api/git/stage",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({paths:e})})}async function G6(e){await Oe("/api/git/unstage",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({paths:e})})}async function zC(e){return(await Bi("/api/git/commit",{message:e})).output}async function of(){const e=await Bi("/api/git/push",{});return{output:e.output,branch:e.branch,setUpstream:e.setUpstream}}async function W6(e){await Oe(`/api/git/repositories/${encodeURIComponent(e)}`,{method:"DELETE"})}async function K6(){return Oe("/api/github/token")}async function Y6(){return await Oe("/api/github/oauth/start",{method:"POST"})}async function X6(e){const t=await Oe("/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 function Z6(e,t){const s=new URLSearchParams({host:e,token:t});await Oe("/api/github/token",{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s})}async function Ap(e="open",t=1){return(await Oe(`/api/github/prs?state=${e}&page=${t}`)).prs}async function Q6(e){return(await Oe(`/api/github/prs/${e}`)).pr}async function J6(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 function eR(e){return(await Oe("/api/github/prs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).pr}async function tR(e,t={}){const s=await Oe(`/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 function Mp(e="open",t=1){return(await Oe(`/api/github/issues?state=${e}&page=${t}`)).issues}async function sR(e){return(await Oe(`/api/github/issues/${e}`)).issue}async function nR(e){return(await Oe(`/api/github/issues/${e}/comments`)).comments}async function iR(e,t){return(await Oe(`/api/github/issues/${e}/comments`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({body:t})})).comment}async function rR(e){return(await Oe(`/api/github/ci/${encodeURIComponent(e)}`)).status}async function i0(e,t=1){const s=new URLSearchParams({page:String(t)});return e&&s.set("branch",e),(await Oe(`/api/github/runs?${s}`)).runs}async function aR(e){return(await Oe(`/api/github/runs/${e}/jobs`)).jobs}async function oR(){return(await Oe("/api/log-sources")).sources}async function lR(e){return(await Bi("/api/log-sources",e)).sources}async function BC(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 Oe(`/api/log-sources/${encodeURIComponent(e)}/logs?${s.toString()}`)).logs}const zb={"content-type":"application/json"};async function cR(e){const t=await Oe("/api/onboard/scan",{method:"POST",headers:zb,body:JSON.stringify({url:e})});return{profile:t.profile,proposals:t.proposals,databases:t.databases??[]}}async function uR(e,t,s){const i=s?{name:s.name,engine:s.engine,url:s.url}:void 0;await Oe("/api/onboard/register",{method:"POST",headers:zb,body:JSON.stringify({...e,start:t,database:i})})}async function dR(e,t){const s=await fetch("/api/onboard/install/stream",{method:"POST",headers:zb,body:JSON.stringify(e)});if(!s.ok||!s.body){const u=await s.json().catch(()=>{});t.onError(u?.error||s.statusText);return}const i=s.body.getReader(),a=new TextDecoder;let l="";for(;;){const{done:u,value:h}=await i.read();if(u)break;l+=a.decode(h,{stream:!0});const m=l.split(`
|
|
15
|
+
|
|
16
|
+
`);l=m.pop()??"";for(const d of m)hR(d,t)}}function hR(e,t){let s="message",i="";for(const a of e.split(`
|
|
17
|
+
`))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{}}async function fR(){return Oe("/api/dashboard")}async function mR(e){await Oe(`/api/services/${encodeURIComponent(e)}`,{method:"DELETE"})}async function pR(e,t,s){t.includes(s)||await mn("/api/bundles",{name:e,originalName:e,services:[...t,s].join(",")})}async function gR(e,t,s){t.includes(s)&&await mn("/api/bundles",{name:e,originalName:e,services:t.filter(i=>i!==s).join(",")})}async function IC(e,{files:t=!1}={}){const s=new URLSearchParams({path:e});return t&&s.set("files","1"),Oe(`/api/fs/directories?${s.toString()}`)}async function PC(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 Oe(`/api/services/${encodeURIComponent(e)}/logs?${s.toString()}`);return{logs:i.logs,queryable:!!i.queryable}}async function bR(e,t){const s=t?`?path=${encodeURIComponent(t)}`:"";return Oe(`/api/services/${encodeURIComponent(e)}/config-browse${s}`)}async function xR(e){const t=await Oe(`/api/services/${encodeURIComponent(e)}/config-files`);return{cwd:t.cwd,files:t.files}}async function Iy(e,t){return Oe(`/api/services/${encodeURIComponent(e)}/config-file?path=${encodeURIComponent(t)}`)}async function vR(e,t,s){return Oe(`/api/services/${encodeURIComponent(e)}/config-file?path=${encodeURIComponent(t)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({entries:s})})}async function _R(e,t,s){return Oe(`/api/services/${encodeURIComponent(e)}/config-file?path=${encodeURIComponent(t)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({content:s})})}async function yR(e){return(await Oe(`/api/services/${encodeURIComponent(e)}/metrics`)).metrics}async function SR(e){return Bi("/api/services/test",e)}async function wR(e,t){return Bi(`/api/services/${encodeURIComponent(e)}/test`,t?{pattern:t}:{})}async function kR(){return(await Oe("/api/terminal/sessions")).sessions}async function lh(e){return(await Oe("/api/terminal/sessions",{method:"POST",...e?.serviceName?{headers:{"content-type":"application/json"},body:JSON.stringify({serviceName:e.serviceName})}:{}})).session}async function CR(e){await Oe(`/api/terminal/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})}async function NR(){return(await Oe("/api/workflows")).workflows}async function ER(e){return(await Oe("/api/workflows",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).workflows}async function TR(e){return(await Oe(`/api/workflows/${encodeURIComponent(e)}`,{method:"DELETE"})).workflows}async function Py(){return(await Oe("/api/git/status")).status}function $C(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=$C(e[t]))&&(i&&(i+=" "),i+=s)}else for(s in e)e[s]&&(i&&(i+=" "),i+=s);return i}function Wc(){for(var e,t,s=0,i="",a=arguments.length;s<a;s++)(e=arguments[s])&&(t=$C(e))&&(i&&(i+=" "),i+=t);return i}const $y=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Hy=Wc,HC=(e,t)=>s=>{var i;if(t?.variants==null)return Hy(e,s?.class,s?.className);const{variants:a,defaultVariants:l}=t,u=Object.keys(a).map(d=>{const p=s?.[d],g=l?.[d];if(p===null)return null;const v=$y(p)||$y(g);return a[d][v]}),h=s&&Object.entries(s).reduce((d,p)=>{let[g,v]=p;return v===void 0||(d[g]=v),d},{}),m=t==null||(i=t.compoundVariants)===null||i===void 0?void 0:i.reduce((d,p)=>{let{class:g,className:v,..._}=p;return Object.entries(_).every(S=>{let[w,C]=S;return Array.isArray(C)?C.includes({...l,...h}[w]):{...l,...h}[w]===C})?[...d,g,v]:d},[]);return Hy(e,u,m,s?.class,s?.className)},jR=(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},AR=(e,t)=>({classGroupId:e,validator:t}),UC=(e=new Map,t=null,s)=>({nextPart:e,validators:t,classGroupId:s}),Nh="-",Uy=[],MR="arbitrary..",RR=e=>{const t=OR(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return DR(u);const h=u.split(Nh),m=h[0]===""&&h.length>1?1:0;return FC(h,m,t)},getConflictingClassGroupIds:(u,h)=>{if(h){const m=i[u],d=s[u];return m?d?jR(d,m):m:d||Uy}return s[u]||Uy}}},FC=(e,t,s)=>{if(e.length-t===0)return s.classGroupId;const a=e[t],l=s.nextPart.get(a);if(l){const d=FC(e,t+1,l);if(d)return d}const u=s.validators;if(u===null)return;const h=t===0?e.join(Nh):e.slice(t).join(Nh),m=u.length;for(let d=0;d<m;d++){const p=u[d];if(p.validator(h))return p.classGroupId}},DR=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?MR+i:void 0})(),OR=e=>{const{theme:t,classGroups:s}=e;return LR(s,t)},LR=(e,t)=>{const s=UC();for(const i in e){const a=e[i];Bb(a,s,i,t)}return s},Bb=(e,t,s,i)=>{const a=e.length;for(let l=0;l<a;l++){const u=e[l];zR(u,t,s,i)}},zR=(e,t,s,i)=>{if(typeof e=="string"){BR(e,t,s);return}if(typeof e=="function"){IR(e,t,s,i);return}PR(e,t,s,i)},BR=(e,t,s)=>{const i=e===""?t:qC(t,e);i.classGroupId=s},IR=(e,t,s,i)=>{if($R(e)){Bb(e(i),t,s,i);return}t.validators===null&&(t.validators=[]),t.validators.push(AR(s,e))},PR=(e,t,s,i)=>{const a=Object.entries(e),l=a.length;for(let u=0;u<l;u++){const[h,m]=a[u];Bb(m,qC(t,h),s,i)}},qC=(e,t)=>{let s=e;const i=t.split(Nh),a=i.length;for(let l=0;l<a;l++){const u=i[l];let h=s.nextPart.get(u);h||(h=UC(),s.nextPart.set(u,h)),s=h}return s},$R=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,HR=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,s=Object.create(null),i=Object.create(null);const a=(l,u)=>{s[l]=u,t++,t>e&&(t=0,i=s,s=Object.create(null))};return{get(l){let u=s[l];if(u!==void 0)return u;if((u=i[l])!==void 0)return a(l,u),u},set(l,u){l in s?s[l]=u:a(l,u)}}},r0="!",Fy=":",UR=[],qy=(e,t,s,i,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:s,maybePostfixModifierPosition:i,isExternal:a}),FR=e=>{const{prefix:t,experimentalParseClassName:s}=e;let i=a=>{const l=[];let u=0,h=0,m=0,d;const p=a.length;for(let w=0;w<p;w++){const C=a[w];if(u===0&&h===0){if(C===Fy){l.push(a.slice(m,w)),m=w+1;continue}if(C==="/"){d=w;continue}}C==="["?u++:C==="]"?u--:C==="("?h++:C===")"&&h--}const g=l.length===0?a:a.slice(m);let v=g,_=!1;g.endsWith(r0)?(v=g.slice(0,-1),_=!0):g.startsWith(r0)&&(v=g.slice(1),_=!0);const S=d&&d>m?d-m:void 0;return qy(l,_,v,S)};if(t){const a=t+Fy,l=i;i=u=>u.startsWith(a)?l(u.slice(a.length)):qy(UR,!1,u,void 0,!0)}if(s){const a=i;i=l=>s({className:l,parseClassName:a})}return i},qR=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 u=s[l],h=u[0]==="[",m=t.has(u);h||m?(a.length>0&&(a.sort(),i.push(...a),a=[]),i.push(u)):a.push(u)}return a.length>0&&(a.sort(),i.push(...a)),i}},VR=e=>({cache:HR(e.cacheSize),parseClassName:FR(e),sortModifiers:qR(e),postfixLookupClassGroupIds:GR(e),...RR(e)}),GR=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},WR=/\s+/,KR=(e,t)=>{const{parseClassName:s,getClassGroupId:i,getConflictingClassGroupIds:a,sortModifiers:l,postfixLookupClassGroupIds:u}=t,h=[],m=e.trim().split(WR);let d="";for(let p=m.length-1;p>=0;p-=1){const g=m[p],{isExternal:v,modifiers:_,hasImportantModifier:S,baseClassName:w,maybePostfixModifierPosition:C}=s(g);if(v){d=g+(d.length>0?" "+d:d);continue}let E=!!C,T;if(E){const D=w.substring(0,C);T=i(D);const M=T&&u[T]?i(w):void 0;M&&M!==T&&(T=M,E=!1)}else T=i(w);if(!T){if(!E){d=g+(d.length>0?" "+d:d);continue}if(T=i(w),!T){d=g+(d.length>0?" "+d:d);continue}E=!1}const N=_.length===0?"":_.length===1?_[0]:l(_).join(":"),j=S?N+r0:N,R=j+T;if(h.indexOf(R)>-1)continue;h.push(R);const z=a(T,E);for(let D=0;D<z.length;++D){const M=z[D];h.push(j+M)}d=g+(d.length>0?" "+d:d)}return d},YR=(...e)=>{let t=0,s,i,a="";for(;t<e.length;)(s=e[t++])&&(i=VC(s))&&(a&&(a+=" "),a+=i);return a},VC=e=>{if(typeof e=="string")return e;let t,s="";for(let i=0;i<e.length;i++)e[i]&&(t=VC(e[i]))&&(s&&(s+=" "),s+=t);return s},XR=(e,...t)=>{let s,i,a,l;const u=m=>{const d=t.reduce((p,g)=>g(p),e());return s=VR(d),i=s.cache.get,a=s.cache.set,l=h,h(m)},h=m=>{const d=i(m);if(d)return d;const p=KR(m,s);return a(m,p),p};return l=u,(...m)=>l(YR(...m))},ZR=[],fs=e=>{const t=s=>s[e]||ZR;return t.isThemeGetter=!0,t},GC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,WC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,QR=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,JR=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,e8=/\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$/,t8=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,s8=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,n8=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Yr=e=>QR.test(e),Ze=e=>!!e&&!Number.isNaN(Number(e)),Si=e=>!!e&&Number.isInteger(Number(e)),Rp=e=>e.endsWith("%")&&Ze(e.slice(0,-1)),dr=e=>JR.test(e),KC=()=>!0,i8=e=>e8.test(e)&&!t8.test(e),Ib=()=>!1,r8=e=>s8.test(e),a8=e=>n8.test(e),o8=e=>!Ce(e)&&!Ne(e),l8=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)),c8=e=>da(e,ZC,Ib),Ce=e=>GC.test(e),Da=e=>da(e,QC,i8),Vy=e=>da(e,b8,Ze),u8=e=>da(e,eN,KC),d8=e=>da(e,JC,Ib),Gy=e=>da(e,YC,Ib),h8=e=>da(e,XC,a8),Id=e=>da(e,tN,r8),Ne=e=>WC.test(e),pc=e=>to(e,QC),f8=e=>to(e,JC),Wy=e=>to(e,YC),m8=e=>to(e,ZC),p8=e=>to(e,XC),Pd=e=>to(e,tN,!0),g8=e=>to(e,eN,!0),da=(e,t,s)=>{const i=GC.exec(e);return i?i[1]?t(i[1]):s(i[2]):!1},to=(e,t,s=!1)=>{const i=WC.exec(e);return i?i[1]?t(i[1]):s:!1},YC=e=>e==="position"||e==="percentage",XC=e=>e==="image"||e==="url",ZC=e=>e==="length"||e==="size"||e==="bg-size",QC=e=>e==="length",b8=e=>e==="number",JC=e=>e==="family-name",eN=e=>e==="number"||e==="weight",tN=e=>e==="shadow",x8=()=>{const e=fs("color"),t=fs("font"),s=fs("text"),i=fs("font-weight"),a=fs("tracking"),l=fs("leading"),u=fs("breakpoint"),h=fs("container"),m=fs("spacing"),d=fs("radius"),p=fs("shadow"),g=fs("inset-shadow"),v=fs("text-shadow"),_=fs("drop-shadow"),S=fs("blur"),w=fs("perspective"),C=fs("aspect"),E=fs("ease"),T=fs("animate"),N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],j=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],R=()=>[...j(),Ne,Ce],z=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto","contain","none"],M=()=>[Ne,Ce,m],$=()=>[Yr,"full","auto",...M()],L=()=>[Si,"none","subgrid",Ne,Ce],B=()=>["auto",{span:["full",Si,Ne,Ce]},Si,Ne,Ce],P=()=>[Si,"auto",Ne,Ce],F=()=>["auto","min","max","fr",Ne,Ce],V=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],G=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",...M()],Y=()=>[Yr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...M()],X=()=>[Yr,"screen","full","dvw","lvw","svw","min","max","fit",...M()],W=()=>[Yr,"screen","full","lh","dvh","lvh","svh","min","max","fit",...M()],ee=()=>[e,Ne,Ce],O=()=>[...j(),Wy,Gy,{position:[Ne,Ce]}],Z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ie=()=>["auto","cover","contain",m8,c8,{size:[Ne,Ce]}],de=()=>[Rp,pc,Da],fe=()=>["","none","full",d,Ne,Ce],pe=()=>["",Ze,pc,Da],Se=()=>["solid","dashed","dotted","double"],Le=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ve=()=>[Ze,Rp,Wy,Gy],Ge=()=>["","none",S,Ne,Ce],ge=()=>["none",Ze,Ne,Ce],Te=()=>["none",Ze,Ne,Ce],Ae=()=>[Ze,Ne,Ce],It=()=>[Yr,"full",...M()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[dr],breakpoint:[dr],color:[KC],container:[dr],"drop-shadow":[dr],ease:["in","out","in-out"],font:[o8],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[dr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[dr],shadow:[dr],spacing:["px",Ze],text:[dr],"text-shadow":[dr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Yr,Ce,Ne,C]}],container:["container"],"container-type":[{"@container":["","normal","size",Ne,Ce]}],"container-named":[l8],columns:[{columns:[Ze,Ce,Ne,h]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"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:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:$()}],"inset-x":[{"inset-x":$()}],"inset-y":[{"inset-y":$()}],start:[{"inset-s":$(),start:$()}],end:[{"inset-e":$(),end:$()}],"inset-bs":[{"inset-bs":$()}],"inset-be":[{"inset-be":$()}],top:[{top:$()}],right:[{right:$()}],bottom:[{bottom:$()}],left:[{left:$()}],visibility:["visible","invisible","collapse"],z:[{z:[Si,"auto",Ne,Ce]}],basis:[{basis:[Yr,"full","auto",h,...M()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ze,Yr,"auto","initial","none",Ce]}],grow:[{grow:["",Ze,Ne,Ce]}],shrink:[{shrink:["",Ze,Ne,Ce]}],order:[{order:[Si,"first","last","none",Ne,Ce]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:M()}],"gap-x":[{"gap-x":M()}],"gap-y":[{"gap-y":M()}],"justify-content":[{justify:[...V(),"normal"]}],"justify-items":[{"justify-items":[...G(),"normal"]}],"justify-self":[{"justify-self":["auto",...G()]}],"align-content":[{content:["normal",...V()]}],"align-items":[{items:[...G(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...G(),{baseline:["","last"]}]}],"place-content":[{"place-content":V()}],"place-items":[{"place-items":[...G(),"baseline"]}],"place-self":[{"place-self":["auto",...G()]}],p:[{p:M()}],px:[{px:M()}],py:[{py:M()}],ps:[{ps:M()}],pe:[{pe:M()}],pbs:[{pbs:M()}],pbe:[{pbe:M()}],pt:[{pt:M()}],pr:[{pr:M()}],pb:[{pb:M()}],pl:[{pl:M()}],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":M()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":M()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],"inline-size":[{inline:["auto",...X()]}],"min-inline-size":[{"min-inline":["auto",...X()]}],"max-inline-size":[{"max-inline":["none",...X()]}],"block-size":[{block:["auto",...W()]}],"min-block-size":[{"min-block":["auto",...W()]}],"max-block-size":[{"max-block":["none",...W()]}],w:[{w:[h,"screen",...Y()]}],"min-w":[{"min-w":[h,"screen","none",...Y()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[u]},...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,pc,Da]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,g8,u8]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Rp,Ce]}],"font-family":[{font:[f8,d8,t]}],"font-features":[{"font-features":[Ce]}],"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,Ne,Ce]}],"line-clamp":[{"line-clamp":[Ze,"none",Ne,Vy]}],leading:[{leading:[l,...M()]}],"list-image":[{"list-image":["none",Ne,Ce]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ne,Ce]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:ee()}],"text-color":[{text:ee()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Se(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ze,"from-font","auto",Ne,Da]}],"text-decoration-color":[{decoration:ee()}],"underline-offset":[{"underline-offset":[Ze,"auto",Ne,Ce]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"tab-size":[{tab:[Si,Ne,Ce]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ne,Ce]}],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",Ne,Ce]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:O()}],"bg-repeat":[{bg:Z()}],"bg-size":[{bg:ie()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Si,Ne,Ce],radial:["",Ne,Ce],conic:[Si,Ne,Ce]},p8,h8]}],"bg-color":[{bg:ee()}],"gradient-from-pos":[{from:de()}],"gradient-via-pos":[{via:de()}],"gradient-to-pos":[{to:de()}],"gradient-from":[{from:ee()}],"gradient-via":[{via:ee()}],"gradient-to":[{to:ee()}],rounded:[{rounded:fe()}],"rounded-s":[{"rounded-s":fe()}],"rounded-e":[{"rounded-e":fe()}],"rounded-t":[{"rounded-t":fe()}],"rounded-r":[{"rounded-r":fe()}],"rounded-b":[{"rounded-b":fe()}],"rounded-l":[{"rounded-l":fe()}],"rounded-ss":[{"rounded-ss":fe()}],"rounded-se":[{"rounded-se":fe()}],"rounded-ee":[{"rounded-ee":fe()}],"rounded-es":[{"rounded-es":fe()}],"rounded-tl":[{"rounded-tl":fe()}],"rounded-tr":[{"rounded-tr":fe()}],"rounded-br":[{"rounded-br":fe()}],"rounded-bl":[{"rounded-bl":fe()}],"border-w":[{border:pe()}],"border-w-x":[{"border-x":pe()}],"border-w-y":[{"border-y":pe()}],"border-w-s":[{"border-s":pe()}],"border-w-e":[{"border-e":pe()}],"border-w-bs":[{"border-bs":pe()}],"border-w-be":[{"border-be":pe()}],"border-w-t":[{"border-t":pe()}],"border-w-r":[{"border-r":pe()}],"border-w-b":[{"border-b":pe()}],"border-w-l":[{"border-l":pe()}],"divide-x":[{"divide-x":pe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":pe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Se(),"hidden","none"]}],"divide-style":[{divide:[...Se(),"hidden","none"]}],"border-color":[{border:ee()}],"border-color-x":[{"border-x":ee()}],"border-color-y":[{"border-y":ee()}],"border-color-s":[{"border-s":ee()}],"border-color-e":[{"border-e":ee()}],"border-color-bs":[{"border-bs":ee()}],"border-color-be":[{"border-be":ee()}],"border-color-t":[{"border-t":ee()}],"border-color-r":[{"border-r":ee()}],"border-color-b":[{"border-b":ee()}],"border-color-l":[{"border-l":ee()}],"divide-color":[{divide:ee()}],"outline-style":[{outline:[...Se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ze,Ne,Ce]}],"outline-w":[{outline:["",Ze,pc,Da]}],"outline-color":[{outline:ee()}],shadow:[{shadow:["","none",p,Pd,Id]}],"shadow-color":[{shadow:ee()}],"inset-shadow":[{"inset-shadow":["none",g,Pd,Id]}],"inset-shadow-color":[{"inset-shadow":ee()}],"ring-w":[{ring:pe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:ee()}],"ring-offset-w":[{"ring-offset":[Ze,Da]}],"ring-offset-color":[{"ring-offset":ee()}],"inset-ring-w":[{"inset-ring":pe()}],"inset-ring-color":[{"inset-ring":ee()}],"text-shadow":[{"text-shadow":["none",v,Pd,Id]}],"text-shadow-color":[{"text-shadow":ee()}],opacity:[{opacity:[Ze,Ne,Ce]}],"mix-blend":[{"mix-blend":[...Le(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Le()}],"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":[Ze]}],"mask-image-linear-from-pos":[{"mask-linear-from":ve()}],"mask-image-linear-to-pos":[{"mask-linear-to":ve()}],"mask-image-linear-from-color":[{"mask-linear-from":ee()}],"mask-image-linear-to-color":[{"mask-linear-to":ee()}],"mask-image-t-from-pos":[{"mask-t-from":ve()}],"mask-image-t-to-pos":[{"mask-t-to":ve()}],"mask-image-t-from-color":[{"mask-t-from":ee()}],"mask-image-t-to-color":[{"mask-t-to":ee()}],"mask-image-r-from-pos":[{"mask-r-from":ve()}],"mask-image-r-to-pos":[{"mask-r-to":ve()}],"mask-image-r-from-color":[{"mask-r-from":ee()}],"mask-image-r-to-color":[{"mask-r-to":ee()}],"mask-image-b-from-pos":[{"mask-b-from":ve()}],"mask-image-b-to-pos":[{"mask-b-to":ve()}],"mask-image-b-from-color":[{"mask-b-from":ee()}],"mask-image-b-to-color":[{"mask-b-to":ee()}],"mask-image-l-from-pos":[{"mask-l-from":ve()}],"mask-image-l-to-pos":[{"mask-l-to":ve()}],"mask-image-l-from-color":[{"mask-l-from":ee()}],"mask-image-l-to-color":[{"mask-l-to":ee()}],"mask-image-x-from-pos":[{"mask-x-from":ve()}],"mask-image-x-to-pos":[{"mask-x-to":ve()}],"mask-image-x-from-color":[{"mask-x-from":ee()}],"mask-image-x-to-color":[{"mask-x-to":ee()}],"mask-image-y-from-pos":[{"mask-y-from":ve()}],"mask-image-y-to-pos":[{"mask-y-to":ve()}],"mask-image-y-from-color":[{"mask-y-from":ee()}],"mask-image-y-to-color":[{"mask-y-to":ee()}],"mask-image-radial":[{"mask-radial":[Ne,Ce]}],"mask-image-radial-from-pos":[{"mask-radial-from":ve()}],"mask-image-radial-to-pos":[{"mask-radial-to":ve()}],"mask-image-radial-from-color":[{"mask-radial-from":ee()}],"mask-image-radial-to-color":[{"mask-radial-to":ee()}],"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":j()}],"mask-image-conic-pos":[{"mask-conic":[Ze]}],"mask-image-conic-from-pos":[{"mask-conic-from":ve()}],"mask-image-conic-to-pos":[{"mask-conic-to":ve()}],"mask-image-conic-from-color":[{"mask-conic-from":ee()}],"mask-image-conic-to-color":[{"mask-conic-to":ee()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:O()}],"mask-repeat":[{mask:Z()}],"mask-size":[{mask:ie()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ne,Ce]}],filter:[{filter:["","none",Ne,Ce]}],blur:[{blur:Ge()}],brightness:[{brightness:[Ze,Ne,Ce]}],contrast:[{contrast:[Ze,Ne,Ce]}],"drop-shadow":[{"drop-shadow":["","none",_,Pd,Id]}],"drop-shadow-color":[{"drop-shadow":ee()}],grayscale:[{grayscale:["",Ze,Ne,Ce]}],"hue-rotate":[{"hue-rotate":[Ze,Ne,Ce]}],invert:[{invert:["",Ze,Ne,Ce]}],saturate:[{saturate:[Ze,Ne,Ce]}],sepia:[{sepia:["",Ze,Ne,Ce]}],"backdrop-filter":[{"backdrop-filter":["","none",Ne,Ce]}],"backdrop-blur":[{"backdrop-blur":Ge()}],"backdrop-brightness":[{"backdrop-brightness":[Ze,Ne,Ce]}],"backdrop-contrast":[{"backdrop-contrast":[Ze,Ne,Ce]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ze,Ne,Ce]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ze,Ne,Ce]}],"backdrop-invert":[{"backdrop-invert":["",Ze,Ne,Ce]}],"backdrop-opacity":[{"backdrop-opacity":[Ze,Ne,Ce]}],"backdrop-saturate":[{"backdrop-saturate":[Ze,Ne,Ce]}],"backdrop-sepia":[{"backdrop-sepia":["",Ze,Ne,Ce]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":M()}],"border-spacing-x":[{"border-spacing-x":M()}],"border-spacing-y":[{"border-spacing-y":M()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ne,Ce]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ze,"initial",Ne,Ce]}],ease:[{ease:["linear","initial",E,Ne,Ce]}],delay:[{delay:[Ze,Ne,Ce]}],animate:[{animate:["none",T,Ne,Ce]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,Ne,Ce]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:ge()}],"rotate-x":[{"rotate-x":ge()}],"rotate-y":[{"rotate-y":ge()}],"rotate-z":[{"rotate-z":ge()}],scale:[{scale:Te()}],"scale-x":[{"scale-x":Te()}],"scale-y":[{"scale-y":Te()}],"scale-z":[{"scale-z":Te()}],"scale-3d":["scale-3d"],skew:[{skew:Ae()}],"skew-x":[{"skew-x":Ae()}],"skew-y":[{"skew-y":Ae()}],transform:[{transform:[Ne,Ce,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:It()}],"translate-x":[{"translate-x":It()}],"translate-y":[{"translate-y":It()}],"translate-z":[{"translate-z":It()}],"translate-none":["translate-none"],zoom:[{zoom:[Si,Ne,Ce]}],accent:[{accent:ee()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:ee()}],"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",Ne,Ce]}],"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":ee()}],"scrollbar-track-color":[{"scrollbar-track":ee()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mbs":[{"scroll-mbs":M()}],"scroll-mbe":[{"scroll-mbe":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pbs":[{"scroll-pbs":M()}],"scroll-pbe":[{"scroll-pbe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"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",Ne,Ce]}],fill:[{fill:["none",...ee()]}],"stroke-w":[{stroke:[Ze,pc,Da,Vy]}],stroke:[{stroke:["none",...ee()]}],"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"]}},v8=XR(x8);function le(...e){return v8(Wc(e))}const _8=HC("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"},size:{default:"h-9 px-3",sm:"h-8 px-2.5 text-xs",icon:"size-9 p-0"}},defaultVariants:{variant:"default",size:"default"}});function se({className:e,variant:t,size:s,...i}){return o.jsx("button",{className:le(_8({variant:t,size:s,className:e})),...i})}const sN=y.createContext({});function y8(e){const t=y.useRef(null);return t.current===null&&(t.current=e()),t.current}const S8=typeof window<"u",w8=S8?y.useLayoutEffect:y.useEffect,Pb=y.createContext(null);function $b(e,t){e.indexOf(t)===-1&&e.push(t)}function Eh(e,t){const s=e.indexOf(t);s>-1&&e.splice(s,1)}const Di=(e,t,s)=>s>t?t:s<e?e:s;let Hb=()=>{};const oa={},nN=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function iN(e){return typeof e=="object"&&e!==null}const rN=e=>/^0[^.\s]+$/u.test(e);function aN(e){let t;return()=>(t===void 0&&(t=e()),t)}const Kn=e=>e,k8=(e,t)=>s=>t(e(s)),uu=(...e)=>e.reduce(k8),Kc=(e,t,s)=>{const i=t-e;return i===0?1:(s-e)/i};class Ub{constructor(){this.subscriptions=[]}add(t){return $b(this.subscriptions,t),()=>Eh(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 u=this.subscriptions[l];u&&u(t,s,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const An=e=>e*1e3,Wn=e=>e/1e3;function oN(e,t){return t?e*(1e3/t):0}const lN=(e,t,s)=>(((1-3*s+3*t)*e+(3*s-6*t))*e+3*t)*e,C8=1e-7,N8=12;function E8(e,t,s,i,a){let l,u,h=0;do u=t+(s-t)/2,l=lN(u,i,a)-e,l>0?s=u:t=u;while(Math.abs(l)>C8&&++h<N8);return u}function du(e,t,s,i){if(e===t&&s===i)return Kn;const a=l=>E8(l,0,1,e,s);return l=>l===0||l===1?l:lN(a(l),t,i)}const cN=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,uN=e=>t=>1-e(1-t),dN=du(.33,1.53,.69,.99),Fb=uN(dN),hN=cN(Fb),fN=e=>e>=1?1:(e*=2)<1?.5*Fb(e):.5*(2-Math.pow(2,-10*(e-1))),qb=e=>1-Math.sin(Math.acos(e)),mN=uN(qb),pN=cN(qb),T8=du(.42,0,1,1),j8=du(0,0,.58,1),gN=du(.42,0,.58,1),A8=e=>Array.isArray(e)&&typeof e[0]!="number",bN=e=>Array.isArray(e)&&typeof e[0]=="number",M8={linear:Kn,easeIn:T8,easeInOut:gN,easeOut:j8,circIn:qb,circInOut:pN,circOut:mN,backIn:Fb,backInOut:hN,backOut:dN,anticipate:fN},R8=e=>typeof e=="string",Ky=e=>{if(bN(e)){Hb(e.length===4);const[t,s,i,a]=e;return du(t,s,i,a)}else if(R8(e))return M8[e];return e},$d=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function D8(e,t){let s=new Set,i=new Set,a=!1,l=!1;const u=new WeakSet;let h={delta:0,timestamp:0,isProcessing:!1};function m(p){u.has(p)&&(d.schedule(p),e()),p(h)}const d={schedule:(p,g=!1,v=!1)=>{const S=v&&a?s:i;return g&&u.add(p),S.add(p),p},cancel:p=>{i.delete(p),u.delete(p)},process:p=>{if(h=p,a){l=!0;return}a=!0;const g=s;s=i,i=g,s.forEach(m),s.clear(),a=!1,l&&(l=!1,d.process(p))}};return d}const O8=40;function xN(e,t){let s=!1,i=!0;const a={delta:0,timestamp:0,isProcessing:!1},l=()=>s=!0,u=$d.reduce((N,j)=>(N[j]=D8(l),N),{}),{setup:h,read:m,resolveKeyframes:d,preUpdate:p,update:g,preRender:v,render:_,postRender:S}=u,w=()=>{const N=oa.useManualTiming,j=N?a.timestamp:performance.now();s=!1,N||(a.delta=i?1e3/60:Math.max(Math.min(j-a.timestamp,O8),1)),a.timestamp=j,a.isProcessing=!0,h.process(a),m.process(a),d.process(a),p.process(a),g.process(a),v.process(a),_.process(a),S.process(a),a.isProcessing=!1,s&&t&&(i=!1,e(w))},C=()=>{s=!0,i=!0,a.isProcessing||e(w)};return{schedule:$d.reduce((N,j)=>{const R=u[j];return N[j]=(z,D=!1,M=!1)=>(s||C(),R.schedule(z,D,M)),N},{}),cancel:N=>{for(let j=0;j<$d.length;j++)u[$d[j]].cancel(N)},state:a,steps:u}}const{schedule:Et,cancel:la,state:Ls,steps:Dp}=xN(typeof requestAnimationFrame<"u"?requestAnimationFrame:Kn,!0);let ch;function L8(){ch=void 0}const Qs={now:()=>(ch===void 0&&Qs.set(Ls.isProcessing||oa.useManualTiming?Ls.timestamp:performance.now()),ch),set:e=>{ch=e,queueMicrotask(L8)}},vN=e=>t=>typeof t=="string"&&t.startsWith(e),_N=vN("--"),z8=vN("var(--"),Vb=e=>z8(e)?B8.test(e.split("/*")[0].trim()):!1,B8=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Yy(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const dl={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Yc={...dl,transform:e=>Di(0,1,e)},Hd={...dl,default:1},Ic=e=>Math.round(e*1e5)/1e5,Gb=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function I8(e){return e==null}const P8=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Wb=(e,t)=>s=>!!(typeof s=="string"&&P8.test(s)&&s.startsWith(e)||t&&!I8(s)&&Object.prototype.hasOwnProperty.call(s,t)),yN=(e,t,s)=>i=>{if(typeof i!="string")return i;const[a,l,u,h]=i.match(Gb);return{[e]:parseFloat(a),[t]:parseFloat(l),[s]:parseFloat(u),alpha:h!==void 0?parseFloat(h):1}},$8=e=>Di(0,255,e),Op={...dl,transform:e=>Math.round($8(e))},Ha={test:Wb("rgb","red"),parse:yN("red","green","blue"),transform:({red:e,green:t,blue:s,alpha:i=1})=>"rgba("+Op.transform(e)+", "+Op.transform(t)+", "+Op.transform(s)+", "+Ic(Yc.transform(i))+")"};function H8(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 a0={test:Wb("#"),parse:H8,transform:Ha.transform},hu=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),ea=hu("deg"),Ai=hu("%"),je=hu("px"),U8=hu("vh"),F8=hu("vw"),Xy={...Ai,parse:e=>Ai.parse(e)/100,transform:e=>Ai.transform(e*100)},Qo={test:Wb("hsl","hue"),parse:yN("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:s,alpha:i=1})=>"hsla("+Math.round(e)+", "+Ai.transform(Ic(t))+", "+Ai.transform(Ic(s))+", "+Ic(Yc.transform(i))+")"},os={test:e=>Ha.test(e)||a0.test(e)||Qo.test(e),parse:e=>Ha.test(e)?Ha.parse(e):Qo.test(e)?Qo.parse(e):a0.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Ha.transform(e):Qo.transform(e),getAnimatableNone:e=>{const t=os.parse(e);return t.alpha=0,os.transform(t)}},q8=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function V8(e){return isNaN(e)&&typeof e=="string"&&(e.match(Gb)?.length||0)+(e.match(q8)?.length||0)>0}const SN="number",wN="color",G8="var",W8="var(",Zy="${}",K8=/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 al(e){const t=e.toString(),s=[],i={color:[],number:[],var:[]},a=[];let l=0;const h=t.replace(K8,m=>(os.test(m)?(i.color.push(l),a.push(wN),s.push(os.parse(m))):m.startsWith(W8)?(i.var.push(l),a.push(G8),s.push(m)):(i.number.push(l),a.push(SN),s.push(parseFloat(m))),++l,Zy)).split(Zy);return{values:s,split:h,indexes:i,types:a}}function Y8(e){return al(e).values}function kN({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 u=t[l];u===SN?a+=Ic(i[l]):u===wN?a+=os.transform(i[l]):a+=i[l]}return a}}function X8(e){return kN(al(e))}const Z8=e=>typeof e=="number"?0:os.test(e)?os.getAnimatableNone(e):e,Q8=(e,t)=>typeof e=="number"?t?.trim().endsWith("/")?e:0:Z8(e);function J8(e){const t=al(e);return kN(t)(t.values.map((i,a)=>Q8(i,t.split[a])))}const di={test:V8,parse:Y8,createTransformer:X8,getAnimatableNone:J8};function Lp(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 eD({hue:e,saturation:t,lightness:s,alpha:i}){e/=360,t/=100,s/=100;let a=0,l=0,u=0;if(!t)a=l=u=s;else{const h=s<.5?s*(1+t):s+t-s*t,m=2*s-h;a=Lp(m,h,e+1/3),l=Lp(m,h,e),u=Lp(m,h,e-1/3)}return{red:Math.round(a*255),green:Math.round(l*255),blue:Math.round(u*255),alpha:i}}function Th(e,t){return s=>s>0?t:e}const Dt=(e,t,s)=>e+(t-e)*s,zp=(e,t,s)=>{const i=e*e,a=s*(t*t-i)+i;return a<0?0:Math.sqrt(a)},tD=[a0,Ha,Qo],sD=e=>tD.find(t=>t.test(e));function Qy(e){const t=sD(e);if(!t)return!1;let s=t.parse(e);return t===Qo&&(s=eD(s)),s}const Jy=(e,t)=>{const s=Qy(e),i=Qy(t);if(!s||!i)return Th(e,t);const a={...s};return l=>(a.red=zp(s.red,i.red,l),a.green=zp(s.green,i.green,l),a.blue=zp(s.blue,i.blue,l),a.alpha=Dt(s.alpha,i.alpha,l),Ha.transform(a))},o0=new Set(["none","hidden"]);function nD(e,t){return o0.has(e)?s=>s<=0?e:t:s=>s>=1?t:e}function iD(e,t){return s=>Dt(e,t,s)}function Kb(e){return typeof e=="number"?iD:typeof e=="string"?Vb(e)?Th:os.test(e)?Jy:oD:Array.isArray(e)?CN:typeof e=="object"?os.test(e)?Jy:rD:Th}function CN(e,t){const s=[...e],i=s.length,a=e.map((l,u)=>Kb(l)(l,t[u]));return l=>{for(let u=0;u<i;u++)s[u]=a[u](l);return s}}function rD(e,t){const s={...e,...t},i={};for(const a in s)e[a]!==void 0&&t[a]!==void 0&&(i[a]=Kb(e[a])(e[a],t[a]));return a=>{for(const l in i)s[l]=i[l](a);return s}}function aD(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],u=e.indexes[l][i[l]],h=e.values[u]??0;s[a]=h,i[l]++}return s}const oD=(e,t)=>{const s=di.createTransformer(t),i=al(e),a=al(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?o0.has(e)&&!a.values.length||o0.has(t)&&!i.values.length?nD(e,t):uu(CN(aD(i,a),a.values),s):Th(e,t)};function NN(e,t,s){return typeof e=="number"&&typeof t=="number"&&typeof s=="number"?Dt(e,t,s):Kb(e)(e,t)}const lD=e=>{const t=({timestamp:s})=>e(s);return{start:(s=!0)=>Et.update(t,s),stop:()=>la(t),now:()=>Ls.isProcessing?Ls.timestamp:Qs.now()}},EN=(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)})`},jh=2e4;function Yb(e){let t=0;const s=50;let i=e.next(t);for(;!i.done&&t<jh;)t+=s,i=e.next(t);return t>=jh?1/0:t}function cD(e,t=100,s){const i=s({...e,keyframes:[0,t]}),a=Math.min(Yb(i),jh);return{type:"keyframes",ease:l=>i.next(a*l).value/t,duration:Wn(a)}}const qt={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 l0(e,t){return e*Math.sqrt(1-t*t)}const uD=12;function dD(e,t,s){let i=s;for(let a=1;a<uD;a++)i=i-e(i)/t(i);return i}const Bp=.001;function hD({duration:e=qt.duration,bounce:t=qt.bounce,velocity:s=qt.velocity,mass:i=qt.mass}){let a,l,u=1-t;u=Di(qt.minDamping,qt.maxDamping,u),e=Di(qt.minDuration,qt.maxDuration,Wn(e)),u<1?(a=d=>{const p=d*u,g=p*e,v=p-s,_=l0(d,u),S=Math.exp(-g);return Bp-v/_*S},l=d=>{const g=d*u*e,v=g*s+s,_=Math.pow(u,2)*Math.pow(d,2)*e,S=Math.exp(-g),w=l0(Math.pow(d,2),u);return(-a(d)+Bp>0?-1:1)*((v-_)*S)/w}):(a=d=>{const p=Math.exp(-d*e),g=(d-s)*e+1;return-Bp+p*g},l=d=>{const p=Math.exp(-d*e),g=(s-d)*(e*e);return p*g});const h=5/e,m=dD(a,l,h);if(e=An(e),isNaN(m))return{stiffness:qt.stiffness,damping:qt.damping,duration:e};{const d=Math.pow(m,2)*i;return{stiffness:d,damping:u*2*Math.sqrt(i*d),duration:e}}}const fD=["duration","bounce"],mD=["stiffness","damping","mass"];function eS(e,t){return t.some(s=>e[s]!==void 0)}function pD(e){let t={velocity:qt.velocity,stiffness:qt.stiffness,damping:qt.damping,mass:qt.mass,isResolvedFromDuration:!1,...e};if(!eS(e,mD)&&eS(e,fD))if(t.velocity=0,e.visualDuration){const s=e.visualDuration,i=2*Math.PI/(s*1.2),a=i*i,l=2*Di(.05,1,1-(e.bounce||0))*Math.sqrt(a);t={...t,mass:qt.mass,stiffness:a,damping:l}}else{const s=hD({...e,velocity:0});t={...t,...s,mass:qt.mass},t.isResolvedFromDuration=!0}return t}function Ah(e=qt.visualDuration,t=qt.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],u=s.keyframes[s.keyframes.length-1],h={done:!1,value:l},{stiffness:m,damping:d,mass:p,duration:g,velocity:v,isResolvedFromDuration:_}=pD({...s,velocity:-Wn(s.velocity||0)}),S=v||0,w=d/(2*Math.sqrt(m*p)),C=u-l,E=Wn(Math.sqrt(m/p)),T=Math.abs(C)<5;i||(i=T?qt.restSpeed.granular:qt.restSpeed.default),a||(a=T?qt.restDelta.granular:qt.restDelta.default);let N,j,R,z,D,M;if(w<1)R=l0(E,w),z=(S+w*E*C)/R,N=L=>{const B=Math.exp(-w*E*L);return u-B*(z*Math.sin(R*L)+C*Math.cos(R*L))},D=w*E*z+C*R,M=w*E*C-z*R,j=L=>Math.exp(-w*E*L)*(D*Math.sin(R*L)+M*Math.cos(R*L));else if(w===1){N=B=>u-Math.exp(-E*B)*(C+(S+E*C)*B);const L=S+E*C;j=B=>Math.exp(-E*B)*(E*L*B-S)}else{const L=E*Math.sqrt(w*w-1);N=V=>{const G=Math.exp(-w*E*V),I=Math.min(L*V,300);return u-G*((S+w*E*C)*Math.sinh(I)+L*C*Math.cosh(I))/L};const B=(S+w*E*C)/L,P=w*E*B-C*L,F=w*E*C-B*L;j=V=>{const G=Math.exp(-w*E*V),I=Math.min(L*V,300);return G*(P*Math.sinh(I)+F*Math.cosh(I))}}const $={calculatedDuration:_&&g||null,velocity:L=>An(j(L)),next:L=>{if(!_&&w<1){const P=Math.exp(-w*E*L),F=Math.sin(R*L),V=Math.cos(R*L),G=u-P*(z*F+C*V),I=An(P*(D*F+M*V));return h.done=Math.abs(I)<=i&&Math.abs(u-G)<=a,h.value=h.done?u:G,h}const B=N(L);if(_)h.done=L>=g;else{const P=An(j(L));h.done=Math.abs(P)<=i&&Math.abs(u-B)<=a}return h.value=h.done?u:B,h},toString:()=>{const L=Math.min(Yb($),jh),B=EN(P=>$.next(L*P).value,L,30);return L+"ms "+B},toTransition:()=>{}};return $}Ah.applyToOptions=e=>{const t=cD(e,100,Ah);return e.ease=t.ease,e.duration=An(t.duration),e.type="keyframes",e};const gD=5;function TN(e,t,s){const i=Math.max(t-gD,0);return oN(s-e(i),t-i)}function c0({keyframes:e,velocity:t=0,power:s=.8,timeConstant:i=325,bounceDamping:a=10,bounceStiffness:l=500,modifyTarget:u,min:h,max:m,restDelta:d=.5,restSpeed:p}){const g=e[0],v={done:!1,value:g},_=M=>h!==void 0&&M<h||m!==void 0&&M>m,S=M=>h===void 0?m:m===void 0||Math.abs(h-M)<Math.abs(m-M)?h:m;let w=s*t;const C=g+w,E=u===void 0?C:u(C);E!==C&&(w=E-g);const T=M=>-w*Math.exp(-M/i),N=M=>E+T(M),j=M=>{const $=T(M),L=N(M);v.done=Math.abs($)<=d,v.value=v.done?E:L};let R,z;const D=M=>{_(v.value)&&(R=M,z=Ah({keyframes:[v.value,S(v.value)],velocity:TN(N,M,v.value),damping:a,stiffness:l,restDelta:d,restSpeed:p}))};return D(0),{calculatedDuration:null,next:M=>{let $=!1;return!z&&R===void 0&&($=!0,j(M),D(M)),R!==void 0&&M>=R?z.next(M-R):(!$&&j(M),v)}}}function bD(e,t,s){const i=[],a=s||oa.mix||NN,l=e.length-1;for(let u=0;u<l;u++){let h=a(e[u],e[u+1]);if(t){const m=Array.isArray(t)?t[u]||Kn:t;h=uu(m,h)}i.push(h)}return i}function xD(e,t,{clamp:s=!0,ease:i,mixer:a}={}){const l=e.length;if(Hb(l===t.length),l===1)return()=>t[0];if(l===2&&t[0]===t[1])return()=>t[1];const u=e[0]===e[1];e[0]>e[l-1]&&(e=[...e].reverse(),t=[...t].reverse());const h=bD(t,i,a),m=h.length,d=p=>{if(u&&p<e[0])return t[0];let g=0;if(m>1)for(;g<e.length-2&&!(p<e[g+1]);g++);const v=Kc(e[g],e[g+1],p);return h[g](v)};return s?p=>d(Di(e[0],e[l-1],p)):d}function vD(e,t){const s=e[e.length-1];for(let i=1;i<=t;i++){const a=Kc(0,t,i);e.push(Dt(s,1,a))}}function _D(e){const t=[0];return vD(t,e.length-1),t}function yD(e,t){return e.map(s=>s*t)}function SD(e,t){return e.map(()=>t||gN).splice(0,e.length-1)}function Pc({duration:e=300,keyframes:t,times:s,ease:i="easeInOut"}){const a=A8(i)?i.map(Ky):Ky(i),l={done:!1,value:t[0]},u=yD(s&&s.length===t.length?s:_D(t),e),h=xD(u,t,{ease:Array.isArray(a)?a:SD(t,a)});return{calculatedDuration:e,next:m=>(l.value=h(m),l.done=m>=e,l)}}const wD=e=>e!==null;function lf(e,{repeat:t,repeatType:s="loop"},i,a=1){const l=e.filter(wD),h=a<0||t&&s!=="loop"&&t%2===1?0:l.length-1;return!h||i===void 0?l[h]:i}const kD={decay:c0,inertia:c0,tween:Pc,keyframes:Pc,spring:Ah};function jN(e){typeof e.type=="string"&&(e.type=kD[e.type])}class Xb{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 CD=e=>e/100;class Mh extends Xb{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!==Qs.now()&&this.tick(Qs.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;jN(t);const{type:s=Pc,repeat:i=0,repeatDelay:a=0,repeatType:l,velocity:u=0}=t;let{keyframes:h}=t;const m=s||Pc;m!==Pc&&typeof h[0]!="number"&&(this.mixKeyframes=uu(CD,NN(h[0],h[1])),h=[0,100]);const d=m({...t,keyframes:h});l==="mirror"&&(this.mirroredGenerator=m({...t,keyframes:[...h].reverse(),velocity:-u})),d.calculatedDuration===null&&(d.calculatedDuration=Yb(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:u,resolvedDuration:h,calculatedDuration:m}=this;if(this.startTime===null)return i.next(0);const{delay:d=0,keyframes:p,repeat:g,repeatType:v,repeatDelay:_,type:S,onUpdate:w,finalKeyframe:C}=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 N=this.currentTime,j=i;if(g){const M=Math.min(this.currentTime,a)/h;let $=Math.floor(M),L=M%1;!L&&M>=1&&(L=1),L===1&&$--,$=Math.min($,g+1),$%2&&(v==="reverse"?(L=1-L,_&&(L-=_/h)):v==="mirror"&&(j=u)),N=Di(0,1,L)*h}let R;T?(this.delayState.value=p[0],R=this.delayState):R=j.next(N),l&&!T&&(R.value=l(R.value));let{done:z}=R;!T&&m!==null&&(z=this.playbackSpeed>=0?this.currentTime>=a:this.currentTime<=0);const D=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&z);return D&&S!==c0&&(R.value=lf(p,this.options,C,this.speed)),w&&w(R.value),D&&this.finish(),R}then(t,s){return this.finished.then(t,s)}get duration(){return Wn(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Wn(t)}get time(){return Wn(this.currentTime)}set time(t){t=An(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 TN(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(Qs.now()),this.playbackSpeed=t,s&&this.driver&&(this.time=Wn(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=lD,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(Qs.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 ND(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Ua=e=>e*180/Math.PI,u0=e=>{const t=Ua(Math.atan2(e[1],e[0]));return d0(t)},ED={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:u0,rotateZ:u0,skewX:e=>Ua(Math.atan(e[1])),skewY:e=>Ua(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},d0=e=>(e=e%360,e<0&&(e+=360),e),tS=u0,sS=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),nS=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),TD={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:sS,scaleY:nS,scale:e=>(sS(e)+nS(e))/2,rotateX:e=>d0(Ua(Math.atan2(e[6],e[5]))),rotateY:e=>d0(Ua(Math.atan2(-e[2],e[0]))),rotateZ:tS,rotate:tS,skewX:e=>Ua(Math.atan(e[4])),skewY:e=>Ua(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function h0(e){return e.includes("scale")?1:0}function f0(e,t){if(!e||e==="none")return h0(t);const s=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,a;if(s)i=TD,a=s;else{const h=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=ED,a=h}if(!a)return h0(t);const l=i[t],u=a[1].split(",").map(AD);return typeof l=="function"?l(u):u[l]}const jD=(e,t)=>{const{transform:s="none"}=getComputedStyle(e);return f0(s,t)};function AD(e){return parseFloat(e.trim())}const hl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],fl=new Set(hl),iS=e=>e===dl||e===je,MD=new Set(["x","y","z"]),RD=hl.filter(e=>!MD.has(e));function DD(e){const t=[];return RD.forEach(s=>{const i=e.getValue(s);i!==void 0&&(t.push([s,i.get()]),i.set(s.startsWith("scale")?1:0))}),t}const sa={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})=>f0(t,"x"),y:(e,{transform:t})=>f0(t,"y")};sa.translateX=sa.x;sa.translateY=sa.y;const Va=new Set;let m0=!1,p0=!1,g0=!1;function AN(){if(p0){const e=Array.from(Va).filter(i=>i.needsMeasurement),t=new Set(e.map(i=>i.element)),s=new Map;t.forEach(i=>{const a=DD(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,u])=>{i.getValue(l)?.set(u)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}p0=!1,m0=!1,Va.forEach(e=>e.complete(g0)),Va.clear()}function MN(){Va.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(p0=!0)})}function OD(){g0=!0,MN(),AN(),g0=!1}class Zb{constructor(t,s,i,a,l,u=!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=u}scheduleResolve(){this.state="scheduled",this.isAsync?(Va.add(this),m0||(m0=!0,Et.read(MN),Et.resolveKeyframes(AN))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:s,element:i,motionValue:a}=this;if(t[0]===null){const l=a?.get(),u=t[t.length-1];if(l!==void 0)t[0]=l;else if(i&&s){const h=i.readValue(s,u);h!=null&&(t[0]=h)}t[0]===void 0&&(t[0]=u),a&&l===void 0&&a.set(t[0])}ND(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Va.delete(this)}cancel(){this.state==="scheduled"&&(Va.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const LD=e=>e.startsWith("--");function RN(e,t,s){LD(t)?e.style.setProperty(t,s):e.style[t]=s}const zD={};function DN(e,t){const s=aN(e);return()=>zD[t]??s()}const BD=DN(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),ON=DN(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Ec=([e,t,s,i])=>`cubic-bezier(${e}, ${t}, ${s}, ${i})`,rS={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ec([0,.65,.55,1]),circOut:Ec([.55,0,1,.45]),backIn:Ec([.31,.01,.66,-.59]),backOut:Ec([.33,1.53,.69,.99])};function LN(e,t){if(e)return typeof e=="function"?ON()?EN(e,t):"ease-out":bN(e)?Ec(e):Array.isArray(e)?e.map(s=>LN(s,t)||rS.easeOut):rS[e]}function ID(e,t,s,{delay:i=0,duration:a=300,repeat:l=0,repeatType:u="loop",ease:h="easeOut",times:m}={},d=void 0){const p={[t]:s};m&&(p.offset=m);const g=LN(h,a);Array.isArray(g)&&(p.easing=g);const v={delay:i,duration:a,easing:Array.isArray(g)?"linear":g,fill:"both",iterations:l+1,direction:u==="reverse"?"alternate":"normal"};return d&&(v.pseudoElement=d),e.animate(p,v)}function zN(e){return typeof e=="function"&&"applyToOptions"in e}function PD({type:e,...t}){return zN(e)&&ON()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class BN extends Xb{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:u=!1,finalKeyframe:h,onComplete:m}=t;this.isPseudoElement=!!l,this.allowFlatten=u,this.options=t,Hb(typeof t.type!="string");const d=PD(t);this.animation=ID(s,i,a,d,l),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!l){const p=lf(a,this.options,h,this.speed);this.updateMotionValue&&this.updateMotionValue(p),RN(s,i,p),this.animation.cancel()}m?.(),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 Wn(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Wn(t)}get time(){return Wn(Number(this.animation.currentTime)||0)}set time(t){const s=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=An(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&&BD()?(this.animation.timeline=t,s&&(this.animation.rangeStart=s),i&&(this.animation.rangeEnd=i),Kn):a(this)}}const IN={anticipate:fN,backInOut:hN,circInOut:pN};function $D(e){return e in IN}function HD(e){typeof e.ease=="string"&&$D(e.ease)&&(e.ease=IN[e.ease])}const Ip=10;class UD extends BN{constructor(t){HD(t),jN(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,...u}=this.options;if(!s)return;if(t!==void 0){s.set(t);return}const h=new Mh({...u,autoplay:!1}),m=Math.max(Ip,Qs.now()-this.startTime),d=Di(0,Ip,m-Ip),p=h.sample(m).value,{name:g}=this.options;l&&g&&RN(l,g,p),s.setWithVelocity(h.sample(Math.max(0,m-d)).value,p,d),h.stop()}}const aS=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(di.test(e)||e==="0")&&!e.startsWith("url("));function FD(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 qD(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],u=aS(a,t),h=aS(l,t);return!u||!h?!1:FD(e)||(s==="spring"||zN(s))&&i}function b0(e){e.duration=0,e.type="keyframes"}const PN=new Set(["opacity","clipPath","filter","transform"]),VD=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function GD(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&VD.test(e[t]))return!0;return!1}const WD=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),KD=aN(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function YD(e){const{motionValue:t,name:s,repeatDelay:i,repeatType:a,damping:l,type:u,keyframes:h}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:d,transformTemplate:p}=t.owner.getProps();return KD()&&s&&(PN.has(s)||WD.has(s)&&GD(h))&&(s!=="transform"||!p)&&!d&&!i&&a!=="mirror"&&l!==0&&u!=="inertia"}const XD=40;class ZD extends Xb{constructor({autoplay:t=!0,delay:s=0,type:i="keyframes",repeat:a=0,repeatDelay:l=0,repeatType:u="loop",keyframes:h,name:m,motionValue:d,element:p,...g}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Qs.now();const v={autoplay:t,delay:s,type:i,repeat:a,repeatDelay:l,repeatType:u,name:m,motionValue:d,element:p,...g},_=p?.KeyframeResolver||Zb;this.keyframeResolver=new _(h,(S,w,C)=>this.onKeyframesResolved(S,w,v,!C),m,d,p),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,s,i,a){this.keyframeResolver=void 0;const{name:l,type:u,velocity:h,delay:m,isHandoff:d,onUpdate:p}=i;this.resolvedAt=Qs.now();let g=!0;qD(t,l,u,h)||(g=!1,(oa.instantAnimations||!m)&&p?.(lf(t,i,s)),t[0]=t[t.length-1],b0(i),i.repeat=0);const _={startTime:a?this.resolvedAt?this.resolvedAt-this.createdAt>XD?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:s,...i,keyframes:t},S=g&&!d&&YD(_),w=_.motionValue?.owner?.current;let C;if(S)try{C=new UD({..._,element:w})}catch{C=new Mh(_)}else C=new Mh(_);C.finished.then(()=>{this.notifyFinished()}).catch(Kn),this.pendingTimeline&&(this.stopTimeline=C.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=C}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(),OD()),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 $N(e,t,s,i=0,a=1){const l=Array.from(e).sort((d,p)=>d.sortNodePosition(p)).indexOf(t),u=e.size,h=(u-1)*i;return typeof s=="function"?s(l,u):a===1?l*i:h-l*i}const QD=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function JD(e){const t=QD.exec(e);if(!t)return[,];const[,s,i,a]=t;return[`--${s??i}`,a]}function HN(e,t,s=1){const[i,a]=JD(e);if(!i)return;const l=window.getComputedStyle(t).getPropertyValue(i);if(l){const u=l.trim();return nN(u)?parseFloat(u):u}return Vb(a)?HN(a,t,s+1):a}const eO={type:"spring",stiffness:500,damping:25,restSpeed:10},tO=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),sO={type:"keyframes",duration:.8},nO={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},iO=(e,{keyframes:t})=>t.length>2?sO:fl.has(e)?e.startsWith("scale")?tO(t[1]):eO:nO;function UN(e,t){if(e?.inherit&&t){const{inherit:s,...i}=e;return{...t,...i}}return e}function Qb(e,t){const s=e?.[t]??e?.default??e;return s!==e?UN(s,e):s}const rO=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function aO(e){for(const t in e)if(!rO.has(t))return!0;return!1}const Jb=(e,t,s,i={},a,l)=>u=>{const h=Qb(i,e)||{},m=h.delay||i.delay||0;let{elapsed:d=0}=i;d=d-An(m);const p={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:t.getVelocity(),...h,delay:-d,onUpdate:v=>{t.set(v),h.onUpdate&&h.onUpdate(v)},onComplete:()=>{u(),h.onComplete&&h.onComplete()},name:e,motionValue:t,element:l?void 0:a};aO(h)||Object.assign(p,iO(e,p)),p.duration&&(p.duration=An(p.duration)),p.repeatDelay&&(p.repeatDelay=An(p.repeatDelay)),p.from!==void 0&&(p.keyframes[0]=p.from);let g=!1;if((p.type===!1||p.duration===0&&!p.repeatDelay)&&(b0(p),p.delay===0&&(g=!0)),(oa.instantAnimations||oa.skipAnimations||a?.shouldSkipAnimations)&&(g=!0,b0(p),p.delay=0),p.allowFlatten=!h.type&&!h.ease,g&&!l&&t.get()!==void 0){const v=lf(p.keyframes,h);if(v!==void 0){Et.update(()=>{p.onUpdate(v),p.onComplete()});return}}return h.isSync?new Mh(p):new ZD(p)};function oS(e){const t=[{},{}];return e?.values.forEach((s,i)=>{t[0][i]=s.get(),t[1][i]=s.getVelocity()}),t}function ex(e,t,s,i){if(typeof t=="function"){const[a,l]=oS(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]=oS(i);t=t(s!==void 0?s:e.custom,a,l)}return t}function Ga(e,t,s){const i=e.getProps();return ex(i,t,s!==void 0?s:i.custom,e)}const FN=new Set(["width","height","top","left","right","bottom",...hl]),lS=30,oO=e=>!isNaN(parseFloat(e));class lO{constructor(t,s={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=i=>{const a=Qs.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=Qs.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=oO(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 Ub);const i=this.events[t].add(s);return t==="change"?()=>{i(),Et.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=Qs.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>lS)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,lS);return oN(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 ol(e,t){return new lO(e,t)}const x0=e=>Array.isArray(e);function cO(e,t,s){e.hasValue(t)?e.getValue(t).set(s):e.addValue(t,ol(s))}function uO(e){return x0(e)?e[e.length-1]||0:e}function dO(e,t){const s=Ga(e,t);let{transitionEnd:i={},transition:a={},...l}=s||{};l={...l,...i};for(const u in l){const h=uO(l[u]);cO(e,u,h)}}const Bs=e=>!!(e&&e.getVelocity);function hO(e){return!!(Bs(e)&&e.add)}function v0(e,t){const s=e.getValue("willChange");if(hO(s))return s.add(t);if(!s&&oa.WillChange){const i=new oa.WillChange("auto");e.addValue("willChange",i),i.add(t)}}function tx(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const fO="framerAppearId",qN="data-"+tx(fO);function VN(e){return e.props[qN]}function mO({protectedKeys:e,needsAnimating:t},s){const i=e.hasOwnProperty(s)&&t[s]!==!0;return t[s]=!1,i}function GN(e,t,{delay:s=0,transitionOverride:i,type:a}={}){let{transition:l,transitionEnd:u,...h}=t;const m=e.getDefaultTransition();l=l?UN(l,m):m;const d=l?.reduceMotion;i&&(l=i);const p=[],g=a&&e.animationState&&e.animationState.getState()[a];for(const v in h){const _=e.getValue(v,e.latestValues[v]??null),S=h[v];if(S===void 0||g&&mO(g,v))continue;const w={delay:s,...Qb(l||{},v)},C=_.get();if(C!==void 0&&!_.isAnimating()&&!Array.isArray(S)&&S===C&&!w.velocity){Et.update(()=>_.set(S));continue}let E=!1;if(window.MotionHandoffAnimation){const j=VN(e);if(j){const R=window.MotionHandoffAnimation(j,v,Et);R!==null&&(w.startTime=R,E=!0)}}v0(e,v);const T=d??e.shouldReduceMotion;_.start(Jb(v,_,S,T&&FN.has(v)?{type:!1}:w,e,E));const N=_.animation;N&&p.push(N)}if(u){const v=()=>Et.update(()=>{u&&dO(e,u)});p.length?Promise.all(p).then(v):v()}return p}function _0(e,t,s={}){const i=Ga(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(GN(e,i,s)):()=>Promise.resolve(),u=e.variantChildren&&e.variantChildren.size?(m=0)=>{const{delayChildren:d=0,staggerChildren:p,staggerDirection:g}=a;return pO(e,t,m,d,p,g,s)}:()=>Promise.resolve(),{when:h}=a;if(h){const[m,d]=h==="beforeChildren"?[l,u]:[u,l];return m().then(()=>d())}else return Promise.all([l(),u(s.delay)])}function pO(e,t,s=0,i=0,a=0,l=1,u){const h=[];for(const m of e.variantChildren)m.notify("AnimationStart",t),h.push(_0(m,t,{...u,delay:s+(typeof i=="function"?0:i)+$N(e.variantChildren,m,i,a,l)}).then(()=>m.notify("AnimationComplete",t)));return Promise.all(h)}function gO(e,t,s={}){e.notify("AnimationStart",t);let i;if(Array.isArray(t)){const a=t.map(l=>_0(e,l,s));i=Promise.all(a)}else if(typeof t=="string")i=_0(e,t,s);else{const a=typeof t=="function"?Ga(e,t,s.custom):t;i=Promise.all(GN(e,a,s))}return i.then(()=>{e.notify("AnimationComplete",t)})}const bO={test:e=>e==="auto",parse:e=>e},WN=e=>t=>t.test(e),KN=[dl,je,Ai,ea,F8,U8,bO],cS=e=>KN.find(WN(e));function xO(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||rN(e):!0}const vO=new Set(["brightness","contrast","saturate","opacity"]);function _O(e){const[t,s]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[i]=s.match(Gb)||[];if(!i)return e;const a=s.replace(i,"");let l=vO.has(t)?1:0;return i!==s&&(l*=100),t+"("+l+a+")"}const yO=/\b([a-z-]*)\(.*?\)/gu,y0={...di,getAnimatableNone:e=>{const t=e.match(yO);return t?t.map(_O).join(" "):e}},S0={...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))}},uS={...dl,transform:Math.round},SO={rotate:ea,rotateX:ea,rotateY:ea,rotateZ:ea,scale:Hd,scaleX:Hd,scaleY:Hd,scaleZ:Hd,skew:ea,skewX:ea,skewY:ea,distance:je,translateX:je,translateY:je,translateZ:je,x:je,y:je,z:je,perspective:je,transformPerspective:je,opacity:Yc,originX:Xy,originY:Xy,originZ:je},sx={borderWidth:je,borderTopWidth:je,borderRightWidth:je,borderBottomWidth:je,borderLeftWidth:je,borderRadius:je,borderTopLeftRadius:je,borderTopRightRadius:je,borderBottomRightRadius:je,borderBottomLeftRadius:je,width:je,maxWidth:je,height:je,maxHeight:je,top:je,right:je,bottom:je,left:je,inset:je,insetBlock:je,insetBlockStart:je,insetBlockEnd:je,insetInline:je,insetInlineStart:je,insetInlineEnd:je,padding:je,paddingTop:je,paddingRight:je,paddingBottom:je,paddingLeft:je,paddingBlock:je,paddingBlockStart:je,paddingBlockEnd:je,paddingInline:je,paddingInlineStart:je,paddingInlineEnd:je,margin:je,marginTop:je,marginRight:je,marginBottom:je,marginLeft:je,marginBlock:je,marginBlockStart:je,marginBlockEnd:je,marginInline:je,marginInlineStart:je,marginInlineEnd:je,fontSize:je,backgroundPositionX:je,backgroundPositionY:je,...SO,zIndex:uS,fillOpacity:Yc,strokeOpacity:Yc,numOctaves:uS},wO={...sx,color:os,backgroundColor:os,outlineColor:os,fill:os,stroke:os,borderColor:os,borderTopColor:os,borderRightColor:os,borderBottomColor:os,borderLeftColor:os,filter:y0,WebkitFilter:y0,mask:S0,WebkitMask:S0},YN=e=>wO[e],kO=new Set([y0,S0]);function XN(e,t){let s=YN(e);return kO.has(s)||(s=di),s.getAnimatableNone?s.getAnimatableNone(t):void 0}const CO=new Set(["auto","none","0"]);function NO(e,t,s){let i=0,a;for(;i<e.length&&!a;){const l=e[i];typeof l=="string"&&!CO.has(l)&&al(l).values.length&&(a=e[i]),i++}if(a&&s)for(const l of t)e[l]=XN(s,a)}class EO extends Zb{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(),Vb(g))){const v=HN(g,s.current);v!==void 0&&(t[p]=v),p===t.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!FN.has(i)||t.length!==2)return;const[a,l]=t,u=cS(a),h=cS(l),m=Yy(a),d=Yy(l);if(m!==d&&sa[i]){this.needsMeasurement=!0;return}if(u!==h)if(iS(u)&&iS(h))for(let p=0;p<t.length;p++){const g=t[p];typeof g=="string"&&(t[p]=parseFloat(g))}else sa[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:s}=this,i=[];for(let a=0;a<t.length;a++)(t[a]===null||xO(t[a]))&&i.push(a);i.length&&NO(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=sa[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,u=i[l];i[l]=sa[s](t.measureViewportBox(),window.getComputedStyle(t.current)),u!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=u),this.removedTransforms?.length&&this.removedTransforms.forEach(([h,m])=>{t.getValue(h).set(m)}),this.resolveNoneKeyframes()}}function ZN(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 QN=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function TO(e){return iN(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:nx}=xN(queueMicrotask,!1),li={x:!1,y:!1};function JN(){return li.x||li.y}function jO(e){return e==="x"||e==="y"?li[e]?null:(li[e]=!0,()=>{li[e]=!1}):li.x||li.y?null:(li.x=li.y=!0,()=>{li.x=li.y=!1})}function eE(e,t){const s=ZN(e),i=new AbortController,a={passive:!0,...t,signal:i.signal};return[s,a,()=>i.abort()]}function AO(e){return!(e.pointerType==="touch"||JN())}function MO(e,t,s={}){const[i,a,l]=eE(e,s);return i.forEach(u=>{let h=!1,m=!1,d;const p=()=>{u.removeEventListener("pointerleave",S)},g=C=>{d&&(d(C),d=void 0),p()},v=C=>{h=!1,window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",v),m&&(m=!1,g(C))},_=()=>{h=!0,window.addEventListener("pointerup",v,a),window.addEventListener("pointercancel",v,a)},S=C=>{if(C.pointerType!=="touch"){if(h){m=!0;return}g(C)}},w=C=>{if(!AO(C))return;m=!1;const E=t(u,C);typeof E=="function"&&(d=E,u.addEventListener("pointerleave",S,a))};u.addEventListener("pointerenter",w,a),u.addEventListener("pointerdown",_,a)}),l}const tE=(e,t)=>t?e===t?!0:tE(e,t.parentElement):!1,ix=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,RO=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function DO(e){return RO.has(e.tagName)||e.isContentEditable===!0}const OO=new Set(["INPUT","SELECT","TEXTAREA"]);function LO(e){return OO.has(e.tagName)||e.isContentEditable===!0}const uh=new WeakSet;function dS(e){return t=>{t.key==="Enter"&&e(t)}}function Pp(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const zO=(e,t)=>{const s=e.currentTarget;if(!s)return;const i=dS(()=>{if(uh.has(s))return;Pp(s,"down");const a=dS(()=>{Pp(s,"up")}),l=()=>Pp(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 hS(e){return ix(e)&&!JN()}const fS=new WeakSet;function BO(e,t,s={}){const[i,a,l]=eE(e,s),u=h=>{const m=h.currentTarget;if(!hS(h)||fS.has(h))return;uh.add(m),s.stopPropagation&&fS.add(h);const d=t(m,h),p=(_,S)=>{window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",v),uh.has(m)&&uh.delete(m),hS(_)&&typeof d=="function"&&d(_,{success:S})},g=_=>{p(_,m===window||m===document||s.useGlobalTarget||tE(m,_.target))},v=_=>{p(_,!1)};window.addEventListener("pointerup",g,a),window.addEventListener("pointercancel",v,a)};return i.forEach(h=>{(s.useGlobalTarget?window:h).addEventListener("pointerdown",u,a),TO(h)&&(h.addEventListener("focus",d=>zO(d,a)),!DO(h)&&!h.hasAttribute("tabindex")&&(h.tabIndex=0))}),l}function rx(e){return iN(e)&&"ownerSVGElement"in e}const dh=new WeakMap;let hh;const sE=(e,t,s)=>(i,a)=>a&&a[0]?a[0][e+"Size"]:rx(i)&&"getBBox"in i?i.getBBox()[t]:i[s],IO=sE("inline","width","offsetWidth"),PO=sE("block","height","offsetHeight");function $O({target:e,borderBoxSize:t}){dh.get(e)?.forEach(s=>{s(e,{get width(){return IO(e,t)},get height(){return PO(e,t)}})})}function HO(e){e.forEach($O)}function UO(){typeof ResizeObserver>"u"||(hh=new ResizeObserver(HO))}function FO(e,t){hh||UO();const s=ZN(e);return s.forEach(i=>{let a=dh.get(i);a||(a=new Set,dh.set(i,a)),a.add(t),hh?.observe(i)}),()=>{s.forEach(i=>{const a=dh.get(i);a?.delete(t),a?.size||hh?.unobserve(i)})}}const fh=new Set;let Jo;function qO(){Jo=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};fh.forEach(t=>t(e))},window.addEventListener("resize",Jo)}function VO(e){return fh.add(e),Jo||qO(),()=>{fh.delete(e),!fh.size&&typeof Jo=="function"&&(window.removeEventListener("resize",Jo),Jo=void 0)}}function mS(e,t){return typeof e=="function"?VO(e):FO(e,t)}function GO(e){return rx(e)&&e.tagName==="svg"}const WO=[...KN,os,di],KO=e=>WO.find(WN(e)),pS=()=>({translate:0,scale:1,origin:0,originPoint:0}),el=()=>({x:pS(),y:pS()}),gS=()=>({min:0,max:0}),gs=()=>({x:gS(),y:gS()}),YO=new WeakMap;function cf(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Xc(e){return typeof e=="string"||Array.isArray(e)}const ax=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],ox=["initial",...ax];function uf(e){return cf(e.animate)||ox.some(t=>Xc(e[t]))}function nE(e){return!!(uf(e)||e.variants)}function XO(e,t,s){for(const i in t){const a=t[i],l=s[i];if(Bs(a))e.addValue(i,a);else if(Bs(l))e.addValue(i,ol(a,{owner:e}));else if(l!==a)if(e.hasValue(i)){const u=e.getValue(i);u.liveStyle===!0?u.jump(a):u.hasAnimated||u.set(a)}else{const u=e.getStaticValue(i);e.addValue(i,ol(u!==void 0?u:a,{owner:e}))}}for(const i in s)t[i]===void 0&&e.removeValue(i);return t}const w0={current:null},iE={current:!1},ZO=typeof window<"u";function QO(){if(iE.current=!0,!!ZO)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>w0.current=e.matches;e.addEventListener("change",t),t()}else w0.current=!1}const bS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Rh={};function rE(e){Rh=e}function JO(){return Rh}class eL{scrapeMotionValuesFromProps(t,s,i){return{}}constructor({parent:t,props:s,presenceContext:i,reducedMotionConfig:a,skipAnimations:l,blockInitialAnimation:u,visualState:h},m={}){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=Zb,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 _=Qs.now();this.renderScheduledAt<_&&(this.renderScheduledAt=_,Et.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=m,this.blockInitialAnimation=!!u,this.isControllingVariants=uf(s),this.isVariantNode=nE(s),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:g,...v}=this.scrapeMotionValuesFromProps(s,{},this);for(const _ in v){const S=v[_];d[_]!==void 0&&Bs(S)&&S.set(d[_])}}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,YO.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:(iE.current||QO(),this.shouldReduceMotion=w0.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(),la(this.notifyUpdate),la(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&&PN.has(t)&&this.current instanceof HTMLElement){const{factory:u,keyframes:h,times:m,ease:d,duration:p}=s.accelerate,g=new BN({element:this.current,name:t,keyframes:h,times:m,ease:d,duration:An(p)}),v=u(g);this.valueSubscriptions.set(t,()=>{v(),g.cancel()});return}const i=fl.has(t);i&&this.onBindTransform&&this.onBindTransform();const a=s.on("change",u=>{this.latestValues[t]=u,this.props.onUpdate&&Et.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 Rh){const s=Rh[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):gs()}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,u=t[l];u&&(this.propEventSubscriptions[a]=this.on(a,u))}this.prevMotionValues=XO(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=ol(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"&&(nN(i)||rN(i))?i=parseFloat(i):!KO(i)&&di.test(s)&&(i=XN(t,s)),this.setBaseTarget(t,Bs(i)?i.get():i)),Bs(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=ex(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&&!Bs(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 Ub),this.events[t].add(s)}notify(t,...s){this.events[t]&&this.events[t].notify(...s)}scheduleRenderMicrotask(){nx.render(this.render)}}class aE extends eL{constructor(){super(...arguments),this.KeyframeResolver=EO}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;Bs(t)&&(this.childSubscription=t.on("change",s=>{this.current&&(this.current.textContent=`${s}`)}))}}class ha{constructor(t){this.isMounted=!1,this.node=t}update(){}}function oE({top:e,left:t,right:s,bottom:i}){return{x:{min:t,max:s},y:{min:e,max:i}}}function tL({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function sL(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 $p(e){return e===void 0||e===1}function k0({scale:e,scaleX:t,scaleY:s}){return!$p(e)||!$p(t)||!$p(s)}function Ba(e){return k0(e)||lE(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function lE(e){return xS(e.x)||xS(e.y)}function xS(e){return e&&e!=="0%"}function Dh(e,t,s){const i=e-s,a=t*i;return s+a}function vS(e,t,s,i,a){return a!==void 0&&(e=Dh(e,a,i)),Dh(e,s,i)+t}function C0(e,t=0,s=1,i,a){e.min=vS(e.min,t,s,i,a),e.max=vS(e.max,t,s,i,a)}function cE(e,{x:t,y:s}){C0(e.x,t.translate,t.scale,t.originPoint),C0(e.y,s.translate,s.scale,s.originPoint)}const _S=.999999999999,yS=1.0000000000001;function nL(e,t,s,i=!1){const a=s.length;if(!a)return;t.x=t.y=1;let l,u;for(let h=0;h<a;h++){l=s[h],u=l.projectionDelta;const{visualElement:m}=l.options;m&&m.props.style&&m.props.style.display==="contents"||(i&&l.options.layoutScroll&&l.scroll&&l!==l.root&&(Ti(e.x,-l.scroll.offset.x),Ti(e.y,-l.scroll.offset.y)),u&&(t.x*=u.x.scale,t.y*=u.y.scale,cE(e,u)),i&&Ba(l.latestValues)&&mh(e,l.latestValues,l.layout?.layoutBox))}t.x<yS&&t.x>_S&&(t.x=1),t.y<yS&&t.y>_S&&(t.y=1)}function Ti(e,t){e.min+=t,e.max+=t}function SS(e,t,s,i,a=.5){const l=Dt(e.min,e.max,a);C0(e,t,s,l,i)}function wS(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function mh(e,t,s){const i=s??e;SS(e.x,wS(t.x,i.x),t.scaleX,t.scale,t.originX),SS(e.y,wS(t.y,i.y),t.scaleY,t.scale,t.originY)}function uE(e,t){return oE(sL(e.getBoundingClientRect(),t))}function iL(e,t,s){const i=uE(e,s),{scroll:a}=t;return a&&(Ti(i.x,a.offset.x),Ti(i.y,a.offset.y)),i}const rL={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},aL=hl.length;function oL(e,t,s){let i="",a=!0;for(let l=0;l<aL;l++){const u=hl[l],h=e[u];if(h===void 0)continue;let m=!0;if(typeof h=="number")m=h===(u.startsWith("scale")?1:0);else{const d=parseFloat(h);m=u.startsWith("scale")?d===1:d===0}if(!m||s){const d=QN(h,sx[u]);if(!m){a=!1;const p=rL[u]||u;i+=`${p}(${d}) `}s&&(t[u]=d)}}return i=i.trim(),s?i=s(t,a?"":i):a&&(i="none"),i}function lx(e,t,s){const{style:i,vars:a,transformOrigin:l}=e;let u=!1,h=!1;for(const m in t){const d=t[m];if(fl.has(m)){u=!0;continue}else if(_N(m)){a[m]=d;continue}else{const p=QN(d,sx[m]);m.startsWith("origin")?(h=!0,l[m]=p):i[m]=p}}if(t.transform||(u||s?i.transform=oL(t,e.transform,s):i.transform&&(i.transform="none")),h){const{originX:m="50%",originY:d="50%",originZ:p=0}=l;i.transformOrigin=`${m} ${d} ${p}`}}function dE(e,{style:t,vars:s},i,a){const l=e.style;let u;for(u in t)l[u]=t[u];a?.applyProjectionStyles(l,i);for(u in s)l.setProperty(u,s[u])}function kS(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const gc={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(je.test(e))e=parseFloat(e);else return e;const s=kS(e,t.target.x),i=kS(e,t.target.y);return`${s}% ${i}%`}},lL={correct:(e,{treeScale:t,projectionDelta:s})=>{const i=e,a=di.parse(e);if(a.length>5)return i;const l=di.createTransformer(e),u=typeof a[0]!="number"?1:0,h=s.x.scale*t.x,m=s.y.scale*t.y;a[0+u]/=h,a[1+u]/=m;const d=Dt(h,m,.5);return typeof a[2+u]=="number"&&(a[2+u]/=d),typeof a[3+u]=="number"&&(a[3+u]/=d),l(a)}},N0={borderRadius:{...gc,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:gc,borderTopRightRadius:gc,borderBottomLeftRadius:gc,borderBottomRightRadius:gc,boxShadow:lL};function hE(e,{layout:t,layoutId:s}){return fl.has(e)||e.startsWith("origin")||(t||s!==void 0)&&(!!N0[e]||e==="opacity")}function cx(e,t,s){const i=e.style,a=t?.style,l={};if(!i)return l;for(const u in i)(Bs(i[u])||a&&Bs(a[u])||hE(u,e)||s?.getValue(u)?.liveStyle!==void 0)&&(l[u]=i[u]);return l}function cL(e){return window.getComputedStyle(e)}class uL extends aE{constructor(){super(...arguments),this.type="html",this.renderInstance=dE}readValueFromInstance(t,s){if(fl.has(s))return this.projection?.isProjecting?h0(s):jD(t,s);{const i=cL(t),a=(_N(s)?i.getPropertyValue(s):i[s])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(t,{transformPagePoint:s}){return uE(t,s)}build(t,s,i){lx(t,s,i.transformTemplate)}scrapeMotionValuesFromProps(t,s,i){return cx(t,s,i)}}const dL={offset:"stroke-dashoffset",array:"stroke-dasharray"},hL={offset:"strokeDashoffset",array:"strokeDasharray"};function fL(e,t,s=1,i=0,a=!0){e.pathLength=1;const l=a?dL:hL;e[l.offset]=`${-i}`,e[l.array]=`${t} ${s}`}const mL=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function fE(e,{attrX:t,attrY:s,attrScale:i,pathLength:a,pathSpacing:l=1,pathOffset:u=0,...h},m,d,p){if(lx(e,h,d),m){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:g,style:v}=e;g.transform&&(v.transform=g.transform,delete g.transform),(v.transform||g.transformOrigin)&&(v.transformOrigin=g.transformOrigin??"50% 50%",delete g.transformOrigin),v.transform&&(v.transformBox=p?.transformBox??"fill-box",delete g.transformBox);for(const _ of mL)g[_]!==void 0&&(v[_]=g[_],delete g[_]);t!==void 0&&(g.x=t),s!==void 0&&(g.y=s),i!==void 0&&(g.scale=i),a!==void 0&&fL(g,a,l,u,!1)}const mE=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"]),pE=e=>typeof e=="string"&&e.toLowerCase()==="svg";function pL(e,t,s,i){dE(e,t,void 0,i);for(const a in t.attrs)e.setAttribute(mE.has(a)?a:tx(a),t.attrs[a])}function gE(e,t,s){const i=cx(e,t,s);for(const a in e)if(Bs(e[a])||Bs(t[a])){const l=hl.indexOf(a)!==-1?"attr"+a.charAt(0).toUpperCase()+a.substring(1):a;i[l]=e[a]}return i}class gL extends aE{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=gs}getBaseTargetFromProps(t,s){return t[s]}readValueFromInstance(t,s){if(fl.has(s)){const i=YN(s);return i&&i.default||0}return s=mE.has(s)?s:tx(s),t.getAttribute(s)}scrapeMotionValuesFromProps(t,s,i){return gE(t,s,i)}build(t,s,i){fE(t,s,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(t,s,i,a){pL(t,s,i,a)}mount(t){this.isSVGTag=pE(t.tagName),super.mount(t)}}const bL=ox.length;function bE(e){if(!e)return;if(!e.isControllingVariants){const s=e.parent?bE(e.parent)||{}:{};return e.props.initial!==void 0&&(s.initial=e.props.initial),s}const t={};for(let s=0;s<bL;s++){const i=ox[s],a=e.props[i];(Xc(a)||a===!1)&&(t[i]=a)}return t}function xE(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 xL=[...ax].reverse(),vL=ax.length;function _L(e){return t=>Promise.all(t.map(({animation:s,options:i})=>gO(e,s,i)))}function yL(e){let t=_L(e),s=CS(),i=!0,a=!1;const l=d=>(p,g)=>{const v=Ga(e,g,d==="exit"?e.presenceContext?.custom:void 0);if(v){const{transition:_,transitionEnd:S,...w}=v;p={...p,...w,...S}}return p};function u(d){t=d(e)}function h(d){const{props:p}=e,g=bE(e.parent)||{},v=[],_=new Set;let S={},w=1/0;for(let E=0;E<vL;E++){const T=xL[E],N=s[T],j=p[T]!==void 0?p[T]:g[T],R=Xc(j),z=T===d?N.isActive:null;z===!1&&(w=E);let D=j===g[T]&&j!==p[T]&&R;if(D&&(i||a)&&e.manuallyAnimateOnMount&&(D=!1),N.protectedKeys={...S},!N.isActive&&z===null||!j&&!N.prevProp||cf(j)||typeof j=="boolean")continue;if(T==="exit"&&N.isActive&&z!==!0){N.prevResolvedValues&&(S={...S,...N.prevResolvedValues});continue}const M=SL(N.prevProp,j);let $=M||T===d&&N.isActive&&!D&&R||E>w&&R,L=!1;const B=Array.isArray(j)?j:[j];let P=B.reduce(l(T),{});z===!1&&(P={});const{prevResolvedValues:F={}}=N,V={...F,...P},G=X=>{$=!0,_.has(X)&&(L=!0,_.delete(X)),N.needsAnimating[X]=!0;const W=e.getValue(X);W&&(W.liveStyle=!1)};for(const X in V){const W=P[X],ee=F[X];if(S.hasOwnProperty(X))continue;let O=!1;x0(W)&&x0(ee)?O=!xE(W,ee):O=W!==ee,O?W!=null?G(X):_.add(X):W!==void 0&&_.has(X)?G(X):N.protectedKeys[X]=!0}N.prevProp=j,N.prevResolvedValues=P,N.isActive&&(S={...S,...P}),(i||a)&&e.blockInitialAnimation&&($=!1);const I=D&&M;$&&(!I||L)&&v.push(...B.map(X=>{const W={type:T};if(typeof X=="string"&&(i||a)&&!I&&e.manuallyAnimateOnMount&&e.parent){const{parent:ee}=e,O=Ga(ee,X);if(ee.enteringChildren&&O){const{delayChildren:Z}=O.transition||{};W.delay=$N(ee.enteringChildren,e,Z)}}return{animation:X,options:W}}))}if(_.size){const E={};if(typeof p.initial!="boolean"){const T=Ga(e,Array.isArray(p.initial)?p.initial[0]:p.initial);T&&T.transition&&(E.transition=T.transition)}_.forEach(T=>{const N=e.getBaseTarget(T),j=e.getValue(T);j&&(j.liveStyle=!0),E[T]=N??null}),v.push({animation:E})}let C=!!v.length;return i&&(p.initial===!1||p.initial===p.animate)&&!e.manuallyAnimateOnMount&&(C=!1),i=!1,a=!1,C?t(v):Promise.resolve()}function m(d,p){if(s[d].isActive===p)return Promise.resolve();e.variantChildren?.forEach(v=>v.animationState?.setActive(d,p)),s[d].isActive=p;const g=h(d);for(const v in s)s[v].protectedKeys={};return g}return{animateChanges:h,setActive:m,setAnimateFunction:u,getState:()=>s,reset:()=>{s=CS(),a=!0}}}function SL(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!xE(t,e):!1}function Oa(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function CS(){return{animate:Oa(!0),whileInView:Oa(),whileHover:Oa(),whileTap:Oa(),whileDrag:Oa(),whileFocus:Oa(),exit:Oa()}}function E0(e,t){e.min=t.min,e.max=t.max}function oi(e,t){E0(e.x,t.x),E0(e.y,t.y)}function NS(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const vE=1e-4,wL=1-vE,kL=1+vE,_E=.01,CL=0-_E,NL=0+_E;function Js(e){return e.max-e.min}function EL(e,t,s){return Math.abs(e-t)<=s}function ES(e,t,s,i=.5){e.origin=i,e.originPoint=Dt(t.min,t.max,e.origin),e.scale=Js(s)/Js(t),e.translate=Dt(s.min,s.max,e.origin)-e.originPoint,(e.scale>=wL&&e.scale<=kL||isNaN(e.scale))&&(e.scale=1),(e.translate>=CL&&e.translate<=NL||isNaN(e.translate))&&(e.translate=0)}function $c(e,t,s,i){ES(e.x,t.x,s.x,i?i.originX:void 0),ES(e.y,t.y,s.y,i?i.originY:void 0)}function TS(e,t,s,i=0){const a=i?Dt(s.min,s.max,i):s.min;e.min=a+t.min,e.max=e.min+Js(t)}function TL(e,t,s,i){TS(e.x,t.x,s.x,i?.x),TS(e.y,t.y,s.y,i?.y)}function jS(e,t,s,i=0){const a=i?Dt(s.min,s.max,i):s.min;e.min=t.min-a,e.max=e.min+Js(t)}function Oh(e,t,s,i){jS(e.x,t.x,s.x,i?.x),jS(e.y,t.y,s.y,i?.y)}function AS(e,t,s,i,a){return e-=t,e=Dh(e,1/s,i),a!==void 0&&(e=Dh(e,1/a,i)),e}function jL(e,t=0,s=1,i=.5,a,l=e,u=e){if(Ai.test(t)&&(t=parseFloat(t),t=Dt(u.min,u.max,t/100)-u.min),typeof t!="number")return;let h=Dt(l.min,l.max,i);e===l&&(h-=t),e.min=AS(e.min,t,s,h,a),e.max=AS(e.max,t,s,h,a)}function MS(e,t,[s,i,a],l,u){jL(e,t[s],t[i],t[a],t.scale,l,u)}const AL=["x","scaleX","originX"],ML=["y","scaleY","originY"];function RS(e,t,s,i){MS(e.x,t,AL,s?s.x:void 0,i?i.x:void 0),MS(e.y,t,ML,s?s.y:void 0,i?i.y:void 0)}function DS(e){return e.translate===0&&e.scale===1}function yE(e){return DS(e.x)&&DS(e.y)}function OS(e,t){return e.min===t.min&&e.max===t.max}function RL(e,t){return OS(e.x,t.x)&&OS(e.y,t.y)}function LS(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function SE(e,t){return LS(e.x,t.x)&&LS(e.y,t.y)}function zS(e){return Js(e.x)/Js(e.y)}function BS(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Ei(e){return[e("x"),e("y")]}function DL(e,t,s){let i="";const a=e.x.translate/t.x,l=e.y.translate/t.y,u=s?.z||0;if((a||l||u)&&(i=`translate3d(${a}px, ${l}px, ${u}px) `),(t.x!==1||t.y!==1)&&(i+=`scale(${1/t.x}, ${1/t.y}) `),s){const{transformPerspective:d,rotate:p,rotateX:g,rotateY:v,skewX:_,skewY:S}=s;d&&(i=`perspective(${d}px) ${i}`),p&&(i+=`rotate(${p}deg) `),g&&(i+=`rotateX(${g}deg) `),v&&(i+=`rotateY(${v}deg) `),_&&(i+=`skewX(${_}deg) `),S&&(i+=`skewY(${S}deg) `)}const h=e.x.scale*t.x,m=e.y.scale*t.y;return(h!==1||m!==1)&&(i+=`scale(${h}, ${m})`),i||"none"}const wE=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],OL=wE.length,IS=e=>typeof e=="string"?parseFloat(e):e,PS=e=>typeof e=="number"||je.test(e);function LL(e,t,s,i,a,l){a?(e.opacity=Dt(0,s.opacity??1,zL(i)),e.opacityExit=Dt(t.opacity??1,0,BL(i))):l&&(e.opacity=Dt(t.opacity??1,s.opacity??1,i));for(let u=0;u<OL;u++){const h=wE[u];let m=$S(t,h),d=$S(s,h);if(m===void 0&&d===void 0)continue;m||(m=0),d||(d=0),m===0||d===0||PS(m)===PS(d)?(e[h]=Math.max(Dt(IS(m),IS(d),i),0),(Ai.test(d)||Ai.test(m))&&(e[h]+="%")):e[h]=d}(t.rotate||s.rotate)&&(e.rotate=Dt(t.rotate||0,s.rotate||0,i))}function $S(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const zL=kE(0,.5,mN),BL=kE(.5,.95,Kn);function kE(e,t,s){return i=>i<e?0:i>t?1:s(Kc(e,t,i))}function IL(e,t,s){const i=Bs(e)?e:ol(e);return i.start(Jb("",i,t,s)),i.animation}function Zc(e,t,s,i={passive:!0}){return e.addEventListener(t,s,i),()=>e.removeEventListener(t,s)}const PL=(e,t)=>e.depth-t.depth;class $L{constructor(){this.children=[],this.isDirty=!1}add(t){$b(this.children,t),this.isDirty=!0}remove(t){Eh(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(PL),this.isDirty=!1,this.children.forEach(t)}}function HL(e,t){const s=Qs.now(),i=({timestamp:a})=>{const l=a-s;l>=t&&(la(i),e(l-t))};return Et.setup(i,!0),()=>la(i)}function ph(e){return Bs(e)?e.get():e}class UL{constructor(){this.members=[]}add(t){$b(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&&(Eh(this.members,i),i.unmount())}t.scheduleRender()}remove(t){if(Eh(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 gh={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Hp=["","X","Y","Z"],FL=1e3;let qL=0;function Up(e,t,s,i){const{latestValues:a}=t;a[e]&&(s[e]=a[e],t.setStaticValue(e,0),i&&(i[e]=0))}function CE(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const s=VN(t);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:a,layoutId:l}=e.options;window.MotionCancelOptimisedAnimation(s,"transform",Et,!(a||l))}const{parent:i}=e;i&&!i.hasCheckedOptimisedAppear&&CE(i)}function NE({attachResizeListener:e,defaultParent:t,measureScroll:s,checkIsScrollRoot:i,resetTransform:a}){return class{constructor(u={},h=t?.()){this.id=qL++,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(WL),this.nodes.forEach(JL),this.nodes.forEach(e7),this.nodes.forEach(KL)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,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 m=0;m<this.path.length;m++)this.path[m].shouldResetTransform=!0;this.root===this&&(this.nodes=new $L)}addEventListener(u,h){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Ub),this.eventHandlers.get(u).add(h)}notifyListeners(u,...h){const m=this.eventHandlers.get(u);m&&m.notify(...h)}hasListeners(u){return this.eventHandlers.has(u)}mount(u){if(this.instance)return;this.isSVG=rx(u)&&!GO(u),this.instance=u;const{layoutId:h,layout:m,visualElement:d}=this.options;if(d&&!d.current&&d.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(m||h)&&(this.isLayoutDirty=!0),e){let p,g=0;const v=()=>this.root.updateBlockedByResize=!1;Et.read(()=>{g=window.innerWidth}),e(u,()=>{const _=window.innerWidth;_!==g&&(g=_,this.root.updateBlockedByResize=!0,p&&p(),p=HL(v,250),gh.hasAnimatedSinceResize&&(gh.hasAnimatedSinceResize=!1,this.nodes.forEach(FS)))})}h&&this.root.registerSharedNode(h,this),this.options.animate!==!1&&d&&(h||m)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:g,hasRelativeLayoutChanged:v,layout:_})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const S=this.options.transition||d.getDefaultTransition()||r7,{onLayoutAnimationStart:w,onLayoutAnimationComplete:C}=d.getProps(),E=!this.targetLayout||!SE(this.targetLayout,_),T=!g&&v;if(this.options.layoutRoot||this.resumeFrom||T||g&&(E||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const N={...Qb(S,"layout"),onPlay:w,onComplete:C};(d.shouldReduceMotion||this.options.layoutRoot)&&(N.delay=0,N.type=!1),this.startAnimation(N),this.setAnimationOrigin(p,T)}else g||FS(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=_})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const u=this.getStack();u&&u.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),la(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(t7),this.animationId++)}getTransformTemplate(){const{visualElement:u}=this.options;return u&&u.getProps().transformTemplate}willUpdate(u=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&CE(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:m}=this.options;if(h===void 0&&!m)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const m=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),m&&this.nodes.forEach(XL),this.nodes.forEach(HS);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(US);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(ZL),this.nodes.forEach(QL),this.nodes.forEach(VL),this.nodes.forEach(GL)):this.nodes.forEach(US),this.clearAllSnapshots();const h=Qs.now();Ls.delta=Di(0,1e3/60,h-Ls.timestamp),Ls.timestamp=h,Ls.isProcessing=!0,Dp.update.process(Ls),Dp.preRender.process(Ls),Dp.render.process(Ls),Ls.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,nx.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(YL),this.sharedNodes.forEach(s7)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Et.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Et.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Js(this.snapshot.measuredBox.x)&&!Js(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 m=0;m<this.path.length;m++)this.path[m].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=gs()),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,u?u.layoutBox:void 0)}updateScroll(u="measure"){let h=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(h=!1),h&&this.instance){const m=i(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:m,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:m}}}resetTransform(){if(!a)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,h=this.projectionDelta&&!yE(this.projectionDelta),m=this.getTransformTemplate(),d=m?m(this.latestValues,""):void 0,p=d!==this.prevTransformTemplateValue;u&&this.instance&&(h||Ba(this.latestValues)||p)&&(a(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const h=this.measurePageBox();let m=this.removeElementScroll(h);return u&&(m=this.removeTransform(m)),a7(m),{animationId:this.root.animationId,measuredBox:h,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:u}=this.options;if(!u)return gs();const h=u.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(o7))){const{scroll:d}=this.root;d&&(Ti(h.x,d.offset.x),Ti(h.y,d.offset.y))}return h}removeElementScroll(u){const h=gs();if(oi(h,u),this.scroll?.wasRoot)return h;for(let m=0;m<this.path.length;m++){const d=this.path[m],{scroll:p,options:g}=d;d!==this.root&&p&&g.layoutScroll&&(p.wasRoot&&oi(h,u),Ti(h.x,p.offset.x),Ti(h.y,p.offset.y))}return h}applyTransform(u,h=!1,m){const d=m||gs();oi(d,u);for(let p=0;p<this.path.length;p++){const g=this.path[p];!h&&g.options.layoutScroll&&g.scroll&&g!==g.root&&(Ti(d.x,-g.scroll.offset.x),Ti(d.y,-g.scroll.offset.y)),Ba(g.latestValues)&&mh(d,g.latestValues,g.layout?.layoutBox)}return Ba(this.latestValues)&&mh(d,this.latestValues,this.layout?.layoutBox),d}removeTransform(u){const h=gs();oi(h,u);for(let m=0;m<this.path.length;m++){const d=this.path[m];if(!Ba(d.latestValues))continue;let p;d.instance&&(k0(d.latestValues)&&d.updateSnapshot(),p=gs(),oi(p,d.measurePageBox())),RS(h,d.latestValues,d.snapshot?.layoutBox,p)}return Ba(this.latestValues)&&RS(h,this.latestValues),h}setTargetDelta(u){this.targetDelta=u,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(u){this.options={...this.options,...u,crossfade:u.crossfade!==void 0?u.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!==Ls.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){const h=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=h.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=h.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=h.isSharedProjectionDirty);const m=!!this.resumingFrom||this!==h;if(!(u||m&&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=Ls.timestamp;const v=this.getClosestProjectingParent();v&&this.linkedParentVersion!==v.layoutVersion&&!v.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&v&&v.layout?this.createRelativeTarget(v,this.layout.layoutBox,v.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=gs(),this.targetWithTransforms=gs()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),TL(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):oi(this.target,this.layout.layoutBox),cE(this.target,this.targetDelta)):oi(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&v&&!!v.resumingFrom==!!this.resumingFrom&&!v.options.layoutScroll&&v.target&&this.animationProgress!==1?this.createRelativeTarget(v,this.target,v.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||k0(this.parent.latestValues)||lE(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(u,h,m){this.relativeParent=u,this.linkedParentVersion=u.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=gs(),this.relativeTargetOrigin=gs(),Oh(this.relativeTargetOrigin,h,m,this.options.layoutAnchor||void 0),oi(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const u=this.getLead(),h=!!this.resumingFrom||this!==u;let m=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(m=!1),h&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(m=!1),this.resolvedRelativeTargetAt===Ls.timestamp&&(m=!1),m)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;oi(this.layoutCorrected,this.layout.layoutBox);const g=this.treeScale.x,v=this.treeScale.y;nL(this.layoutCorrected,this.treeScale,this.path,h),u.layout&&!u.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(u.target=u.layout.layoutBox,u.targetWithTransforms=gs());const{target:_}=u;if(!_){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(NS(this.prevProjectionDelta.x,this.projectionDelta.x),NS(this.prevProjectionDelta.y,this.projectionDelta.y)),$c(this.projectionDelta,this.layoutCorrected,_,this.latestValues),(this.treeScale.x!==g||this.treeScale.y!==v||!BS(this.projectionDelta.x,this.prevProjectionDelta.x)||!BS(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",_))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(u=!0){if(this.options.visualElement?.scheduleRender(),u){const h=this.getStack();h&&h.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=el(),this.projectionDelta=el(),this.projectionDeltaWithTransform=el()}setAnimationOrigin(u,h=!1){const m=this.snapshot,d=m?m.latestValues:{},p={...this.latestValues},g=el();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!h;const v=gs(),_=m?m.source:void 0,S=this.layout?this.layout.source:void 0,w=_!==S,C=this.getStack(),E=!C||C.members.length<=1,T=!!(w&&!E&&this.options.crossfade===!0&&!this.path.some(i7));this.animationProgress=0;let N;this.mixTargetDelta=j=>{const R=j/1e3;qS(g.x,u.x,R),qS(g.y,u.y,R),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Oh(v,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),n7(this.relativeTarget,this.relativeTargetOrigin,v,R),N&&RL(this.relativeTarget,N)&&(this.isProjectionDirty=!1),N||(N=gs()),oi(N,this.relativeTarget)),w&&(this.animationValues=p,LL(p,d,this.latestValues,R,T,E)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=R},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(la(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Et.update(()=>{gh.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=ol(0)),this.motionValue.jump(0,!1),this.currentAnimation=IL(this.motionValue,[0,1e3],{...u,velocity:0,isSync:!0,onUpdate:h=>{this.mixTargetDelta(h),u.onUpdate&&u.onUpdate(h)},onStop:()=>{},onComplete:()=>{u.onComplete&&u.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 u=this.getStack();u&&u.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(FL),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:h,target:m,layout:d,latestValues:p}=u;if(!(!h||!m||!d)){if(this!==u&&this.layout&&d&&EE(this.options.animationType,this.layout.layoutBox,d.layoutBox)){m=this.target||gs();const g=Js(this.layout.layoutBox.x);m.x.min=u.target.x.min,m.x.max=m.x.min+g;const v=Js(this.layout.layoutBox.y);m.y.min=u.target.y.min,m.y.max=m.y.min+v}oi(h,m),mh(h,p),$c(this.projectionDeltaWithTransform,this.layoutCorrected,h,p)}}registerSharedNode(u,h){this.sharedNodes.has(u)||this.sharedNodes.set(u,new UL),this.sharedNodes.get(u).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 u=this.getStack();return u?u.lead===this:!0}getLead(){const{layoutId:u}=this.options;return u?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:u}=this.options;return u?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:h,preserveFollowOpacity:m}={}){const d=this.getStack();d&&d.promote(this,m),u&&(this.projectionDelta=void 0,this.needsReset=!0),h&&this.setOptions({transition:h})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let h=!1;const{latestValues:m}=u;if((m.z||m.rotate||m.rotateX||m.rotateY||m.rotateZ||m.skewX||m.skewY)&&(h=!0),!h)return;const d={};m.z&&Up("z",u,d,this.animationValues);for(let p=0;p<Hp.length;p++)Up(`rotate${Hp[p]}`,u,d,this.animationValues),Up(`skew${Hp[p]}`,u,d,this.animationValues);u.render();for(const p in d)u.setStaticValue(p,d[p]),this.animationValues&&(this.animationValues[p]=d[p]);u.scheduleRender()}applyProjectionStyles(u,h){if(!this.instance||this.isSVG)return;if(!this.isVisible){u.visibility="hidden";return}const m=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,u.visibility="",u.opacity="",u.pointerEvents=ph(h?.pointerEvents)||"",u.transform=m?m(this.latestValues,""):"none";return}const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(u.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,u.pointerEvents=ph(h?.pointerEvents)||""),this.hasProjected&&!Ba(this.latestValues)&&(u.transform=m?m({},""):"none",this.hasProjected=!1);return}u.visibility="";const p=d.animationValues||d.latestValues;this.applyTransformsToTarget();let g=DL(this.projectionDeltaWithTransform,this.treeScale,p);m&&(g=m(p,g)),u.transform=g;const{x:v,y:_}=this.projectionDelta;u.transformOrigin=`${v.origin*100}% ${_.origin*100}% 0`,d.animationValues?u.opacity=d===this?p.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:p.opacityExit:u.opacity=d===this?p.opacity!==void 0?p.opacity:"":p.opacityExit!==void 0?p.opacityExit:0;for(const S in N0){if(p[S]===void 0)continue;const{correct:w,applyTo:C,isCSSVariable:E}=N0[S],T=g==="none"?p[S]:w(p[S],d);if(C){const N=C.length;for(let j=0;j<N;j++)u[C[j]]=T}else E?this.options.visualElement.renderState.vars[S]=T:u[S]=T}this.options.layoutId&&(u.pointerEvents=d===this?ph(h?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>u.currentAnimation?.stop()),this.root.nodes.forEach(HS),this.root.sharedNodes.clear()}}}function VL(e){e.updateLayout()}function GL(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")Ei(p=>{const g=l?t.measuredBox[p]:t.layoutBox[p],v=Js(g);g.min=s[p].min,g.max=g.min+v});else if(a==="x"||a==="y"){const p=a==="x"?"y":"x";E0(l?t.measuredBox[p]:t.layoutBox[p],s[p])}else EE(a,t.layoutBox,s)&&Ei(p=>{const g=l?t.measuredBox[p]:t.layoutBox[p],v=Js(s[p]);g.max=g.min+v,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[p].max=e.relativeTarget[p].min+v)});const u=el();$c(u,s,t.layoutBox);const h=el();l?$c(h,e.applyTransform(i,!0),t.measuredBox):$c(h,s,t.layoutBox);const m=!yE(u);let d=!1;if(!e.resumeFrom){const p=e.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:g,layout:v}=p;if(g&&v){const _=e.options.layoutAnchor||void 0,S=gs();Oh(S,t.layoutBox,g.layoutBox,_);const w=gs();Oh(w,s,v.layoutBox,_),SE(S,w)||(d=!0),p.options.layoutRoot&&(e.relativeTarget=w,e.relativeTargetOrigin=S,e.relativeParent=p)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:t,delta:h,layoutDelta:u,hasLayoutChanged:m,hasRelativeLayoutChanged:d})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function WL(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 KL(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function YL(e){e.clearSnapshot()}function HS(e){e.clearMeasurements()}function XL(e){e.isLayoutDirty=!0,e.updateLayout()}function US(e){e.isLayoutDirty=!1}function ZL(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function QL(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function FS(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function JL(e){e.resolveTargetDelta()}function e7(e){e.calcProjection()}function t7(e){e.resetSkewAndRotation()}function s7(e){e.removeLeadSnapshot()}function qS(e,t,s){e.translate=Dt(t.translate,0,s),e.scale=Dt(t.scale,1,s),e.origin=t.origin,e.originPoint=t.originPoint}function VS(e,t,s,i){e.min=Dt(t.min,s.min,i),e.max=Dt(t.max,s.max,i)}function n7(e,t,s,i){VS(e.x,t.x,s.x,i),VS(e.y,t.y,s.y,i)}function i7(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const r7={duration:.45,ease:[.4,0,.1,1]},GS=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),WS=GS("applewebkit/")&&!GS("chrome/")?Math.round:Kn;function KS(e){e.min=WS(e.min),e.max=WS(e.max)}function a7(e){KS(e.x),KS(e.y)}function EE(e,t,s){return e==="position"||e==="preserve-aspect"&&!EL(zS(t),zS(s),.2)}function o7(e){return e!==e.root&&e.scroll?.wasRoot}const l7=NE({attachResizeListener:(e,t)=>Zc(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Fp={current:void 0},TE=NE({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Fp.current){const e=new l7({});e.mount(window),e.setOptions({layoutScroll:!0}),Fp.current=e}return Fp.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),jE=y.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function c7(e=!0){const t=y.useContext(Pb);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 u=y.useCallback(()=>e&&i&&i(l),[l,i,e]);return!s&&i?[!1,u]:[!0]}const AE=y.createContext({strict:!1}),YS={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 XS=!1;function u7(){if(XS)return;const e={};for(const t in YS)e[t]={isEnabled:s=>YS[t].some(i=>!!s[i])};rE(e),XS=!0}function ME(){return u7(),JO()}function d7(e){const t=ME();for(const s in e)t[s]={...t[s],...e[s]};rE(t)}const h7=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 Lh(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||h7.has(e)}let RE=e=>!Lh(e);function f7(e){typeof e=="function"&&(RE=t=>t.startsWith("on")?!Lh(t):e(t))}try{f7(require("@emotion/is-prop-valid").default)}catch{}function m7(e,t,s){const i={};for(const a in e)a==="values"&&typeof e.values=="object"||Bs(e[a])||(RE(a)||s===!0&&Lh(a)||!t&&!Lh(a)||e.draggable&&a.startsWith("onDrag"))&&(i[a]=e[a]);return i}const df=y.createContext({});function p7(e,t){if(uf(e)){const{initial:s,animate:i}=e;return{initial:s===!1||Xc(s)?s:void 0,animate:Xc(i)?i:void 0}}return e.inherit!==!1?t:{}}function g7(e){const{initial:t,animate:s}=p7(e,y.useContext(df));return y.useMemo(()=>({initial:t,animate:s}),[ZS(t),ZS(s)])}function ZS(e){return Array.isArray(e)?e.join(" "):e}const ux=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function DE(e,t,s){for(const i in t)!Bs(t[i])&&!hE(i,s)&&(e[i]=t[i])}function b7({transformTemplate:e},t){return y.useMemo(()=>{const s=ux();return lx(s,t,e),Object.assign({},s.vars,s.style)},[t])}function x7(e,t){const s=e.style||{},i={};return DE(i,s,e),Object.assign(i,b7(e,t)),i}function v7(e,t){const s={},i=x7(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 OE=()=>({...ux(),attrs:{}});function _7(e,t,s,i){const a=y.useMemo(()=>{const l=OE();return fE(l,t,pE(i),e.transformTemplate,e.style),{...l.attrs,style:{...l.style}}},[t]);if(e.style){const l={};DE(l,e.style,e),a.style={...l,...a.style}}return a}const y7=["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 dx(e){return typeof e!="string"||e.includes("-")?!1:!!(y7.indexOf(e)>-1||/[A-Z]/u.test(e))}function S7(e,t,s,{latestValues:i},a,l=!1,u){const m=(u??dx(e)?_7:v7)(t,i,a,e),d=m7(t,typeof e=="string",l),p=e!==y.Fragment?{...d,...m,ref:s}:{},{children:g}=t,v=y.useMemo(()=>Bs(g)?g.get():g,[g]);return y.createElement(e,{...p,children:v})}function w7({scrapeMotionValuesFromProps:e,createRenderState:t},s,i,a){return{latestValues:k7(s,i,a,e),renderState:t()}}function k7(e,t,s,i){const a={},l=i(e,{});for(const v in l)a[v]=ph(l[v]);let{initial:u,animate:h}=e;const m=uf(e),d=nE(e);t&&d&&!m&&e.inherit!==!1&&(u===void 0&&(u=t.initial),h===void 0&&(h=t.animate));let p=s?s.initial===!1:!1;p=p||u===!1;const g=p?h:u;if(g&&typeof g!="boolean"&&!cf(g)){const v=Array.isArray(g)?g:[g];for(let _=0;_<v.length;_++){const S=ex(e,v[_]);if(S){const{transitionEnd:w,transition:C,...E}=S;for(const T in E){let N=E[T];if(Array.isArray(N)){const j=p?N.length-1:0;N=N[j]}N!==null&&(a[T]=N)}for(const T in w)a[T]=w[T]}}}return a}const LE=e=>(t,s)=>{const i=y.useContext(df),a=y.useContext(Pb),l=()=>w7(e,t,i,a);return s?l():y8(l)},C7=LE({scrapeMotionValuesFromProps:cx,createRenderState:ux}),N7=LE({scrapeMotionValuesFromProps:gE,createRenderState:OE}),E7=Symbol.for("motionComponentSymbol");function T7(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 u=i.current;if(typeof u=="function")if(l){const h=u(l);typeof h=="function"&&(a.current=h)}else a.current?(a.current(),a.current=null):u(l);else u&&(u.current=l);t&&(l?t.mount(l):t.unmount())},[t])}const zE=y.createContext({});function Xo(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function j7(e,t,s,i,a,l){const{visualElement:u}=y.useContext(df),h=y.useContext(AE),m=y.useContext(Pb),d=y.useContext(jE),p=d.reducedMotion,g=d.skipAnimations,v=y.useRef(null),_=y.useRef(!1);i=i||h.renderer,!v.current&&i&&(v.current=i(e,{visualState:t,parent:u,props:s,presenceContext:m,blockInitialAnimation:m?m.initial===!1:!1,reducedMotionConfig:p,skipAnimations:g,isSVG:l}),_.current&&v.current&&(v.current.manuallyAnimateOnMount=!0));const S=v.current,w=y.useContext(zE);S&&!S.projection&&a&&(S.type==="html"||S.type==="svg")&&A7(v.current,s,a,w);const C=y.useRef(!1);y.useInsertionEffect(()=>{S&&C.current&&S.update(s,m)});const E=s[qN],T=y.useRef(!!E&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(E)&&window.MotionHasOptimisedAnimation?.(E));return w8(()=>{_.current=!0,S&&(C.current=!0,window.MotionIsMounted=!0,S.updateFeatures(),S.scheduleRenderMicrotask(),T.current&&S.animationState&&S.animationState.animateChanges())}),y.useEffect(()=>{S&&(!T.current&&S.animationState&&S.animationState.animateChanges(),T.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(E)}),T.current=!1),S.enteringChildren=void 0)}),S}function A7(e,t,s,i){const{layoutId:a,layout:l,drag:u,dragConstraints:h,layoutScroll:m,layoutRoot:d,layoutAnchor:p,layoutCrossfade:g}=t;e.projection=new s(e.latestValues,t["data-framer-portal-id"]?void 0:BE(e.parent)),e.projection.setOptions({layoutId:a,layout:l,alwaysMeasureLayout:!!u||h&&Xo(h),visualElement:e,animationType:typeof l=="string"?l:"both",initialPromotionConfig:i,crossfade:g,layoutScroll:m,layoutRoot:d,layoutAnchor:p})}function BE(e){if(e)return e.options.allowProjection!==!1?e.projection:BE(e.parent)}function qp(e,{forwardMotionProps:t=!1,type:s}={},i,a){i&&d7(i);const l=s?s==="svg":dx(e),u=l?N7:C7;function h(d,p){let g;const v={...y.useContext(jE),...d,layoutId:M7(d)},{isStatic:_}=v,S=g7(d),w=u(d,_);if(!_&&typeof window<"u"){R7();const C=D7(v);g=C.MeasureLayout,S.visualElement=j7(e,w,v,a,C.ProjectionNode,l)}return o.jsxs(df.Provider,{value:S,children:[g&&S.visualElement?o.jsx(g,{visualElement:S.visualElement,...v}):null,S7(e,d,T7(w,S.visualElement,p),w,_,t,l)]})}h.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const m=y.forwardRef(h);return m[E7]=e,m}function M7({layoutId:e}){const t=y.useContext(sN).id;return t&&e!==void 0?t+"-"+e:e}function R7(e,t){y.useContext(AE).strict}function D7(e){const t=ME(),{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 O7(e,t){if(typeof Proxy>"u")return qp;const s=new Map,i=(l,u)=>qp(l,u,e,t),a=(l,u)=>i(l,u);return new Proxy(a,{get:(l,u)=>u==="create"?i:(s.has(u)||s.set(u,qp(u,void 0,e,t)),s.get(u))})}const L7=(e,t)=>t.isSVG??dx(e)?new gL(t):new uL(t,{allowProjection:e!==y.Fragment});class z7 extends ha{constructor(t){super(t),t.animationState||(t.animationState=yL(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();cf(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 B7=0;class I7 extends ha{constructor(){super(...arguments),this.id=B7++,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:u}=this.node.getProps();if(typeof l=="string"){const h=Ga(this.node,l,u);if(h){const{transition:m,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 P7={animation:{Feature:z7},exit:{Feature:I7}};function fu(e){return{point:{x:e.pageX,y:e.pageY}}}const $7=e=>t=>ix(t)&&e(t,fu(t));function Hc(e,t,s,i){return Zc(e,t,$7(s),i)}const IE=({current:e})=>e?e.ownerDocument.defaultView:null,QS=(e,t)=>Math.abs(e-t);function H7(e,t){const s=QS(e.x,t.x),i=QS(e.y,t.y);return Math.sqrt(s**2+i**2)}const JS=new Set(["auto","scroll"]);class PE{constructor(t,s,{transformPagePoint:i,contextWindow:a=window,dragSnapToOrigin:l=!1,distanceThreshold:u=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=_=>{this.handleScroll(_.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Ud(this.lastRawMoveEventInfo,this.transformPagePoint));const _=Vp(this.lastMoveEventInfo,this.history),S=this.startEvent!==null,w=H7(_.offset,{x:0,y:0})>=this.distanceThreshold;if(!S&&!w)return;const{point:C}=_,{timestamp:E}=Ls;this.history.push({...C,timestamp:E});const{onStart:T,onMove:N}=this.handlers;S||(T&&T(this.lastMoveEvent,_),this.startEvent=this.lastMoveEvent),N&&N(this.lastMoveEvent,_)},this.handlePointerMove=(_,S)=>{this.lastMoveEvent=_,this.lastRawMoveEventInfo=S,this.lastMoveEventInfo=Ud(S,this.transformPagePoint),Et.update(this.updatePoint,!0)},this.handlePointerUp=(_,S)=>{this.end();const{onEnd:w,onSessionEnd:C,resumeAnimation:E}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&E&&E(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const T=Vp(_.type==="pointercancel"?this.lastMoveEventInfo:Ud(S,this.transformPagePoint),this.history);this.startEvent&&w&&w(_,T),C&&C(_,T)},!ix(t))return;this.dragSnapToOrigin=l,this.handlers=s,this.transformPagePoint=i,this.distanceThreshold=u,this.contextWindow=a||window;const m=fu(t),d=Ud(m,this.transformPagePoint),{point:p}=d,{timestamp:g}=Ls;this.history=[{...p,timestamp:g}];const{onSessionStart:v}=s;v&&v(t,Vp(d,this.history)),this.removeListeners=uu(Hc(this.contextWindow,"pointermove",this.handlePointerMove),Hc(this.contextWindow,"pointerup",this.handlePointerUp),Hc(this.contextWindow,"pointercancel",this.handlePointerUp)),h&&this.startScrollTracking(h)}startScrollTracking(t){let s=t.parentElement;for(;s;){const i=getComputedStyle(s);(JS.has(i.overflowX)||JS.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),Et.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),la(this.updatePoint)}}function Ud(e,t){return t?{point:t(e.point)}:e}function ew(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Vp({point:e},t){return{point:e,delta:ew(e,$E(t)),offset:ew(e,U7(t)),velocity:F7(t,.1)}}function U7(e){return e[0]}function $E(e){return e[e.length-1]}function F7(e,t){if(e.length<2)return{x:0,y:0};let s=e.length-1,i=null;const a=$E(e);for(;s>=0&&(i=e[s],!(a.timestamp-i.timestamp>An(t)));)s--;if(!i)return{x:0,y:0};i===e[0]&&e.length>2&&a.timestamp-i.timestamp>An(t)*2&&(i=e[1]);const l=Wn(a.timestamp-i.timestamp);if(l===0)return{x:0,y:0};const u={x:(a.x-i.x)/l,y:(a.y-i.y)/l};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}function q7(e,{min:t,max:s},i){return t!==void 0&&e<t?e=i?Dt(t,e,i.min):Math.max(e,t):s!==void 0&&e>s&&(e=i?Dt(s,e,i.max):Math.min(e,s)),e}function tw(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 V7(e,{top:t,left:s,bottom:i,right:a}){return{x:tw(e.x,s,a),y:tw(e.y,t,i)}}function sw(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 G7(e,t){return{x:sw(e.x,t.x),y:sw(e.y,t.y)}}function W7(e,t){let s=.5;const i=Js(e),a=Js(t);return a>i?s=Kc(t.min,t.max-i,e.min):i>a&&(s=Kc(e.min,e.max-a,t.min)),Di(0,1,s)}function K7(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 T0=.35;function Y7(e=T0){return e===!1?e=0:e===!0&&(e=T0),{x:nw(e,"left","right"),y:nw(e,"top","bottom")}}function nw(e,t,s){return{min:iw(e,t),max:iw(e,s)}}function iw(e,t){return typeof e=="number"?e:e[t]||0}const X7=new WeakMap;class Z7{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=gs(),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(fu(g).point),this.stopAnimation()},u=(g,v)=>{const{drag:_,dragPropagation:S,onDragStart:w}=this.getProps();if(_&&!S&&(this.openDragLock&&this.openDragLock(),this.openDragLock=jO(_),!this.openDragLock))return;this.latestPointerEvent=g,this.latestPanInfo=v,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ei(E=>{let T=this.getAxisMotionValue(E).get()||0;if(Ai.test(T)){const{projection:N}=this.visualElement;if(N&&N.layout){const j=N.layout.layoutBox[E];j&&(T=Js(j)*(parseFloat(T)/100))}}this.originPoint[E]=T}),w&&Et.update(()=>w(g,v),!1,!0),v0(this.visualElement,"transform");const{animationState:C}=this.visualElement;C&&C.setActive("whileDrag",!0)},h=(g,v)=>{this.latestPointerEvent=g,this.latestPanInfo=v;const{dragPropagation:_,dragDirectionLock:S,onDirectionLock:w,onDrag:C}=this.getProps();if(!_&&!this.openDragLock)return;const{offset:E}=v;if(S&&this.currentDirection===null){this.currentDirection=J7(E),this.currentDirection!==null&&w&&w(this.currentDirection);return}this.updateAxis("x",v.point,E),this.updateAxis("y",v.point,E),this.visualElement.render(),C&&Et.update(()=>C(g,v),!1,!0)},m=(g,v)=>{this.latestPointerEvent=g,this.latestPanInfo=v,this.stop(g,v),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 PE(t,{onSessionStart:l,onStart:u,onMove:h,onSessionEnd:m,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:p,distanceThreshold:i,contextWindow:IE(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:u}=a;this.startAnimation(u);const{onDragEnd:h}=this.getProps();h&&Et.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||!Fd(t,a,this.currentDirection))return;const l=this.getAxisMotionValue(t);let u=this.originPoint[t]+i[t];this.constraints&&this.constraints[t]&&(u=q7(u,this.constraints[t],this.elastic[t])),l.set(u)}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&&Xo(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&i?this.constraints=V7(i.layoutBox,t):this.constraints=!1,this.elastic=Y7(s),a!==this.constraints&&!Xo(t)&&i&&this.constraints&&!this.hasMutatedConstraints&&Ei(l=>{this.constraints!==!1&&this.getAxisMotionValue(l)&&(this.constraints[l]=K7(i.layoutBox[l],this.constraints[l]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:s}=this.getProps();if(!t||!Xo(t))return!1;const i=t.current,{projection:a}=this.visualElement;if(!a||!a.layout)return!1;const l=iL(i,a.root,this.visualElement.getTransformPagePoint());let u=G7(a.layout.layoutBox,l);if(s){const h=s(tL(u));this.hasMutatedConstraints=!!h,h&&(u=oE(h))}return u}startAnimation(t){const{drag:s,dragMomentum:i,dragElastic:a,dragTransition:l,dragSnapToOrigin:u,onDragTransitionEnd:h}=this.getProps(),m=this.constraints||{},d=Ei(p=>{if(!Fd(p,s,this.currentDirection))return;let g=m&&m[p]||{};(u===!0||u===p)&&(g={min:0,max:0});const v=a?200:1e6,_=a?40:1e7,S={type:"inertia",velocity:i?t[p]:0,bounceStiffness:v,bounceDamping:_,timeConstant:750,restDelta:1,restSpeed:10,...l,...g};return this.startAxisValueAnimation(p,S)});return Promise.all(d).then(h)}startAxisValueAnimation(t,s){const i=this.getAxisMotionValue(t);return v0(this.visualElement,t),i.start(Jb(t,i,0,s,this.visualElement,!1))}stopAnimation(){Ei(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){Ei(s=>{const{drag:i}=this.getProps();if(!Fd(s,i,this.currentDirection))return;const{projection:a}=this.visualElement,l=this.getAxisMotionValue(s);if(a&&a.layout){const{min:u,max:h}=a.layout.layoutBox[s],m=l.get()||0;l.set(t[s]-Dt(u,h,.5)+m)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:s}=this.getProps(),{projection:i}=this.visualElement;if(!Xo(s)||!i||!this.constraints)return;this.stopAnimation();const a={x:0,y:0};Ei(u=>{const h=this.getAxisMotionValue(u);if(h&&this.constraints!==!1){const m=h.get();a[u]=W7({min:m,max:m},this.constraints[u])}});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(),Ei(u=>{if(!Fd(u,t,null))return;const h=this.getAxisMotionValue(u),{min:m,max:d}=this.constraints[u];h.set(Dt(m,d,a[u]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;X7.set(this.visualElement,this);const t=this.visualElement.current,s=Hc(t,"pointerdown",d=>{const{drag:p,dragListener:g=!0}=this.getProps(),v=d.target,_=v!==t&&LO(v);p&&g&&!_&&this.start(d)});let i;const a=()=>{const{dragConstraints:d}=this.getProps();Xo(d)&&d.current&&(this.constraints=this.resolveRefConstraints(),i||(i=Q7(t,d.current,()=>this.scalePositionWithinConstraints())))},{projection:l}=this.visualElement,u=l.addEventListener("measure",a);l&&!l.layout&&(l.root&&l.root.updateScroll(),l.updateLayout()),Et.read(a);const h=Zc(window,"resize",()=>this.scalePositionWithinConstraints()),m=l.addEventListener("didUpdate",(({delta:d,hasLayoutChanged:p})=>{this.isDragging&&p&&(Ei(g=>{const v=this.getAxisMotionValue(g);v&&(this.originPoint[g]+=d[g].translate,v.set(v.get()+d[g].translate))}),this.visualElement.render())}));return()=>{h(),s(),u(),m&&m(),i&&i()}}getProps(){const t=this.visualElement.getProps(),{drag:s=!1,dragDirectionLock:i=!1,dragPropagation:a=!1,dragConstraints:l=!1,dragElastic:u=T0,dragMomentum:h=!0}=t;return{...t,drag:s,dragDirectionLock:i,dragPropagation:a,dragConstraints:l,dragElastic:u,dragMomentum:h}}}function rw(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function Q7(e,t,s){const i=mS(e,rw(s)),a=mS(t,rw(s));return()=>{i(),a()}}function Fd(e,t,s){return(t===!0||t===e)&&(s===null||s===e)}function J7(e,t=10){let s=null;return Math.abs(e.y)>t?s="y":Math.abs(e.x)>t&&(s="x"),s}class e9 extends ha{constructor(t){super(t),this.removeGroupControls=Kn,this.removeListeners=Kn,this.controls=new Z7(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Kn}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 Gp=e=>(t,s)=>{e&&Et.update(()=>e(t,s),!1,!0)};class t9 extends ha{constructor(){super(...arguments),this.removePointerDownListener=Kn}onPointerDown(t){this.session=new PE(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:IE(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:s,onPan:i,onPanEnd:a}=this.node.getProps();return{onSessionStart:Gp(t),onStart:Gp(s),onMove:Gp(i),onEnd:(l,u)=>{delete this.session,a&&Et.postRender(()=>a(l,u))}}}mount(){this.removePointerDownListener=Hc(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 Wp=!1;class s9 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),Wp&&l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),gh.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:s,visualElement:i,drag:a,isPresent:l}=this.props,{projection:u}=i;return u&&(u.isPresent=l,t.layoutDependency!==s&&u.setOptions({...u.options,layoutDependency:s}),Wp=!0,a||t.layoutDependency!==s||s===void 0||t.isPresent!==l?u.willUpdate():this.safeToRemove(),t.isPresent!==l&&(l?u.promote():u.relegate()||Et.postRender(()=>{const h=u.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(),nx.postRender(()=>{!i.currentAnimation&&i.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:s,switchLayoutGroup:i}=this.props,{projection:a}=t;Wp=!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 HE(e){const[t,s]=c7(),i=y.useContext(sN);return o.jsx(s9,{...e,layoutGroup:i,switchLayoutGroup:y.useContext(zE),isPresent:t,safeToRemove:s})}const n9={pan:{Feature:t9},drag:{Feature:e9,ProjectionNode:TE,MeasureLayout:HE}};function aw(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&&Et.postRender(()=>l(t,fu(t)))}class i9 extends ha{mount(){const{current:t}=this.node;t&&(this.unmount=MO(t,(s,i)=>(aw(this.node,i,"Start"),a=>aw(this.node,a,"End"))))}unmount(){}}class r9 extends ha{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=uu(Zc(this.node.current,"focus",()=>this.onFocus()),Zc(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function ow(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&&Et.postRender(()=>l(t,fu(t)))}class a9 extends ha{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:s,propagate:i}=this.node.props;this.unmount=BO(t,(a,l)=>(ow(this.node,l,"Start"),(u,{success:h})=>ow(this.node,u,h?"End":"Cancel")),{useGlobalTarget:s,stopPropagation:i?.tap===!1})}unmount(){}}const j0=new WeakMap,Kp=new WeakMap,o9=e=>{const t=j0.get(e.target);t&&t(e)},l9=e=>{e.forEach(o9)};function c9({root:e,...t}){const s=e||document;Kp.has(s)||Kp.set(s,{});const i=Kp.get(s),a=JSON.stringify(t);return i[a]||(i[a]=new IntersectionObserver(l9,{root:e,...t})),i[a]}function u9(e,t,s){const i=c9(t);return j0.set(e,s),i.observe(e),()=>{j0.delete(e),i.unobserve(e)}}const d9={some:0,all:1};class h9 extends ha{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,u={root:s?s.current:void 0,rootMargin:i,threshold:typeof a=="number"?a:d9[a]},h=m=>{const{isIntersecting:d}=m;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(),v=d?p:g;v&&v(m)};this.stopObserver=u9(this.node.current,u,h)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:s}=this.node;["amount","margin","root"].some(f9(t,s))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function f9({viewport:e={}},{viewport:t={}}={}){return s=>e[s]!==t[s]}const m9={inView:{Feature:h9},tap:{Feature:a9},focus:{Feature:r9},hover:{Feature:i9}},p9={layout:{ProjectionNode:TE,MeasureLayout:HE}},g9={...P7,...m9,...n9,...p9},Yp=O7(g9,L7),Pe=({label:e,children:t,variant:s="primary",size:i="medium",icon:a,onClick:l,removable:u=!1,className:h,maxWidth:m,appearance:d,onRemove:p,isLoading:g=!1})=>{const v=b9(s),_=d??(s==="outline"?"outline":"solid"),S=e??t,w=!!l,C={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=j=>{j.stopPropagation(),l?.()},N=j=>{j.stopPropagation(),p?.()};return o.jsxs(Yp.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:w?1.04:1,transition:{duration:.2,ease:"easeInOut",type:"spring"}},onClick:T,style:{maxWidth:m},className:le("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",C[v][_],E[i],w&&"cursor-pointer",h),children:[g?o.jsx(Yp.div,{animate:{rotate:360},transition:{duration:1,ease:"linear",repeat:1/0},className:"flex-shrink-0",children:o.jsx(pt,{className:"size-3.5"})}):a&&o.jsx("span",{className:"flex-shrink-0",children:a}),o.jsx("span",{className:"min-w-0 truncate",children:S}),u&&o.jsx(Yp.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:N,type:"button",children:o.jsx(Gs,{className:"size-3.5"})})]})};function b9(e){return e==="danger"?"error":e==="default"||e==="outline"?"primary":e}const x9=HC("rounded-lg border p-4 text-sm",{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 Qe({className:e,variant:t,...s}){return o.jsx("div",{className:le(x9({variant:t,className:e})),...s})}function zh(e){return le("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 Bh(e){return le("flex size-7 shrink-0 items-center justify-center [&_svg]:size-4 [&_svg]:shrink-0",e)}function Ih(e){return le("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 fi({className:e,...t}){return o.jsx("div",{className:le("rounded-lg border border-border bg-card text-card-foreground",e),...t})}function mi({className:e,...t}){return o.jsx("div",{className:le("grid gap-1.5 p-4",e),...t})}function pi({className:e,...t}){return o.jsx("h3",{className:le("text-sm font-semibold tracking-tight",e),...t})}function Ii({className:e,...t}){return o.jsx("p",{className:le("text-sm text-muted-foreground",e),...t})}function gi({className:e,...t}){return o.jsx("div",{className:le("p-4 pt-0",e),...t})}const lw=100;function v9(){const[e,t]=y.useState([]),[s,i]=y.useState(!1),a=y.useRef(new Set);y.useEffect(()=>{const u=new EventSource("/api/agent/tool-calls/stream");return u.addEventListener("open",()=>i(!0)),u.addEventListener("error",()=>i(!1)),u.addEventListener("tool-call",h=>{try{const m=JSON.parse(h.data);t(d=>{if(a.current.has(m.id))return d;a.current.add(m.id);const p=[...d,m];return p.length>lw&&p.splice(0,p.length-lw),p})}catch{}}),()=>{u.close()}},[]);const l=[...e].reverse();return o.jsxs(fi,{className:"min-w-0 rounded-none border-0 border-b border-border bg-transparent",children:[o.jsxs(mi,{className:"border-b border-border px-3 py-2",children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(qa,{className:"size-4 text-muted-foreground"}),o.jsx(pi,{children:"Live MCP Tool Calls"}),o.jsx(Pe,{variant:"outline",size:"small",children:e.length})]}),o.jsx(Pe,{variant:"outline",size:"small",icon:o.jsx("span",{className:le("inline-block size-1.5 rounded-full",s?"animate-pulse bg-emerald-500":"bg-muted-foreground/60")}),children:s?"live":"reconnecting…"})]}),o.jsx(Ii,{className:"text-xs",children:"Streamed from this NoMoreIDE MCP server. Newest at the top."})]}),o.jsx(gi,{className:"p-0",children:l.length?o.jsx("ul",{className:"max-h-96 divide-y divide-border overflow-auto",children:l.map(u=>o.jsxs("li",{className:"px-3 py-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"truncate font-mono text-xs font-semibold",children:u.tool}),o.jsxs("div",{className:"flex shrink-0 items-center gap-2 font-mono text-[10px] text-muted-foreground",children:[o.jsxs("span",{children:[u.durationMs," ms"]}),o.jsx(Pe,{variant:u.status==="ok"?"success":"error",appearance:"outline",size:"small",children:u.status})]})]}),u.args?o.jsx("div",{className:"mt-0.5 truncate font-mono text-[11px] text-muted-foreground",children:u.args}):null,u.error?o.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-destructive",children:u.error}):null,o.jsx("div",{className:"mt-0.5 font-mono text-[10px] text-muted-foreground/80",children:new Date(u.startedAt).toLocaleTimeString()})]},u.id))}):o.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 _9({agent:e}){return o.jsxs(o.Fragment,{children:[o.jsx(v9,{}),o.jsxs(fi,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[o.jsxs(mi,{className:"border-b border-border px-3 py-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rf,{className:"size-4 text-muted-foreground"}),o.jsx(pi,{children:"Recent Projects"})]}),o.jsx(Pe,{variant:"outline",size:"small",children:e.projects.length})]}),o.jsx(Ii,{className:"text-xs",children:"Most recently active projects known to the agent."})]}),o.jsx(gi,{className:"p-0",children:e.projects.length?o.jsx("ul",{className:"divide-y divide-border",children:e.projects.map(t=>o.jsxs("li",{className:le("flex items-start justify-between gap-3 px-3 py-2",t.current&&"bg-primary/5"),children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"truncate font-mono text-xs font-semibold",children:t.path}),t.current?o.jsx(Pe,{variant:"outline",size:"small",children:"current"}):null]}),t.lastSessionFirstPrompt?o.jsx("p",{className:"mt-0.5 truncate text-[11px] text-muted-foreground",children:t.lastSessionFirstPrompt}):null]}),o.jsxs("div",{className:"shrink-0 text-right font-mono text-[10px] text-muted-foreground",children:[t.mcpServerCount?o.jsxs("div",{children:[t.mcpServerCount," mcp"]}):null,t.lastSessionModified?o.jsx("div",{children:y9(t.lastSessionModified)}):null]})]},t.path))}):o.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No known projects."})})]})]})}function y9(e){const t=Date.parse(e);return Number.isNaN(t)?e:new Date(t).toLocaleString()}function ml({className:e}){return o.jsx("svg",{className:le("size-3.5",e),viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:o.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 mu({className:e}){return o.jsx("svg",{className:le("size-3.5",e),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":!0,children:o.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 S9({className:e}){return o.jsx("svg",{className:le("size-3.5",e),viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:o.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"})})}let cw=0;const uw=()=>(cw+=1,`t${Date.now()}-${cw}`);function w9(){const[e,t]=y.useState([]),[s,i]=y.useState(!1),[a,l]=y.useState(null),[u,h]=y.useState(null),[m,d]=y.useState(null),[p,g]=y.useState([]),v=y.useRef(null),_=y.useRef(void 0);y.useEffect(()=>{E6().then(T=>{h(T.configured),d(T.provider)}).catch(()=>h(!1))},[]);const S=y.useCallback(async(T,N)=>{g(R=>R.filter(z=>z.requestId!==T));const j=_.current;if(j)try{await T6(j,T,N)}catch{}},[]),w=y.useCallback(()=>{v.current?.abort(),v.current=null,i(!1)},[]),C=y.useCallback(async(T,N)=>{const j=T.trim();if(!j||s)return;l(null);const R={id:uw(),createdAt:Date.now(),role:"user",text:j,label:N?.label,tools:[]},z=uw(),D={id:z,createdAt:Date.now(),role:"assistant",text:"",tools:[]};t(L=>[...L,R,D]);const M=L=>t(B=>B.map(P=>P.id===z?L(P):P)),$=new AbortController;v.current=$,i(!0);try{await j6(j,_.current,L=>{switch(L.type){case"session":_.current=L.sessionId;break;case"text":M(B=>({...B,text:B.text+L.text}));break;case"tool_use":M(B=>({...B,tools:[...B.tools,{id:L.id,name:L.name,input:L.input,status:"running"}]}));break;case"tool_result":M(B=>({...B,tools:B.tools.map(P=>P.id===L.id?{...P,preview:L.preview,isError:L.isError,status:"done"}:P)}));break;case"approval_request":g(B=>[...B,{requestId:L.requestId,name:L.name,input:L.input}]);break;case"error":l(L.message);break;case"done":break}},$.signal,N?.autoApprove)}catch(L){$.signal.aborted||l(L instanceof Error?L.message:String(L))}finally{v.current=null,i(!1)}},[s]),E=y.useCallback(()=>{w(),_.current=void 0,t([]),g([]),l(null)},[w]);return{turns:e,streaming:s,error:a,configured:u,provider:m,approvals:p,send:C,stop:w,clear:E,respond:S}}const UE=y.createContext(null);function k9({children:e}){const t=w9(),{streaming:s}=t,[i,a]=y.useState(!1),[l,u]=y.useState(""),[h,m]=y.useState(null),[d,p]=y.useState(0),[g,v]=y.useState(0),[_,S]=y.useState(!1),w=y.useRef([]),C=y.useCallback(()=>p($=>$+1),[]),E=y.useCallback(()=>v($=>$+1),[]),T=y.useCallback(($,L)=>(E(),t.send($,L)),[t,E]),N=y.useCallback(()=>m(null),[]),j=y.useCallback(()=>{a(!0),S(!0)},[]),R=y.useCallback($=>{a(!0),u(L=>L.trim()?`${L.replace(/\s*$/,"")}
|
|
18
|
+
${$}`:$),C()},[C]);y.useEffect(()=>{if(s)return;const $=w.current.shift();$&&T($.prompt,{label:$.label,autoApprove:$.autoApprove})},[s,T]);const z=y.useCallback(({prompt:$,source:L,mode:B="send",label:P,autoApprove:F,background:V})=>(V||a(!0),m(L??null),E(),B==="draft"?(u($),C(),{queued:!1}):s?(w.current.push({prompt:$,label:P,autoApprove:F}),{queued:!0}):(T($,{label:P,autoApprove:F}),{queued:!1})),[s,T,C,E]),D=y.useCallback(()=>{w.current=[],m(null),t.clear()},[t]),M={...t,send:T,clear:D,open:i,setOpen:a,draft:l,setDraft:u,insertPath:R,activeSource:h,clearSource:N,focusNonce:d,stickNonce:g,sendToAgent:z,onboarding:_,setOnboarding:S,startOnboard:j};return o.jsx(UE.Provider,{value:M,children:e})}function Bt(){const e=y.useContext(UE);if(!e)throw new Error("useAgentDock must be used within an AgentProvider");return e}function C9(e){const t=Math.max(0,Math.floor(e/6e4));if(t<60)return`${t}m`;const s=Math.floor(t/60),i=t%60;return`${s}h ${String(i).padStart(2,"0")}m`}function N9(e,t=Date.now()){const s=e[0],i=s?t-s.createdAt:0,a=e.length,l=i>=60*6e4||a>=30,u=i>=30*6e4||a>=16,h=l?"heavy":u?"long":"fresh";return{durationLabel:s?C9(i):"0m",recommendation:h==="fresh"?null:"Consider starting a new chat for a cleaner context.",status:h,statusLabel:h==="heavy"?"Heavy context":h==="long"?"Long":"Fresh",turnCount:a}}function E9({now:e,onNewChat:t,turns:s}){const[i,a]=y.useState(()=>Date.now());y.useEffect(()=>{const h=window.setInterval(()=>a(Date.now()),3e4);return()=>window.clearInterval(h)},[]);const l=N9(s,e??i),u=s.length>0;return o.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border bg-background/55 px-3 py-2 text-xs",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(dM,{className:le("size-4 shrink-0",l.status==="heavy"?"text-amber-500":l.status==="long"?"text-yellow-500":"text-muted-foreground")}),o.jsx("span",{className:"font-medium",children:"Conversation"}),o.jsx("span",{className:"font-mono text-muted-foreground",children:u?l.durationLabel:"not started"}),u?o.jsxs("span",{className:"font-mono text-muted-foreground",children:[l.turnCount," turns"]}):null]}),o.jsx(Pe,{appearance:l.status==="fresh"?"subtle":"solid",size:"small",variant:l.status==="heavy"?"warning":l.status==="long"?"secondary":"outline",children:l.statusLabel}),l.recommendation?o.jsx("span",{className:"min-w-0 flex-1 text-muted-foreground",children:l.recommendation}):o.jsx("span",{className:"min-w-0 flex-1 text-muted-foreground",children:"Short chats usually give the agent cleaner context."}),o.jsxs(se,{className:"h-7 gap-1.5 px-2 text-xs",disabled:!u,onClick:t,size:"sm",type:"button",variant:"outline",children:[o.jsx(Ob,{className:"size-3.5"}),"New chat"]})]})}function T9({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 o.jsxs(fi,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[o.jsxs(mi,{className:"border-b border-border px-3 py-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(oC,{className:"size-4 text-muted-foreground"}),o.jsx(pi,{children:"Project Memory"})]}),o.jsx(Pe,{variant:"outline",size:"small",children:a})]}),o.jsx(Ii,{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.")})]}),o.jsxs(gi,{className:"space-y-2 p-3",children:[s?o.jsx(dw,{title:s,preview:i,defaultOpen:!0}):null,e.project.memoryFiles.length?e.project.memoryFiles.map(l=>o.jsx(dw,{title:l.name,subtitle:`${l.size} B`,preview:l.preview,defaultOpen:l.name==="MEMORY.md"},l.path)):s?null:o.jsx("p",{className:"text-xs text-muted-foreground",children:"No memory files persisted yet for this project."})]})]})}function dw({title:e,subtitle:t,preview:s,defaultOpen:i=!1}){const[a,l]=y.useState(i);return o.jsxs("div",{className:"rounded-md border border-border bg-background/40",children:[o.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:[o.jsx(Li,{className:le("size-3.5 text-muted-foreground transition-transform",a&&"rotate-90")}),o.jsx("span",{children:e}),t?o.jsx("span",{className:"font-mono text-[10px] font-normal text-muted-foreground",children:t}):null]}),a&&s?o.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 j9=[{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%)"}],A9=({size:e=20,color:t="#8f8f8f"})=>o.jsx("div",{style:{width:e,height:e},children:o.jsx("div",{className:"relative left-1/2 top-1/2",style:{width:e,height:e},children:j9.map(s=>o.jsx("div",{className:"absolute -left-[10%] -top-[3.9%] h-[8%] w-[24%] animate-fade-spin rounded-[5px]",style:{backgroundColor:t,...s}},s.transform))})}),M9=[{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"}],R9={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"},D9={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]"}},qd=({size:e="medium",type:t="primary",variant:s="styled",shape:i="square",svgOnly:a=!1,children:l,prefix:u,suffix:h,shadow:m=!1,loading:d=!1,disabled:p=!1,fullWidth:g=!1,className:v,..._})=>o.jsxs("button",{disabled:p,tabIndex:0,className:Wc("flex items-center justify-center gap-0.5 duration-150",M9[+a][e],p||d?"cursor-not-allowed border border-gray-400 bg-gray-100 text-gray-700":R9[t],D9[i][e],m&&"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",v),type:"button",..._,children:[d?o.jsx(A9,{size:e==="large"?24:16}):u,o.jsx("span",{className:Wc("relative overflow-hidden overflow-ellipsis whitespace-nowrap font-sans",e!=="tiny"&&s!=="unstyled"&&"px-1.5"),children:l}),!d&&h]}),O9=({className:e})=>o.jsx("svg",{height:"16",strokeLinejoin:"round",viewBox:"0 0 16 16",width:"16",className:e,children:o.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"})}),L9=()=>o.jsx("svg",{height:"16",strokeLinejoin:"round",viewBox:"0 0 16 16",width:"16",className:"fill-gray-1000",children:o.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 Xp=null,z9=0;const ls={toasts:[],listeners:new Set,add(e,t,s,i,a,l){const u=z9++,h={id:u,text:e,preserve:s,action:i,onAction:a,onUndoAction:l,type:t};if(!h.preserve){h.remaining=3e3,h.start=Date.now();const m=()=>{this.toasts=this.toasts.filter(d=>d.id!==u),this.notify()};h.timeout=setTimeout(m,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(m,h.remaining))}}this.toasts.push(h),this.notify()},remove(e){ls.toasts=ls.toasts.filter(t=>t.id!==e),ls.notify()},subscribe(e){return ls.listeners.add(e),()=>{ls.listeners.delete(e)}},notify(){ls.listeners.forEach(e=>{e()})}},B9=()=>{const[e,t]=y.useState([]),[s,i]=y.useState([]),[a,l]=y.useState(!1),u=S=>w=>{w&&S.measuredHeight==null&&(S.measuredHeight=w.getBoundingClientRect().height,ls.notify())};y.useEffect(()=>(t([...ls.toasts]),ls.subscribe(()=>{t([...ls.toasts])})),[]),y.useEffect(()=>{const S=e.filter(w=>!s.includes(w.id)).map(w=>w.id);S.length>0&&requestAnimationFrame(()=>{i(w=>[...w,...S])})},[s,e]);const m=Math.max(0,e.length-3),d=(S,w)=>{if(S===w-1)return"none";const C=w-1-S;let E=e[w-1]?.measuredHeight||63;for(let j=w-1;j>S;j--)a?E+=(e[j-1]?.measuredHeight||63)+10:E+=20;const T=-C,N=a?1:1-.05*C;return`translate3d(0, calc(100% - ${E}px), ${T}px) scale(${N})`},p=()=>{l(!0),ls.toasts.forEach(S=>{S.pause?.()})},g=()=>{l(!1),ls.toasts.forEach(S=>{S.resume?.()})},_=e.slice(m).reduce((S,w)=>S+(w.measuredHeight??63),0);return o.jsx("div",{className:"pointer-events-none fixed bottom-4 right-4 z-[9999] w-[min(420px,calc(100vw-2rem))]",style:{height:_},children:o.jsx("div",{className:"pointer-events-auto relative w-full",style:{height:_},onMouseEnter:p,onMouseLeave:g,children:e.map((S,w)=>{const C=w>=m;return o.jsx("div",{ref:u(S),className:Wc("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"}[S.type],C?"opacity-100":"opacity-0",w<m&&"pointer-events-none"),style:{width:"100%",transition:"all .35s cubic-bezier(.25,.75,.6,.98)",transform:s.includes(S.id)?d(w,e.length):"translate3d(0, 100%, 150px) scale(1)"},children:o.jsxs("div",{className:"flex flex-col items-center justify-between text-[.875rem]",children:[o.jsxs("div",{className:"flex h-full w-full items-center justify-between gap-4",children:[o.jsx("span",{children:S.text}),!S.action&&o.jsxs("div",{className:"flex gap-1",children:[S.onUndoAction&&o.jsx(qd,{type:"tertiary",svgOnly:!0,size:"small",onClick:()=>{S.onUndoAction?.(),ls.remove(S.id)},children:o.jsx(L9,{})}),o.jsx(qd,{type:"tertiary",svgOnly:!0,size:"small",onClick:()=>ls.remove(S.id),children:o.jsx(O9,{className:{message:"fill-gray-1000",success:"fill-contrast-fg",warning:"fill-gray-1000 dark:fill-gray-100",error:"fill-contrast-fg"}[S.type]})})]})]}),S.action&&o.jsxs("div",{className:"flex w-full items-center justify-end gap-2",children:[o.jsx(qd,{type:"tertiary",size:"small",onClick:()=>ls.remove(S.id),children:"Dismiss"}),o.jsx(qd,{type:"primary",size:"small",onClick:()=>{S.onAction?.(),ls.remove(S.id)},children:S.action})]})]})},S.id)})})})},Vd=()=>{if(Xp)return;const e=document.createElement("div");e.className="fixed bottom-4 right-4 z-[9999]",document.body.appendChild(e),Xp=iC.createRoot(e),Xp.render(o.jsx(B9,{}))},Ns=()=>({message:y.useCallback(({text:e,preserve:t,action:s,onAction:i,onUndoAction:a})=>{Vd(),ls.add(e,"message",t,s,i,a)},[]),success:y.useCallback(e=>{Vd(),ls.add(e,"success")},[]),warning:y.useCallback(e=>{Vd(),ls.add(e,"warning")},[]),error:y.useCallback(e=>{Vd(),ls.add(e,"error")},[])});function I9({usage:e}){const t=e.inputTokens+e.cacheCreationInputTokens+e.cacheReadInputTokens,s=t>0?e.cacheReadInputTokens/t*100:0;return o.jsxs("div",{className:"rounded-md border border-border",children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ml,{className:"size-3.5 text-amber-700"}),o.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Claude Code · last session"}),e.sessionId?o.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:e.sessionId.slice(0,8)}):null]}),o.jsxs("span",{className:"font-mono text-sm font-semibold text-emerald-700",children:["$",e.costUSD.toFixed(4)]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1.5 px-3 py-2 text-[11px] sm:grid-cols-4",children:[o.jsx(qs,{label:"Input",value:Vn(e.inputTokens)}),o.jsx(qs,{label:"Output",value:Vn(e.outputTokens)}),o.jsx(qs,{label:"Cache read",value:Vn(e.cacheReadInputTokens)}),o.jsx(qs,{label:"Cache create",value:Vn(e.cacheCreationInputTokens)}),o.jsx(qs,{label:"Lines +",value:String(e.linesAdded)}),o.jsx(qs,{label:"Lines −",value:String(e.linesRemoved)}),o.jsx(qs,{label:"Wall",value:fw(e.durationMs)}),o.jsx(qs,{label:"API",value:fw(e.apiDurationMs)})]}),o.jsxs("div",{className:"border-t border-border px-3 py-2",children:[o.jsxs("div",{className:"flex items-center justify-between text-[11px] text-muted-foreground",children:[o.jsx("span",{children:"Cache read share of input"}),o.jsxs("span",{className:"font-mono",children:[s.toFixed(1),"%"]})]}),o.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-muted",children:o.jsx("div",{className:"h-full bg-emerald-500",style:{width:`${Math.min(100,s).toFixed(2)}%`}})})]}),e.fiveHour||e.weekly?o.jsxs("div",{className:"space-y-2 border-t border-border px-3 py-2",children:[o.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Rate limits"}),e.fiveHour?o.jsx(Ph,{label:"5h block",window:e.fiveHour}):null,e.weekly?o.jsx(Ph,{label:"This week",window:e.weekly}):null]}):null,e.models.length?o.jsxs("div",{className:"space-y-1 border-t border-border px-3 py-2",children:[o.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"By model"}),e.models.map(i=>o.jsxs("div",{className:"flex items-center justify-between gap-2 font-mono text-[11px]",children:[o.jsx("span",{className:"truncate",children:i.model}),o.jsxs("span",{className:"shrink-0 text-muted-foreground",children:[Vn(i.inputTokens+i.outputTokens)," tok ·"," ",o.jsxs("span",{className:"text-emerald-700",children:["$",i.costUSD.toFixed(4)]})]})]},i.model))]}):null]})}function P9({usage:e}){const t=e.inputTokens>0?e.cachedInputTokens/e.inputTokens*100:0,s=e.contextWindow&&e.contextWindow>0?e.lastTotalTokens/e.contextWindow*100:0;return o.jsxs("div",{className:"rounded-md border border-border",children:[o.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-1.5",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(mu,{className:"size-3.5 text-foreground"}),o.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Codex · last session"})]}),e.timestamp?o.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:new Date(e.timestamp).toLocaleString()}):null]}),o.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1.5 px-3 py-2 text-[11px] sm:grid-cols-4",children:[o.jsx(qs,{label:"Input",value:Vn(e.inputTokens)}),o.jsx(qs,{label:"Output",value:Vn(e.outputTokens)}),o.jsx(qs,{label:"Cache read",value:Vn(e.cachedInputTokens)}),o.jsx(qs,{label:"Reasoning",value:Vn(e.reasoningOutputTokens)}),o.jsx(qs,{label:"Total",value:Vn(e.totalTokens)}),o.jsx(qs,{label:"Last turn",value:Vn(e.lastTotalTokens)}),o.jsx(qs,{label:"Context",value:e.contextWindow?Vn(e.contextWindow):"n/a"}),o.jsx(qs,{label:"Cost",value:"n/a"})]}),o.jsxs("div",{className:"space-y-2 border-t border-border px-3 py-2",children:[o.jsx(hw,{label:"Cache read share of input",value:t,tone:"bg-emerald-500"}),e.contextWindow?o.jsx(hw,{label:"Last turn context share",value:s,tone:"bg-sky-500"}):null]}),e.primary||e.secondary?o.jsxs("div",{className:"space-y-2 border-t border-border px-3 py-2",children:[o.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Rate limits"}),e.primary?o.jsx(Ph,{label:"5h window",window:e.primary}):null,e.secondary?o.jsx(Ph,{label:"Weekly window",window:e.secondary}):null]}):null]})}function hw({label:e,value:t,tone:s}){const i=Math.min(100,Math.max(0,t));return o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between text-[11px] text-muted-foreground",children:[o.jsx("span",{children:e}),o.jsxs("span",{className:"font-mono",children:[i.toFixed(1),"%"]})]}),o.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-muted",children:o.jsx("div",{className:le("h-full",s),style:{width:`${i.toFixed(2)}%`}})})]})}function Ph({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 o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[o.jsx("span",{className:"text-muted-foreground",children:e}),o.jsxs("span",{className:"font-mono",children:[s.toFixed(1),"%"]})]}),o.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-muted",children:o.jsx("div",{className:le("h-full",a),style:{width:`${s.toFixed(2)}%`}})}),i?o.jsxs("div",{className:"mt-0.5 font-mono text-[10px] text-muted-foreground",children:["resets ",i]}):null]})}function qs({label:e,value:t}){return o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:e}),o.jsx("div",{className:"font-mono text-xs font-semibold",children:t})]})}function Vn(e){return e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function fw(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 $9(e=1e4){const[t,s]=y.useState(null),[i,a]=y.useState(null);return y.useEffect(()=>{let l=!0;const u=()=>{k6().then(m=>{l&&(s(m),a(null))}).catch(m=>{l&&a(m instanceof Error?m.message:String(m))})};u();const h=window.setInterval(u,e);return()=>{l=!1,window.clearInterval(h)}},[e]),{usage:t,error:i}}const H9={"claude-code":{label:"Claude Code",icon:o.jsx(ml,{})},codex:{label:"Codex",icon:o.jsx(mu,{})}};function U9({agent:e,agentId:t,isDetected:s}){const{usage:i,error:a}=$9(),l=H9[t],u=t==="codex";return o.jsxs(fi,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[o.jsxs(mi,{className:"border-b border-border px-3 py-2",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(bC,{className:"size-4 text-muted-foreground"}),o.jsx(pi,{children:u?"Token Usage & Rate Limits":"Token & Cost Usage"}),o.jsx(Pe,{variant:"outline",size:"small",icon:l.icon,children:l.label}),s?o.jsx(Pe,{variant:"outline",size:"small",children:"active session"}):o.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Not the active agent in this session"}),u?null:o.jsx(F9,{className:"ml-auto"})]}),o.jsxs(Ii,{className:"truncate text-xs",children:[u?o.jsxs(o.Fragment,{children:["Session metrics from ",o.jsx("code",{className:"font-mono",children:"~/.codex/sessions"})]}):o.jsxs(o.Fragment,{children:["Last-session metrics from ",o.jsx("code",{className:"font-mono",children:"~/.claude.json"})]})," · ",o.jsx("span",{className:"font-mono",children:e.project.cwd})]})]}),o.jsxs(gi,{className:"p-3",children:[a?o.jsx("p",{className:"text-xs text-destructive",children:a}):null,u?i?.codex?o.jsx(P9,{usage:i.codex}):a?null:o.jsx(mw,{agent:"Codex CLI"}):i?.claude?o.jsx(I9,{usage:i.claude}):a?null:o.jsx(mw,{agent:"Claude Code"})]})]})}function F9({className:e}){const[t,s]=y.useState(!0),[i,a]=y.useState(!0),[l,u]=y.useState(!1),h=Ns();y.useEffect(()=>{let d=!0;return C6().then(p=>d&&s(p.coAuthorWithClaude)).catch(()=>{}).finally(()=>d&&a(!1)),()=>{d=!1}},[]);const m=async()=>{const d=!t;u(!0),s(d);try{const p=await N6({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{u(!1)}};return o.jsxs(se,{type:"button",variant:t?"default":"outline",size:"sm",onClick:m,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:le("gap-1.5",e),children:[o.jsx(ml,{className:"size-3.5"}),"Co-author"]})}function mw({agent:e}){return o.jsxs("p",{className:"text-xs text-muted-foreground",children:["No usage data yet. Run a session with ",e," in this project."]})}const pw=["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(`
|
|
19
|
+
`),q9=["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(`
|
|
20
|
+
`);function V9(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(`
|
|
21
|
+
`)}function G9(e){return e.map(t=>`- ${t.name}: ${t.dataType}${t.primaryKey?" (PK)":""}${t.nullable?"":" NOT NULL"}`).join(`
|
|
22
|
+
`)}function FE(e){return e?.length?["## Table schema",G9(e),""].join(`
|
|
23
|
+
`):""}const qE="Your prompt: ";function W9(e,t,s,i,a){return[`I'm looking at a row in my ${t} database (connection "${e}", table \`${s.qualifiedName}\`).`,"",FE(i),"## Row","```json",JSON.stringify(a,null,2),"```","",qE].join(`
|
|
24
|
+
`)}function gw(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=FE(s?.columns);return l&&a.push(l),a.push(qE),a.join(`
|
|
25
|
+
`)}function K9(e,t,s){const i=s.engine?`${s.engine} `:"",a=(s.tables??[]).map(u=>u.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(u=>`- ${u}`).join(`
|
|
26
|
+
`)),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(`
|
|
27
|
+
`)}function Y9(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(`
|
|
28
|
+
`)}function X9({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(`
|
|
29
|
+
`)}function Z9(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(`
|
|
30
|
+
`)}function Q9(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(`
|
|
31
|
+
`)}function J9(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(`
|
|
32
|
+
`)}function ez(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(`
|
|
33
|
+
`)}function tz(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(`
|
|
34
|
+
`)}function sz(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(`
|
|
35
|
+
`):"- (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(`
|
|
36
|
+
`)}function nz({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(`
|
|
37
|
+
`)}function bw(){return{serviceNames:[],databaseNames:[],errorIds:[],repositoryPaths:[]}}function iz(e){return e.serviceNames.length>0||e.databaseNames.length>0||e.errorIds.length>0||e.repositoryPaths.length>0}function rz({dashboard:e,databases:t,incidents:s,note:i,selection:a}){const l=[oz(e,a.serviceNames),lz(t,a.databaseNames),cz(s,a.errorIds),uz(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:
|
|
38
|
+
${i.trim()}`:null,"",l.join(`
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
`)].filter(Boolean).join(`
|
|
43
|
+
`)}function az({note:e,selection:t}){const s=[Gd(t.serviceNames.length,"service"),Gd(t.databaseNames.length,"database"),Gd(t.errorIds.length,"error"),Gd(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 oz(e,t){return t.length?["Services",t.map(i=>{const a=e.config.services.find(m=>m.name===i),l=e.runtime.services[i],u=e.health[i],h=e.logs.filter(m=>m.service===i).slice(-8).map(m=>`${m.timestamp} ${m.stream}: ${m.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,u?`health: ${u.status} - ${u.summary}`:null,u?.agentContext?`agent debug context:
|
|
44
|
+
${u.agentContext}`:null,h.length?`recent logs:
|
|
45
|
+
${h.join(`
|
|
46
|
+
`)}`:null].filter(Boolean).join(`
|
|
47
|
+
`)}).join(`
|
|
48
|
+
|
|
49
|
+
`)].join(`
|
|
50
|
+
`):null}function lz(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(`
|
|
51
|
+
`)}).join(`
|
|
52
|
+
|
|
53
|
+
`)].join(`
|
|
54
|
+
`):null}function cz(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:
|
|
55
|
+
${a.logExcerpt.join(`
|
|
56
|
+
`)}`:null].filter(Boolean).join(`
|
|
57
|
+
`):`Incident #${i}`}).join(`
|
|
58
|
+
|
|
59
|
+
`)].join(`
|
|
60
|
+
`):null}function uz(e,t){if(!t.length)return null;const s=dz(e),i=e.git.selectedRepository?.path??e.git.cwd,a=e.git.status?.files.map(u=>`${u.status}: ${u.path}`)??[];return["Git Repositories",t.map(u=>{const h=s.find(d=>d.path===u),m=u===i;return[`Repository: ${h?.name??u.split("/").pop()??u}`,`path: ${u}`,m?"current: yes":"current: no",m?a.length?`changed files:
|
|
61
|
+
${a.join(`
|
|
62
|
+
`)}`:"changed files: none":"changed files: not loaded for this repository in the current dashboard view"].join(`
|
|
63
|
+
`)}).join(`
|
|
64
|
+
|
|
65
|
+
`)].join(`
|
|
66
|
+
`)}function dz(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 Gd(e,t){return e?`${e} ${t}${e===1?"":"s"}`:null}function hf(e){return e==="codex"?"Codex":"Claude Code"}function hz(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 ${hf(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(`
|
|
67
|
+
`)}function fz(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(`
|
|
68
|
+
`)}function mz(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(`
|
|
69
|
+
`)}function pz(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 ${hf(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(`
|
|
70
|
+
`)}function gz(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(`
|
|
71
|
+
`)}function bz(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(`
|
|
72
|
+
`)}function xz(e,t){return[`Install a plugin for ${hf(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(`
|
|
73
|
+
`)}function vz(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(`
|
|
74
|
+
`)}function _z(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(`
|
|
75
|
+
`)}function yz(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 ${hf(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(`
|
|
76
|
+
`)}function Sz(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(`
|
|
77
|
+
`)}function wz(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(`
|
|
78
|
+
`)}function VE({id:e,className:t}){return e==="codex"?o.jsx(mu,{className:le("text-foreground",t)}):e==="gemini"?o.jsx(S9,{className:le("text-[#1A73E8]",t)}):o.jsx(ml,{className:le("text-[#D97757]",t)})}function Gt({className:e}){const{provider:t}=Bt();return o.jsx(VE,{id:t?.id,className:e})}function ll({onAsk:e,label:t,className:s}){const{provider:i}=Bt(),a=t??`Ask ${i?.label??"Claude"}`;return o.jsx("button",{"aria-label":a,className:le("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:o.jsx(VE,{id:i?.id,className:"size-3.5"})})}function pu({placeholder:e,onSubmit:t,onCancel:s,className:i}){const[a,l]=y.useState(""),u=()=>{const h=a.trim();h&&t(h)};return o.jsxs("form",{className:le("flex items-center gap-1.5 rounded-md border border-primary/40 bg-primary/5 px-1.5 py-1",i),onSubmit:h=>{h.preventDefault(),u()},children:[o.jsx(ll,{className:"size-5 opacity-100",label:"Send to the agent",onAsk:u}),o.jsx("input",{autoFocus:!0,className:"min-w-0 flex-1 bg-transparent text-xs outline-none placeholder:text-muted-foreground",onChange:h=>l(h.target.value),onKeyDown:h=>{h.key==="Escape"&&s()},placeholder:e,value:a}),o.jsx(se,{type:"submit",size:"icon",className:"size-6",disabled:!a.trim(),title:"Send",children:o.jsx(hi,{className:"size-3.5"})}),o.jsx(se,{type:"button",size:"icon",variant:"ghost",className:"size-6",onClick:s,"aria-label":"Cancel",title:"Cancel",children:o.jsx(Gs,{className:"size-3.5"})})]})}function ff({label:e,onClick:t}){return o.jsxs(se,{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:[o.jsx(Cs,{className:"size-3.5"}),"Add"]})}function mf({askLabel:e,removeLabel:t,onAsk:s,onRemove:i}){return o.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[o.jsx(ll,{label:e,onAsk:s}),o.jsx(kz,{label:t,onConfirm:i})]})}function kz({label:e,onConfirm:t}){const[s,i]=y.useState(!1);return s?o.jsxs("span",{className:"flex items-center gap-0.5",children:[o.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:o.jsx(hi,{className:"size-3.5"})}),o.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:o.jsx(Gs,{className:"size-3.5"})})]}):o.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:o.jsx(ua,{className:"size-3.5"})})}function Cz({agent:e,agentId:t,alternateHooks:s}){const{sendToAgent:i}=Bt(),[a,l]=y.useState(!1),u=e.hooks??[];function h(p){l(!1),i({prompt:yz(t,p),source:{type:"agent-hook",label:"New hook"},label:`Add hook: ${p}`})}function m(p){i({prompt:wz(p),source:{type:"agent-hook",label:`${p.event} hook`},mode:"draft"})}function d(p){i({prompt:Sz(p),source:{type:"agent-hook",label:`Remove ${p.event}`},label:`Remove hook: ${p.event}`})}return o.jsxs(fi,{className:"min-w-0 rounded-none border-0 border-t border-border bg-transparent md:border-l lg:border-t-0",children:[o.jsxs(mi,{className:"border-b border-border px-3 py-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(b6,{className:"size-4 text-muted-foreground"}),o.jsx(pi,{children:"Hooks"})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(Pe,{variant:"outline",size:"small",children:u.length}),o.jsx(ff,{label:"Add a hook with AI",onClick:()=>l(p=>!p)})]})]}),a?o.jsx(pu,{className:"mt-1.5",placeholder:"Describe the event, matcher, and command…",onSubmit:h,onCancel:()=>l(!1)}):o.jsx(Ii,{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."})]}),o.jsx(gi,{className:"p-0",children:u.length?o.jsx("ul",{className:"divide-y divide-border",children:u.map(p=>o.jsxs("li",{className:"group px-3 py-2 hover:bg-muted/40",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[o.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold",title:p.event,children:p.event}),o.jsx(mf,{askLabel:`Ask AI about the ${p.event} hook`,removeLabel:`Remove the ${p.event} hook`,onAsk:()=>m(p),onRemove:()=>d(p)})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[o.jsx(Ez,{hook:p}),o.jsx(Tz,{hook:p}),o.jsx(Pe,{variant:"outline",size:"small",children:p.scope})]})]}),o.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted-foreground",title:xw(p),children:xw(p)})]},p.id))}):o.jsx(Nz,{agentId:t,alternateHooks:s})})]})}function Nz({agentId:e,alternateHooks:t}){const s=e==="codex"?"Codex":"Claude Code";return o.jsxs("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:["No ",s," hooks configured.",t?.count?o.jsxs(o.Fragment,{children:[" ",t.agentLabel," has ",t.count," hook",t.count===1?"":"s","; switch agents above to view them."]}):null]})}function Ez({hook:e}){return e.status==="enabled"?o.jsx(Pe,{variant:"success",appearance:"subtle",size:"small",children:"Enabled"}):e.status==="disabled"?o.jsx(Pe,{variant:"error",appearance:"subtle",size:"small",children:"Disabled"}):o.jsx(Pe,{variant:"warning",appearance:"subtle",size:"small",children:"Default"})}function Tz({hook:e}){return e.trusted===void 0?null:o.jsx(Pe,{variant:e.trusted?"success":"warning",appearance:"subtle",size:"small",children:e.trusted?"Trusted":"Untrusted"})}function jz(e){return e.command?e.command:e.type??e.settingsPath}function xw(e){return`${e.matcher?`matcher ${e.matcher} · `:""}${jz(e)}`}function Az({agent:e,agentId:t}){const{sendToAgent:s}=Bt(),[i,a]=y.useState([]),[l,u]=y.useState(!1),[h,m]=y.useState(!1),d=y.useCallback(async()=>{u(!0);try{a(await w6(t))}catch{a([])}finally{u(!1)}},[t]);y.useEffect(()=>{d()},[d]);const p=y.useMemo(()=>{const w={};for(const C of i)w[C.name]=C.state;return w},[i]),g=y.useMemo(()=>{const w=new Set(e.mcpServers.map(E=>E.name)),C=i.filter(E=>!w.has(E.name)).map(E=>({name:E.name,scope:"user",synthetic:!0}));return[...e.mcpServers,...C]},[e.mcpServers,i]);function v(w){m(!1),s({prompt:pz(t,w),source:{type:"agent-mcp",label:"New MCP server"},label:`Add MCP server: ${w}`})}function _(w){s({prompt:bz(w),source:{type:"agent-mcp",label:`${w.name} server`},mode:"draft"})}function S(w){s({prompt:gz(w,t),source:{type:"agent-mcp",label:`Remove ${w.name}`},label:`Remove MCP server: ${w.name}`})}return o.jsxs(fi,{className:"min-w-0 rounded-none border-0 bg-transparent md:border-l md:border-border",children:[o.jsxs(mi,{className:"border-b border-border px-3 py-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(SC,{className:"size-4 text-muted-foreground"}),o.jsx(pi,{children:"MCP Servers"})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(Pe,{variant:"outline",size:"small",children:g.length}),o.jsx(se,{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:o.jsx(ou,{className:l?"animate-spin":void 0})}),o.jsx(ff,{label:"Register an MCP server with AI",onClick:()=>m(w=>!w)})]})]}),h?o.jsx(pu,{className:"mt-1.5",placeholder:"Paste the MCP install command or URL…",onSubmit:v,onCancel:()=>m(!1)}):o.jsxs(Ii,{className:"text-xs",children:["From"," ",o.jsx("code",{className:"font-mono",children:t==="codex"?"~/.codex/config.toml":"~/.claude.json"}),t==="codex"?"":" + claude.ai connectors",". Status via"," ",o.jsxs("code",{className:"font-mono",children:[t==="codex"?"codex":"claude"," mcp list"]})," ","(fresh health check)."]})]}),o.jsx(gi,{className:"p-0",children:g.length?o.jsx("ul",{className:"divide-y divide-border",children:g.map(w=>o.jsxs("li",{className:"group px-3 py-2 hover:bg-muted/40",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[o.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold",title:w.name,children:w.name}),o.jsx(mf,{askLabel:`Ask AI about the ${w.name} server`,removeLabel:`Remove the ${w.name} server`,onAsk:()=>_(w),onRemove:()=>S(w)})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[o.jsx(Rz,{state:p[w.name],loading:l}),o.jsx(Pe,{variant:"outline",size:"small",children:w.synthetic?"connector":w.scope})]})]}),o.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted-foreground",title:w.synthetic?"claude.ai managed connector":vw(w),children:w.synthetic?"claude.ai managed connector":vw(w)})]},`${w.scope}:${w.name}`))}):o.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No MCP servers configured."})})]})}const Mz={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 Rz({state:e,loading:t}){if(!e)return t?o.jsx(pt,{className:"size-3 animate-spin text-muted-foreground"}):null;const s=e==="unknown"?void 0:Mz[e];return s?o.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[o.jsx("span",{className:le("size-1.5 shrink-0 rounded-full",s.dot),"aria-hidden":!0}),s.label]}):null}function vw(e){return e.command?[e.command,...e.args??[]].join(" "):e.url??e.type??"-"}function Dz({agent:e,agentId:t}){const{sendToAgent:s}=Bt(),[i,a]=y.useState(!1),l=e.plugins??[];function u(d){a(!1),s({prompt:xz(t,d),source:{type:"agent-plugin",label:"New plugin"},label:`Install plugin: ${d}`})}function h(d){s({prompt:_z(d),source:{type:"agent-plugin",label:`${d.name} plugin`},mode:"draft"})}function m(d){s({prompt:vz(d),source:{type:"agent-plugin",label:`Remove ${d.name}`},label:`Uninstall plugin: ${d.name}`})}return o.jsxs(fi,{className:"min-w-0 rounded-none border-0 border-t border-border bg-transparent lg:border-l lg:border-t-0",children:[o.jsxs(mi,{className:"border-b border-border px-3 py-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(TA,{className:"size-4 text-muted-foreground"}),o.jsx(pi,{children:"Plugins"})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(Pe,{variant:"outline",size:"small",children:l.length}),o.jsx(ff,{label:"Install a plugin with AI",onClick:()=>a(d=>!d)})]})]}),i?o.jsx(pu,{className:"mt-1.5",placeholder:"Paste a plugin name, marketplace, or install command…",onSubmit:u,onCancel:()=>a(!1)}):o.jsx(Ii,{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."})]}),o.jsx(gi,{className:"p-0",children:l.length?o.jsx("ul",{className:"divide-y divide-border",children:l.map(d=>o.jsxs("li",{className:"group px-3 py-2 hover:bg-muted/40",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[o.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold",title:d.name,children:d.name}),o.jsx(mf,{askLabel:`Ask AI about the ${d.name} plugin`,removeLabel:`Uninstall the ${d.name} plugin`,onAsk:()=>h(d),onRemove:()=>m(d)})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[d.version&&d.version!=="unknown"?o.jsxs(Pe,{variant:"outline",size:"small",children:["v",d.version]}):null,d.marketplace?o.jsx(Pe,{variant:"outline",size:"small",children:d.marketplace}):null]})]}),d.description?o.jsx("p",{className:"mt-1 truncate text-[11px] text-muted-foreground",title:d.description,children:d.description}):null,o.jsx(Oz,{plugin:d})]},`${d.name}@${d.marketplace??""}`))}):o.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No plugins installed."})})]})}function Oz({plugin:e}){const t=[];return e.skills.length&&t.push(`${e.skills.length} skill${Wd(e.skills.length)}`),e.commands.length&&t.push(`${e.commands.length} command${Wd(e.commands.length)}`),e.agents.length&&t.push(`${e.agents.length} agent${Wd(e.agents.length)}`),e.mcpServers.length&&t.push(`${e.mcpServers.length} MCP server${Wd(e.mcpServers.length)}`),t.length?o.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:t.map(s=>o.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[10px] text-muted-foreground",children:s},s))}):null}function Wd(e){return e===1?"":"s"}function Lz({agent:e,agentId:t}){const{sendToAgent:s}=Bt(),[i,a]=y.useState(!1);function l(m){a(!1),s({prompt:hz(t,m),source:{type:"agent-skill",label:"New skill"},label:`Add skill: ${m}`})}function u(m){s({prompt:mz(m),source:{type:"agent-skill",label:`${m.name} skill`},mode:"draft"})}function h(m){s({prompt:fz(m),source:{type:"agent-skill",label:`Remove ${m.name}`},label:`Remove skill: ${m.name}`})}return o.jsxs(fi,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[o.jsxs(mi,{className:"border-b border-border px-3 py-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(zi,{className:"size-4 text-muted-foreground"}),o.jsx(pi,{children:"Skills"})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(Pe,{variant:"outline",size:"small",children:e.skills.length}),o.jsx(ff,{label:"Add a skill with AI",onClick:()=>a(m=>!m)})]})]}),i?o.jsx(pu,{className:"mt-1.5",placeholder:"Paste a skill URL/repo, or describe the skill…",onSubmit:l,onCancel:()=>a(!1)}):o.jsx(Ii,{className:"text-xs",children:t==="codex"?"User, project, and system skills discovered for Codex.":"User and project skills discovered for the active agent."})]}),o.jsx(gi,{className:"p-0",children:e.skills.length?o.jsx("ul",{className:"divide-y divide-border",children:e.skills.map(m=>o.jsxs("li",{className:"group px-3 py-2 hover:bg-muted/40",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[o.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold",title:m.name,children:m.name}),o.jsx(mf,{askLabel:`Ask AI about the ${m.name} skill`,removeLabel:`Remove the ${m.name} skill`,onAsk:()=>u(m),onRemove:()=>h(m)})]}),o.jsx("div",{className:"flex shrink-0 items-center gap-1.5",children:o.jsx(Pe,{variant:"outline",size:"small",children:m.scope})})]}),m.description?o.jsx("p",{className:"mt-1 truncate text-[11px] text-muted-foreground",title:m.description,children:m.description}):null]},`${m.scope}:${m.name}`))}):o.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No skills found."})})]})}function zz({agent:e,agentId:t,alternateHooks:s}){return o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4",children:[o.jsx(Lz,{agent:e,agentId:t}),o.jsx(Az,{agent:e,agentId:t}),o.jsx(Dz,{agent:e,agentId:t}),o.jsx(Cz,{agent:e,agentId:t,alternateHooks:s})]})}const Bz=[{id:"claude-code",label:"Claude Code",icon:o.jsx(ml,{className:"size-4"})},{id:"codex",label:"Codex",icon:o.jsx(mu,{className:"size-4"})}],Iz=[{id:"overview",label:"Overview",icon:o.jsx(bC,{className:"size-3.5"})},{id:"memory",label:"Memory",icon:o.jsx(oC,{className:"size-3.5"})},{id:"tools",label:"Skills, MCPs, Plugins & Hooks",icon:o.jsx(SC,{className:"size-3.5"})},{id:"activity",label:"Activity",icon:o.jsx(qa,{className:"size-3.5"})}];function Pz(){const[e,t]=y.useState(null),[s,i]=y.useState(null),[a,l]=y.useState("claude-code"),[u,h]=y.useState("overview"),{clear:m,turns:d}=Bt();if(y.useEffect(()=>{let v=!0;return MC().then(_=>{v&&(t(_),_.detected.name==="codex"&&l("codex"))}).catch(_=>{v&&i(_ instanceof Error?_.message:String(_))}),()=>{v=!1}},[]),s)return o.jsx("div",{className:"h-full overflow-auto bg-card/85 p-4",children:o.jsxs(Qe,{variant:"muted",className:"border-destructive/40 text-destructive",children:["Failed to load agent info: ",s]})});if(!e)return o.jsx("div",{className:"h-full overflow-auto bg-card/85 p-4",children:o.jsx(Qe,{variant:"muted",children:"Loading agent info…"})});const p=e.agents?.[a]??e,g=a==="codex"?{agentLabel:"Claude Code",count:e.agents["claude-code"].hooks.length}:{agentLabel:"Codex",count:e.agents.codex.hooks.length};return o.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[o.jsx("div",{className:"flex shrink-0 items-center gap-2 border-b border-border bg-card/90 px-3 py-2",children:Bz.map(v=>{const _=a===v.id,S=e.detected.name===v.id;return o.jsxs("button",{type:"button",onClick:()=>l(v.id),className:le("flex items-center gap-2 rounded-lg border px-3 py-1.5 text-xs font-medium transition-colors",_?"border-border bg-background text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-muted/60 hover:text-foreground"),children:[v.icon,v.label,S?o.jsx("span",{className:"size-1.5 rounded-full bg-emerald-500","aria-hidden":!0}):null]},v.id)})}),o.jsx("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card/90 px-3",children:Iz.map(v=>o.jsxs("button",{type:"button",onClick:()=>h(v.id),className:le("relative flex items-center gap-1.5 px-2.5 py-2 text-xs font-medium transition-colors",u===v.id?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[v.icon,v.label,u===v.id?o.jsx("span",{className:"absolute inset-x-1 -bottom-px h-0.5 bg-primary"}):null]},v.id))}),o.jsx(E9,{onNewChat:m,turns:d}),o.jsxs("div",{className:"min-h-0 flex-1 overflow-auto",children:[u==="overview"?o.jsx(U9,{agent:p,agentId:a,isDetected:e.detected.name===a}):null,u==="memory"?o.jsx(T9,{agent:p,agentId:a}):null,u==="tools"?o.jsx(zz,{agent:p,agentId:a,alternateHooks:g}):null,u==="activity"?o.jsx(_9,{agent:p,agentId:a}):null]})]})}var gu=nC();function Zn({children:e,icon:t,onClose:s,title:i,size:a="md"}){return y.useEffect(()=>{function l(u){u.key==="Escape"&&s()}return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[s]),gu.createPortal(o.jsx("div",{className:"fixed inset-0 z-[1000] grid place-items-center bg-black/35 px-4",onMouseDown:s,children:o.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:[o.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[o.jsx("div",{className:"flex size-8 items-center justify-center rounded-md border border-border bg-background text-foreground [&_svg]:size-4",children:t}),o.jsx("h2",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:i}),o.jsx(se,{"aria-label":"Close dialog",onClick:s,size:"icon",type:"button",variant:"ghost",children:o.jsx(Gs,{})})]}),o.jsx("div",{className:"min-h-0 overflow-auto p-4",children:e})]})}),document.body)}function nt({className:e,type:t,...s}){return o.jsx("input",{type:t,className:le("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 $z={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 il({label:e,children:t,side:s="bottom",className:i}){return o.jsxs("span",{className:le("group/tt relative inline-flex",i),children:[t,o.jsx("span",{role:"tooltip",className:le("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",$z[s]),children:e})]})}const hx="application/x-nomoreide-path";function bu(e,t){return`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`}function GE(e,t){e.setData(hx,t)}function _w(e){return e.types.includes(hx)}function Hz(e){return e.getData(hx)||null}function WE(e){return{draggable:!0,onDragStart:t=>{GE(t.dataTransfer,e),t.dataTransfer.effectAllowed="copy"}}}const Qn='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>',Jn='</title><path d="',ei='"/></svg>',Uz={title:".NET",slug:"dotnet",get svg(){return Qn+".NET"+Jn+this.path+ei},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"}},Fz={title:"Bun",slug:"bun",get svg(){return Qn+"Bun"+Jn+this.path+ei},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"},qz={title:"Deno",slug:"deno",get svg(){return Qn+"Deno"+Jn+this.path+ei},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"}},Vz={title:"Docker",slug:"docker",get svg(){return Qn+"Docker"+Jn+this.path+ei},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"},Gz={title:"Go",slug:"go",get svg(){return Qn+"Go"+Jn+this.path+ei},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"},Wz={title:"Node.js",slug:"nodedotjs",get svg(){return Qn+"Node.js"+Jn+this.path+ei},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"},Kz={title:"npm",slug:"npm",get svg(){return Qn+"npm"+Jn+this.path+ei},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"},Yz={title:"pnpm",slug:"pnpm",get svg(){return Qn+"pnpm"+Jn+this.path+ei},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"},Xz={title:"Python",slug:"python",get svg(){return Qn+"Python"+Jn+this.path+ei},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/"},yw={title:"Rust",slug:"rust",get svg(){return Qn+"Rust"+Jn+this.path+ei},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"}},Zz={title:"Vite",slug:"vite",get svg(){return Qn+"Vite"+Jn+this.path+ei},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"},Qz={title:"Yarn",slug:"yarn",get svg(){return Qn+"Yarn"+Jn+this.path+ei},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 Jz(e){const t=e.toLowerCase();return/\bvite\b/.test(t)?dn.vite:/\bcargo\s+/.test(t)?dn.cargo:/\brustc\b/.test(t)?dn.rust:/\bdotnet\b/.test(t)?dn.dotnet:/\bdocker(?:\s+compose|-compose|\s+)/.test(t)?dn.docker:/\bpython3?\b|\buvicorn\b|\bfastapi\b/.test(t)?dn.python:/\bgo\s+(run|test|build)\b|\bair\b/.test(t)?dn.go:/\bbun\b/.test(t)?dn.bun:/\bdeno\b/.test(t)?dn.deno:/\bpnpm\b/.test(t)?dn.pnpm:/\byarn\b/.test(t)?dn.yarn:/\bnpm\b/.test(t)?dn.npm:/\bnode\b/.test(t)?dn.node:dn.generic}const dn={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 fx({command:e,compact:t}){const s=Jz(e),i=eB[s.kind];return o.jsx("span",{"aria-label":`${s.label} process`,className:le("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?o.jsx("svg",{"aria-hidden":"true",className:t?"size-3.5":"size-4",fill:"currentColor",role:"img",viewBox:"0 0 24 24",children:o.jsx("path",{d:i.path})}):o.jsx(af,{className:t?"size-3.5":"size-4"})})}const eB={bun:Fz,cargo:yw,deno:qz,dotnet:Uz,docker:Vz,generic:null,go:Gz,node:Wz,npm:Kz,pnpm:Yz,python:Xz,rust:yw,vite:Zz,yarn:Qz};function Fn({className:e,...t}){return o.jsx("label",{className:le("grid gap-1.5 text-xs font-medium text-muted-foreground",e),...t})}const tB=[{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"}],Sw=[{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 sB({result:e}){const t=[...e.stdout,...e.stderr].slice(0,4);return o.jsxs(Qe,{variant:e.ok?"default":"destructive",children:[o.jsx("div",{className:"font-medium",children:e.ok?"Command test passed":"Command test failed"}),o.jsx("div",{className:"mt-1 text-xs",children:e.message}),t.length?o.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(`
|
|
79
|
+
`)}):null]})}function mx({active:e,baseUrl:t,compact:s=!1,onRefresh:i,onStarted:a,restartAction:l,solidStart:u=!1,targetLabel:h}){return e?o.jsxs(o.Fragment,{children:[o.jsx(Zp,{compact:s,intent:"restart",icon:o.jsx(Ob,{}),label:"Restart",action:l,targetLabel:h,url:`${t}/restart`,onRefresh:i,onSuccess:a}),o.jsx(Zp,{compact:s,intent:"stop",icon:o.jsx(lu,{}),label:"Stop",targetLabel:h,url:`${t}/stop`,onRefresh:i})]}):o.jsx(Zp,{compact:s,intent:u?"startSolid":"start",icon:o.jsx(eo,{}),label:"Start",targetLabel:h,url:`${t}/start`,onRefresh:i,onSuccess:a})}function $h(e,t,s){const i=s instanceof Error?s.message:String(s);return`${e} failed for ${t}: ${i}`}function Zp({action:e,compact:t=!1,intent:s="neutral",icon:i,label:a,targetLabel:l,url:u,onRefresh:h,onSuccess:m}){const[d,p]=y.useState(!1),[g,v]=y.useState(null),{error:_,success:S}=Ns();async function w(E={}){p(!0);try{e?await e():await mn(u,E),S(`${a} requested for ${l}.`),await h(),v(null),m?.()}catch(T){T instanceof AC?v(T.conflict):_($h(a,l,T))}finally{p(!1)}}const C=o.jsxs(se,{"aria-label":a,className:`${iB[s]} ${t?"size-7":""}`.trim(),disabled:d,onClick:()=>w(),size:t?"icon":"sm",variant:"outline",children:[i,t?null:a]});return o.jsxs(o.Fragment,{children:[t?o.jsx(il,{label:a,children:C}):C,g?o.jsx(nB,{busy:d,conflict:g,onCancel:()=>v(null),onKillAndStart:()=>w({strategy:"killHolder"}),targetLabel:l}):null]})}function nB({busy:e,conflict:t,onCancel:s,onKillAndStart:i,targetLabel:a}){const l=t.holder,u=`http://localhost:${t.port}/`;return o.jsx(Zn,{icon:o.jsx(S6,{}),onClose:e?()=>{}:s,title:`Port ${t.port} is already in use`,children:o.jsxs("div",{className:"space-y-3 p-4 text-sm",children:[o.jsxs("p",{children:[o.jsx("span",{className:"font-medium",children:a})," wants port"," ",o.jsx("span",{className:"font-mono",children:t.port}),", but it's already held by:"]}),o.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})`:""}
|
|
80
|
+
${l.command}`:"unknown process"}),o.jsxs("div",{className:"flex flex-wrap justify-end gap-2 pt-2",children:[o.jsx(se,{onClick:s,size:"sm",type:"button",variant:"outline",disabled:e,children:"Cancel"}),o.jsxs(se,{onClick:()=>window.open(u,"_blank","noopener,noreferrer"),size:"sm",type:"button",variant:"outline",disabled:e,children:[o.jsx(aa,{}),"Open in browser"]}),o.jsx(se,{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 iB={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 rB({cwd:e,onRefresh:t,onSaved:s,initialService:i}){const{error:a,success:l}=Ns(),u=!!i,[h,m]=y.useState(i?.kind??"local"),[d,p]=y.useState(i?.name??""),[g,v]=y.useState(i?.command??""),[_,S]=y.useState(i?.cwd??e),[w,C]=y.useState(i?.port?String(i.port):""),[E,T]=y.useState(i?.description??""),[N,j]=y.useState(i?.composeFile??""),[R,z]=y.useState(i?.composeService??""),[D,M]=y.useState(i?.host??""),[$,L]=y.useState(null),[B,P]=y.useState(!1);y.useEffect(()=>{L(null)},[g,_,w,h]);function F(){p(""),v(""),S(e),C(""),T(""),j(""),z(""),M(""),L(null)}async function V(I){I.preventDefault();try{const Y={name:d,kind:h,cwd:_,port:w,description:E};(h==="local"||h==="ssh")&&(Y.command=g),h==="docker-compose"&&(Y.composeFile=N,Y.composeService=R),h==="ssh"&&(Y.host=D),await mn("/api/services",Y),u||F(),l(u?`${d} updated.`:`${d} added.`),await t(),s?.()}catch(Y){a($h(u?"Update service":"Add service",d||"service",Y))}}async function G(){if(!g.trim()){a("Test command failed for service: command is required.");return}P(!0);try{L(await SR({command:g,cwd:_,port:w}))}catch(I){a($h("Test command",d||"service",I))}finally{P(!1)}}return{editing:u,kind:h,setKind:m,name:d,setName:p,command:g,setCommand:v,formCwd:_,setFormCwd:S,port:w,setPort:C,description:E,setDescription:T,composeFile:N,setComposeFile:j,composeService:R,setComposeService:z,host:D,setHost:M,testResult:$,testing:B,submit:V,testCommand:G}}function ww({cwd:e,onRefresh:t,onSaved:s,initialService:i}){const{editing:a,kind:l,setKind:u,name:h,setName:m,command:d,setCommand:p,formCwd:g,setFormCwd:v,port:_,setPort:S,description:w,setDescription:C,composeFile:E,setComposeFile:T,composeService:N,setComposeService:j,host:R,setHost:z,testResult:D,testing:M,submit:$,testCommand:L}=rB({cwd:e,onRefresh:t,onSaved:s,initialService:i}),B=Sw.find(G=>G.value===l),P=l==="local"&&d.trim().length>0&&g.trim().length>0,F="grid gap-2 rounded-md border border-border bg-muted/30 p-3",V="px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground";return o.jsxs("form",{className:"grid gap-3",onSubmit:$,children:[o.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[o.jsxs("fieldset",{className:`${F} sm:col-span-2`,children:[o.jsx("legend",{className:V,children:"Step 1 · Service kind"}),o.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:Sw.map(G=>o.jsx(se,{className:"justify-center",disabled:a,onClick:()=>u(G.value),size:"sm",type:"button",variant:l===G.value?"default":"outline",children:G.label},G.value))}),o.jsx("p",{className:"text-[11px] text-muted-foreground",children:B.hint})]}),o.jsxs("div",{className:"grid gap-3 sm:col-start-1 sm:row-start-2 sm:self-start",children:[o.jsxs("fieldset",{className:F,children:[o.jsx("legend",{className:V,children:"Step 2 · Identity"}),o.jsxs(Fn,{children:["Name",o.jsx(nt,{className:"h-8 text-sm",name:"name",onChange:G=>m(G.target.value),placeholder:"backend",readOnly:a,required:!0,value:h}),a?o.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Name is the service key and can't be changed here."}):null]}),o.jsxs(Fn,{children:["Description",o.jsx(nt,{className:"h-8 text-sm",name:"description",onChange:G=>C(G.target.value),placeholder:"API server",value:w})]})]}),o.jsxs("fieldset",{className:F,children:[o.jsx("legend",{className:V,children:"Step 4 · Networking (optional)"}),o.jsxs(Fn,{children:["Port",o.jsx(nt,{className:"h-8 text-sm",inputMode:"numeric",name:"port",onChange:G=>S(G.target.value),placeholder:"3001",value:_})]})]})]}),l==="local"?o.jsxs("fieldset",{className:`${F} sm:col-start-2 sm:row-start-2 sm:self-start`,children:[o.jsx("legend",{className:V,children:"Step 3 · Local command"}),o.jsx("div",{className:"grid grid-cols-2 gap-1.5 sm:grid-cols-4",children:tB.map(G=>o.jsxs(se,{className:"justify-start gap-1.5",onClick:()=>{p(G.command),C(G.description)},size:"sm",type:"button",variant:"outline",children:[o.jsx(fx,{command:G.badgeCommand??G.command,compact:!0}),o.jsx("span",{className:"truncate",children:G.label})]},G.label))}),o.jsxs(Fn,{children:["Command",o.jsx(nt,{className:"h-8 font-mono text-sm",name:"command",onChange:G=>p(G.target.value),placeholder:"npm run dev",required:!0,value:d})]}),o.jsxs(Fn,{children:["Working Directory",o.jsx(nt,{className:"h-8 font-mono text-sm",name:"cwd",onChange:G=>v(G.target.value),required:!0,value:g})]})]}):null,l==="docker-compose"?o.jsxs("fieldset",{className:`${F} sm:col-start-2 sm:row-start-2 sm:self-start`,children:[o.jsx("legend",{className:V,children:"Step 3 · Docker Compose target"}),o.jsxs(Fn,{children:["Compose Service",o.jsx(nt,{className:"h-8 font-mono text-sm",name:"composeService",onChange:G=>j(G.target.value),placeholder:"api",required:!0,value:N})]}),o.jsxs(Fn,{children:["Compose File (optional)",o.jsx(nt,{className:"h-8 font-mono text-sm",name:"composeFile",onChange:G=>T(G.target.value),placeholder:"docker-compose.yml",value:E})]}),o.jsxs(Fn,{children:["Working Directory (where compose file lives)",o.jsx(nt,{className:"h-8 font-mono text-sm",name:"cwd",onChange:G=>v(G.target.value),required:!0,value:g})]})]}):null,l==="ssh"?o.jsxs("fieldset",{className:`${F} sm:col-start-2 sm:row-start-2 sm:self-start`,children:[o.jsx("legend",{className:V,children:"Step 3 · SSH connection"}),o.jsxs(Fn,{children:["SSH Host (alias from ~/.ssh/config)",o.jsx(nt,{className:"h-8 font-mono text-sm",name:"host",onChange:G=>z(G.target.value),placeholder:"devbox",required:!0,value:R})]}),o.jsxs(Fn,{children:["Remote Command",o.jsx(nt,{className:"h-8 font-mono text-sm",name:"command",onChange:G=>p(G.target.value),placeholder:"npm run dev",required:!0,value:d})]}),o.jsxs(Fn,{children:["Remote Working Directory",o.jsx(nt,{className:"h-8 font-mono text-sm",name:"cwd",onChange:G=>v(G.target.value),placeholder:"/srv/app",required:!0,value:g})]}),o.jsxs(Qe,{variant:"muted",children:[o.jsx("div",{className:"font-medium",children:"SSH key handling"}),o.jsxs("div",{className:"mt-1 text-xs",children:["NoMoreIDE never stores key files. Add a ",o.jsxs("code",{children:["Host ",R||"<alias>"]})," entry to",o.jsx("code",{children:" ~/.ssh/config"})," with ",o.jsx("code",{children:"HostName"}),", ",o.jsx("code",{children:"User"}),", and"," ",o.jsx("code",{children:"IdentityFile ~/.ssh/your-key.pem"})," (chmod 0600). Make sure"," ",o.jsx("code",{children:"ssh-agent"})," is running or your key is loaded (",o.jsx("code",{children:"ssh-add ~/.ssh/your-key.pem"}),"). NoMoreIDE will run"," ",o.jsxs("code",{children:["ssh ",R||"<alias>"]})," using that config."]})]})]}):null]}),D?o.jsx(sB,{result:D}):null,o.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[l==="local"?o.jsxs(se,{disabled:M||!P,onClick:L,type:"button",variant:"outline",children:[o.jsx(af,{}),M?"Testing...":"Test Command"]}):null,o.jsx(se,{type:"submit",children:a?"Save Service":"Add Service"})]})]})}function KE({initialName:e="",initialServices:t=[],onSaved:s,onRefresh:i,originalName:a,services:l,submitLabel:u="Save Group"}){const{error:h,success:m}=Ns();async function d(p){p.preventDefault();const g=p.currentTarget,v=new FormData(g),_=String(v.get("name")??""),S=v.getAll("services").map(w=>String(w)).filter(Boolean);try{await mn("/api/bundles",{name:_,originalName:a,services:S.join(",")}),g.reset(),m(`${_} group saved.`),await i(),s?.()}catch(w){h($h("Save group",_||"group",w))}}return o.jsxs("form",{className:"grid gap-2.5",onSubmit:d,children:[o.jsxs(Fn,{children:["Group name",o.jsx(nt,{className:"h-8 text-sm",defaultValue:e,name:"name",placeholder:"full-stack",required:!0})]}),o.jsxs("fieldset",{className:"grid gap-1.5",children:[o.jsx("legend",{className:"text-xs font-medium",children:"Services"}),l.length?l.map(p=>o.jsxs("label",{className:"flex items-center gap-2 overflow-hidden rounded-md border border-border px-2.5 py-1.5 text-sm",children:[o.jsx("input",{className:"size-4 shrink-0 accent-primary",defaultChecked:t.includes(p.name),name:"services",type:"checkbox",value:p.name}),o.jsx(fx,{command:p.command??"",compact:!0}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-sm font-medium",children:p.name}),o.jsx("span",{className:"block truncate font-mono text-[11px] text-muted-foreground",children:p.command??p.kind??""})]})]},p.name)):o.jsx(Qe,{variant:"muted",children:"All services are already grouped, or none registered."})]}),o.jsx(se,{className:"h-8",disabled:!l.length,type:"submit",children:u})]})}function aB({allServices:e,group:t,onRefresh:s,ports:i,services:a,health:l,statuses:u,timeline:h,selectedService:m,onSelectService:d,onDropService:p}){const[g,v]=y.useState(!1),[_,S]=y.useState(!1),[w,C]=y.useState(!1),E=a.some(j=>Uc(u[j.name]?.state));function T(j){!p||!j.dataTransfer.types.includes(Qc)||(j.preventDefault(),j.dataTransfer.dropEffect="copy",C(!0))}function N(j){if(!p)return;j.preventDefault(),C(!1);const R=j.dataTransfer.getData(Qc);R&&p(R)}return o.jsxs("section",{className:le("transition-colors",w&&"bg-primary/5 outline-dashed outline-2 -outline-offset-2 outline-primary/60"),onDragOver:T,onDragLeave:()=>C(!1),onDrop:N,children:[o.jsxs("div",{className:"flex items-center gap-1.5 bg-muted/35 px-3 py-1.5",children:[o.jsxs("button",{"aria-expanded":!_,className:"flex min-w-0 flex-1 cursor-pointer items-center gap-1.5 text-left",onClick:()=>S(j=>!j),type:"button",children:[o.jsx(Mn,{className:le("size-3.5 shrink-0 text-muted-foreground transition-transform",_&&"-rotate-90")}),o.jsx("span",{className:"truncate text-sm font-medium",children:t.name}),t.services.length?o.jsx(Pe,{size:"small",variant:"secondary",children:t.services.length}):null]}),o.jsx(il,{label:"Edit group",children:o.jsx(se,{"aria-expanded":g,"aria-label":`Edit ${t.name}`,className:"size-7",onClick:()=>v(j=>!j),size:"icon",type:"button",variant:"ghost",children:o.jsx(Gc,{})})}),o.jsx(mx,{active:E,baseUrl:`/api/bundles/${encodeURIComponent(t.name)}`,compact:!0,restartAction:async()=>{await mn(`/api/bundles/${encodeURIComponent(t.name)}/stop`,{}),await mn(`/api/bundles/${encodeURIComponent(t.name)}/start`,{})},solidStart:!0,targetLabel:`group ${t.name}`,onRefresh:s,onStarted:()=>{const j=a[0];j&&d(j.name)}})]}),g?o.jsx("div",{className:"border-t border-border bg-background/65 p-3",children:o.jsx(KE,{initialName:t.name,initialServices:t.services,onRefresh:s,onSaved:()=>v(!1),originalName:t.name,services:e,submitLabel:"Save Group"})}):null,_?null:o.jsx("div",{className:"divide-y divide-border border-t border-border bg-background/45",children:a.length?a.map(j=>o.jsx(YE,{service:j,status:u[j.name],health:l[j.name],ports:i,onRefresh:s,timeline:h,selected:m===j.name,onSelect:()=>d(j.name)},j.name)):o.jsx(Qe,{variant:"muted",className:"m-4",children:"This group does not match any registered services."})})]})}function YE({service:e,status:t,onRefresh:s,selected:i=!1,onSelect:a}){const l=t?.state??"stopped",u=Uc(l),[h,m]=y.useState(!1);return o.jsxs("div",{"aria-selected":i,draggable:!0,onDragStart:d=>{d.dataTransfer.setData(Qc,e.name),e.cwd&&GE(d.dataTransfer,e.cwd),d.dataTransfer.effectAllowed="copyMove",m(!0)},onDragEnd:()=>m(!1),className:le("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:[o.jsx(fx,{command:e.command??""}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("div",{className:"truncate text-sm font-medium",children:e.name}),o.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[o.jsx(oB,{kind:e.kind}),e.port?o.jsxs("span",{children:[":",e.port]}):null]})]}),o.jsx(px,{state:l}),o.jsx("span",{className:"flex items-center gap-1",onClick:d=>d.stopPropagation(),children:o.jsx(mx,{active:u,baseUrl:`/api/services/${encodeURIComponent(e.name)}`,compact:!0,targetLabel:e.name,onRefresh:s,onStarted:a})})]})}const Qc="application/x-nomoreide-service",kw={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 oB({kind:e}){const t=kw[e??"local"]??kw.local;return o.jsx("span",{className:le("rounded border px-1 py-px text-[9px] font-semibold uppercase leading-none tracking-wide",t.className),children:t.label})}function Uc(e){return e==="running"||e==="starting"}function lB(e){return`http://127.0.0.1:${e}`}function px({state:e}){return o.jsx(Pe,{variant:e==="running"?"success":e==="exited"?"danger":e==="starting"?"warning":"outline",className:le(e==="running"&&"font-mono"),children:e})}function cB({data:e}){const[t,s]=y.useState(!1),[i,a]=y.useState(()=>bw()),[l,u]=y.useState(""),[h,m]=y.useState([]),[d,p]=y.useState([]),[g,v]=y.useState(null),{sendToAgent:_}=Bt();y.useEffect(()=>{if(!t)return;let N=!0;return v(null),Promise.allSettled([RC(),OC(20)]).then(j=>{if(!N)return;const[R,z]=j;R.status==="fulfilled"&&m(R.value),z.status==="fulfilled"&&p(z.value),j.filter(M=>M.status==="rejected").length&&v("Some AI context could not be loaded. You can still send available context.")}),()=>{N=!1}},[t]);const S=y.useMemo(()=>uB(e),[e]),w=iz(i),C=y.useMemo(()=>i.serviceNames.length+i.databaseNames.length+i.errorIds.length+i.repositoryPaths.length,[i]);function E(N,j){a(R=>{const z=R[N],D=z.includes(j)?z.filter(M=>M!==j):[...z,j];return{...R,[N]:D}})}function T(){w&&(_({prompt:rz({dashboard:e,databases:h,incidents:d,note:l,selection:i}),source:{type:"workspace-context",label:"AI Diagnose"},label:az({note:l,selection:i})}),s(!1),u(""),a(bw()))}return o.jsxs(o.Fragment,{children:[o.jsxs("button",{"aria-label":"Open AI Diagnose",className:zh(),onClick:()=>s(!0),title:"Open AI Diagnose",type:"button",children:[o.jsx("span",{className:Bh(),children:o.jsx(Gt,{className:"size-4"})}),o.jsx("span",{className:Ih(),children:"Diagnose"})]}),t?o.jsx(Zn,{icon:o.jsx(Gt,{}),onClose:()=>s(!1),size:"xl",title:"AI Diagnose",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium",children:"Pick the context the agent should inspect"}),o.jsx("div",{className:"text-xs text-muted-foreground",children:"Combine services, databases, incidents, and repositories into one focused prompt."})]}),o.jsxs(Pe,{variant:C?"secondary":"outline",children:[C," selected"]})]}),g?o.jsx(Qe,{variant:"muted",children:g}):null,o.jsxs("div",{className:"grid min-h-0 gap-3 overflow-hidden lg:grid-cols-4",children:[o.jsx(Kd,{count:e.config.services.length,icon:o.jsx(CC,{}),title:"Services",children:o.jsx("div",{className:"grid gap-2",children:e.config.services.map(N=>{const j=i.serviceNames.includes(N.name),R=e.runtime.services[N.name],z=e.health[N.name];return o.jsxs(Yd,{selected:j,onClick:()=>E("serviceNames",N.name),children:[o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx("span",{className:"min-w-0 flex-1 truncate font-semibold",children:N.name}),o.jsx("span",{className:"shrink-0",children:o.jsx(px,{state:R?.state??"stopped"})})]}),o.jsxs("span",{className:"mt-1 flex flex-wrap gap-1.5 text-[11px] text-muted-foreground",children:[N.kind?o.jsx("span",{children:N.kind}):null,N.port?o.jsxs("span",{children:[":",N.port]}):null,z?.status?o.jsx("span",{children:z.status}):null]})]},N.name)})})}),o.jsx(Kd,{count:h.length,icon:o.jsx(Xn,{}),title:"Databases",children:h.length?o.jsx("div",{className:"grid gap-2",children:h.map(N=>o.jsxs(Yd,{selected:i.databaseNames.includes(N.name),onClick:()=>E("databaseNames",N.name),children:[o.jsx("span",{className:"truncate font-semibold",children:N.name}),o.jsx("span",{className:"mt-1 block truncate text-[11px] text-muted-foreground",children:N.engine})]},N.name))}):o.jsx(Cw,{text:"No database connections detected."})}),o.jsx(Kd,{count:d.length,icon:o.jsx(Ch,{}),title:"Error Inbox",children:d.length?o.jsx("div",{className:"grid gap-2",children:d.map(N=>o.jsxs(Yd,{selected:i.errorIds.includes(N.id),onClick:()=>E("errorIds",N.id),children:[o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx("span",{className:"min-w-0 flex-1 truncate font-semibold",children:N.title}),o.jsx(Pe,{appearance:"subtle",size:"small",variant:N.level==="error"?"danger":"secondary",children:N.level})]}),o.jsxs("span",{className:"mt-1 block min-w-0 truncate font-mono text-[11px] text-muted-foreground",children:[N.service," x",N.count]})]},N.id))}):o.jsx(Cw,{text:"No recent incidents."})}),o.jsx(Kd,{count:S.length,icon:o.jsx(pn,{}),title:"Git Repositories",children:o.jsx("div",{className:"grid gap-2",children:S.map(N=>{const j=i.repositoryPaths.includes(N.path),R=N.path===(e.git.selectedRepository?.path??e.git.cwd),z=R?e.git.status?.files.length??0:void 0;return o.jsxs(Yd,{selected:j,onClick:()=>E("repositoryPaths",N.path),children:[o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx("span",{className:"min-w-0 flex-1 truncate font-semibold",children:N.name}),R?o.jsx(Pe,{className:"shrink-0",size:"small",variant:"outline",children:"current"}):null]}),o.jsx("span",{className:"mt-1 block min-w-0 truncate font-mono text-[11px] text-muted-foreground",children:N.path}),z!==void 0?o.jsx("span",{className:"mt-1 block truncate text-[11px] text-muted-foreground",children:z?`${z} changed file${z===1?"":"s"}`:"No changed files"}):null]},N.path)})})})]}),o.jsxs("label",{className:"block space-y-2",children:[o.jsx("span",{className:"text-sm font-medium",children:"Extra context"}),o.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:N=>u(N.target.value),placeholder:"Example: checkout is failing after login, API exits when DB is selected...",value:l})]}),o.jsxs("div",{className:"flex items-center justify-end gap-2",children:[o.jsx(se,{onClick:()=>s(!1),type:"button",variant:"outline",children:"Cancel"}),o.jsxs(se,{className:"gap-2",disabled:!w,onClick:T,type:"button",children:[o.jsx(KM,{className:"size-4"}),"Send"]})]})]})}):null]})}function Kd({children:e,count:t,icon:s,title:i}){return o.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:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-sm font-semibold",children:[o.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}),o.jsx("span",{className:"min-w-0 flex-1 truncate",children:i}),o.jsx(Pe,{className:"shrink-0",size:"small",variant:"outline",children:t})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-auto pr-1",children:e})]})}function Yd({children:e,onClick:t,selected:s}){return o.jsx("button",{"aria-pressed":s,className:le("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 Cw({text:e}){return o.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 uB(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 dB(e){const t=hB(e.capabilities);return t?`${e.prompt}
|
|
81
|
+
|
|
82
|
+
${t}`:e.prompt}function hB(e){if(!e)return"";const t=[Xd("Skills",e.skills),Xd("MCP servers",e.mcpServers),Xd("Plugins",e.plugins),Xd("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(`
|
|
83
|
+
`):""}function Xd(e,t){const s=Array.from(new Set((t??[]).map(i=>i.trim()).filter(Boolean)));return s.length?`- ${e}: ${s.join(", ")}`:""}const Nw=/^[ \t>*_-]*WORKFLOW_STATUS:\s*(ok|blocked)\b[ \t]*[—–:-]?[ \t]*(.*)$/im;function fB(e){const t=e.match(Nw);if(t){const s=t[1].toLowerCase()==="blocked",i=t[2]?.trim()||void 0;return{output:e.replace(Nw,"").trim(),blocked:s,reason:s?i:void 0}}return{output:e,blocked:mB(e)}}function mB(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)}const pB="\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 gB(e){const{sendToAgent:t,streaming:s,turns:i}=Bt(),[a,l]=y.useState(null),u=y.useRef(i);y.useEffect(()=>{u.current=i},[i]);const h=y.useRef(!1),m=y.useRef(!1),d=y.useRef(null),p=y.useRef(null),g=y.useRef(!1);y.useEffect(()=>{if(s)g.current=!0;else if(g.current&&p.current){const R=p.current;p.current=null,R()}},[s]);const v=y.useCallback(()=>new Promise(R=>{d.current=R}),[]),_=y.useCallback(()=>new Promise(R=>{let z=!1;const D=()=>{z||(z=!0,clearTimeout(M),p.current=null,R())};p.current=D;const M=setTimeout(()=>{g.current||D()},8e3)}),[]),S=y.useCallback(async R=>{const z=await Py();return R==="committed"?z.files.length===0:R==="pushed"?z.ahead===0:!0},[]),w=y.useCallback(async R=>{if(R.op==="push"){await of();return}if(R.op==="commit"){const z=await Py(),D=z.files.map(M=>M.path);if(!D.length)throw new Error("Nothing to commit — the working tree is clean.");await LC(D),await zC(vB(z.files));return}throw new Error(`Unknown action: ${R.op}`)},[]),C=y.useCallback(async(R,z=!1)=>{if(h.current)return;h.current=!0,m.current=!1;const D=R.steps.map(()=>"pending"),M=R.steps.map(()=>""),$=(B,P,F)=>{D[B]=P,l(V=>V&&{...V,index:B,statuses:[...D],outputs:[...M],...F})};l({workflow:R,index:0,statuses:[...D],outputs:[...M],error:null,outcome:"running"});const L=B=>{h.current=!1,l(P=>P&&{...P,outcome:B})};for(let B=0;B<R.steps.length;B++){const P=R.steps[B];if(P.kind==="gate"){$(B,"waiting");const V=await v();if(d.current=null,V==="stop"){$(B,"skipped"),L("stopped");return}$(B,V==="skip"?"skipped":"done");continue}if(P.kind==="action"){$(B,"running");try{await w(P),$(B,"done"),e?.()}catch(V){$(B,"failed",{error:bB(V)}),L("failed");return}if(m.current)return L("stopped");continue}$(B,"running"),g.current=!1,t({prompt:dB(P)+pB,source:{type:"workflow",label:`${R.name}: ${P.title}`},mode:"send",label:P.title,autoApprove:z,background:!0}),await _(),e?.();const F=fB(xB(u.current));if(M[B]=F.output||"(no reply — see the dock)",F.blocked){$(B,"blocked",{error:F.reason?`Paused — ${F.reason}`:"Paused — this step needs your input. Open the dock to reply, then re-run."}),L("blocked");return}if(P.verify&&!await S(P.verify).catch(()=>!1)){$(B,"failed",{error:P.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."}),L("failed");return}if($(B,"done"),m.current)return L("stopped")}L("done")},[e,w,t,S,_,v]),E=y.useCallback(()=>d.current?.("approve"),[]),T=y.useCallback(()=>d.current?.("skip"),[]),N=y.useCallback(()=>{m.current=!0,d.current?.("stop")},[]),j=y.useCallback(()=>{h.current||l(null)},[]);return{run:a,start:C,approve:E,skip:T,stop:N,dismiss:j,isRunning:!!a&&a.outcome==="running"}}function bB(e){return e instanceof Error?e.message:String(e)}function xB(e){for(let t=e.length-1;t>=0;t--)if(e[t].role==="assistant")return e[t].text.trim();return""}function vB(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 XE=y.createContext(null);function _B({onRefresh:e,children:t}){const s=gB(e);return o.jsx(XE.Provider,{value:s,children:t})}function yB(){const e=y.useContext(XE);if(!e)throw new Error("useWorkflowRun must be used within a WorkflowRunProvider");return e}function SB({git:e,onRefresh:t}){const{sendToAgent:s}=Bt(),[i,a]=y.useState(!1),[l,u]=y.useState(null),[h,m]=y.useState(null),d=e.status,p=d?.branch||void 0,g=d?.files.length??0,v=d?.ahead??0,_=d?.behind??0;y.useEffect(()=>{if(!p){m(null);return}let C=!0;return i0(p,1).then(E=>{if(!C)return;const T=E[0];m(T&&wB(T)?T:null)}).catch(()=>{C&&m(null)}),()=>{C=!1}},[p]);const S=y.useMemo(()=>g>0||v>0||_>0||!!h,[g,v,_,h]);if(!d||!S)return null;async function w(){a(!0),u(null);try{await of(),t?.()}catch(C){u(C instanceof Error?C.message:String(C))}finally{a(!1)}}return o.jsx("div",{className:"mx-auto mb-2 w-full max-w-4xl",children:o.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:[o.jsxs("span",{className:"mr-0.5 inline-flex items-center gap-1 font-medium text-muted-foreground",children:[o.jsx(Gt,{className:"size-3.5"}),p??"git"]}),g>0?o.jsx(Zd,{icon:o.jsx(L4,{className:"size-3"}),label:`Commit ${g} change${g===1?"":"s"}`,ai:!0,onClick:()=>s({prompt:J9({branch:p,fileCount:g}),source:{type:"git-situation",label:"uncommitted changes"},mode:"send",label:`Commit ${g} uncommitted change${g===1?"":"s"}`})}):null,_>0?o.jsx(Zd,{icon:o.jsx(jb,{className:"size-3"}),label:`Pull ${_} behind`,ai:!0,onClick:()=>s({prompt:ez({branch:p,behind:_,upstream:d.upstream}),source:{type:"git-situation",label:"behind upstream"},mode:"send",label:`Pull & rebase (${_} behind)`})}):null,v>0?o.jsx(Zd,{icon:i?o.jsx(pt,{className:"size-3 animate-spin"}):o.jsx(Lb,{className:"size-3"}),label:`Push ${v}`,disabled:i,onClick:()=>{w()}}):null,h?o.jsx(Zd,{danger:!0,icon:o.jsx(cu,{className:"size-3"}),label:"Fix failing CI",ai:!0,onClick:()=>s({prompt:tz({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?o.jsx("span",{className:"text-destructive",children:l}):null]})})}function Zd({ai:e,danger:t,disabled:s,icon:i,label:a,onClick:l}){return o.jsxs("button",{className:le("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?o.jsx(Gt,{className:"size-3 opacity-70"}):null]})}function wB(e){return e.status==="completed"&&e.conclusion!==null&&!["success","neutral","skipped"].includes(e.conclusion)}const kB=new Set(["c","cpp","cs","go","java","js","jsx","kt","mjs","py","rs","swift","ts","tsx"]),CB=new Set([".env",".gitignore","components.json","dockerfile","package.json","tsconfig.json","vite.config.ts"]),NB=new Set(["conf","config","ini","toml","yaml","yml"]),EB=new Set(["csv","json","sql","xml"]),TB=new Set(["md","mdx","rst","txt"]),jB=new Set(["gif","jpeg","jpg","png","svg","webp"]),AB=new Set(["package-lock.json","pnpm-lock.yaml","yarn.lock"]),MB=new Set(["css","less","sass","scss"]);function RB(e){const t=e.split("/").pop()?.toLowerCase()??e.toLowerCase(),s=t.includes(".")?t.split(".").pop()??"":"";return AB.has(t)||t.endsWith(".lock")?"lock":DB(t)?"test":CB.has(t)||NB.has(s)?"config":MB.has(s)?"style":jB.has(s)?"image":TB.has(s)?"document":EB.has(s)?"data":kB.has(s)?"code":"generic"}function DB(e){return e.includes(".test.")||e.includes(".spec.")||e.endsWith("_test.go")}function gx({path:e,className:t}){const s=RB(e),i=OB[s];return o.jsx(i,{"aria-label":`${s} file`,className:le("size-3.5 shrink-0",LB[s],t)})}const OB={code:fC,config:ZM,data:Xn,document:pC,generic:gC,image:W4,lock:nM,style:SM,test:w4},LB={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 zB(e){const t=e.lastIndexOf(".");return t>0?e.slice(t):""}function BB({onPick:e,onClose:t}){const[s,i]=y.useState(""),[a,l]=y.useState(null),[u,h]=y.useState(null),[m,d]=y.useState(!1),p=y.useRef(null),g=a?a.parent!==a.path:!1;return y.useEffect(()=>{function v(_){p.current&&!p.current.contains(_.target)&&t()}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[t]),y.useEffect(()=>{let v=!0;return d(!0),h(null),IC(s,{files:!0}).then(_=>v&&l(_)).catch(_=>v&&h(_ instanceof Error?_.message:String(_))).finally(()=>v&&d(!1)),()=>{v=!1}},[s]),o.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:[o.jsxs("div",{className:"flex items-center gap-1 border-b border-border px-2 py-1.5",children:[o.jsx(se,{"aria-label":"Parent folder",className:"size-7",disabled:!g,onClick:()=>a&&i(a.parent),size:"icon",type:"button",variant:"ghost",children:o.jsx(nf,{})}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",title:a?.path,children:a?.path??"…"}),m?o.jsx(pt,{className:"size-3.5 animate-spin text-muted-foreground"}):null,a?o.jsxs(se,{className:"h-7 px-2 text-[11px]",onClick:()=>e(a.path),size:"sm",title:"Attach this folder",type:"button",variant:"outline",children:[o.jsx(r4,{})," This folder"]}):null,o.jsx(se,{"aria-label":"Close",className:"size-7",onClick:t,size:"icon",type:"button",variant:"ghost",children:o.jsx(Gs,{})})]}),o.jsx("div",{className:"max-h-64 overflow-auto p-1",children:u?o.jsx(Qe,{variant:"destructive",className:"m-1",children:u}):a&&a.entries.length===0?o.jsx(Qe,{variant:"muted",className:"m-1 text-center",children:"Empty folder."}):a?.entries.map(v=>{const _=v.isDir?"":zB(v.name);return o.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:()=>v.isDir?i(v.path):e(v.path),title:v.path,type:"button",children:[v.isDir?o.jsx(Ja,{className:"size-3.5 shrink-0 text-amber-600"}):o.jsx(gx,{path:v.path}),o.jsx("span",{className:"min-w-0 flex-1 truncate",children:v.name}),_?o.jsx("span",{className:"shrink-0 rounded bg-muted px-1 font-mono text-[10px] text-muted-foreground",children:_}):null]},v.path)})})]})}const IB=/```options[^\n]*\n([\s\S]*?)```/g,PB=/```service[^\n]*\n([\s\S]*?)```/g,$B=/```sql-write[^\S\n]*([^\n]*)\n([\s\S]*?)```/g,HB=/```(?:options|service|sql-write)[^\n]*\n[\s\S]*$/;function UB(e){const t=[];let s=null,i=null,a=e.replace(IB,(l,u)=>{for(const h of u.split(`
|
|
84
|
+
`)){const m=h.replace(/^[-*\d.)\s]+/,"").trim();m&&t.push(m)}return""});return a=a.replace(PB,(l,u)=>{const h=u.split(`
|
|
85
|
+
`).map(m=>m.trim()).find(Boolean);return h&&(s=h),""}),a=a.replace($B,(l,u,h)=>{const m=h.trim();return m&&(i={connection:u.trim(),sql:m}),""}),a=a.replace(HB,""),{body:a.trim(),options:t,service:s,sqlWrite:i}}function FB({options:e,disabled:t,onChoose:s}){return o.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.map(i=>o.jsx(se,{className:"h-7",disabled:t,onClick:()=>s(i),size:"sm",type:"button",variant:"outline",children:i},i))})}function qB({service:e,onStart:t,onOpen:s}){return o.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 rounded-md border border-border bg-muted/30 px-2 py-1.5",children:[o.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["Added ",o.jsx("span",{className:"font-medium text-foreground",children:e})]}),o.jsxs("div",{className:"ml-auto flex gap-1.5",children:[o.jsxs(se,{className:"h-7",onClick:()=>t(e),size:"sm",type:"button",children:[o.jsx(eo,{})," Start"]}),s?o.jsxs(se,{className:"h-7",onClick:()=>s(e),size:"sm",type:"button",variant:"outline",children:[o.jsx(aa,{})," Open"]}):null]})]})}function VB({proposal:e,onOpen:t}){return o.jsxs("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/[0.06] px-2.5 py-2",children:[o.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[o.jsx(Xn,{className:"size-3.5 text-amber-600 dark:text-amber-400"}),o.jsxs("span",{children:["Proposed write",e.connection?o.jsxs(o.Fragment,{children:[" ","on ",o.jsx("span",{className:"font-medium text-foreground",children:e.connection})]}):null," ","— runs in the console after you unlock and preview."]})]}),o.jsx("pre",{className:"mb-2 max-h-28 overflow-auto rounded bg-background px-2 py-1.5 font-mono text-[11px] text-foreground",children:e.sql}),o.jsxs(se,{className:"h-7 w-full bg-amber-600 text-white hover:bg-amber-600/90",onClick:()=>t(e.connection,e.sql),size:"sm",type:"button",children:[o.jsx(aa,{})," Open in SQL console"]})]})}function bx(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var so=bx();function ZE(e){so=e}var $a={exec:()=>null};function qo(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 ct(e,t=""){let s=typeof e=="string"?e:e.source,i={replace:(a,l)=>{let u=typeof l=="string"?l:l.source;return u=u.replace(Vs.caret,"$1"),s=s.replace(a,u),i},getRegex:()=>new RegExp(s,t)};return i}var GB=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch{return!1}})(),Vs={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:qo(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:qo(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:qo(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:qo(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:qo(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:qo(e=>new RegExp(`^ {0,${e}}>`))},WB=/^(?:[ \t]*(?:\n|$))+/,KB=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,YB=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,xu=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,XB=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,xx=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,QE=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,JE=ct(QE).replace(/bull/g,xx).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(),ZB=ct(QE).replace(/bull/g,xx).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(),vx=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,QB=/^[^\n]+/,_x=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,JB=ct(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",_x).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),eI=ct(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,xx).getRegex(),pf="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",yx=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,tI=ct("^ {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",yx).replace("tag",pf).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),e3=ct(vx).replace("hr",xu).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",pf).getRegex(),sI=ct(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",e3).getRegex(),Sx={blockquote:sI,code:KB,def:JB,fences:YB,heading:XB,hr:xu,html:tI,lheading:JE,list:eI,newline:WB,paragraph:e3,table:$a,text:QB},Ew=ct("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",xu).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",pf).getRegex(),nI={...Sx,lheading:ZB,table:Ew,paragraph:ct(vx).replace("hr",xu).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ew).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",pf).getRegex()},iI={...Sx,html:ct(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",yx).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:$a,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ct(vx).replace("hr",xu).replace("heading",` *#{1,6} *[^
|
|
86
|
+
]`).replace("lheading",JE).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},rI=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,aI=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,t3=/^( {2,}|\\)\n(?!\s*$)/,oI=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,pl=/[\p{P}\p{S}]/u,gf=/[\s\p{P}\p{S}]/u,wx=/[^\s\p{P}\p{S}]/u,lI=ct(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,gf).getRegex(),s3=/(?!~)[\p{P}\p{S}]/u,cI=/(?!~)[\s\p{P}\p{S}]/u,uI=/(?:[^\s\p{P}\p{S}]|~)/u,dI=ct(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",GB?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),n3=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,hI=ct(n3,"u").replace(/punct/g,pl).getRegex(),fI=ct(n3,"u").replace(/punct/g,s3).getRegex(),i3="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",mI=ct(i3,"gu").replace(/notPunctSpace/g,wx).replace(/punctSpace/g,gf).replace(/punct/g,pl).getRegex(),pI=ct(i3,"gu").replace(/notPunctSpace/g,uI).replace(/punctSpace/g,cI).replace(/punct/g,s3).getRegex(),gI=ct("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,wx).replace(/punctSpace/g,gf).replace(/punct/g,pl).getRegex(),bI=ct(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,pl).getRegex(),xI="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",vI=ct(xI,"gu").replace(/notPunctSpace/g,wx).replace(/punctSpace/g,gf).replace(/punct/g,pl).getRegex(),_I=ct(/\\(punct)/,"gu").replace(/punct/g,pl).getRegex(),yI=ct(/^<(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(),SI=ct(yx).replace("(?:-->|$)","-->").getRegex(),wI=ct("^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",SI).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Hh=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,kI=ct(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Hh).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),r3=ct(/^!?\[(label)\]\[(ref)\]/).replace("label",Hh).replace("ref",_x).getRegex(),a3=ct(/^!?\[(ref)\](?:\[\])?/).replace("ref",_x).getRegex(),CI=ct("reflink|nolink(?!\\()","g").replace("reflink",r3).replace("nolink",a3).getRegex(),Tw=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,kx={_backpedal:$a,anyPunctuation:_I,autolink:yI,blockSkip:dI,br:t3,code:aI,del:$a,delLDelim:$a,delRDelim:$a,emStrongLDelim:hI,emStrongRDelimAst:mI,emStrongRDelimUnd:gI,escape:rI,link:kI,nolink:a3,punctuation:lI,reflink:r3,reflinkSearch:CI,tag:wI,text:oI,url:$a},NI={...kx,link:ct(/^!?\[(label)\]\((.*?)\)/).replace("label",Hh).getRegex(),reflink:ct(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Hh).getRegex()},A0={...kx,emStrongRDelimAst:pI,emStrongLDelim:fI,delLDelim:bI,delRDelim:vI,url:ct(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Tw).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:ct(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Tw).getRegex()},EI={...A0,br:ct(t3).replace("{2,}","*").getRegex(),text:ct(A0.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Qd={normal:Sx,gfm:nI,pedantic:iI},bc={normal:kx,gfm:A0,breaks:EI,pedantic:NI},TI={"&":"&","<":"<",">":">",'"':""","'":"'"},jw=e=>TI[e];function Ci(e,t){if(t){if(Vs.escapeTest.test(e))return e.replace(Vs.escapeReplace,jw)}else if(Vs.escapeTestNoEncode.test(e))return e.replace(Vs.escapeReplaceNoEncode,jw);return e}function Aw(e){try{e=encodeURI(e).replace(Vs.percentDecode,"%")}catch{return null}return e}function Mw(e,t){let s=e.replace(Vs.findPipe,(l,u,h)=>{let m=!1,d=u;for(;--d>=0&&h[d]==="\\";)m=!m;return m?"|":" |"}),i=s.split(Vs.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(Vs.slashPipe,"|");return i}function Xr(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 Rw(e){let t=e.split(`
|
|
87
|
+
`),s=t.length-1;for(;s>=0&&Vs.blankLine.test(t[s]);)s--;return t.length-s<=2?e:t.slice(0,s+1).join(`
|
|
88
|
+
`)}function jI(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 AI(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 Dw(e,t,s,i,a){let l=t.href,u=t.title||null,h=e[1].replace(a.other.outputLinkReplace,"$1");i.state.inLink=!0;let m={type:e[0].charAt(0)==="!"?"image":"link",raw:s,href:l,title:u,text:h,tokens:i.inlineTokens(h)};return i.state.inLink=!1,m}function MI(e,t,s){let i=e.match(s.other.indentCodeCompensation);if(i===null)return t;let a=i[1];return t.split(`
|
|
89
|
+
`).map(l=>{let u=l.match(s.other.beginningSpace);if(u===null)return l;let[h]=u;return h.length>=a.length?l.slice(a.length):l}).join(`
|
|
90
|
+
`)}var Uh=class{options;rules;lexer;constructor(e){this.options=e||so}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]:Rw(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=MI(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=Xr(s,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(s=i.trim())}return{type:"heading",raw:Xr(t[0],`
|
|
91
|
+
`),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:Xr(t[0],`
|
|
92
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let s=Xr(t[0],`
|
|
93
|
+
`).split(`
|
|
94
|
+
`),i="",a="",l=[];for(;s.length>0;){let u=!1,h=[],m;for(m=0;m<s.length;m++)if(this.rules.other.blockquoteStart.test(s[m]))h.push(s[m]),u=!0;else if(!u)h.push(s[m]);else break;s=s.slice(m);let d=h.join(`
|
|
95
|
+
`),p=d.replace(this.rules.other.blockquoteSetextReplace,`
|
|
96
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
|
|
97
|
+
${d}`:d,a=a?`${a}
|
|
98
|
+
${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 v=l.at(-1);if(v?.type==="code")break;if(v?.type==="blockquote"){let _=v,S=_.raw+`
|
|
99
|
+
`+s.join(`
|
|
100
|
+
`),w=this.blockquote(S);l[l.length-1]=w,i=i.substring(0,i.length-_.raw.length)+w.raw,a=a.substring(0,a.length-_.text.length)+w.text;break}else if(v?.type==="list"){let _=v,S=_.raw+`
|
|
101
|
+
`+s.join(`
|
|
102
|
+
`),w=this.list(S);l[l.length-1]=w,i=i.substring(0,i.length-v.raw.length)+w.raw,a=a.substring(0,a.length-_.raw.length)+w.raw,s=S.substring(l.at(-1).raw.length).split(`
|
|
103
|
+
`);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),u=!1;for(;e;){let m=!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=AI(t[2].split(`
|
|
104
|
+
`,1)[0],t[1].length),v=e.split(`
|
|
105
|
+
`,1)[0],_=!g.trim(),S=0;if(this.options.pedantic?(S=2,p=g.trimStart()):_?S=t[1].length+1:(S=g.search(this.rules.other.nonSpaceChar),S=S>4?1:S,p=g.slice(S),S+=t[1].length),_&&this.rules.other.blankLine.test(v)&&(d+=v+`
|
|
106
|
+
`,e=e.substring(v.length+1),m=!0),!m){let w=this.rules.other.nextBulletRegex(S),C=this.rules.other.hrRegex(S),E=this.rules.other.fencesBeginRegex(S),T=this.rules.other.headingBeginRegex(S),N=this.rules.other.htmlBeginRegex(S),j=this.rules.other.blockquoteBeginRegex(S);for(;e;){let R=e.split(`
|
|
107
|
+
`,1)[0],z;if(v=R,this.options.pedantic?(v=v.replace(this.rules.other.listReplaceNesting," "),z=v):z=v.replace(this.rules.other.tabCharGlobal," "),E.test(v)||T.test(v)||N.test(v)||j.test(v)||w.test(v)||C.test(v))break;if(z.search(this.rules.other.nonSpaceChar)>=S||!v.trim())p+=`
|
|
108
|
+
`+z.slice(S);else{if(_||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||E.test(g)||T.test(g)||C.test(g))break;p+=`
|
|
109
|
+
`+v}_=!v.trim(),d+=R+`
|
|
110
|
+
`,e=e.substring(R.length+1),g=z.slice(S)}}a.loose||(u?a.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(u=!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 m of a.items){this.lexer.state.top=!1,m.tokens=this.lexer.blockTokens(m.text,[]);let d=m.tokens[0];if(m.task&&(d?.type==="text"||d?.type==="paragraph")){m.text=m.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(m.raw);if(p){let g={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};m.checked=g.checked,a.loose?m.tokens[0]&&["paragraph","text"].includes(m.tokens[0].type)&&"tokens"in m.tokens[0]&&m.tokens[0].tokens?(m.tokens[0].raw=g.raw+m.tokens[0].raw,m.tokens[0].text=g.raw+m.tokens[0].text,m.tokens[0].tokens.unshift(g)):m.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):m.tokens.unshift(g)}}else m.task&&(m.task=!1);if(!a.loose){let p=m.tokens.filter(v=>v.type==="space"),g=p.length>0&&p.some(v=>this.rules.other.anyLine.test(v.raw));a.loose=g}}if(a.loose)for(let m of a.items){m.loose=!0;for(let d of m.tokens)d.type==="text"&&(d.type="paragraph")}return a}}html(e){let t=this.rules.block.html.exec(e);if(t){let s=Rw(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:Xr(t[0],`
|
|
111
|
+
`),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=Mw(t[1]),i=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),a=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
112
|
+
`):[],l={type:"table",raw:Xr(t[0],`
|
|
113
|
+
`),header:[],align:[],rows:[]};if(s.length===i.length){for(let u of i)this.rules.other.tableAlignRight.test(u)?l.align.push("right"):this.rules.other.tableAlignCenter.test(u)?l.align.push("center"):this.rules.other.tableAlignLeft.test(u)?l.align.push("left"):l.align.push(null);for(let u=0;u<s.length;u++)l.header.push({text:s[u],tokens:this.lexer.inline(s[u]),header:!0,align:l.align[u]});for(let u of a)l.rows.push(Mw(u,l.header.length).map((h,m)=>({text:h,tokens:this.lexer.inline(h),header:!1,align:l.align[m]})));return l}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let s=t[1].trim();return{type:"heading",raw:Xr(t[0],`
|
|
114
|
+
`),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)===`
|
|
115
|
+
`?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=Xr(s.slice(0,-1),"\\");if((s.length-l.length)%2===0)return}else{let l=jI(t[2],"()");if(l===-2)return;if(l>-1){let u=(t[0].indexOf("!")===0?5:4)+t[1].length+l;t[2]=t[2].substring(0,l),t[0]=t[0].substring(0,u).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)),Dw(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 Dw(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,u,h=a,m=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(u=[...l].length,i[3]||i[4]){h+=u;continue}else if((i[5]||i[6])&&a%3&&!((a+u)%3)){m+=u;continue}if(h-=u,h>0)continue;u=Math.min(u,u+h+m);let p=[...i[0]][0].length,g=e.slice(0,a+i.index+p+u);if(Math.min(a,u)%2){let _=g.slice(1,-1);return{type:"em",raw:g,text:_,tokens:this.lexer.inlineTokens(_)}}let v=g.slice(2,-2);return{type:"strong",raw:g,text:v,tokens:this.lexer.inlineTokens(v)}}}}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,u,h=a,m=this.rules.inline.delRDelim;for(m.lastIndex=0,t=t.slice(-1*e.length+a);(i=m.exec(t))!==null;){if(l=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!l||(u=[...l].length,u!==a))continue;if(i[3]||i[4]){h+=u;continue}if(h-=u,h>0)continue;u=Math.min(u,u+h);let d=[...i[0]][0].length,p=e.slice(0,a+i.index+d+u),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}}}},ci=class M0{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||so,this.options.tokenizer=this.options.tokenizer||new Uh,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:Vs,block:Qd.normal,inline:bc.normal};this.options.pedantic?(s.block=Qd.pedantic,s.inline=bc.pedantic):this.options.gfm&&(s.block=Qd.gfm,this.options.breaks?s.inline=bc.breaks:s.inline=bc.gfm),this.tokenizer.rules=s}static get rules(){return{block:Qd,inline:bc}}static lex(t,s){return new M0(s).lex(t)}static lexInline(t,s){return new M0(s).inlineTokens(t)}lex(t){t=t.replace(Vs.carriageReturn,`
|
|
116
|
+
`),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(Vs.tabCharGlobal," ").replace(Vs.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+=`
|
|
117
|
+
`: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(`
|
|
118
|
+
`)?"":`
|
|
119
|
+
`)+l.raw,h.text+=`
|
|
120
|
+
`+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(`
|
|
121
|
+
`)?"":`
|
|
122
|
+
`)+l.raw,h.text+=`
|
|
123
|
+
`+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 u=t;if(this.options.extensions?.startBlock){let h=1/0,m=t.slice(1),d;this.options.extensions.startBlock.forEach(p=>{d=p.call({lexer:this},m),typeof d=="number"&&d>=0&&(h=Math.min(h,d))}),h<1/0&&h>=0&&(u=t.substring(0,h+1))}if(this.state.top&&(l=this.tokenizer.paragraph(u))){let h=s.at(-1);i&&h?.type==="paragraph"?(h.raw+=(h.raw.endsWith(`
|
|
124
|
+
`)?"":`
|
|
125
|
+
`)+l.raw,h.text+=`
|
|
126
|
+
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):s.push(l),i=u.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(`
|
|
127
|
+
`)?"":`
|
|
128
|
+
`)+l.raw,h.text+=`
|
|
129
|
+
`+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 u=!1,h="",m=1/0;for(;t;){if(t.length<m)m=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}u||(h=""),u=!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,v=t.slice(1),_;this.options.extensions.startInline.forEach(S=>{_=S.call({lexer:this},v),typeof _=="number"&&_>=0&&(g=Math.min(g,_))}),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)),u=!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)}},Fh=class{options;parser;constructor(e){this.options=e||so}space(e){return""}code({text:e,lang:t,escaped:s}){let i=(t||"").match(Vs.notSpaceStart)?.[0],a=e.replace(Vs.endingNewline,"")+`
|
|
130
|
+
`;return i?'<pre><code class="language-'+Ci(i)+'">'+(s?a:Ci(a,!0))+`</code></pre>
|
|
131
|
+
`:"<pre><code>"+(s?a:Ci(a,!0))+`</code></pre>
|
|
132
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
133
|
+
${this.parser.parse(e)}</blockquote>
|
|
134
|
+
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
135
|
+
`}hr(e){return`<hr>
|
|
136
|
+
`}list(e){let t=e.ordered,s=e.start,i="";for(let u=0;u<e.items.length;u++){let h=e.items[u];i+=this.listitem(h)}let a=t?"ol":"ul",l=t&&s!==1?' start="'+s+'"':"";return"<"+a+l+`>
|
|
137
|
+
`+i+"</"+a+`>
|
|
138
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
139
|
+
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
140
|
+
`}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 u=0;u<l.length;u++)s+=this.tablecell(l[u]);i+=this.tablerow({text:s})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
|
|
141
|
+
<thead>
|
|
142
|
+
`+t+`</thead>
|
|
143
|
+
`+i+`</table>
|
|
144
|
+
`}tablerow({text:e}){return`<tr>
|
|
145
|
+
${e}</tr>
|
|
146
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),s=e.header?"th":"td";return(e.align?`<${s} align="${e.align}">`:`<${s}>`)+t+`</${s}>
|
|
147
|
+
`}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>${Ci(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=Aw(e);if(a===null)return i;e=a;let l='<a href="'+e+'"';return t&&(l+=' title="'+Ci(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=Aw(e);if(a===null)return Ci(s);e=a;let l=`<img src="${e}" alt="${Ci(s)}"`;return t&&(l+=` title="${Ci(t)}"`),l+=">",l}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Ci(e.text)}},Cx=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},ui=class R0{options;renderer;textRenderer;constructor(t){this.options=t||so,this.options.renderer=this.options.renderer||new Fh,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Cx}static parse(t,s){return new R0(s).parse(t)}static parseInline(t,s){return new R0(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 u=a,h=this.options.extensions.renderers[u.type].call({parser:this},u);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(u.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 u='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}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 u=l;switch(u.type){case"escape":{i+=s.text(u);break}case"html":{i+=s.html(u);break}case"link":{i+=s.link(u);break}case"image":{i+=s.image(u);break}case"checkbox":{i+=s.checkbox(u);break}case"strong":{i+=s.strong(u);break}case"em":{i+=s.em(u);break}case"codespan":{i+=s.codespan(u);break}case"br":{i+=s.br(u);break}case"del":{i+=s.del(u);break}case"text":{i+=s.text(u);break}default:{let h='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return i}},Tc=class{options;block;constructor(e){this.options=e||so}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?ci.lex:ci.lexInline}provideParser(e=this.block){return e?ui.parse:ui.parseInline}},RI=class{defaults=bx();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ui;Renderer=Fh;TextRenderer=Cx;Lexer=ci;Tokenizer=Uh;Hooks=Tc;constructor(...t){this.use(...t)}walkTokens(t,s){let i=[];for(let a of t)switch(i=i.concat(s.call(this,a)),a.type){case"table":{let l=a;for(let u of l.header)i=i.concat(this.walkTokens(u.tokens,s));for(let u of l.rows)for(let h of u)i=i.concat(this.walkTokens(h.tokens,s));break}case"list":{let l=a;i=i.concat(this.walkTokens(l.items,s));break}default:{let l=a;this.defaults.extensions?.childTokens?.[l.type]?this.defaults.extensions.childTokens[l.type].forEach(u=>{let h=l[u].flat(1/0);i=i.concat(this.walkTokens(h,s))}):l.tokens&&(i=i.concat(this.walkTokens(l.tokens,s)))}}return i}use(...t){let s=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(i=>{let a={...i};if(a.async=this.defaults.async||a.async||!1,i.extensions&&(i.extensions.forEach(l=>{if(!l.name)throw new Error("extension name required");if("renderer"in l){let u=s.renderers[l.name];u?s.renderers[l.name]=function(...h){let m=l.renderer.apply(this,h);return m===!1&&(m=u.apply(this,h)),m}:s.renderers[l.name]=l.renderer}if("tokenizer"in l){if(!l.level||l.level!=="block"&&l.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let u=s[l.level];u?u.unshift(l.tokenizer):s[l.level]=[l.tokenizer],l.start&&(l.level==="block"?s.startBlock?s.startBlock.push(l.start):s.startBlock=[l.start]:l.level==="inline"&&(s.startInline?s.startInline.push(l.start):s.startInline=[l.start]))}"childTokens"in l&&l.childTokens&&(s.childTokens[l.name]=l.childTokens)}),a.extensions=s),i.renderer){let l=this.defaults.renderer||new Fh(this.defaults);for(let u in i.renderer){if(!(u in l))throw new Error(`renderer '${u}' does not exist`);if(["options","parser"].includes(u))continue;let h=u,m=i.renderer[h],d=l[h];l[h]=(...p)=>{let g=m.apply(l,p);return g===!1&&(g=d.apply(l,p)),g||""}}a.renderer=l}if(i.tokenizer){let l=this.defaults.tokenizer||new Uh(this.defaults);for(let u in i.tokenizer){if(!(u in l))throw new Error(`tokenizer '${u}' does not exist`);if(["options","rules","lexer"].includes(u))continue;let h=u,m=i.tokenizer[h],d=l[h];l[h]=(...p)=>{let g=m.apply(l,p);return g===!1&&(g=d.apply(l,p)),g}}a.tokenizer=l}if(i.hooks){let l=this.defaults.hooks||new Tc;for(let u in i.hooks){if(!(u in l))throw new Error(`hook '${u}' does not exist`);if(["options","block"].includes(u))continue;let h=u,m=i.hooks[h],d=l[h];Tc.passThroughHooks.has(u)?l[h]=p=>{if(this.defaults.async&&Tc.passThroughHooksRespectAsync.has(u))return(async()=>{let v=await m.call(l,p);return d.call(l,v)})();let g=m.call(l,p);return d.call(l,g)}:l[h]=(...p)=>{if(this.defaults.async)return(async()=>{let v=await m.apply(l,p);return v===!1&&(v=await d.apply(l,p)),v})();let g=m.apply(l,p);return g===!1&&(g=d.apply(l,p)),g}}a.hooks=l}if(i.walkTokens){let l=this.defaults.walkTokens,u=i.walkTokens;a.walkTokens=function(h){let m=[];return m.push(u.call(this,h)),l&&(m=m.concat(l.call(this,h))),m}}this.defaults={...this.defaults,...a}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,s){return ci.lex(t,s??this.defaults)}parser(t,s){return ui.parse(t,s??this.defaults)}parseMarkdown(t){return(s,i)=>{let a={...i},l={...this.defaults,...a},u=this.onError(!!l.silent,!!l.async);if(this.defaults.async===!0&&a.async===!1)return u(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 s>"u"||s===null)return u(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return u(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(l.hooks&&(l.hooks.options=l,l.hooks.block=t),l.async)return(async()=>{let h=l.hooks?await l.hooks.preprocess(s):s,m=await(l.hooks?await l.hooks.provideLexer(t):t?ci.lex:ci.lexInline)(h,l),d=l.hooks?await l.hooks.processAllTokens(m):m;l.walkTokens&&await Promise.all(this.walkTokens(d,l.walkTokens));let p=await(l.hooks?await l.hooks.provideParser(t):t?ui.parse:ui.parseInline)(d,l);return l.hooks?await l.hooks.postprocess(p):p})().catch(u);try{l.hooks&&(s=l.hooks.preprocess(s));let h=(l.hooks?l.hooks.provideLexer(t):t?ci.lex:ci.lexInline)(s,l);l.hooks&&(h=l.hooks.processAllTokens(h)),l.walkTokens&&this.walkTokens(h,l.walkTokens);let m=(l.hooks?l.hooks.provideParser(t):t?ui.parse:ui.parseInline)(h,l);return l.hooks&&(m=l.hooks.postprocess(m)),m}catch(h){return u(h)}}}onError(t,s){return i=>{if(i.message+=`
|
|
148
|
+
Please report this to https://github.com/markedjs/marked.`,t){let a="<p>An error occurred:</p><pre>"+Ci(i.message+"",!0)+"</pre>";return s?Promise.resolve(a):a}if(s)return Promise.reject(i);throw i}}},Ya=new RI;function mt(e,t){return Ya.parse(e,t)}mt.options=mt.setOptions=function(e){return Ya.setOptions(e),mt.defaults=Ya.defaults,ZE(mt.defaults),mt};mt.getDefaults=bx;mt.defaults=so;mt.use=function(...e){return Ya.use(...e),mt.defaults=Ya.defaults,ZE(mt.defaults),mt};mt.walkTokens=function(e,t){return Ya.walkTokens(e,t)};mt.parseInline=Ya.parseInline;mt.Parser=ui;mt.parser=ui.parse;mt.Renderer=Fh;mt.TextRenderer=Cx;mt.Lexer=ci;mt.lexer=ci.lex;mt.Tokenizer=Uh;mt.Hooks=Tc;mt.parse=mt;mt.options;mt.setOptions;mt.use;mt.walkTokens;mt.parseInline;ui.parse;ci.lex;function DI(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 OI({content:e}){const t=y.useMemo(()=>{const s=mt.parse(e,{async:!1,gfm:!0,breaks:!0});return DI(s)},[e]);return o.jsx("div",{className:"chat-md",dangerouslySetInnerHTML:{__html:t}})}function LI(e){return Math.min(e,Math.max(1,Math.ceil(e/22)))}function zI(e){const[t,s]=y.useState(e),i=y.useRef(e),a=y.useRef(e);return a.current=e,y.useEffect(()=>{e.startsWith(i.current)||(i.current=e,s(e))},[e]),y.useEffect(()=>{if(i.current.length>=a.current.length)return;const l=requestAnimationFrame(()=>{const u=a.current,h=u.slice(0,i.current.length+LI(u.length-i.current.length));i.current=h,s(h)});return()=>cancelAnimationFrame(l)},[t,e]),t}function BI(){return o.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",role:"status",children:[o.jsx(pt,{className:"size-3.5 animate-spin"}),o.jsx("span",{children:"Thinking…"})]})}function II({onOpenAgentPage:e,onOpenService:t,onOpenSqlConsole:s,git:i,onGitRefresh:a}){const{error:l,success:u}=Ns(),{turns:h,streaming:m,error:d,configured:p,provider:g,approvals:v,send:_,stop:S,clear:w,respond:C,open:E,setOpen:T,draft:N,setDraft:j,insertPath:R,activeSource:z,clearSource:D,focusNonce:M,stickNonce:$,sendToAgent:L,onboarding:B,setOnboarding:P}=Bt(),[F,V]=y.useState(""),[G,I]=y.useState(!1),[Y,X]=y.useState(!1),[W,ee]=y.useState(!1),[O,Z]=y.useState(null),[ie,de]=y.useState(!1),fe=y.useRef(null),pe=y.useRef(null),Se=y.useRef(null),Le=y.useRef(null);y.useEffect(()=>{if(!E||B)return;let _e=0,ht=0;const gn=()=>{const Ts=pe.current;if(!Ts||N&&Ts.value!==N){ht++<10&&(_e=requestAnimationFrame(gn));return}Ts.focus();const gt=Ts.value.length;Ts.setSelectionRange(gt,gt),Ts.scrollTop=Ts.scrollHeight};return _e=requestAnimationFrame(gn),()=>cancelAnimationFrame(_e)},[E,M,B]),y.useLayoutEffect(()=>{const _e=pe.current;_e&&(_e.style.height="auto",_e.style.height=`${_e.scrollHeight}px`)},[N]),y.useEffect(()=>{!E||!B||requestAnimationFrame(()=>Se.current?.focus())},[E,B]),y.useEffect(()=>{if(!E)return;const _e=ht=>{Le.current?.contains(ht.target)||T(!1)};return document.addEventListener("pointerdown",_e),()=>document.removeEventListener("pointerdown",_e)},[E,T]),y.useEffect(()=>{const _e=gn=>{gn.dataTransfer&&_w(gn.dataTransfer)&&I(!0)},ht=()=>{I(!1),X(!1)};return document.addEventListener("dragstart",_e),document.addEventListener("dragend",ht),document.addEventListener("drop",ht),()=>{document.removeEventListener("dragstart",_e),document.removeEventListener("dragend",ht),document.removeEventListener("drop",ht)}},[]);const ve=y.useRef(!0);function Ge(){const _e=fe.current;_e&&(ve.current=_e.scrollHeight-_e.scrollTop-_e.clientHeight<48)}y.useEffect(()=>{const _e=fe.current;_e&&ve.current&&(_e.scrollTop=_e.scrollHeight)},[h,E]),y.useEffect(()=>{ve.current=!0;const _e=fe.current;if(!_e)return;const ht=requestAnimationFrame(()=>{_e.scrollTop=_e.scrollHeight});return()=>cancelAnimationFrame(ht)},[$]);async function ge(){const _e=N;j(""),ve.current=!0,await _(_e)}function Te(_e){_e.trim()&&(j(""),P(!1),V(""),ve.current=!0,L({prompt:V9(_e),source:{type:"repo-onboard",label:"Onboard repo"},label:`Onboard and run this repo: ${_e}`}))}function Ae(_e){ve.current=!0,_(_e)}async function It(_e){try{await mn(`/api/services/${encodeURIComponent(_e)}/start`,{}),u(`Starting ${_e}…`)}catch(ht){l(ht instanceof Error?ht.message:`Could not start ${_e}.`)}}function Pi(_e){_e.key==="Enter"&&!_e.shiftKey&&(_e.preventDefault(),ge())}function ti(_e){_w(_e.dataTransfer)&&(_e.preventDefault(),_e.dataTransfer.dropEffect="copy",E||T(!0),X(!0))}function vr(_e){_e.currentTarget.contains(_e.relatedTarget)||X(!1)}function $i(_e){X(!1);const ht=Hz(_e.dataTransfer);ht&&(_e.preventDefault(),R(ht))}function Hi(_e){if(!E)return;_e.preventDefault(),_e.currentTarget.setPointerCapture(_e.pointerId),de(!0);const ht=160,gn=window.innerHeight-48;function Ts(si){const ds=window.innerHeight-si.clientY;Z(Math.max(ht,Math.min(gn,ds)))}function gt(){de(!1),window.removeEventListener("pointermove",Ts),window.removeEventListener("pointerup",gt)}window.addEventListener("pointermove",Ts),window.addEventListener("pointerup",gt)}return o.jsx("div",{ref:Le,className:le("fixed inset-x-0 bottom-0 z-50 flex flex-col border-t border-border bg-card/95 shadow-[0_-8px_24px_-12px_rgba(0,0,0,0.25)] backdrop-blur",ie?"select-none":"transition-[height] duration-200",E?O===null?"h-[50vh]":"":G?"h-12":"h-9",G&&!Y&&"border-primary/60 bg-primary/5",Y&&"outline-dashed outline-2 -outline-offset-2 outline-primary/70"),style:E&&O!==null?{height:O}:void 0,onDragOver:ti,onDragLeave:vr,onDrop:$i,children:E?o.jsxs(o.Fragment,{children:[o.jsx("div",{"aria-hidden":!0,className:"absolute inset-x-0 -top-1 z-10 h-2 cursor-ns-resize",onDoubleClick:()=>Z(null),onPointerDown:Hi}),o.jsxs("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-20 flex items-start justify-between gap-2 px-2 pt-1.5",children:[o.jsxs("div",{className:"pointer-events-auto flex items-center gap-2",children:[o.jsx(Ow,{provider:g,className:"size-4 text-primary"}),o.jsx("span",{className:"text-sm font-medium",children:g?.label??"Agent"}),z?o.jsxs("span",{className:"flex items-center gap-1 rounded-full border border-primary/30 bg-primary/10 px-2 py-0.5 text-[11px] text-primary",children:[o.jsx(zi,{className:"size-3"}),o.jsx("span",{className:"max-w-40 truncate",children:z.label}),o.jsx("button",{"aria-label":"Clear source",className:"opacity-60 hover:opacity-100",onClick:D,type:"button",children:o.jsx(Gs,{className:"size-3"})})]}):null]}),o.jsxs("div",{className:"pointer-events-auto flex items-center gap-1",children:[e?o.jsx(se,{"aria-label":"Open agent page",className:"size-7",onClick:e,size:"icon",title:"Open the full agent page",type:"button",variant:"ghost",children:o.jsx(AM,{})}):null,o.jsx(se,{"aria-label":"Clear conversation",className:"size-7",disabled:h.length===0,onClick:w,size:"icon",title:"Clear conversation",type:"button",variant:"ghost",children:o.jsx(ua,{})}),o.jsx(se,{"aria-label":"Collapse agent",className:"size-7",onClick:()=>T(!1),size:"icon",title:"Collapse",type:"button",variant:"ghost",children:o.jsx(Mn,{})})]})]}),o.jsx("div",{ref:fe,className:"min-h-0 flex-1 overflow-auto px-3 py-3",onScroll:Ge,children:o.jsxs("div",{className:"mx-auto w-full max-w-4xl space-y-3",children:[h.length===0?o.jsx(PI,{configured:p,provider:g,onOnboard:()=>P(!0)}):h.map((_e,ht)=>o.jsx(FI,{turn:_e,streaming:m&&ht===h.length-1,isLast:ht===h.length-1,onChoose:Ae,onStartService:It,onOpenService:t,onOpenSqlConsole:s},_e.id)),d?o.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive",children:[o.jsx(cu,{className:"mt-px size-3.5 shrink-0"}),o.jsx("span",{className:"min-w-0 break-words",children:d})]}):null]})}),v.length>0?o.jsx("div",{className:"shrink-0 space-y-1.5 border-t border-amber-500/25 bg-amber-500/[0.04] px-3 py-2",children:v.map(_e=>o.jsx(VI,{prompt:_e,onRespond:C},_e.requestId))}):null,o.jsxs("div",{className:le("relative shrink-0 p-2 transition-colors",G&&"bg-primary/5"),children:[i?o.jsx(SB,{git:i,onRefresh:a}):null,W?o.jsx(BB,{onClose:()=>ee(!1),onPick:_e=>{ee(!1),R(_e)}}):null,o.jsxs("div",{className:"mx-auto w-full max-w-4xl",children:[B?o.jsxs("form",{className:"mb-2 flex items-center gap-2 rounded-md border border-primary/40 bg-primary/5 p-1.5",onSubmit:_e=>{_e.preventDefault(),Te(F)},children:[o.jsx(pn,{className:"size-4 shrink-0 text-primary"}),o.jsx("input",{ref:Se,className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground",onChange:_e=>V(_e.target.value),placeholder:"Paste a repo URL — e.g. https://github.com/owner/repo",value:F}),o.jsx(se,{disabled:!F.trim(),size:"sm",type:"submit",children:"Onboard"}),o.jsx(se,{"aria-label":"Cancel onboarding",className:"size-7",onClick:()=>{P(!1),V("")},size:"icon",type:"button",variant:"ghost",children:o.jsx(Gs,{})})]}):HI(N)&&!m?o.jsxs("button",{className:"mb-2 flex w-full items-center gap-2 rounded-md border border-primary/40 bg-primary/5 px-3 py-1.5 text-left text-xs text-primary transition-colors hover:bg-primary/10",onClick:()=>Te(N),type:"button",children:[o.jsx(pn,{className:"size-3.5 shrink-0"}),o.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["Onboard ",o.jsx("span",{className:"font-mono",children:N.trim()})," as a service"]}),o.jsx(n4,{className:"size-3.5 shrink-0 opacity-60"})]}):null,o.jsxs("div",{className:"flex items-end gap-1.5 rounded-2xl border border-border bg-background px-1.5 py-1.5 shadow-sm transition-colors hover:border-foreground/25 focus-within:border-foreground/40 focus-within:ring-1 focus-within:ring-ring",children:[o.jsx(se,{"aria-label":"Attach a file or folder",className:"size-8 shrink-0 rounded-full text-muted-foreground hover:text-foreground",disabled:p===!1,onClick:()=>ee(!0),size:"icon",title:"Attach a file or folder",type:"button",variant:W?"secondary":"ghost",children:o.jsx(RM,{})}),o.jsx("textarea",{ref:pe,className:"max-h-32 min-h-8 flex-1 resize-none self-center overflow-y-auto bg-transparent px-1 py-1.5 text-sm outline-none placeholder:text-muted-foreground",disabled:p===!1,onChange:_e=>j(_e.target.value),onKeyDown:Pi,placeholder:p===!1?`${g?.label??"Agent"} (\`${g?.commandName??"agent"}\`) is not installed`:`Ask ${g?.label??"the agent"} anything about this project...`,rows:1,value:N}),m?o.jsx(se,{"aria-label":"Stop generating",className:"size-8 shrink-0 rounded-full",onClick:S,size:"icon",title:"Stop",type:"button",variant:"secondary",children:o.jsx(lu,{className:"size-3.5 fill-current"})}):o.jsx(se,{"aria-label":"Send message",className:"size-8 shrink-0 rounded-full",disabled:!N.trim()||p===!1,onClick:()=>{ge()},size:"icon",title:"Send",type:"button",children:o.jsx(Ab,{className:"size-4"})})]})]})]})]}):o.jsx("button",{className:le("flex h-full w-full items-center gap-2 px-3 text-left text-sm hover:bg-muted/50",G?"font-medium text-primary":"text-muted-foreground"),onClick:()=>T(!0),type:"button",children:G?o.jsxs(o.Fragment,{children:[o.jsx(uC,{className:"size-4 animate-bounce text-primary"}),o.jsx("span",{children:"Drop here to add it to your message"})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ow,{provider:g,className:"size-4 text-primary"}),m?o.jsxs("span",{className:"flex items-center gap-2 text-foreground",children:[o.jsx(pt,{className:"size-3.5 animate-spin"})," ",g?.label??"Agent"," is thinking…"]}):o.jsxs("span",{children:["Ask ",g?.label??"the agent","..."]}),o.jsx("span",{className:"ml-auto text-xs text-muted-foreground/70",children:"click to expand"})]})})})}function Ow({provider:e,className:t}){return e?.id==="claude"?o.jsx(ml,{className:t}):e?.id==="codex"?o.jsx(mu,{className:t}):o.jsx(zi,{className:t})}function PI({configured:e,provider:t,onOnboard:s}){return e===!1?o.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground",children:["This dock runs the ",o.jsx("code",{className:"font-mono",children:t?.commandName??"agent"})," ","CLI. ",t?.installHint??"Install the active agent CLI, then reload."]}):o.jsxs("div",{className:"space-y-2 text-xs text-muted-foreground",children:[o.jsx("p",{children:t?.intro??'This is the active agent, running in your workspace with full tools - e.g. "restart the api and tail its logs", "what changed in git and why?", "fix the failing test".'}),o.jsxs("button",{className:"inline-flex items-center gap-1.5 rounded-full border border-primary/40 bg-primary/5 px-2.5 py-1 text-primary transition-colors hover:bg-primary/10",onClick:s,type:"button",children:[o.jsx(pn,{className:"size-3.5"}),"Onboard a repo from a URL"]})]})}const $I=/^(?:https?:\/\/|git@|ssh:\/\/)\S+$/i;function HI(e){const t=e.trim();return t.includes(`
|
|
149
|
+
`)||t.includes(" ")||!$I.test(t)?!1:/github\.com|gitlab\.|bitbucket\.|\.git$/i.test(t)}function UI({turn:e}){const[t,s]=y.useState(!1),i=!!e.label&&e.label!==e.text,a=i&&!t?e.label:e.text;return o.jsx("div",{className:"flex justify-end",children:o.jsxs("div",{className:"flex max-w-[85%] flex-col items-end gap-0.5",children:[o.jsx("div",{className:"whitespace-pre-wrap break-words rounded-2xl rounded-br-sm bg-muted px-3.5 py-2 text-sm text-foreground",children:a}),i?o.jsxs("button",{className:"flex items-center gap-0.5 px-1 text-[11px] text-muted-foreground transition-colors hover:text-foreground",onClick:()=>s(l=>!l),type:"button",children:[t?o.jsx(nf,{className:"size-3"}):o.jsx(Mn,{className:"size-3"}),t?"Hide full prompt":"Show full prompt"]}):null]})})}function FI({turn:e,streaming:t,isLast:s,onChoose:i,onStartService:a,onOpenService:l,onOpenSqlConsole:u}){const h=zI(e.text);if(e.role==="user")return o.jsx(UI,{turn:e});const{body:m,options:d,service:p,sqlWrite:g}=UB(h);return o.jsxs("div",{className:"space-y-1.5",children:[e.tools.map(v=>o.jsx(qI,{tool:v},v.id)),m?o.jsx("div",{className:"break-words px-0.5 text-sm text-foreground",children:o.jsx(OI,{content:m})}):null,d.length>0&&s&&!t?o.jsx(FB,{options:d,onChoose:i}):null,p&&!t?o.jsx(qB,{service:p,onStart:a,onOpen:l}):null,g&&u&&!t?o.jsx(VB,{proposal:g,onOpen:u}):null,t&&!m?o.jsx(BI,{}):null]})}function qI({tool:e}){const t=o3(e.input);return o.jsxs("div",{className:le("inline-flex max-w-[85%] items-center gap-1.5 rounded-md border px-2 py-1 font-mono text-[11px]",e.isError?"border-destructive/40 bg-destructive/5 text-destructive":"border-border bg-background text-muted-foreground"),children:[e.status==="running"?o.jsx(pt,{className:"size-3 animate-spin"}):o.jsx(v6,{className:"size-3"}),o.jsx("span",{className:"font-semibold",children:e.name}),t?o.jsx("span",{className:"truncate",children:t}):null]})}function VI({prompt:e,onRespond:t}){const s=o3(e.input).slice(0,140);return o.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-amber-500/30 bg-amber-500/5 px-2.5 py-2 text-xs",children:[o.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md bg-amber-500/15 text-amber-600 dark:text-amber-400",children:o.jsx(NC,{className:"size-4"})}),o.jsxs("div",{className:"min-w-0 flex-1 leading-tight",children:[o.jsx("div",{className:"mb-0.5 text-[10px] font-semibold uppercase tracking-wider text-amber-600 dark:text-amber-400/90",children:"Permission needed"}),o.jsxs("div",{className:"truncate font-mono text-[11px]",children:[o.jsx("span",{className:"font-semibold text-foreground",children:e.name}),s?o.jsx("span",{className:"ml-1 text-muted-foreground",children:s}):null]})]}),o.jsxs(se,{className:"h-7 gap-1 text-muted-foreground hover:border-destructive/40 hover:bg-destructive/10 hover:text-destructive",onClick:()=>t(e.requestId,"deny"),size:"sm",type:"button",variant:"outline",children:[o.jsx(Gs,{className:"size-3.5"})," Deny"]}),o.jsxs(se,{className:"h-7 gap-1",onClick:()=>t(e.requestId,"allow"),size:"sm",type:"button",children:[o.jsx(hi,{className:"size-3.5"})," Allow"]})]})}function o3(e){return!e||typeof e!="object"?"":Object.values(e).filter(s=>s!==void 0&&s!=="").map(s=>String(s)).join(" ")}const Qp={host:"",port:"",user:"",password:"",database:"",ssl:!1},GI="localhost";function D0(e,t,{includePassword:s=!0}={}){const i=e==="mysql"?"mysql":"postgres",a=t.host.trim()||GI,l=t.port.trim(),u=t.database.trim().replace(/^\//,""),h=t.user.trim(),m=s&&t.password,d=h?`${encodeURIComponent(h)}${m?`:${encodeURIComponent(t.password)}`:""}@`:"",p=l?`:${l}`:"",g=e==="postgres"&&t.ssl?"?sslmode=require":"";return`${i}://${d}${a}${p}/${u}${g}`}function O0(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:Lw(t.username),password:Lw(t.password),database:t.pathname.replace(/^\//,""),ssl:t.searchParams.get("sslmode")==="require"||t.searchParams.has("ssl")}}function WI(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 Lw(e){try{return decodeURIComponent(e)}catch{return e}}const KI=[{value:"postgres",label:"Postgres"},{value:"mysql",label:"MySQL"},{value:"sqlite",label:"SQLite"}];function YI({onClose:e,onSaved:t,initial:s}){const{error:i,success:a}=Ns(),l=!!s,u=y.useMemo(()=>XI(s),[s]),[h,m]=y.useState(u.engine),[d,p]=y.useState(u.name),[g,v]=y.useState(u.url),[_,S]=y.useState(u.fields),[w,C]=y.useState([]),[E,T]=y.useState({status:"idle"}),[N,j]=y.useState(!1),[R,z]=y.useState(!1);y.useEffect(()=>{l||A6().then(C).catch(()=>C([]))},[l]);const D=h==="sqlite",M=D?g.trim():D0(h,_),$=D?!!g.trim():!!(_.host.trim()&&_.database.trim());function L(){T({status:"idle"})}function B(W,ee){return D0(W,ee,{includePassword:!1})}function P(W){m(W),L(),W!=="sqlite"&&v(B(W,_))}function F(W){const ee={..._,...W};S(ee),v(B(h,ee)),L()}function V(W){L();const ee=WI(W),O=ee??h;ee&&ee!==h&&m(ee);const Z=ee==="sqlite"?null:O0(W);if(!Z){v(W);return}Z.password?(S(Z),v(B(O,Z))):(S({...Z,password:_.password}),v(W))}function G(W){m(W.engine);const ee=W.engine==="sqlite"?null:O0(W.url);ee?(S(ee),v(B(W.engine,ee))):v(W.url),L(),d.trim()||p(ZI(W))}function I(){return d.trim()?D?g.trim()?null:"Database file path is required.":_.host.trim()?_.database.trim()?null:"Database name is required.":"Host is required.":"Name is required."}async function Y(){if($){j(!0),L();try{const W=await R6({engine:h,url:M});T(W.ok?{status:"ok",message:"Connected"}:{status:"fail",message:W.error??"Connection failed"})}catch(W){T({status:"fail",message:W instanceof Error?W.message:String(W)})}finally{j(!1)}}}async function X(){const W=I();if(W){i(W);return}z(!0);try{await M6({name:d.trim(),engine:h,url:M}),a(`Saved connection "${d.trim()}".`),t(),e()}catch(ee){i(ee instanceof Error?ee.message:String(ee))}finally{z(!1)}}return o.jsx(Zn,{icon:o.jsx(Xn,{}),onClose:e,title:l?"Edit database connection":"Add database connection",children:o.jsxs("div",{className:"flex flex-col gap-4",children:[w.length>0?o.jsxs("section",{children:[o.jsxs("p",{className:"mb-1.5 flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[o.jsx(p6,{className:"size-3.5"}),"Found in your services"]}),o.jsx("div",{className:"flex flex-wrap gap-1.5",children:w.map(W=>o.jsxs("button",{type:"button",onClick:()=>G(W),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:W.maskedUrl,children:[o.jsx(Pe,{variant:"outline",size:"small",children:W.engine}),o.jsx("span",{className:"font-mono",children:W.service}),o.jsxs("span",{className:"font-mono text-muted-foreground",children:["·",W.key]})]},`${W.service}:${W.key}`))})]}):null,o.jsxs("section",{children:[o.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Engine"}),o.jsx("div",{className:"flex gap-1.5",children:KI.map(W=>o.jsx(se,{size:"sm",variant:h===W.value?"default":"outline",onClick:()=>P(W.value),disabled:l,type:"button",children:W.label},W.value))})]}),o.jsxs("label",{className:"flex flex-col gap-1.5",children:[o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Name"}),o.jsx(nt,{value:d,onChange:W=>p(W.target.value),placeholder:"e.g. shop-db",disabled:l}),l?o.jsx("span",{className:"text-[11px] text-muted-foreground",children:"The name identifies the connection and can't be changed here."}):null]}),D?null:o.jsxs("section",{className:"flex flex-col gap-3",children:[o.jsxs("div",{className:"flex gap-3",children:[o.jsxs("label",{className:"flex flex-1 flex-col gap-1.5",children:[o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Host"}),o.jsx(nt,{value:_.host,onChange:W=>F({host:W.target.value}),placeholder:"localhost",className:"font-mono text-xs"})]}),o.jsxs("label",{className:"flex w-24 flex-col gap-1.5",children:[o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Port"}),o.jsx(nt,{value:_.port,onChange:W=>F({port:W.target.value}),placeholder:h==="mysql"?"3306":"5432",className:"font-mono text-xs"})]})]}),o.jsxs("div",{className:"flex gap-3",children:[o.jsxs("label",{className:"flex flex-1 flex-col gap-1.5",children:[o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"User"}),o.jsx(nt,{value:_.user,onChange:W=>F({user:W.target.value}),placeholder:"postgres",className:"font-mono text-xs"})]}),o.jsxs("label",{className:"flex flex-1 flex-col gap-1.5",children:[o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Password"}),o.jsx(nt,{type:"password",value:_.password,onChange:W=>F({password:W.target.value}),placeholder:l?"leave blank to keep current":"••••••••",className:"font-mono text-xs"})]})]}),o.jsxs("label",{className:"flex flex-col gap-1.5",children:[o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Database"}),o.jsx(nt,{value:_.database,onChange:W=>F({database:W.target.value}),placeholder:"app",className:"font-mono text-xs"})]}),h==="postgres"?o.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[o.jsx("input",{type:"checkbox",checked:_.ssl,onChange:W=>F({ssl:W.target.checked}),className:"size-3.5 accent-primary"}),"Require SSL (adds ",o.jsx("span",{className:"font-mono",children:"?sslmode=require"}),")"]}):null]}),o.jsxs("label",{className:"flex flex-col gap-1.5",children:[o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:D?"Database file path":"Connection URL"}),o.jsx(nt,{value:g,onChange:W=>V(W.target.value),placeholder:D?"/abs/path/to/app.db":h==="mysql"?"mysql://user:pass@host:3306/db":"postgres://user:pass@host:5432/db",className:"font-mono text-xs"}),o.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."})]}),E.status!=="idle"?o.jsxs("div",{className:`flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-xs ${E.status==="ok"?"border-emerald-500/40 text-emerald-600 dark:text-emerald-400":"border-destructive/40 text-destructive"}`,children:[E.status==="ok"?o.jsx(hi,{className:"size-3.5"}):o.jsx(Gs,{className:"size-3.5"}),o.jsx("span",{className:"break-all font-mono",children:E.message})]}):null,o.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-3",children:[o.jsxs(se,{variant:"outline",size:"sm",onClick:()=>{Y()},disabled:N||!$,type:"button",children:[N?o.jsx(pt,{className:"animate-spin"}):null,"Test connection"]}),o.jsxs(se,{size:"sm",onClick:()=>{X()},disabled:R,type:"button",children:[R?o.jsx(pt,{className:"animate-spin"}):null,l?"Save changes":"Save"]})]})]})})}function XI(e){if(!e)return{engine:"postgres",name:"",fields:Qp,url:""};if(e.engine==="sqlite")return{engine:"sqlite",name:e.name,fields:Qp,url:e.url};const t=O0(e.url),s=t?{...t,password:""}:Qp;return{engine:e.engine,name:e.name,fields:s,url:D0(e.engine,s,{includePassword:!1})}}function ZI(e){try{const s=new URL(e.url).pathname.replace(/^\//,"");if(s)return`${e.service}-${s}`}catch{}return`${e.service}-${e.engine}`}function QI({connections:e,selected:t,onSelect:s,onAdd:i,onEdit:a,onRemove:l}){const[u,h]=y.useState(!1),m=y.useRef(null),d=e.find(p=>p.name===t);return y.useEffect(()=>{if(!u)return;function p(g){m.current&&g.target instanceof Node&&!m.current.contains(g.target)&&h(!1)}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[u]),o.jsxs("div",{className:"relative z-50 flex items-center gap-2",ref:m,children:[o.jsxs(se,{className:"max-w-[240px] justify-start gap-2 rounded-md border-border bg-card",onClick:()=>h(p=>!p),size:"sm",type:"button",variant:"outline",children:[o.jsx(Xn,{className:"text-muted-foreground"}),o.jsx("span",{className:"truncate",children:d?.name??"Select connection"}),d?o.jsx(Pe,{variant:"outline",size:"small",children:d.engine}):null,o.jsx(Mn,{className:le("ml-auto transition-transform",u&&"rotate-180")})]}),u?o.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:[o.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[o.jsx(Xn,{className:"size-3.5 text-muted-foreground"}),o.jsx("div",{className:"text-xs font-semibold",children:"Connections"}),o.jsx(Pe,{className:"ml-auto",variant:"outline",size:"small",children:e.length})]}),o.jsx("div",{className:"max-h-72 overflow-auto",children:e.length?o.jsx("div",{className:"divide-y divide-border",children:e.map(p=>{const g=p.name===t;return o.jsxs("div",{className:le("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",g&&"bg-muted/70"),children:[o.jsxs("button",{className:"min-w-0 text-left",onClick:()=>{s(p.name),h(!1)},type:"button",children:[o.jsx("span",{className:"block truncate text-sm font-medium leading-tight",children:p.name}),o.jsx("span",{className:"block truncate font-mono text-[10px] leading-tight text-muted-foreground",children:p.url})]}),g?o.jsx(hi,{className:"size-3.5"}):o.jsx("span",{className:"size-3.5"}),o.jsx(se,{"aria-label":`Edit ${p.name}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>{a(p),h(!1)},size:"icon",title:`Edit ${p.name}`,type:"button",variant:"ghost",children:o.jsx(Gc,{className:"size-3.5"})}),o.jsx(se,{"aria-label":`Remove ${p.name}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>l(p.name),size:"icon",title:`Remove ${p.name}`,type:"button",variant:"ghost",children:o.jsx(ua,{className:"size-3.5 text-destructive"})})]},p.name)})}):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No saved connections yet."})}),o.jsx("div",{className:"border-t border-border bg-muted/20 p-2",children:o.jsxs(se,{className:"w-full",onClick:()=>{i(),h(!1)},size:"sm",type:"button",children:[o.jsx(Cs,{className:"size-3"}),"Add connection"]})})]}):null]})}function JI({onAddManual:e,onAddWithAi:t}){const[s,i]=y.useState(!1),a=y.useRef(null);y.useEffect(()=>{if(!s)return;function u(h){a.current&&h.target instanceof Node&&!a.current.contains(h.target)&&i(!1)}return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);function l(u){i(!1),u()}return o.jsxs("div",{className:"relative",ref:a,children:[o.jsxs(se,{"aria-label":"Add database connection",onClick:()=>i(u=>!u),size:"sm",type:"button",children:[o.jsx(Cs,{className:"size-3.5"}),"Add"]}),s?o.jsxs("div",{className:"absolute right-0 top-9 z-50 w-56 overflow-hidden rounded-lg border border-border bg-card shadow-lg",children:[o.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:[o.jsx(Xn,{className:"size-3.5 text-muted-foreground"}),"Add connection"]}),o.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:[o.jsx(zi,{className:"size-3.5 text-muted-foreground"}),"Add with AI"]})]}):null]})}function eP(){const[e,t]=y.useState([]),[s,i]=y.useState(!0),[a,l]=y.useState(null),u=y.useCallback(async()=>{i(!0),l(null);try{t(await RC())}catch(h){l(h instanceof Error?h.message:String(h))}finally{i(!1)}},[]);return y.useEffect(()=>{u()},[u]),{connections:e,loading:s,error:a,refresh:u}}const l3=[50,100,500,1e3];function tP(e){const[t,s]=y.useState(null),[i,a]=y.useState(null),[l,u]=y.useState(!1);y.useEffect(()=>{s(null),a(null)},[e]);const h=y.useCallback(async(d,p)=>{if(!(!e||!d.trim())){u(!0),a(null);try{s(await O6(e,d,p))}catch(g){s(null),a(g instanceof Error?g.message:String(g))}finally{u(!1)}}},[e]),m=y.useCallback(()=>{s(null),a(null)},[]);return{result:t,error:i,running:l,run:h,reset:m}}const sP=["select","show","explain","pragma","describe","desc"];function nP(e){const t=/^\s*([a-z]+)/i.exec(e)?.[1]?.toLowerCase()??"";return sP.includes(t)}function iP(e){const[t,s]=y.useState(null),[i,a]=y.useState(null),[l,u]=y.useState(null),[h,m]=y.useState(!1),[d,p]=y.useState(!1);y.useEffect(()=>{s(null),a(null),u(null)},[e]);const g=y.useCallback(async w=>{if(!(!e||!w.trim())){m(!0),u(null),a(null);try{const C=await By(e,w,"preview");s({sql:w,preview:C})}catch(C){u(C instanceof Error?C.message:String(C))}finally{m(!1)}}},[e]),v=y.useCallback(async()=>{if(!e||!t)return null;p(!0),u(null);try{const w=await By(e,t.sql,"commit");return a(w),s(null),w}catch(w){return s(null),u(w instanceof Error?w.message:String(w)),null}finally{p(!1)}},[e,t]),_=y.useCallback(()=>s(null),[]),S=y.useCallback(()=>{s(null),a(null),u(null)},[]);return{pending:t,committed:i,error:l,previewing:h,committing:d,preview:g,commit:v,cancel:_,reset:S}}function rP(e,t){const[s,i]=y.useState(!1),a=y.useCallback(async l=>{if(e){i(!0);try{await L6(e,l),t()}finally{i(!1)}}},[e,t]);return{updating:s,setUnlocked:a}}function aP(e){const[t,s]=y.useState([]),[i,a]=y.useState(null),[l,u]=y.useState(null),[h,m]=y.useState(null),[d,p]=y.useState(null),[g,v]=y.useState(!1),[_,S]=y.useState(!1),[w,C]=y.useState(100),[E,T]=y.useState(0);y.useEffect(()=>{T(0)},[e,i]),y.useEffect(()=>{if(s([]),a(null),u(null),m(null),p(null),!e)return;let M=!1;return v(!0),DC(e).then($=>{M||(s($),a($[0]?.qualifiedName??null))}).catch($=>{M||m($ instanceof Error?$.message:String($))}).finally(()=>{M||v(!1)}),()=>{M=!0}},[e]),y.useEffect(()=>{if(u(null),p(null),!e||!i)return;let M=!1;return S(!0),z6(e,i,w,E).then($=>{M||u($)}).catch($=>{M||p($ instanceof Error?$.message:String($))}).finally(()=>{M||S(!1)}),()=>{M=!0}},[e,i,w,E]);const N=E>0,j=l?l.rowCount===w:!1;function R(M){C(M),T(0)}function z(){j&&T(M=>M+w)}function D(){T(M=>Math.max(0,M-w))}return{tables:t,selectedTable:i,setSelectedTable:a,sample:l,tablesError:h,rowsError:d,loadingTables:g,loadingRows:_,limit:w,offset:E,canPrev:N,canNext:j,changePageSize:R,nextPage:z,prevPage:D}}function oP(e,t,s,i){const{sendToAgent:a,streaming:l,turns:u}=Bt(),[h,m]=y.useState(!1),[d,p]=y.useState(null),g=y.useRef(u);y.useEffect(()=>{g.current=u},[u]);const v=y.useRef(!1),_=y.useRef(null);return y.useEffect(()=>{if(l)v.current=!0;else if(v.current&&_.current){const w=_.current;_.current=null,w()}},[l]),{generate:y.useCallback(async w=>{if(!e||!w.trim()||h)return;m(!0),p(null);let C=[];try{C=await DC(e)}catch{C=[]}v.current=!1;const E=new Promise(T=>{let N=!1;const j=()=>{N||(N=!0,clearTimeout(R),_.current=null,T())};_.current=j;const R=setTimeout(()=>{v.current||j()},8e3)});a({prompt:K9(e,w,{engine:t,tables:C,unlocked:s}),source:{type:"database-sql-generate",label:"Generate SQL"},label:`Generate SQL: ${w}`,background:!0});try{await E;const T=cP(lP(g.current));T?i(T):p("The agent didn't return a SQL block — open the dock to see its reply.")}finally{m(!1)}},[e,t,s,h,i,a]),generating:h,error:d}}function lP(e){for(let t=e.length-1;t>=0;t--)if(e[t].role==="assistant")return e[t].text.trim();return""}function cP(e){if(!e)return null;const s=/```(?:sql)?\s*\n?([\s\S]*?)```/i.exec(e)?.[1]?.trim();return s||null}function c3({items:e,label:t="More actions",className:s}){const[i,a]=y.useState(!1),[l,u]=y.useState({top:0,right:0}),h=y.useRef(null),m=y.useRef(null);function d(){const p=h.current?.getBoundingClientRect();p&&u({top:p.bottom+4,right:window.innerWidth-p.right}),a(g=>!g)}return y.useEffect(()=>{if(!i)return;function p(_){const S=_.target;h.current?.contains(S)||m.current?.contains(S)||a(!1)}function g(_){_.key==="Escape"&&a(!1)}const v=()=>a(!1);return document.addEventListener("mousedown",p),document.addEventListener("keydown",g),window.addEventListener("scroll",v,!0),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",g),window.removeEventListener("scroll",v,!0)}},[i]),o.jsxs(o.Fragment,{children:[o.jsx("button",{"aria-label":t,className:le("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:o.jsx(dC,{className:"size-3.5"})}),i?gu.createPortal(o.jsx("div",{className:"fixed z-50 min-w-44 overflow-hidden rounded-md border border-border bg-card p-1 shadow-md",ref:m,style:{top:l.top,right:l.right},children:e.map(p=>o.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?o.jsx("span",{className:"text-muted-foreground",children:p.icon}):null,p.label]},p.label))}),document.body):null]})}function uP({connection:e,sample:t}){const{sendToAgent:s}=Bt(),{success:i,error:a}=Ns(),l=t.columns.map(p=>p.name);function u(p){s({prompt:W9(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(v){a(v instanceof Error?v.message:String(v))}}function m(p){const g=v=>{const _=Fc(v);return/[",\n]/.test(_)?`"${_.replace(/"/g,'""')}"`:_};return`${l.join(",")}
|
|
150
|
+
${l.map(v=>g(p[v])).join(",")}`}function d(p){const g=_=>_==null?"NULL":typeof _=="number"||typeof _=="boolean"?String(_):`'${(typeof _=="object"?JSON.stringify(_):String(_)).replace(/'/g,"''")}'`,v=l.map(_=>g(p[_])).join(", ");return`INSERT INTO ${t.table} (${l.join(", ")}) VALUES (${v});`}return t.columns.length===0?o.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"This table has no columns."}):o.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:o.jsxs("table",{className:"w-max min-w-full border-collapse text-left font-mono text-[11px]",children:[o.jsx("thead",{className:"sticky top-0 z-10 bg-card",children:o.jsxs("tr",{className:"border-b border-border",children:[t.columns.map(p=>o.jsxs("th",{className:"whitespace-nowrap px-3 py-2 font-semibold text-foreground",children:[o.jsxs("span",{className:"flex items-center gap-1",children:[p.primaryKey?o.jsx(xC,{className:"size-3 text-amber-500"}):null,p.name]}),o.jsx("span",{className:"block text-[10px] font-normal text-muted-foreground",children:p.dataType})]},p.name)),o.jsx("th",{className:"sticky right-0 z-20 w-16 border-l border-border bg-card px-2 py-2"})]})}),o.jsxs("tbody",{children:[t.rows.map((p,g)=>o.jsxs("tr",{className:"group border-b border-border/60 hover:bg-muted/40",children:[t.columns.map(v=>o.jsx("td",{className:"max-w-[320px] truncate px-3 py-1 align-top text-muted-foreground",title:Fc(p[v.name]),children:Fc(p[v.name])},v.name)),o.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:o.jsxs("div",{className:"relative z-[1] flex items-center justify-end gap-0.5",children:[o.jsx(ll,{label:"Ask AI about this row",onAsk:()=>u(p)}),o.jsx(c3,{label:"Row actions",items:[{label:"Copy as JSON",icon:o.jsx(LA,{className:"size-3.5"}),onSelect:()=>{h(JSON.stringify(p,null,2),"row as JSON")}},{label:"Copy as CSV",icon:o.jsx(v4,{className:"size-3.5"}),onSelect:()=>{h(m(p),"row as CSV")}},{label:"Copy as SQL INSERT",icon:o.jsx(Xn,{className:"size-3.5"}),onSelect:()=>{h(d(p),"INSERT statement")}}]})]})})]},g)),t.rows.length===0?o.jsx("tr",{children:o.jsx("td",{colSpan:t.columns.length+1,className:"px-3 py-6 text-center text-muted-foreground",children:"No rows."})}):null]})]})})}function Fc(e){return e==null?"NULL":typeof e=="object"?JSON.stringify(e):String(e)}function dP({connection:e,busy:t,onConfirm:s,onClose:i}){return o.jsx(Zn,{icon:o.jsx(NC,{className:"text-amber-500"}),onClose:i,title:`Unlock writes on "${e}"?`,children:o.jsxs("div",{className:"flex flex-col gap-4 text-sm",children:[o.jsxs("p",{className:"text-muted-foreground",children:["This lets the SQL console run statements that ",o.jsx("strong",{children:"change data"})," ","— ",o.jsx("span",{className:"font-mono",children:"INSERT"}),","," ",o.jsx("span",{className:"font-mono",children:"UPDATE"}),","," ",o.jsx("span",{className:"font-mono",children:"DELETE"}),", and DDL like"," ",o.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."]}),o.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."}),o.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-3",children:[o.jsx(se,{variant:"outline",size:"sm",onClick:i,type:"button",children:"Cancel"}),o.jsxs(se,{size:"sm",onClick:s,disabled:t,type:"button",children:[t?o.jsx(pt,{className:"animate-spin"}):o.jsx(vC,{}),"Unlock writes"]})]})]})})}function hP({sql:e,preview:t,busy:s,onConfirm:i,onClose:a}){return o.jsx(Zn,{icon:o.jsx(cu,{className:"text-amber-500"}),onClose:a,title:"Confirm write",children:o.jsxs("div",{className:"flex flex-col gap-4 text-sm",children:[o.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?o.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."}):o.jsxs("p",{className:"text-muted-foreground",children:["This will affect"," ",o.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."]}),o.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-3",children:[o.jsx(se,{variant:"outline",size:"sm",onClick:a,type:"button",children:"Cancel"}),o.jsxs(se,{size:"sm",className:"bg-amber-600 text-white hover:bg-amber-600/90",onClick:i,disabled:s,type:"button",children:[s?o.jsx(pt,{className:"animate-spin"}):null,"Run & commit"]})]})]})})}function fP({connection:e,engine:t,unlocked:s,seed:i,onWriteAccessChange:a}){const{success:l}=Ns(),{sendToAgent:u}=Bt(),h=tP(e),m=iP(e),d=rP(e,a),[p,g]=y.useState(i?.sql??""),[v,_]=y.useState(100),S=i?.nonce;y.useEffect(()=>{i&&g(i.sql)},[S]);const[w,C]=y.useState(!1),E=oP(e,t,s,g),T=p.trim().length>0&&!nP(p),N=s&&T,j=T&&!s,R=h.running||m.previewing;function z(){if(p.trim()){if(j){C(!0);return}N?(h.reset(),m.preview(p)):(m.reset(),h.run(p,v))}}function D(L){(L.metaKey||L.ctrlKey)&&L.key==="Enter"&&(L.preventDefault(),z())}function M(L){u({prompt:Y9(e,t,p,L),source:{type:"database-sql-debug",label:"Debug SQL"},label:"Debug this SQL error"})}async function $(){const L=await m.commit();if(L?.committed){const B=L.affectedRows??0;l(`Committed — ${B} row${B===1?"":"s"} affected.`)}}return o.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[o.jsxs("div",{className:"shrink-0 border-b border-border p-2",children:[o.jsx(mP,{generate:E}),o.jsx("textarea",{value:p,onChange:L=>g(L.target.value),onKeyDown:D,spellCheck:!1,placeholder:s?"SELECT … / INSERT … / UPDATE … (Cmd/Ctrl+Enter to run)":"SELECT * FROM … (read-only — Cmd/Ctrl+Enter to run)",className:"h-24 w-full resize-y rounded-md border border-border bg-background px-2 py-1.5 font-mono text-[12px] outline-none focus:border-ring"}),o.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[o.jsx(pP,{unlocked:s,updating:d.updating,onUnlock:()=>C(!0),onLock:()=>{d.setUnlocked(!1)}}),o.jsxs("div",{className:"flex items-center gap-2",children:[N?null:o.jsx("select",{"aria-label":"Max rows",className:"rounded-md border border-border bg-background px-1.5 py-1 text-[11px]",value:v,onChange:L=>_(Number(L.target.value)),children:l3.map(L=>o.jsxs("option",{value:L,children:[L," rows"]},L))}),o.jsxs(se,{size:"sm",className:le("h-7 px-3",N&&"bg-amber-600 text-white hover:bg-amber-600/90"),onClick:z,disabled:R||!p.trim(),type:"button",children:[R?o.jsx(pt,{className:"size-3.5 animate-spin"}):o.jsx(eo,{className:"size-3.5"}),N?"Preview write":"Run"]})]})]})]}),o.jsx(gP,{read:h,write:m,onDebug:M}),w?o.jsx(dP,{connection:e,busy:d.updating,onConfirm:async()=>{await d.setUnlocked(!0),C(!1)},onClose:()=>C(!1)}):null,m.pending?o.jsx(hP,{sql:m.pending.sql,preview:m.pending.preview,busy:m.committing,onConfirm:()=>{$()},onClose:m.cancel}):null]})}function mP({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 o.jsxs("div",{className:"mb-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(Gt,{className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2"}),o.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"})]}),o.jsxs(se,{size:"sm",variant:"outline",className:"h-8 px-3",onClick:i,disabled:e.generating||!t.trim(),type:"button",children:[e.generating?o.jsx(pt,{className:"size-3.5 animate-spin"}):o.jsx(Gt,{className:"size-3.5"}),e.generating?"Generating…":"Ask AI"]})]}),e.error?o.jsx("p",{className:"mt-1 text-[11px] text-amber-600 dark:text-amber-400",children:e.error}):null]})}function pP({unlocked:e,updating:t,onUnlock:s,onLock:i}){return o.jsxs("button",{type:"button",onClick:e?i:s,disabled:t,className:le("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?o.jsx(pt,{className:"size-3.5 animate-spin"}):e?o.jsx(vC,{className:"size-3.5"}):o.jsx(aM,{className:"size-3.5"}),e?"Writes unlocked":"Read-only"]})}function gP({read:e,write:t,onDebug:s}){const i=t.error??e.error;return o.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:i?o.jsxs("div",{className:"space-y-3 p-4",children:[o.jsx("p",{className:"whitespace-pre-wrap font-mono text-[12px] text-destructive",children:i}),o.jsxs(se,{size:"sm",variant:"outline",className:"h-7 px-3",onClick:()=>s(i),type:"button",children:[o.jsx(Gt,{className:"size-3.5"}),"Debug with AI"]})]}):t.committed?o.jsx(bP,{outcome:t.committed}):e.result?o.jsx(u3,{columns:e.result.columns,rows:e.result.rows,truncated:e.result.truncated}):o.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 bP({outcome:e}){if(!e)return null;const t=e.affectedRows??0;return o.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[o.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:[o.jsx(hi,{className:"size-3.5"}),"Committed — ",t," row",t===1?"":"s"," affected."]}),e.rows&&e.rows.length>0&&e.columns?o.jsx(u3,{columns:e.columns,rows:e.rows}):null]})}function u3({columns:e,rows:t,truncated:s=!1}){return e.length===0?o.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Query ran successfully — no columns returned."}):o.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[s?o.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:[o.jsx(cu,{className:"size-3.5"}),"Showing the first ",t.length," rows — add a LIMIT to narrow the result."]}):null,o.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:o.jsxs("table",{className:"w-max min-w-full border-collapse text-left font-mono text-[11px]",children:[o.jsx("thead",{className:"sticky top-0 z-10 bg-card",children:o.jsx("tr",{className:"border-b border-border",children:e.map(i=>o.jsx("th",{className:"whitespace-nowrap px-3 py-2 font-semibold text-foreground",children:i.name},i.name))})}),o.jsxs("tbody",{children:[t.map((i,a)=>o.jsx("tr",{className:"border-b border-border/60 hover:bg-muted/40",children:e.map(l=>o.jsx("td",{className:"max-w-[320px] truncate px-3 py-1 align-top text-muted-foreground",title:Fc(i[l.name]),children:Fc(i[l.name])},l.name))},a)),t.length===0?o.jsx("tr",{children:o.jsx("td",{colSpan:e.length,className:"px-3 py-6 text-center text-muted-foreground",children:"No rows."})}):null]})]})})]})}function xP({staged:e,onStageConsumed:t}={}){const{connections:s,loading:i,error:a,refresh:l}=eP(),{error:u,success:h}=Ns(),{sendToAgent:m}=Bt(),[d,p]=y.useState(null),[g,v]=y.useState("browse"),[_,S]=y.useState(null),[w,C]=y.useState(null);y.useEffect(()=>{e&&(e.connection&&p(e.connection),v("query"),C({sql:e.sql,nonce:e.nonce}),t?.())},[e?.nonce]);function E(){m({prompt:q9,source:{type:"database-setup",label:"Add a database"},label:"Help me connect a database, one step at a time."})}y.useEffect(()=>{if(s.length===0){p(null);return}p(j=>j&&s.some(R=>R.name===j)?j:s[0].name)},[s]);async function T(j){try{await D6(j),h(`Removed connection "${j}".`),await l()}catch(R){u(R instanceof Error?R.message:String(R))}}function N(j){S({mode:"edit",target:j})}return o.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[o.jsxs("header",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Xn,{className:"size-4 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-semibold",children:"Databases"}),i&&s.length===0?o.jsx(pt,{className:"size-3.5 animate-spin text-muted-foreground"}):null]}),o.jsxs("div",{className:"flex items-center gap-2",children:[d?o.jsx(vP,{mode:g,onChange:v}):null,o.jsx(QI,{connections:s,selected:d,onSelect:p,onAdd:()=>S({mode:"add"}),onEdit:N,onRemove:j=>{T(j)}}),o.jsx(JI,{onAddManual:()=>S({mode:"add"}),onAddWithAi:E})]})]}),o.jsx("div",{className:"min-h-0 flex-1",children:a?o.jsx("div",{className:"p-4",children:o.jsx(Qe,{variant:"muted",className:"border-destructive/40 text-destructive",children:a})}):d?g==="query"?o.jsx(fP,{connection:d,engine:s.find(j=>j.name===d)?.engine,unlocked:s.find(j=>j.name===d)?.writeUnlocked??!1,seed:w,onWriteAccessChange:l},d):o.jsx(_P,{connection:d}):o.jsx(yP,{onAdd:()=>S({mode:"add"}),onAddWithAi:E})}),_?o.jsx(YI,{initial:_.mode==="edit"?_.target:void 0,onClose:()=>S(null),onSaved:l}):null]})}function vP({mode:e,onChange:t}){const s=[{value:"browse",label:"Browse",icon:jC},{value:"query",label:"SQL",icon:af}];return o.jsx("div",{className:"flex items-center rounded-md border border-border p-0.5",children:s.map(i=>{const a=i.icon;return o.jsxs("button",{type:"button",onClick:()=>t(i.value),className:le("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:[o.jsx(a,{className:"size-3.5"}),i.label]},i.value)})})}function _P({connection:e}){const{sendToAgent:t}=Bt(),{tables:s,selectedTable:i,setSelectedTable:a,sample:l,tablesError:u,rowsError:h,loadingTables:m,loadingRows:d,limit:p,offset:g,canPrev:v,canNext:_,changePageSize:S,nextPage:w,prevPage:C}=aP(e);function E(N){t({prompt:gw(e,N.table,{engine:N.engine,columns:N.columns}),source:{type:"database-table",label:`${N.table.name} table`},mode:"draft"})}function T(N){t({prompt:gw(e,N),source:{type:"database-table",label:`${N.name} table`},mode:"draft"})}return o.jsxs("div",{className:"flex h-full min-h-0",children:[o.jsxs("div",{className:"flex w-56 shrink-0 flex-col border-r border-border",children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[o.jsx(jC,{className:"size-4 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-semibold",children:"Tables"}),o.jsx(Pe,{variant:"outline",size:"small",children:s.length}),m?o.jsx(pt,{className:"size-3.5 animate-spin"}):null]}),u?o.jsx("div",{className:"p-3",children:o.jsx(Qe,{variant:"muted",className:"border-destructive/40 text-destructive",children:u})}):o.jsxs("ul",{className:"min-h-0 flex-1 overflow-auto",children:[s.map(N=>o.jsxs("li",{className:le("group flex items-center gap-1 pr-1 transition-colors hover:bg-muted/50",N.qualifiedName===i&&"bg-muted/70"),children:[o.jsx("button",{type:"button",onClick:()=>a(N.qualifiedName),className:le("min-w-0 flex-1 truncate px-3 py-1.5 text-left font-mono text-[11px]",N.qualifiedName===i&&"font-semibold"),children:N.qualifiedName}),o.jsx(ll,{label:`Ask AI about \`${N.qualifiedName}\``,onAsk:()=>T(N)})]},N.qualifiedName)),!m&&s.length===0?o.jsx("li",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No tables."}):null]})]}),o.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[o.jsxs("div",{className:"group flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[o.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[o.jsx("span",{className:"truncate font-mono text-xs font-semibold",children:i??"Select a table"}),l?o.jsx(ll,{label:`Ask AI about \`${l.table.qualifiedName}\``,onAsk:()=>E(l)}):null]}),l?o.jsxs("div",{className:"flex shrink-0 items-center gap-2 text-[11px] text-muted-foreground",children:[o.jsx("span",{className:"tabular-nums",children:l.rowCount===0?"no rows":`rows ${g+1}–${g+l.rowCount}`}),o.jsx("select",{"aria-label":"Rows per page",className:"rounded-md border border-border bg-background px-1.5 py-0.5 text-[11px]",value:p,onChange:N=>S(Number(N.target.value)),children:l3.map(N=>o.jsxs("option",{value:N,children:[N," / page"]},N))}),o.jsx(se,{size:"sm",variant:"outline",className:"h-6 px-2",onClick:C,disabled:!v,type:"button",children:"Prev"}),o.jsx(se,{size:"sm",variant:"outline",className:"h-6 px-2",onClick:w,disabled:!_,type:"button",children:"Next"})]}):null]}),h?o.jsx("div",{className:"p-4",children:o.jsx(Qe,{variant:"muted",className:"border-destructive/40 text-destructive",children:h})}):d?o.jsxs("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:[o.jsx(pt,{className:"mr-2 size-4 animate-spin"}),"Loading rows…"]}):l?o.jsx(uP,{connection:e,sample:l}):o.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:"Pick a table to sample its rows."})]})]})}function yP({onAdd:e,onAddWithAi:t}){return o.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center",children:o.jsxs("div",{className:"max-w-sm",children:[o.jsx(Xn,{className:"mx-auto size-8 text-muted-foreground/50"}),o.jsx("p",{className:"mt-3 text-sm font-medium",children:"No connections yet"}),o.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' ",o.jsx("code",{children:".env"})," files."]}),o.jsxs("div",{className:"mt-4 flex items-center justify-center gap-2",children:[o.jsxs(se,{size:"sm",onClick:e,type:"button",children:[o.jsx(Cs,{}),"Add connection"]}),o.jsxs(se,{size:"sm",variant:"outline",onClick:t,type:"button",children:[o.jsx(zi,{}),"Add with AI"]})]})]})})}function SP({incident:e}){const{error:t}=Ns(),{sendToAgent:s}=Bt(),[i,a]=y.useState(!1);async function l(){a(!0);try{const{prompt:u}=await B6(e.id);s({prompt:u,source:{type:"error",label:`${e.service} — ${e.level}`},label:`Help me debug this ${e.level} in \`${e.service}\`: ${e.title}`})}catch(u){t(u instanceof Error?u.message:String(u))}finally{a(!1)}}return o.jsxs("div",{className:"flex h-full min-h-0 min-w-0 flex-col",children:[o.jsxs("div",{className:"shrink-0 border-b border-border px-4 py-3",children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(Pe,{variant:e.level==="error"?"danger":"secondary",appearance:"subtle",size:"small",children:e.level}),o.jsx("span",{className:"truncate font-mono text-xs font-semibold",children:e.service}),e.count>1?o.jsxs(Pe,{variant:"outline",size:"small",children:["×",e.count]}):null]}),o.jsxs(se,{onClick:()=>{l()},disabled:i,size:"sm",variant:"outline",children:[o.jsx(Gt,{className:"size-3.5"}),i?"Sending…":"Fix with AI"]})]}),o.jsx("p",{className:"mt-1.5 break-words font-mono text-xs text-foreground",children:e.title}),e.file?o.jsxs("p",{className:"mt-1 flex items-center gap-1.5 font-mono text-[11px] text-muted-foreground",children:[o.jsx(mC,{className:"size-3.5"}),e.file,e.line?`:${e.line}`:""]}):null,o.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()]})]}),o.jsxs("div",{className:"min-h-0 flex-1 overflow-auto p-4",children:[o.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Log excerpt"}),o.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(`
|
|
151
|
+
`)}),o.jsx("p",{className:"mt-3 text-[11px] text-muted-foreground",children:`"Fix with AI" sends the agent this excerpt with the affected file's diff and the last 40 log lines, so it can start debugging right away.`})]})]})}function zw(e){return[...e].sort((t,s)=>t.lastSeen<s.lastSeen?1:t.lastSeen>s.lastSeen?-1:s.id-t.id)}function wP(){const[e,t]=y.useState([]),[s,i]=y.useState(!1),[a,l]=y.useState(null),u=y.useCallback(h=>{t(m=>zw([...m.filter(d=>d.id!==h.id),h]))},[]);return y.useEffect(()=>{let h=!0;OC().then(d=>{h&&t(zw(d))}).catch(d=>{h&&l(d instanceof Error?d.message:String(d))});const m=new EventSource("/api/errors/stream");return m.addEventListener("open",()=>i(!0)),m.addEventListener("error",()=>i(!1)),m.addEventListener("incident",d=>{try{const p=JSON.parse(d.data);u(p)}catch{}}),()=>{h=!1,m.close()}},[u]),{incidents:e,connected:s,error:a}}function kP(){const{incidents:e,connected:t,error:s}=wP(),[i,a]=y.useState(null);y.useEffect(()=>{if(e.length===0){a(null);return}a(u=>u!==null&&e.some(h=>h.id===u)?u:e[0].id)},[e]);const l=y.useMemo(()=>e.find(u=>u.id===i)??null,[e,i]);return o.jsxs("div",{className:"flex h-full min-h-0 bg-card/85",children:[o.jsxs("div",{className:"flex w-72 shrink-0 flex-col border-r border-border",children:[o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ch,{className:"size-4 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-semibold",children:"Incidents"}),o.jsx(Pe,{variant:"outline",size:"small",children:e.length})]}),o.jsx(Pe,{variant:"outline",size:"small",icon:o.jsx("span",{className:le("inline-block size-1.5 rounded-full",t?"animate-pulse bg-emerald-500":"bg-muted-foreground/60")}),children:t?"live":"reconnecting…"})]}),o.jsx("ul",{className:"min-h-0 flex-1 divide-y divide-border overflow-auto",children:e.map(u=>o.jsx("li",{children:o.jsxs("button",{type:"button",onClick:()=>a(u.id),className:le("flex w-full flex-col gap-1 px-3 py-2 text-left transition-colors hover:bg-muted/50",u.id===i&&"bg-muted/70"),children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"truncate font-mono text-[11px] font-semibold",children:u.service}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[u.count>1?o.jsxs(Pe,{variant:"outline",size:"small",children:["×",u.count]}):null,o.jsx(Pe,{variant:u.level==="error"?"danger":"secondary",appearance:"subtle",size:"small",children:u.level})]})]}),o.jsx("span",{className:"truncate font-mono text-[11px] text-muted-foreground",children:u.title}),o.jsx("span",{className:"font-mono text-[10px] text-muted-foreground/70",children:new Date(u.lastSeen).toLocaleTimeString()})]})},u.id))})]}),o.jsx("div",{className:"min-h-0 min-w-0 flex-1",children:s?o.jsx("div",{className:"p-4",children:o.jsxs(Qe,{variant:"muted",className:"border-destructive/40 text-destructive",children:["Failed to load incidents: ",s]})}):l?o.jsx(SP,{incident:l}):o.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center",children:o.jsxs("div",{className:"max-w-sm",children:[o.jsx(Ch,{className:"mx-auto size-8 text-muted-foreground/50"}),o.jsx("p",{className:"mt-3 text-sm font-medium",children:"No incidents yet"}),o.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 qh({label:e}){return o.jsx(Qe,{variant:"muted",className:"m-4 text-center",children:e})}const CP=900*1e3,jc=12,Jp=200;function NP({events:e}){const[t,s]=y.useState(null),[i,a]=y.useState(null),{rows:l,windowStart:u,windowEnd:h}=y.useMemo(()=>EP(e),[e]),m=t?l.find(d=>d.service===t)??null:null;return o.jsxs(o.Fragment,{children:[o.jsxs(fi,{className:"rounded-none border-0 border-b border-border bg-transparent",children:[o.jsxs(mi,{className:"border-b border-border px-3 py-2",children:[o.jsxs(pi,{className:"flex items-center gap-2",children:[o.jsx(qa,{className:"size-3.5"}),"Runtime Monitor"]}),o.jsx(Ii,{className:"text-xs",children:e.length===0?"No events yet":`${e.length} event${e.length===1?"":"s"} · last 15 min`})]}),o.jsx(gi,{className:"p-0",children:l.length===0?o.jsx(qh,{label:"No runtime timeline events yet."}):o.jsxs("div",{className:"divide-y divide-border",children:[l.map(d=>o.jsx(jP,{onClick:()=>s(d.service),row:d,windowEnd:h,windowStart:u},d.service)),o.jsxs("div",{className:"flex justify-between px-3 py-1.5 font-mono text-[10px] text-muted-foreground",children:[o.jsx("span",{children:Vh(u)}),o.jsx("span",{children:"now"})]})]})})]}),m?o.jsx(Zn,{icon:o.jsx(qa,{}),onClose:()=>s(null),title:m.service,children:o.jsx(MP,{onSelect:a,row:m})}):null,i?o.jsx(Zn,{icon:o.jsx(qa,{}),onClose:()=>a(null),title:i.title,children:o.jsx(RP,{event:i})}):null]})}function EP(e){const t=Date.now(),s=t,i=t-CP;let a=e.filter(m=>{if(m.kind==="service.http")return!1;const d=new Date(m.timestamp).getTime();return!Number.isNaN(d)&&d>=i});a.length===0&&e.length>0?a=e.slice(-Jp):a.length>Jp&&(a=a.slice(-Jp));const l=new Map;for(const m of a){const d=m.service||"·system",p=l.get(d)??[];p.push(m),l.set(d,p)}const u=Math.max(s-i,1);return{rows:Array.from(l.entries()).map(([m,d])=>{const p=[...d].sort((T,N)=>T.timestamp.localeCompare(N.timestamp)),g=new Array(jc).fill(0),v=new Array(jc).fill(null);for(const T of p){const N=new Date(T.timestamp).getTime(),j=Math.max(i,Math.min(s,N)),R=Math.min(jc-1,Math.floor((j-i)/u*jc));g[R]+=1;const z=v[R];v[R]=TP(z,T.severity)}const _=p.filter(T=>T.severity==="error").length,S=p.filter(T=>T.severity==="warning").length,w=p.length-_-S,C=[...p].reverse().find(T=>T.severity!=="info")??null,E=_>0?"error":S>0?"warning":"info";return{service:m,events:p,errors:_,warnings:S,infos:w,buckets:g,bucketSeverity:v,lastNotable:C,worstSeverity:E}}).sort((m,d)=>{const p=v=>v.errors*1e3+v.warnings,g=p(d)-p(m);return g!==0?g:m.service.localeCompare(d.service)}),windowStart:i,windowEnd:s}}function TP(e,t){return e==="error"||t==="error"?"error":e==="warning"||t==="warning"?"warning":"info"}function jP({onClick:e,row:t,windowEnd:s,windowStart:i}){const a=Math.max(1,...t.buckets);return o.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:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.jsx("span",{className:le("size-2 shrink-0 rounded-full",d3(t.worstSeverity))}),o.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium text-foreground",dir:"rtl",children:o.jsx("bdi",{children:t.service})}),t.errors>0?o.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?o.jsxs("span",{className:"rounded bg-amber-500/15 px-1 font-mono text-[10px] text-amber-500",children:[t.warnings,"W"]}):null,o.jsx(Li,{className:"size-3 text-muted-foreground"})]}),o.jsx("div",{className:"timeline-density mt-1.5 grid h-3 gap-px","data-testid":"timeline-density",style:{gridTemplateColumns:`repeat(${jc}, minmax(0, 1fr))`},children:t.buckets.map((l,u)=>o.jsx(AP,{count:l,max:a,severity:t.bucketSeverity[u]},u))}),t.lastNotable?o.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-muted-foreground",children:t.lastNotable.detail??t.lastNotable.title}):o.jsxs("div",{className:"mt-1 truncate text-[10px] text-muted-foreground",children:[t.infos," info ",t.infos===1?"event":"events"]}),o.jsxs("div",{className:"mt-0.5 flex justify-between font-mono text-[9px] text-muted-foreground/60",children:[o.jsx("span",{children:Vh(i)}),o.jsx("span",{children:Vh(s)})]})]})}function AP({count:e,max:t,severity:s}){if(e===0)return o.jsx("span",{className:"rounded-sm bg-border/60"});const i=Math.min(1,.35+e/t*.65);return o.jsx("span",{className:le("rounded-sm",DP(s)),style:{opacity:i},title:`${e} event${e===1?"":"s"}`})}function MP({onSelect:e,row:t}){const s=[...t.events].sort((i,a)=>a.timestamp.localeCompare(i.timestamp));return o.jsxs("div",{className:"flex max-h-[480px] flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-4 py-2 text-xs text-muted-foreground",children:[o.jsxs("span",{children:[t.events.length," events"]}),o.jsx("span",{children:"·"}),o.jsxs("span",{children:[t.errors," error",t.errors===1?"":"s"]}),o.jsx("span",{children:"·"}),o.jsxs("span",{children:[t.warnings," warning",t.warnings===1?"":"s"]})]}),o.jsx("ul",{className:"min-h-0 divide-y divide-border overflow-auto",children:s.map(i=>o.jsx("li",{children:o.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:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:le("size-2 shrink-0 rounded-full",d3(i.severity))}),o.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium text-foreground",children:i.title}),o.jsx("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:Vh(i.timestamp)})]}),i.detail?o.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-muted-foreground",children:i.detail}):null]})},i.id))})]})}function RP({event:e}){const t=new Date(e.timestamp);return o.jsxs("div",{className:"space-y-3 p-4 text-sm",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("span",{className:le("rounded px-1.5 py-0.5 font-mono text-[10px] uppercase text-white",OP(e.severity)),children:e.severity}),o.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?o.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]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"When"}),o.jsx("div",{className:"font-mono text-xs",children:Number.isNaN(t.getTime())?e.timestamp:t.toLocaleString()})]}),e.detail?o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Detail"}),o.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 d3(e){return e==="error"?"bg-red-500":e==="warning"?"bg-amber-500":"bg-zinc-400"}function DP(e){return e==="error"?"bg-red-500":e==="warning"?"bg-amber-500":"bg-zinc-500"}function OP(e){return e==="error"?"bg-red-600":e==="warning"?"bg-amber-600":"bg-zinc-700"}function Vh(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"})}function LP({onOnboardRepo:e,onOnboardWithAi:t,onCreateService:s,onCreateWithAi:i}){return o.jsx("div",{className:"flex h-full min-h-0 items-center justify-center overflow-auto bg-card/85 p-6",children:o.jsxs("div",{className:"w-full max-w-xl space-y-6",children:[o.jsxs("div",{className:"space-y-2 text-center",children:[o.jsx("h2",{className:"text-xl font-semibold",children:"Set up your first service"}),o.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."})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Bw,{icon:o.jsx(pn,{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"}),o.jsx(Bw,{icon:o.jsx(Cs,{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 Bw({icon:e,title:t,description:s,onClick:i,onAi:a,aiTitle:l}){return o.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:[o.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:[o.jsx("span",{className:"mt-0.5 shrink-0 text-muted-foreground",children:e}),o.jsxs("span",{className:"min-w-0 space-y-1",children:[o.jsx("span",{className:"block text-sm font-semibold",children:t}),o.jsx("span",{className:"block text-xs text-muted-foreground",children:s})]})]}),o.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:[o.jsx(Gt,{className:"size-4 shrink-0"}),"AI"]})]})}function zP({health:e}){if(!e)return null;const t=e.processTree,s=e.status==="healthy"||e.status==="unknown"?void 0:$P(e.summary);return o.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:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.jsxs("span",{className:le("inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2.5 font-medium",BP(e.status)),children:[o.jsx("span",{className:"inline-flex shrink-0",children:o.jsx(qa,{className:"size-3"})}),o.jsx("span",{className:"whitespace-nowrap",children:e.status})]}),s?o.jsx("span",{className:"min-w-0 truncate",children:s}):null]}),t?o.jsxs("div",{className:"health-metrics flex min-w-max items-center gap-2 font-mono sm:justify-end",children:[o.jsxs("span",{className:"inline-flex items-center gap-1 font-mono",children:[o.jsx(o4,{className:"size-3"}),t.processCount," ",t.processCount===1?"process":"processes"]}),o.jsxs("span",{children:[PP(t.cpuPercent)," CPU"]}),o.jsxs("span",{className:"inline-flex items-center gap-1 font-mono",children:[o.jsx(cM,{className:"size-3"}),IP(t.rssMb)," RAM"]})]}):null]})}function BP(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 IP(e){return Number.isInteger(e)?`${e} MB`:`${e.toFixed(1)} MB`}function PP(e){return`${e.toFixed(1)}%`}function $P(e){return e.replace(/^Recent error log:\s*/i,"Recent stderr: ").replace(/:\s*\d+(?:\.\d+)? MB RSS\.?$/i,"").replace(/\s+RSS\.?$/i,"")}function HP({ports:e}){const t=e.filter(i=>i.state==="occupied").length,s=e.filter(i=>i.state==="managed").length;return o.jsxs(fi,{className:"rounded-none border-0 border-b border-border bg-transparent",children:[o.jsxs(mi,{className:"border-b border-border px-3 py-2",children:[o.jsxs(pi,{className:"flex items-center gap-2",children:[o.jsx(_M,{className:"size-3.5"}),"Ports"]}),o.jsxs(Ii,{className:"text-xs",children:[s," managed, ",t," occupied by other"]})]}),o.jsx(gi,{className:"p-0",children:e.length?o.jsx("div",{className:"divide-y divide-border",children:e.map(i=>o.jsxs("div",{className:"grid grid-cols-[1fr_auto] items-center gap-2 px-3 py-2",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"font-mono text-xs",children:[":",i.port]}),o.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:i.services.join(", ")||"Unassigned"}),i.urls[0]?o.jsx("div",{className:"truncate font-mono text-[10px] text-muted-foreground",children:i.urls[0]}):null]}),o.jsx(UP,{port:i})]},i.port))}):o.jsx(qh,{label:"No configured ports yet."})})]})}function UP({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 o.jsx(Pe,{className:le(e&&"max-w-36 truncate"),variant:i,children:s})}function FP({onChange:e,value:t}){return o.jsxs("label",{className:"relative block",children:[o.jsx(GM,{className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),o.jsx(nt,{"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 qP({className:e,containerRef:t,emptyText:s,logs:i,query:a}){return o.jsx("div",{className:le("h-full max-w-full overflow-auto bg-background font-mono text-[11px] leading-5 dark:bg-zinc-950",e),ref:t,role:"log",children:i.length?i.map((l,u)=>o.jsxs("div",{className:le("grid min-w-max grid-cols-[168px_minmax(420px,1fr)] gap-2 border-b border-border/45 px-3 py-0.5 dark:border-zinc-800/80",l.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:[o.jsx("span",{className:"text-muted-foreground dark:text-zinc-500",children:l.timestamp}),o.jsxs("span",{className:"whitespace-pre-wrap break-words",children:[l.stream==="stderr"?o.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,GP(l.text,a)]})]},`${l.timestamp}-${l.stream}-${u}`)):o.jsx("div",{className:"p-3 text-muted-foreground",children:s})})}function VP(e){return`${e.timestamp} ${e.stream} ${e.text}`}function GP(e,t){const s=t.trim();if(!s)return e;const i=e.toLowerCase(),a=s.toLowerCase(),l=[];let u=0,h=i.indexOf(a);for(;h!==-1;){h>u&&l.push(e.slice(u,h));const m=h+s.length;l.push(o.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,m)},`${h}-${m}`)),u=m,h=i.indexOf(a,u)}return u<e.length&&l.push(e.slice(u)),l}function Iw(e){return`${e.kind}:${e.name}`}function WP(e,t=!1,s={}){const[i,a]=y.useState(),[l,u]=y.useState(),[h,m]=y.useState(e.kind==="source"),d=JSON.stringify(s);return y.useEffect(()=>{a(void 0),u(void 0);let p=!1;const g=async()=>{try{if(e.kind==="service"){const _=await PC(e.name,s);p||(a(_.logs),m(_.queryable),u(void 0))}else{const _=await BC(e.name,s);p||(a(_),m(!0),u(void 0))}}catch(_){p||u(_ instanceof Error?_.message:String(_))}};g();const v=window.setInterval(g,t?1e3:2e3);return()=>{p=!0,window.clearInterval(v)}},[e.kind,e.name,t,d]),{logs:i,error:l,queryable:h}}const KP=[{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 h3({target:e,query:t,setQuery:s,streaming:i,setStreaming:a,hideStdout:l,setHideStdout:u,fill:h=!1,leading:m,trailing:d}){const p=e.kind==="source",[g,v]=y.useState(""),[_,S]=y.useState(""),[w,C]=y.useState(t);y.useEffect(()=>{const W=window.setTimeout(()=>C(t),300);return()=>window.clearTimeout(W)},[t]);const E=y.useMemo(()=>{const W={};g&&(W.since=g),_&&(W.level=_);const ee=w.trim();return ee&&(W.grep=ee),W},[g,_,w]),{logs:T,error:N,queryable:j}=WP(e,i,E),R=p||j,z=y.useRef(null),D=y.useRef(!0),[M,$]=y.useState([]),[L,B]=y.useState(!1),P=JSON.stringify(E);y.useEffect(()=>{$([])},[P,e.kind,e.name]);const F=y.useMemo(()=>{const W=T??[];if(M.length===0)return W;const ee=new Set(M.map(O=>O.cursor).filter(Boolean));return[...M,...W.filter(O=>!O.cursor||!ee.has(O.cursor))]},[T,M]),V=(M[0]??(T??[])[0])?.cursor;async function G(){if(!(!R||!V||L)){B(!0),D.current=!1;try{const W={...E,before:V,lines:200},ee=e.kind==="source"?await BC(e.name,W):(await PC(e.name,W)).logs;ee.length&&$(O=>{const Z=new Set(O.map(de=>de.cursor).filter(Boolean));return[...ee.filter(de=>!de.cursor||!Z.has(de.cursor)),...O]})}finally{B(!1)}}}const I=t.trim().toLowerCase(),Y=y.useMemo(()=>{let W=F;return l&&(W=W.filter(ee=>ee.stream==="stderr")),I&&(W=W.filter(ee=>VP(ee).toLowerCase().includes(I))),W},[F,l,I]);y.useEffect(()=>{const W=z.current;if(!W)return;const ee=()=>{const O=W.scrollHeight-W.scrollTop-W.clientHeight;D.current=O<40};return ee(),W.addEventListener("scroll",ee,{passive:!0}),()=>W.removeEventListener("scroll",ee)},[]),y.useEffect(()=>{if(!i||!D.current||Y.length===0)return;const W=z.current;W&&(W.scrollTop=W.scrollHeight)},[i,Y]);const X=T?I?`No log lines match "${t.trim()}".`:l?"No stderr output captured.":"No log entries.":"Loading…";return o.jsxs("div",{className:h?"flex h-full min-h-0 flex-col gap-2":"flex flex-col gap-2",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[m,o.jsx(FP,{onChange:s,value:t}),R?o.jsxs(o.Fragment,{children:[o.jsx("select",{"aria-label":"Time range",className:"h-8 rounded-md border border-border bg-background px-2 text-xs",onChange:W=>v(W.target.value),value:g,children:KP.map(W=>o.jsx("option",{value:W.value,children:W.label},W.label))}),o.jsxs("select",{"aria-label":"Level",className:"h-8 rounded-md border border-border bg-background px-2 text-xs",onChange:W=>S(W.target.value),value:_,children:[o.jsx("option",{value:"",children:"All levels"}),o.jsx("option",{value:"warn",children:"Warnings+"}),o.jsx("option",{value:"error",children:"Errors"})]})]}):o.jsxs(Pw,{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:()=>u(!l),children:[o.jsx(M4,{}),"Errors only"]}),o.jsxs(Pw,{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:[o.jsx($M,{}),i?"Streaming":"Stream"]}),R&&V?o.jsxs(se,{disabled:L,onClick:()=>{G()},size:"sm",type:"button",variant:"outline",children:[o.jsx(nf,{}),L?"Loading…":"Load older"]}):null,d?o.jsx("div",{className:"ml-auto flex items-center gap-2",children:d}):null]}),N?o.jsx("div",{className:"text-red-600",children:N}):null,o.jsx(qP,{className:le("rounded border border-border/60",h?"min-h-0 flex-1":"max-h-80"),containerRef:z,emptyText:X,logs:Y,query:t})]})}function Pw({active:e,activeClassName:t,children:s,onClick:i}){return o.jsx(se,{"aria-pressed":e,className:e?t:void 0,onClick:i,size:"sm",type:"button",variant:"outline",children:s})}function YP(e,t){return e.kind===t.kind&&e.name===t.name}function XP({options:e,target:t,onChange:s,className:i}){const a=e.findIndex(u=>YP(u.target,t)),l=[...new Set(e.map(u=>u.group))];return o.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:u=>s(e[Number(u.target.value)].target),value:String(a),children:l.map(u=>o.jsx("optgroup",{label:u,children:e.map((h,m)=>h.group===u?o.jsx("option",{value:String(m),children:h.label},`${h.group}:${h.label}`):null)},u))})}function ZP({serviceName:e}){const[t,s]=y.useState(""),[i,a]=y.useState(!1),[l,u]=y.useState(!1),[h,m]=y.useState(!1),d=o.jsx(h3,{fill:!0,hideStdout:l,query:t,setHideStdout:u,setQuery:s,setStreaming:a,streaming:i,target:{kind:"service",name:e},trailing:o.jsxs(se,{onClick:()=>m(p=>!p),size:"sm",type:"button",variant:"outline",children:[h?o.jsx(yC,{}):o.jsx(_C,{}),h?"Exit":"Expand"]})});return h?o.jsx(Nx,{onClose:()=>m(!1),title:`Logs — ${e}`,children:d}):o.jsx("div",{className:"h-[60vh] min-h-[24rem]",children:d})}function Nx({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]),gu.createPortal(o.jsx("div",{className:"fixed inset-0 z-[1000] bg-black/40 p-4 sm:p-8",onMouseDown:t,children:o.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:[o.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-2",children:[o.jsx("h2",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:e}),o.jsx(se,{"aria-label":"Close logs",onClick:t,size:"icon",type:"button",variant:"ghost",children:o.jsx(Gs,{})})]}),o.jsx("div",{className:"min-h-0 flex-1 p-3",children:s})]})}),document.body)}const QP={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 JP({onClose:e,onAdded:t}){const[s,i]=y.useState(""),[a,l]=y.useState("journald"),[u,h]=y.useState(""),[m,d]=y.useState(""),[p,g]=y.useState(""),[v,_]=y.useState(""),[S,w]=y.useState(""),[C,E]=y.useState(""),[T,N]=y.useState(),[j,R]=y.useState(!1);async function z(){R(!0),N(void 0);try{const D={name:s.trim(),kind:"command"};a==="file"?(D.kind="file",D.path=m.trim()):a==="ssh"?(D.kind="ssh",D.host=u.trim(),D.path=m.trim()):a==="command"?(D.kind="command",D.command=p.trim(),v.trim()&&(D.cwd=v.trim())):a==="journald"?(D.driver="journald",D.unit=S.trim(),u.trim()&&(D.host=u.trim())):a==="docker"&&(D.driver="docker",D.container=C.trim(),u.trim()&&(D.host=u.trim()));const M=await lR(D);t(M,D.name),e()}catch(D){N(D instanceof Error?D.message:String(D))}finally{R(!1)}}return o.jsx(Zn,{icon:o.jsx(kC,{}),onClose:e,size:"md",title:"Add log source",children:o.jsxs("form",{className:"flex flex-col gap-3 p-4 text-xs",onSubmit:D=>{D.preventDefault(),z()},children:[o.jsx(hr,{label:"Name",children:o.jsx(nt,{autoFocus:!0,onChange:D=>i(D.target.value),placeholder:"PROD",value:s})}),o.jsxs(hr,{label:"Type",children:[o.jsxs("select",{className:"h-9 w-full rounded-md border border-border bg-background px-2 text-xs",onChange:D=>l(D.target.value),value:a,children:[o.jsx("option",{value:"journald",children:"systemd journal (journald)"}),o.jsx("option",{value:"docker",children:"Docker container"}),o.jsx("option",{value:"ssh",children:"Remote file (SSH)"}),o.jsx("option",{value:"file",children:"Local file"}),o.jsx("option",{value:"command",children:"Command"})]}),o.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:QP[a]})]}),a==="journald"||a==="docker"?o.jsx(hr,{label:"Host (optional — leave blank to run locally)",children:o.jsx(nt,{onChange:D=>h(D.target.value),placeholder:"jobjourney-prod (an alias from ~/.ssh/config)",value:u})}):null,a==="journald"?o.jsx(hr,{label:"Unit",children:o.jsx(nt,{onChange:D=>w(D.target.value),placeholder:"jobjourney",value:S})}):null,a==="docker"?o.jsx(hr,{label:"Container",children:o.jsx(nt,{onChange:D=>E(D.target.value),placeholder:"brainctl-api",value:C})}):null,a==="ssh"?o.jsx(hr,{label:"Host",children:o.jsx(nt,{onChange:D=>h(D.target.value),placeholder:"prod (an alias from ~/.ssh/config)",value:u})}):null,a==="file"||a==="ssh"?o.jsx(hr,{label:a==="ssh"?"Remote path":"File path",children:o.jsx(nt,{onChange:D=>d(D.target.value),placeholder:"/var/log/app/out.log",value:m})}):null,a==="command"?o.jsxs(o.Fragment,{children:[o.jsx(hr,{label:"Command",children:o.jsx(nt,{onChange:D=>g(D.target.value),placeholder:"kubectl logs -l app=myapp --tail 500",value:p})}),o.jsx(hr,{label:"Working directory (optional)",children:o.jsx(nt,{onChange:D=>_(D.target.value),placeholder:"/srv/app",value:v})})]}):null,T?o.jsx("div",{className:"text-red-600",children:T}):null,o.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[o.jsx(se,{onClick:e,size:"sm",type:"button",variant:"outline",children:"Cancel"}),o.jsx(se,{disabled:j||!s.trim(),size:"sm",type:"submit",children:j?"Saving…":"Add source"})]})]})})}function hr({label:e,children:t}){return o.jsxs("label",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:e}),t]})}const $w=4;function e$({services:e,initialService:t,onClose:s}){const[i,a]=y.useState([]),[l,u]=y.useState(!1),[h,m]=y.useState(()=>[0]),[d,p]=y.useState(()=>{const N=t?{kind:"service",name:t}:e[0]?{kind:"service",name:e[0]}:void 0;return N?{0:N}:{}}),g=y.useRef(1);y.useEffect(()=>{let N=!1;return oR().then(j=>{N||a(j)}),()=>{N=!0}},[]);const v=[...e.map(N=>({target:{kind:"service",name:N},label:N,group:"Services"})),...i.map(N=>({target:{kind:"source",name:N.name},label:N.name,group:"Log sources"}))],_=v.map(N=>N.target);function S(){if(h.length>=$w||_.length===0)return;const N=g.current++,j=new Set(Object.values(d).map(Iw)),R=_.find(z=>!j.has(Iw(z)))??_[0];m(z=>[...z,N]),p(z=>({...z,[N]:R}))}function w(N){m(j=>j.filter(R=>R!==N)),p(j=>{const R={...j};return delete R[N],R})}function C(N,j){p(R=>({...R,[N]:j}))}function E(N,j){a(N);const R=h[0];R!==void 0&&C(R,{kind:"source",name:j})}const T=o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{children:"Logs"}),o.jsxs(se,{onClick:()=>u(!0),size:"sm",type:"button",variant:"outline",children:[o.jsx(Cs,{}),"Add source"]}),o.jsxs(se,{disabled:h.length>=$w||_.length===0,onClick:S,size:"sm",type:"button",variant:"outline",children:[o.jsx(Cs,{}),"Add pane"]})]});return o.jsxs(o.Fragment,{children:[o.jsx(Nx,{maxWidthClass:"max-w-[1500px]",onClose:s,title:T,children:_.length===0?o.jsx("div",{className:"grid h-full place-items-center text-center text-muted-foreground",children:o.jsxs("div",{children:[o.jsx("p",{children:"No services or log sources yet."}),o.jsxs(se,{className:"mt-2",onClick:()=>u(!0),size:"sm",type:"button",children:[o.jsx(Cs,{}),"Add a log source"]})]})}):o.jsx("div",{className:le("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(N=>o.jsx(t$,{onChangeTarget:j=>C(N,j),onRemove:h.length>1?()=>w(N):void 0,options:v,target:d[N]??_[0]},N))})}),l?o.jsx(JP,{onAdded:E,onClose:()=>u(!1)}):null]})}function t$({options:e,target:t,onChangeTarget:s,onRemove:i}){const[a,l]=y.useState(""),[u,h]=y.useState(!0),[m,d]=y.useState(!1);return o.jsx("div",{className:"flex min-h-0 min-w-0 flex-col rounded-lg border border-border bg-background/60 p-2",children:o.jsx(h3,{fill:!0,hideStdout:m,leading:o.jsx(XP,{onChange:s,options:e,target:t}),query:a,setHideStdout:d,setQuery:l,setStreaming:h,streaming:u,target:t,trailing:i?o.jsx(se,{"aria-label":"Remove pane",onClick:i,size:"icon",type:"button",variant:"ghost",children:o.jsx(Gs,{})}):void 0})})}function s$({rows:e,revealAll:t,onAdd:s,onRemove:i,onUpdate:a}){return e.length===0?o.jsxs("div",{className:"text-muted-foreground",children:["No variables yet."," ",o.jsx("button",{className:"underline",onClick:s,type:"button",children:"Add one"}),"."]}):o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full font-mono text-[11px]",children:[o.jsx("thead",{className:"text-left text-muted-foreground",children:o.jsxs("tr",{children:[o.jsx("th",{className:"py-1 pr-3",children:"Key"}),o.jsx("th",{className:"py-1 pr-3",children:"Value"}),o.jsx("th",{className:"py-1 w-8"})]})}),o.jsx("tbody",{children:e.map((l,u)=>{const h=!l.reveal&&!t;return o.jsxs("tr",{className:"border-t border-border/40",children:[o.jsx("td",{className:"py-1 pr-3 align-top",children:o.jsx("input",{className:"w-full rounded border border-border/60 bg-background px-1.5 py-0.5 font-mono",onChange:m=>a(u,{key:m.target.value}),placeholder:"KEY",spellCheck:!1,value:l.key})}),o.jsx("td",{className:"py-1 pr-3 align-top",children:o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("input",{className:"w-full rounded border border-border/60 bg-background px-1.5 py-0.5 font-mono",onChange:m=>a(u,{value:m.target.value}),spellCheck:!1,type:h?"password":"text",value:l.value}),o.jsx("button",{className:"text-muted-foreground hover:text-foreground",onClick:()=>a(u,{reveal:!l.reveal}),title:l.reveal||t?"Hide":"Reveal",type:"button",children:l.reveal||t?o.jsx(hC,{size:14}):o.jsx(Rb,{size:14})})]})}),o.jsx("td",{className:"py-1 align-top",children:o.jsx("button",{className:"text-muted-foreground hover:text-red-600",onClick:()=>i(u),type:"button",children:o.jsx(ua,{size:14})})})]},u)})})]})})}function n$({serviceName:e,onClose:t,onPick:s}){const[i,a]=y.useState(),[l,u]=y.useState(),[h,m]=y.useState(!0),[d,p]=y.useState();y.useEffect(()=>{let _=!1;return m(!0),u(void 0),(async()=>{try{const S=await bR(e,d);_||a(S)}catch(S){_||u(S instanceof Error?S.message:String(S))}finally{_||m(!1)}})(),()=>{_=!0}},[e,d]);function g(_){if(_.kind==="directory"){p(_.relativePath);return}_.supported&&s(_.relativePath)}function v(){if(!i||i.isRoot)return;const _=i.relativePath,S=_.includes("/")?_.slice(0,_.lastIndexOf("/")):"";p(S||void 0)}return o.jsx(Zn,{icon:o.jsx(rf,{}),onClose:t,size:"lg",title:"Pick a config file",children:o.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[o.jsxs(se,{disabled:!i||i.isRoot,onClick:v,size:"sm",type:"button",variant:"outline",children:[o.jsx(nf,{})," Up"]}),o.jsx("code",{className:"truncate rounded bg-muted px-2 py-1 font-mono",children:i?.relativePath||"./"})]}),l?o.jsx("div",{className:"text-red-600",children:l}):h?o.jsx("div",{className:"text-muted-foreground",children:"Loading…"}):!i||i.entries.length===0?o.jsx("div",{className:"text-muted-foreground",children:"Empty directory."}):o.jsx("div",{className:"max-h-[50vh] overflow-auto rounded border border-border/60",children:o.jsx("ul",{className:"divide-y divide-border/40",children:i.entries.map(_=>{const S=_.kind==="directory",w=S||_.supported;return o.jsx("li",{children:o.jsxs("button",{className:le("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs",w?"hover:bg-muted":"cursor-not-allowed text-muted-foreground"),disabled:!w,onClick:()=>g(_),type:"button",children:[S?o.jsx(Ja,{size:14}):o.jsx(gC,{size:14}),o.jsx("span",{className:"flex-1 truncate font-mono",children:_.name}),!S&&_.format?o.jsx(Pe,{size:"small",variant:"secondary",children:_.format}):null]})},_.relativePath)})})}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Only ",o.jsx("code",{children:".env*"}),", ",o.jsx("code",{children:"appsettings*.json"}),", and"," ",o.jsx("code",{children:"application*.yml"})," can be selected. Other files are shown disabled."]})]})})}function f3(e){if(!e.trim())return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function i$(e){const{error:t,success:s}=Ns(),[i,a]=y.useState([]),[l,u]=y.useState(),[h,m]=y.useState(),[d,p]=y.useState(!0),[g,v]=y.useState(!1),[_,S]=y.useState(!1),[w,C]=y.useState(!1),[E,T]=y.useState();y.useEffect(()=>{let L=!1;return p(!0),T(void 0),(async()=>{try{const B=await xR(e);if(L)return;a(B.files),B.files.length>0?u(P=>P??B.files[0].path):(u(void 0),m(void 0))}catch(B){L||T(B instanceof Error?B.message:String(B))}finally{L||p(!1)}})(),()=>{L=!0}},[e]);const N=y.useCallback(async L=>{v(!0),T(void 0);try{const B=await Iy(e,L),P={path:B.path,relativePath:B.relativePath,format:B.format};B.format==="env"?m({info:P,exists:B.exists,rows:B.entries.map(F=>({...F,reveal:!1}))}):m({info:P,exists:B.exists,text:B.format==="json"?f3(B.content):B.content}),C(!1)}catch(B){T(B instanceof Error?B.message:String(B))}finally{v(!1)}},[e]);y.useEffect(()=>{l&&N(l)},[l,N]);function j(L,B){m(P=>{if(!P?.rows)return P;const F=P.rows.map((V,G)=>G===L?{...V,...B}:V);return{...P,rows:F}}),C(!0)}function R(){m(L=>L?.rows?{...L,rows:[...L.rows,{key:"",value:"",secret:!1,reveal:!0}]}:L),C(!0)}function z(L){m(B=>B?.rows?{...B,rows:B.rows.filter((P,F)=>F!==L)}:B),C(!0)}function D(L){m(B=>B&&{...B,text:L}),C(!0)}async function M(){if(h){S(!0);try{if(h.info.format==="env"&&h.rows){const L=await vR(e,h.info.path,h.rows.map(B=>({key:B.key.trim(),value:B.value})));m({info:{path:L.path,relativePath:L.relativePath,format:L.format},exists:L.exists,rows:L.entries.map(B=>({...B,reveal:!1}))}),s(`Saved ${L.entries.length} entries to ${L.relativePath}.`)}else if(h.text!==void 0){const L=await _R(e,h.info.path,h.text);m({info:{path:L.path,relativePath:L.relativePath,format:L.format},exists:L.exists,text:L.content}),s(`Saved ${L.relativePath}.`)}C(!1)}catch(L){t(L instanceof Error?L.message:String(L))}finally{S(!1)}}}async function $(L){try{const B=await Iy(e,L),P={path:B.path,relativePath:B.relativePath,format:B.format};return a(F=>F.some(V=>V.path===P.path)?F:[...F,P]),u(P.path),s(`Loaded ${P.relativePath}.`),!0}catch(B){return t(B instanceof Error?B.message:String(B)),!1}}return{files:i,selectedPath:l,setSelectedPath:u,loaded:h,loadingList:d,loadingFile:g,saving:_,dirty:w,error:E,addRow:R,removeRow:z,updateRow:j,updateText:D,save:M,pickFile:$}}function r$({serviceName:e}){const{files:t,selectedPath:s,setSelectedPath:i,loaded:a,loadingList:l,loadingFile:u,saving:h,dirty:m,error:d,addRow:p,removeRow:g,updateRow:v,updateText:_,save:S,pickFile:w}=i$(e),[C,E]=y.useState(!1),[T,N]=y.useState(!1);return l?o.jsx("div",{className:"text-muted-foreground",children:"Loading…"}):d&&!a?o.jsx("div",{className:"text-red-600",children:d}):o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("span",{className:"text-muted-foreground",children:"File:"}),t.length>0?o.jsx("select",{className:"rounded border border-border/60 bg-background px-1.5 py-0.5 font-mono text-xs",onChange:j=>i(j.target.value),value:s??"",children:t.map(j=>o.jsxs("option",{value:j.path,children:[j.relativePath," [",j.format,"]"]},j.path))}):o.jsx("span",{className:"text-muted-foreground",children:"none detected"}),o.jsxs(se,{onClick:()=>N(!0),size:"sm",type:"button",variant:"outline",children:[o.jsx(rf,{})," Browse files"]}),a?o.jsx("code",{className:"rounded bg-background px-1.5 py-0.5 font-mono text-muted-foreground",children:a.info.path}):null]}),o.jsxs("div",{className:"flex items-center gap-1",children:[a?.info.format==="env"?o.jsxs(o.Fragment,{children:[o.jsxs(se,{onClick:()=>E(j=>!j),size:"sm",type:"button",variant:"outline",children:[C?o.jsx(hC,{}):o.jsx(Rb,{}),C?"Hide secrets":"Reveal secrets"]}),o.jsxs(se,{onClick:p,size:"sm",type:"button",variant:"outline",children:[o.jsx(Cs,{})," Add"]})]}):null,o.jsxs(se,{disabled:!m||h||!a,onClick:S,size:"sm",type:"button",children:[o.jsx(wC,{})," ",h?"Saving…":"Save"]})]})]}),d&&!a?o.jsx("div",{className:"text-red-600",children:d}):a?.info.format==="env"&&a.rows?o.jsx("div",{className:le(u&&"opacity-60 transition-opacity"),children:o.jsx(s$,{revealAll:C,rows:a.rows,onAdd:p,onRemove:g,onUpdate:v})}):a?.text!==void 0?o.jsxs("div",{className:le("space-y-1",u&&"opacity-60 transition-opacity"),children:[a.info.format==="json"?o.jsx("div",{className:"flex justify-end",children:o.jsx(se,{onClick:()=>_(f3(a.text??"")),size:"sm",type:"button",variant:"outline",children:"Format JSON"})}):null,o.jsx("textarea",{className:"min-h-[300px] w-full rounded border border-border/60 bg-background p-2 font-mono text-[11px] leading-relaxed",onChange:j=>_(j.target.value),spellCheck:!1,value:a.text})]}):u?o.jsx("div",{className:"text-muted-foreground",children:"Loading file…"}):null,a?o.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,T?o.jsx(n$,{onClose:()=>N(!1),onPick:j=>{w(j).then(R=>{R&&N(!1)})},serviceName:e}):null]})}function a$({serviceName:e,status:t,timeline:s,onRefresh:i}){const{error:a,success:l}=Ns(),[u,h]=y.useState(!1),m=t?.inspector,d=t?.state==="running",p=y.useMemo(()=>s.filter(_=>_.kind==="service.http"&&_.service===e).map(_=>{const S=_.data??{};return{id:S.id??_.id,startedAt:_.timestamp,method:S.method??"?",path:S.path??"?",status:S.status??0,durationMs:S.durationMs??0,reqBytes:S.reqBytes??0,resBytes:S.resBytes??0}}).slice(-500).reverse(),[s,e]);async function g(_){h(!0);try{await mn(`/api/services/${encodeURIComponent(e)}/inspector`,{enabled:_?"true":"false"}),await i(),l(_?`HTTP inspector started for ${e}.`:`HTTP inspector stopped for ${e}.`)}catch(S){a(S instanceof Error?S.message:String(S))}finally{h(!1)}}if(!d)return o.jsx("div",{className:"text-muted-foreground",children:"Service is not running."});if(!m?.enabled)return o.jsxs("div",{className:"space-y-2",children:[o.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."}),o.jsxs(se,{disabled:u,onClick:()=>g(!0),size:"sm",type:"button",children:[o.jsx(eo,{})," Start HTTP inspector"]})]});const v=m.port?`http://127.0.0.1:${m.port}`:void 0;return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("span",{className:"text-muted-foreground",children:"Inspect URL:"}),v?o.jsxs(o.Fragment,{children:[o.jsx("code",{className:"rounded bg-background px-1.5 py-0.5 font-mono",children:v}),o.jsxs(se,{onClick:()=>{navigator.clipboard.writeText(v),l("Copied inspect URL.")},size:"sm",type:"button",variant:"outline",children:[o.jsx(kh,{})," Copy"]}),o.jsx(se,{onClick:()=>window.open(v,"_blank","noopener,noreferrer"),size:"sm",type:"button",variant:"outline",children:"Open"})]}):o.jsx("span",{className:"text-muted-foreground",children:"starting…"}),o.jsxs("span",{className:"text-muted-foreground",children:["→ upstream :",m.upstreamPort??"?"]}),o.jsxs(se,{disabled:u,onClick:()=>g(!1),size:"sm",type:"button",variant:"outline",children:[o.jsx(lu,{})," Stop"]})]}),p.length===0?o.jsx("div",{className:"text-muted-foreground",children:"No requests captured yet. Hit the inspect URL in your browser to see traffic."}):o.jsx("div",{className:"max-h-80 overflow-auto",children:o.jsxs("table",{className:"w-full font-mono text-[11px]",children:[o.jsx("thead",{className:"sticky top-0 bg-muted/60 text-left text-muted-foreground",children:o.jsxs("tr",{children:[o.jsx("th",{className:"py-1 pr-3",children:"Time"}),o.jsx("th",{className:"py-1 pr-3",children:"Method"}),o.jsx("th",{className:"py-1 pr-3",children:"Path"}),o.jsx("th",{className:"py-1 pr-3 text-right",children:"Status"}),o.jsx("th",{className:"py-1 pr-3 text-right",children:"Size"}),o.jsx("th",{className:"py-1 pr-3 text-right",children:"ms"})]})}),o.jsx("tbody",{children:p.map(_=>o.jsxs("tr",{className:"border-t border-border/40",children:[o.jsx("td",{className:"py-1 pr-3 text-muted-foreground",children:new Date(_.startedAt).toLocaleTimeString()}),o.jsx("td",{className:"py-1 pr-3",children:_.method}),o.jsx("td",{className:"py-1 pr-3 truncate max-w-[40ch]",children:_.path}),o.jsx("td",{className:le("py-1 pr-3 text-right",o$(_.status)),children:_.status}),o.jsx("td",{className:"py-1 pr-3 text-right text-muted-foreground",children:l$(_.resBytes)}),o.jsx("td",{className:"py-1 pr-3 text-right",children:_.durationMs.toFixed(1)})]},_.id))})]})})]})}function o$(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 l$(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function c$({serviceName:e}){const[t,s]=y.useState(null),[i,a]=y.useState(null),[l,u]=y.useState(()=>Date.now());return y.useEffect(()=>{let h=!1;async function m(){try{const p=await yR(e);h||(s(p),u(Date.now()),a(null))}catch(p){h||a(p instanceof Error?p.message:String(p))}}m();const d=setInterval(()=>{m()},3e3);return()=>{h=!0,clearInterval(d)}},[e]),i?o.jsxs("p",{className:"text-destructive",children:["Failed to load metrics: ",i]}):t?t.samples.length===0?o.jsx("p",{className:"text-muted-foreground",children:"No samples yet. Metrics start collecting once the service is running."}):o.jsx(u$,{series:t,now:l}):o.jsx("p",{className:"text-muted-foreground",children:"Loading metrics…"})}function u$({series:e,now:t}){const{samples:s}=e,i=y.useMemo(()=>Hw(s,m=>m.cpu),[s]),a=y.useMemo(()=>Hw(s,m=>m.rss),[s]),l=e.startedAt?new Date(e.startedAt):null,u=l?t-l.getTime():null,h=s.length>1?s[s.length-1].t-s[0].t:0;return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[o.jsx(Jd,{accent:"#22c55e",label:"CPU",value:`${i.last.toFixed(1)}%`,sub:`peak ${i.max.toFixed(1)}% · avg ${i.avg.toFixed(1)}%`}),o.jsx(Jd,{accent:"#3b82f6",label:"Memory",value:eg(a.last),sub:`peak ${eg(a.max)} · avg ${eg(a.avg)}`}),o.jsx(Jd,{accent:"#a855f7",label:"Uptime",value:u!=null?qw(u):"—",sub:l?`since ${l.toLocaleTimeString()}`:"not running"}),o.jsx(Jd,{accent:"#f59e0b",label:"Samples",value:String(s.length),sub:h?`over ${qw(h)}`:"collecting…"})]}),o.jsx(Fw,{label:"CPU",samples:s,pick:m=>m.cpu,summary:i,color:"#22c55e",suffix:"%",unit:"percent"}),o.jsx(Fw,{label:"Memory (RSS)",samples:s,pick:m=>m.rss,summary:a,color:"#3b82f6",suffix:" MB",unit:"mb"})]})}function Hw(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 Jd({accent:e,label:t,value:s,sub:i}){return o.jsxs("div",{className:"rounded-lg border border-border bg-card px-3 py-2",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full",style:{backgroundColor:e}}),o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:t})]}),o.jsx("div",{className:"mt-1 font-mono text-lg leading-none tabular-nums",children:s}),o.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-muted-foreground",children:i})]})}const Vo=160,Uw=44,d$=20;function Fw({label:e,samples:t,pick:s,summary:i,color:a,suffix:l,unit:u}){const h=y.useMemo(()=>`metric-grad-${u}-${Math.random().toString(36).slice(2,8)}`,[u]),m=t.map(s),d=Math.max(...m,u==="percent"?10:1),p=h$(d),g=0,v=p-g||1,_=t[0].t,S=t[t.length-1].t,w=Math.max(1,S-_),C=L=>(L-_)/w*1e3,E=L=>(1-(L-g)/v)*1e3,T=t.map(L=>`${C(L.t).toFixed(1)},${E(s(L)).toFixed(1)}`),N=`M0,1000 L${T.join(" L")} L1000,1000 Z`,j=`M${T.join(" L")}`,R=C(S),z=E(i.last),D=E(i.avg),M=[1,.75,.5,.25,0],$=5;return o.jsxs("figure",{className:"space-y-1",children:[o.jsxs("figcaption",{className:"flex items-baseline justify-between",children:[o.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:e}),o.jsxs("span",{className:"font-mono text-[11px] text-muted-foreground",children:["now ",o.jsxs("span",{className:"text-foreground",children:[i.last.toFixed(1),l]}),o.jsx("span",{className:"mx-1.5",children:"·"}),"peak ",i.max.toFixed(1),l,o.jsx("span",{className:"mx-1.5",children:"·"}),"avg ",i.avg.toFixed(1),l]})]}),o.jsxs("div",{className:"rounded-lg border border-border bg-card p-2",children:[o.jsxs("div",{className:"flex",children:[o.jsx("div",{className:"relative flex shrink-0 flex-col justify-between text-right font-mono text-[10px] text-muted-foreground",style:{width:Uw,height:Vo},children:M.map(L=>o.jsx("span",{className:"pr-1 leading-none",children:f$(g+L*v,u)},L))}),o.jsxs("div",{className:"relative min-w-0 flex-1",style:{height:Vo},children:[M.map((L,B)=>o.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-t border-border/40",style:{top:`${L===1?0:L===0?Vo-1:(1-L)*Vo}px`,borderStyle:B===M.length-1?"solid":"dashed"}},L)),o.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-t border-dashed",style:{top:`${D/1e3*Vo}px`,borderColor:a,opacity:.4}}),o.jsxs("svg",{"aria-label":e,className:"absolute inset-0 h-full w-full",preserveAspectRatio:"none",role:"img",viewBox:"0 0 1000 1000",children:[o.jsx("defs",{children:o.jsxs("linearGradient",{id:h,x1:"0",x2:"0",y1:"0",y2:"1",children:[o.jsx("stop",{offset:"0%",stopColor:a,stopOpacity:.35}),o.jsx("stop",{offset:"100%",stopColor:a,stopOpacity:.02})]})}),o.jsx("path",{d:N,fill:`url(#${h})`}),o.jsx("path",{d:j,fill:"none",stroke:a,strokeWidth:2,vectorEffect:"non-scaling-stroke",strokeLinejoin:"round",strokeLinecap:"round"})]}),o.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:`${z/1e3*Vo}px`,backgroundColor:a,boxShadow:`0 0 0 4px ${a}33`}})]})]}),o.jsx("div",{className:"flex font-mono text-[10px] text-muted-foreground",style:{height:d$,paddingLeft:Uw},children:o.jsx("div",{className:"relative flex-1",children:Array.from({length:$+1},(L,B)=>{const P=B/$,F=_+P*w;return o.jsx("span",{className:"absolute top-1 whitespace-nowrap",style:{left:`${P*100}%`,transform:B===0?"translateX(0)":B===$?"translateX(-100%)":"translateX(-50%)"},children:m$(F-S)},B)})})})]})]})}function h$(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 f$(e,t){return t==="percent"?`${e.toFixed(0)}%`:e>=1024?`${(e/1024).toFixed(1)}G`:`${e.toFixed(0)}M`}function eg(e){return e>=1024?`${(e/1024).toFixed(2)} GB`:`${e.toFixed(0)} MB`}function qw(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 m$(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 p$({rows:e}){if(e.length===0)return o.jsx("div",{className:"text-muted-foreground",children:"No process tree (service not running)."});const t=[...e].sort((i,a)=>a.cpuPercent-i.cpuPercent),s=new Set(e.map(i=>i.pid));return o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full font-mono text-[11px]",children:[o.jsx("thead",{className:"text-left text-muted-foreground",children:o.jsxs("tr",{children:[o.jsx("th",{className:"py-1 pr-3",children:"PID"}),o.jsx("th",{className:"py-1 pr-3",children:"PPID"}),o.jsx("th",{className:"py-1 pr-3 text-right",children:"CPU%"}),o.jsx("th",{className:"py-1 pr-3 text-right",children:"RSS MB"}),o.jsx("th",{className:"py-1",children:"Command"})]})}),o.jsx("tbody",{children:t.map(i=>{const a=s.has(i.ppid);return o.jsxs("tr",{className:"border-t border-border/40",children:[o.jsx("td",{className:"py-1 pr-3",children:i.pid}),o.jsx("td",{className:"py-1 pr-3 text-muted-foreground",children:i.ppid}),o.jsx("td",{className:"py-1 pr-3 text-right",children:i.cpuPercent.toFixed(1)}),o.jsx("td",{className:"py-1 pr-3 text-right",children:i.rssMb.toFixed(1)}),o.jsx("td",{className:le("py-1 truncate max-w-[60ch]",a&&"pl-4"),children:i.command})]},i.pid)})})]})})}var g$=2,b$=1,x$=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),u={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=u.top+u.bottom,m=u.right+u.left,d=i-h,p=a-m-t;return{cols:Math.max(g$,Math.floor(p/e.css.cell.width)),rows:Math.max(b$,Math.floor(d/e.css.cell.height))}}};var m3=Object.defineProperty,v$=Object.getOwnPropertyDescriptor,_$=(e,t)=>{for(var s in t)m3(e,s,{get:t[s],enumerable:!0})},Wt=(e,t,s,i)=>{for(var a=i>1?void 0:i?v$(t,s):t,l=e.length-1,u;l>=0;l--)(u=e[l])&&(a=(i?u(t,s,a):u(a))||a);return i&&a&&m3(t,s,a),a},we=(e,t)=>(s,i)=>t(s,i,e),Vw="Terminal input",L0={get:()=>Vw,set:e=>Vw=e},Gw="Too much output to announce, navigate to rows manually to read",z0={get:()=>Gw,set:e=>Gw=e};function y$(e){return e.replace(/\r?\n/g,"\r")}function S$(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function w$(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function k$(e,t,s,i){if(e.stopPropagation(),e.clipboardData){let a=e.clipboardData.getData("text/plain");p3(a,t,s,i)}}function p3(e,t,s,i){e=y$(e),e=S$(e,s.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(e,!0),t.value=""}function g3(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 Ww(e,t,s,i,a){g3(e,t,s),a&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function ta(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function bf(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 C$=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 u=e.charCodeAt(l);if(55296<=u&&u<=56319){if(++l>=s)return this._interim=u,i;let h=e.charCodeAt(l);56320<=h&&h<=57343?t[i++]=(u-55296)*1024+h-56320+65536:(t[i++]=u,t[i++]=h);continue}u!==65279&&(t[i++]=u)}return i}},N$=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,u,h,m=0,d=0;if(this.interim[0]){let v=!1,_=this.interim[0];_&=(_&224)===192?31:(_&240)===224?15:7;let S=0,w;for(;(w=this.interim[++S]&63)&&S<4;)_<<=6,_|=w;let C=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,E=C-S;for(;d<E;){if(d>=s)return 0;if(w=e[d++],(w&192)!==128){d--,v=!0;break}else this.interim[S++]=w,_<<=6,_|=w&63}v||(C===2?_<128?d--:t[i++]=_:C===3?_<2048||_>=55296&&_<=57343||_===65279||(t[i++]=_):_<65536||_>1114111||(t[i++]=_)),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)&&!((u=e[g+2])&128)&&!((h=e[g+3])&128);)t[i++]=a,t[i++]=l,t[i++]=u,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(m=(a&31)<<6|l&63,m<128){g--;continue}t[i++]=m}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(u=e[g++],(u&192)!==128){g--;continue}if(m=(a&15)<<12|(l&63)<<6|u&63,m<2048||m>=55296&&m<=57343||m===65279)continue;t[i++]=m}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(u=e[g++],(u&192)!==128){g--;continue}if(g>=s)return this.interim[0]=a,this.interim[1]=l,this.interim[2]=u,i;if(h=e[g++],(h&192)!==128){g--;continue}if(m=(a&7)<<18|(l&63)<<12|(u&63)<<6|h&63,m<65536||m>1114111)continue;t[i++]=m}}return i}},b3="",na=" ",vu=class x3{constructor(){this.fg=0,this.bg=0,this.extended=new Gh}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 x3;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}},Gh=class v3{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 v3(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Yn=class _3 extends vu{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Gh,this.combinedData=""}static fromCharData(t){let s=new _3;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?ta(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()]}},Kw="di$target",B0="di$dependencies",tg=new Map;function E$(e){return e[B0]||[]}function Es(e){if(tg.has(e))return tg.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");T$(t,s,a)};return t._id=e,tg.set(e,t),t}function T$(e,t,s){t[Kw]===t?t[B0].push({id:e,index:s}):(t[B0]=[{id:e,index:s}],t[Kw]=t)}var en=Es("BufferService"),y3=Es("CoreMouseService"),no=Es("CoreService"),j$=Es("CharsetService"),Ex=Es("InstantiationService"),S3=Es("LogService"),tn=Es("OptionsService"),w3=Es("OscLinkService"),A$=Es("UnicodeService"),_u=Es("DecorationService"),I0=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 Yn,u=s.getTrimmedLength(),h=-1,m=-1,d=!1;for(let p=0;p<u;p++)if(!(m===-1&&!s.hasContent(p))){if(s.loadCell(p,l),l.hasExtendedAttrs()&&l.extended.urlId)if(m===-1){m=p,h=l.extended.urlId;continue}else d=l.extended.urlId!==h;else m!==-1&&(d=!0);if(d||m!==-1&&p===u-1){let g=this._oscLinkService.getLinkData(h)?.uri;if(g){let v={start:{x:m+1,y:e},end:{x:p+(!d&&p===u-1?1:0),y:e}},_=!1;if(!a?.allowNonHttpProtocols)try{let S=new URL(g);["http:","https:"].includes(S.protocol)||(_=!0)}catch{_=!0}_||i.push({text:g,range:v,activate:(S,w)=>a?a.activate(S,w,v):M$(S,w),hover:(S,w)=>a?.hover?.(S,w,v),leave:(S,w)=>a?.leave?.(S,w,v)})}d=!1,l.hasExtendedAttrs()&&l.extended.urlId?(m=p,h=l.extended.urlId):(m=-1,h=-1)}}t(i)}};I0=Wt([we(0,en),we(1,tn),we(2,w3)],I0);function M$(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
152
|
+
|
|
153
|
+
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 xf=Es("CharSizeService"),br=Es("CoreBrowserService"),Tx=Es("MouseService"),xr=Es("RenderService"),R$=Es("SelectionService"),k3=Es("CharacterJoinerService"),gl=Es("ThemeService"),C3=Es("LinkProviderService"),D$=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Yw.isErrorNoTelemetry(e)?new Yw(e.message+`
|
|
154
|
+
|
|
155
|
+
`+e.stack):new Error(e.message+`
|
|
156
|
+
|
|
157
|
+
`+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)}},O$=new D$;function bh(e){L$(e)||O$.onUnexpectedError(e)}var P0="Canceled";function L$(e){return e instanceof z$?!0:e instanceof Error&&e.name===P0&&e.message===P0}var z$=class extends Error{constructor(){super(P0),this.name=this.message}};function B$(e){return new Error(`Illegal argument: ${e}`)}var Yw=class $0 extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof $0)return t;let s=new $0;return s.message=t.message,s.stack=t.stack,s}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},H0=class N3 extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,N3.prototype)}};function En(e,t=0){return e[e.length-(1+t)]}var I$;(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})(I$||={});function P$(e,t){let s=this,i=!1,a;return function(){return i||(i=!0,t||(a=e.apply(s,arguments))),a}}var E3;(e=>{function t(j){return j&&typeof j=="object"&&typeof j[Symbol.iterator]=="function"}e.is=t;let s=Object.freeze([]);function i(){return s}e.empty=i;function*a(j){yield j}e.single=a;function l(j){return t(j)?j:a(j)}e.wrap=l;function u(j){return j||s}e.from=u;function*h(j){for(let R=j.length-1;R>=0;R--)yield j[R]}e.reverse=h;function m(j){return!j||j[Symbol.iterator]().next().done===!0}e.isEmpty=m;function d(j){return j[Symbol.iterator]().next().value}e.first=d;function p(j,R){let z=0;for(let D of j)if(R(D,z++))return!0;return!1}e.some=p;function g(j,R){for(let z of j)if(R(z))return z}e.find=g;function*v(j,R){for(let z of j)R(z)&&(yield z)}e.filter=v;function*_(j,R){let z=0;for(let D of j)yield R(D,z++)}e.map=_;function*S(j,R){let z=0;for(let D of j)yield*R(D,z++)}e.flatMap=S;function*w(...j){for(let R of j)yield*R}e.concat=w;function C(j,R,z){let D=z;for(let M of j)D=R(D,M);return D}e.reduce=C;function*E(j,R,z=j.length){for(R<0&&(R+=j.length),z<0?z+=j.length:z>j.length&&(z=j.length);R<z;R++)yield j[R]}e.slice=E;function T(j,R=Number.POSITIVE_INFINITY){let z=[];if(R===0)return[z,j];let D=j[Symbol.iterator]();for(let M=0;M<R;M++){let $=D.next();if($.done)return[z,e.empty()];z.push($.value)}return[z,{[Symbol.iterator](){return D}}]}e.consume=T;async function N(j){let R=[];for await(let z of j)R.push(z);return Promise.resolve(R)}e.asyncToArray=N})(E3||={});function Xa(e){if(E3.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 $$(...e){return zt(()=>Xa(e))}function zt(e){return{dispose:P$(()=>{e()})}}var T3=class j3{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{Xa(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?j3.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)}};T3.DISABLE_DISPOSED_WARNING=!1;var ia=T3,Je=class{constructor(){this._store=new ia,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Je.None=Object.freeze({dispose(){}});var cl=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},pr=typeof window=="object"?window:globalThis,U0=class F0{constructor(t){this.element=t,this.next=F0.Undefined,this.prev=F0.Undefined}};U0.Undefined=new U0(void 0);var $t=U0,Xw=class{constructor(){this._first=$t.Undefined,this._last=$t.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===$t.Undefined}clear(){let e=this._first;for(;e!==$t.Undefined;){let t=e.next;e.prev=$t.Undefined,e.next=$t.Undefined,e=t}this._first=$t.Undefined,this._last=$t.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let s=new $t(e);if(this._first===$t.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!==$t.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==$t.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==$t.Undefined&&e.next!==$t.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===$t.Undefined&&e.next===$t.Undefined?(this._first=$t.Undefined,this._last=$t.Undefined):e.next===$t.Undefined?(this._last=this._last.prev,this._last.next=$t.Undefined):e.prev===$t.Undefined&&(this._first=this._first.next,this._first.prev=$t.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==$t.Undefined;)yield e.element,e=e.next}},H$=globalThis.performance&&typeof globalThis.performance.now=="function",U$=class A3{static create(t){return new A3(t)}constructor(t){this._now=H$&&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}},zs;(e=>{e.None=()=>Je.None;function t(P,F){return g(P,()=>{},0,void 0,!0,void 0,F)}e.defer=t;function s(P){return(F,V=null,G)=>{let I=!1,Y;return Y=P(X=>{if(!I)return Y?Y.dispose():I=!0,F.call(V,X)},null,G),I&&Y.dispose(),Y}}e.once=s;function i(P,F,V){return d((G,I=null,Y)=>P(X=>G.call(I,F(X)),null,Y),V)}e.map=i;function a(P,F,V){return d((G,I=null,Y)=>P(X=>{F(X),G.call(I,X)},null,Y),V)}e.forEach=a;function l(P,F,V){return d((G,I=null,Y)=>P(X=>F(X)&&G.call(I,X),null,Y),V)}e.filter=l;function u(P){return P}e.signal=u;function h(...P){return(F,V=null,G)=>{let I=$$(...P.map(Y=>Y(X=>F.call(V,X))));return p(I,G)}}e.any=h;function m(P,F,V,G){let I=V;return i(P,Y=>(I=F(I,Y),I),G)}e.reduce=m;function d(P,F){let V,G={onWillAddFirstListener(){V=P(I.fire,I)},onDidRemoveLastListener(){V?.dispose()}},I=new be(G);return F?.add(I),I.event}function p(P,F){return F instanceof Array?F.push(P):F&&F.add(P),P}function g(P,F,V=100,G=!1,I=!1,Y,X){let W,ee,O,Z=0,ie,de={leakWarningThreshold:Y,onWillAddFirstListener(){W=P(pe=>{Z++,ee=F(ee,pe),G&&!O&&(fe.fire(ee),ee=void 0),ie=()=>{let Se=ee;ee=void 0,O=void 0,(!G||Z>1)&&fe.fire(Se),Z=0},typeof V=="number"?(clearTimeout(O),O=setTimeout(ie,V)):O===void 0&&(O=0,queueMicrotask(ie))})},onWillRemoveListener(){I&&Z>0&&ie?.()},onDidRemoveLastListener(){ie=void 0,W.dispose()}},fe=new be(de);return X?.add(fe),fe.event}e.debounce=g;function v(P,F=0,V){return e.debounce(P,(G,I)=>G?(G.push(I),G):[I],F,void 0,!0,void 0,V)}e.accumulate=v;function _(P,F=(G,I)=>G===I,V){let G=!0,I;return l(P,Y=>{let X=G||!F(Y,I);return G=!1,I=Y,X},V)}e.latch=_;function S(P,F,V){return[e.filter(P,F,V),e.filter(P,G=>!F(G),V)]}e.split=S;function w(P,F=!1,V=[],G){let I=V.slice(),Y=P(ee=>{I?I.push(ee):W.fire(ee)});G&&G.add(Y);let X=()=>{I?.forEach(ee=>W.fire(ee)),I=null},W=new be({onWillAddFirstListener(){Y||(Y=P(ee=>W.fire(ee)),G&&G.add(Y))},onDidAddFirstListener(){I&&(F?setTimeout(X):X())},onDidRemoveLastListener(){Y&&Y.dispose(),Y=null}});return G&&G.add(W),W.event}e.buffer=w;function C(P,F){return(V,G,I)=>{let Y=F(new T);return P(function(X){let W=Y.evaluate(X);W!==E&&V.call(G,W)},void 0,I)}}e.chain=C;let E=Symbol("HaltChainable");class T{constructor(){this.steps=[]}map(F){return this.steps.push(F),this}forEach(F){return this.steps.push(V=>(F(V),V)),this}filter(F){return this.steps.push(V=>F(V)?V:E),this}reduce(F,V){let G=V;return this.steps.push(I=>(G=F(G,I),G)),this}latch(F=(V,G)=>V===G){let V=!0,G;return this.steps.push(I=>{let Y=V||!F(I,G);return V=!1,G=I,Y?I:E}),this}evaluate(F){for(let V of this.steps)if(F=V(F),F===E)break;return F}}function N(P,F,V=G=>G){let G=(...W)=>X.fire(V(...W)),I=()=>P.on(F,G),Y=()=>P.removeListener(F,G),X=new be({onWillAddFirstListener:I,onDidRemoveLastListener:Y});return X.event}e.fromNodeEventEmitter=N;function j(P,F,V=G=>G){let G=(...W)=>X.fire(V(...W)),I=()=>P.addEventListener(F,G),Y=()=>P.removeEventListener(F,G),X=new be({onWillAddFirstListener:I,onDidRemoveLastListener:Y});return X.event}e.fromDOMEventEmitter=j;function R(P){return new Promise(F=>s(P)(F))}e.toPromise=R;function z(P){let F=new be;return P.then(V=>{F.fire(V)},()=>{F.fire(void 0)}).finally(()=>{F.dispose()}),F.event}e.fromPromise=z;function D(P,F){return P(V=>F.fire(V))}e.forward=D;function M(P,F,V){return F(V),P(G=>F(G))}e.runAndSubscribe=M;class ${constructor(F,V){this._observable=F,this._counter=0,this._hasChanged=!1;let G={onWillAddFirstListener:()=>{F.addObserver(this)},onDidRemoveLastListener:()=>{F.removeObserver(this)}};this.emitter=new be(G),V&&V.add(this.emitter)}beginUpdate(F){this._counter++}handlePossibleChange(F){}handleChange(F,V){this._hasChanged=!0}endUpdate(F){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function L(P,F){return new $(P,F).emitter.event}e.fromObservable=L;function B(P){return(F,V,G)=>{let I=0,Y=!1,X={beginUpdate(){I++},endUpdate(){I--,I===0&&(P.reportChanges(),Y&&(Y=!1,F.call(V)))},handlePossibleChange(){},handleChange(){Y=!0}};P.addObserver(X),P.reportChanges();let W={dispose(){P.removeObserver(X)}};return G instanceof ia?G.add(W):Array.isArray(G)&&G.push(W),W}}e.fromObservableLight=B})(zs||={});var q0=class V0{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${V0._idPool++}`,V0.all.add(this)}start(t){this._stopWatch=new U$,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}}};q0.all=new Set,q0._idPool=0;var F$=q0,q$=-1,M3=class R3{constructor(t,s,i=(R3._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,u]=this.getMostFrequentStack(),h=`[${this.name}] potential listener LEAK detected, having ${s} listeners already. MOST frequent listener (${u}):`;console.warn(h),console.warn(l);let m=new W$(h,l);this._errorHandler(m)}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}};M3._idPool=1;var V$=M3,G$=class D3{constructor(t){this.value=t}static create(){let t=new Error;return new D3(t.stack??"")}print(){console.warn(this.value.split(`
|
|
158
|
+
`).slice(2).join(`
|
|
159
|
+
`))}},W$=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},K$=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Y$=0,sg=class{constructor(e){this.value=e,this.id=Y$++}},X$=2,Z$,be=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new V$(e?.onListenerError??bh,this._options?.leakWarningThreshold??q$):void 0,this._perfMon=this._options?._profName?new F$(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??=(e,t,s)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let u=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(u);let h=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],m=new K$(`${u}. HINT: Stack shows most frequent listener (${h[1]}-times)`,h[0]);return(this._options?.onListenerError||bh)(m),Je.None}if(this._disposed)return Je.None;t&&(e=e.bind(t));let i=new sg(e),a;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=G$.create(),a=this._leakageMon.check(i.stack,this._size+1)),this._listeners?this._listeners instanceof sg?(this._deliveryQueue??=new Q$,this._listeners=[this._listeners,i]):this._listeners.push(i):(this._options?.onWillAddFirstListener?.(this),this._listeners=i,this._options?.onDidAddFirstListener?.(this)),this._size++;let l=zt(()=>{a?.(),this._removeListener(i)});return s instanceof ia?s.add(l):Array.isArray(s)&&s.push(l),l},this._event}_removeListener(e){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 t=this._listeners,s=t.indexOf(e);if(s===-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--,t[s]=void 0;let i=this._deliveryQueue.current===this;if(this._size*X$<=t.length){let a=0;for(let l=0;l<t.length;l++)t[l]?t[a++]=t[l]:i&&(this._deliveryQueue.end--,a<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=a}}_deliver(e,t){if(!e)return;let s=this._options?.onListenerError||bh;if(!s){e.value(t);return}try{e.value(t)}catch(i){s(i)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof sg)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},Q$=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}},G0=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new be,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new be,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}};G0.INSTANCE=new G0;var jx=G0;function J$(e,t,s){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",s)}jx.INSTANCE.onDidChangeZoomLevel;function eH(e){return jx.INSTANCE.getZoomFactor(e)}jx.INSTANCE.onDidChangeFullscreen;var bl=typeof navigator=="object"?navigator.userAgent:"",W0=bl.indexOf("Firefox")>=0,tH=bl.indexOf("AppleWebKit")>=0,Ax=bl.indexOf("Chrome")>=0,sH=!Ax&&bl.indexOf("Safari")>=0;bl.indexOf("Electron/")>=0;bl.indexOf("Android")>=0;var ng=!1;if(typeof pr.matchMedia=="function"){let e=pr.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=pr.matchMedia("(display-mode: fullscreen)");ng=e.matches,J$(pr,e,({matches:s})=>{ng&&t.matches||(ng=s)})}var tl="en",K0=!1,Y0=!1,xh=!1,O3=!1,eh,vh=tl,Zw=tl,nH,mr,Wa=globalThis,jn;typeof Wa.vscode<"u"&&typeof Wa.vscode.process<"u"?jn=Wa.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(jn=process);var iH=typeof jn?.versions?.electron=="string",rH=iH&&jn?.type==="renderer";if(typeof jn=="object"){K0=jn.platform==="win32",Y0=jn.platform==="darwin",xh=jn.platform==="linux",xh&&jn.env.SNAP&&jn.env.SNAP_REVISION,jn.env.CI||jn.env.BUILD_ARTIFACTSTAGINGDIRECTORY,eh=tl,vh=tl;let e=jn.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);eh=t.userLocale,Zw=t.osLocale,vh=t.resolvedLanguage||tl,nH=t.languagePack?.translationsConfigFile}catch{}O3=!0}else typeof navigator=="object"&&!rH?(mr=navigator.userAgent,K0=mr.indexOf("Windows")>=0,Y0=mr.indexOf("Macintosh")>=0,(mr.indexOf("Macintosh")>=0||mr.indexOf("iPad")>=0||mr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,xh=mr.indexOf("Linux")>=0,mr?.indexOf("Mobi")>=0,vh=globalThis._VSCODE_NLS_LANGUAGE||tl,eh=navigator.language.toLowerCase(),Zw=eh):console.error("Unable to resolve platform.");var L3=K0,Mi=Y0,aH=xh,Qw=O3,Oi=mr,Zr=vh,oH;(e=>{function t(){return Zr}e.value=t;function s(){return Zr.length===2?Zr==="en":Zr.length>=3?Zr[0]==="e"&&Zr[1]==="n"&&Zr[2]==="-":!1}e.isDefaultVariant=s;function i(){return Zr==="en"}e.isDefault=i})(oH||={});var lH=typeof Wa.postMessage=="function"&&!Wa.importScripts;(()=>{if(lH){let e=[];Wa.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}),Wa.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var cH=!!(Oi&&Oi.indexOf("Chrome")>=0);Oi&&Oi.indexOf("Firefox")>=0;!cH&&Oi&&Oi.indexOf("Safari")>=0;Oi&&Oi.indexOf("Edg/")>=0;Oi&&Oi.indexOf("Android")>=0;var Go=typeof navigator=="object"?navigator:{};Qw||document.queryCommandSupported&&document.queryCommandSupported("copy")||Go&&Go.clipboard&&Go.clipboard.writeText,Qw||Go&&Go.clipboard&&Go.clipboard.readText;var Mx=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}},ig=new Mx,Jw=new Mx,e2=new Mx,uH=new Array(230),z3;(e=>{function t(h){return ig.keyCodeToStr(h)}e.toString=t;function s(h){return ig.strToKeyCode(h)}e.fromString=s;function i(h){return Jw.keyCodeToStr(h)}e.toUserSettingsUS=i;function a(h){return e2.keyCodeToStr(h)}e.toUserSettingsGeneral=a;function l(h){return Jw.strToKeyCode(h)||e2.strToKeyCode(h)}e.fromUserSettings=l;function u(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 ig.keyCodeToStr(h)}e.toElectronAccelerator=u})(z3||={});var dH=class B3{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 B3&&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 hH([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},hH=class{constructor(e){if(e.length===0)throw B$("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 fH(e){if(e.charCode){let s=String.fromCharCode(e.charCode).toUpperCase();return z3.fromString(s)}let t=e.keyCode;if(t===3)return 7;if(W0)switch(t){case 59:return 85;case 60:if(aH)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Mi)return 57;break}else if(tH&&(Mi&&t===93||!Mi&&t===92))return 57;return uH[t]||0}var mH=Mi?256:2048,pH=512,gH=1024,bH=Mi?2048:256,t2=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=fH(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|=mH),this.altKey&&(t|=pH),this.shiftKey&&(t|=gH),this.metaKey&&(t|=bH),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new dH(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},s2=new WeakMap;function xH(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 vH=class{static getSameOriginWindowChain(e){let t=s2.get(e);if(!t){t=[],s2.set(e,t);let s=e,i;do i=xH(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 u=l.window.deref();if(s+=u?.scrollY??0,i+=u?.scrollX??0,u===t||!l.iframeElement)break;let h=l.iframeElement.getBoundingClientRect();s+=h.top,i+=h.left}return{top:s,left:i}}},th=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let s=vH.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=s.left,this.posy-=s.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},n2=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(Ax){let a=navigator.userAgent.match(/Chrome\/(\d+)/);i=(a?parseInt(a[1]):123)<=122}if(e){let a=e,l=e,u=e.view?.devicePixelRatio||1;if(typeof a.wheelDeltaY<"u")i?this.deltaY=a.wheelDeltaY/(120*u):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?W0&&!Mi?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof a.wheelDeltaX<"u")sH&&L3?this.deltaX=-(a.wheelDeltaX/120):i?this.deltaX=a.wheelDeltaX/(120*u):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?W0&&!Mi?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*u):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},I3=Object.freeze(function(e,t){let s=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(s)}}}),_H;(e=>{function t(s){return s===e.None||s===e.Cancelled||s instanceof yH?!0:!s||typeof s!="object"?!1:typeof s.isCancellationRequested=="boolean"&&typeof s.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:zs.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:I3})})(_H||={});var yH=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?I3:(this._emitter||(this._emitter=new be),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Rx=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new H0("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new H0("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},SH=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 H0("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=s.setInterval(()=>{e()},t);this.disposable=zt(()=>{s.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},wH;(e=>{async function t(i){let a,l=await Promise.all(i.map(u=>u.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(u){l(u)}})}e.withAsyncBody=s})(wH||={});var i2=class qn{static fromArray(t){return new qn(s=>{s.emitMany(t)})}static fromPromise(t){return new qn(async s=>{s.emitMany(await t)})}static fromPromises(t){return new qn(async s=>{await Promise.all(t.map(async i=>s.emitOne(await i)))})}static merge(t){return new qn(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 be,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 zs.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,s){return new qn(async i=>{for await(let a of t)i.emitOne(s(a))})}map(t){return qn.map(this,t)}static filter(t,s){return new qn(async i=>{for await(let a of t)s(a)&&i.emitOne(a)})}filter(t){return qn.filter(this,t)}static coalesce(t){return qn.filter(t,s=>!!s)}coalesce(){return qn.coalesce(this)}static async toPromise(t){let s=[];for await(let i of t)s.push(i);return s}toPromise(){return qn.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())}};i2.EMPTY=i2.fromArray([]);var{getWindow:ji,getWindowId:kH,onDidRegisterWindow:CH}=(function(){let e=new Map,t={window:pr,disposables:new ia};e.set(pr.vscodeWindowId,t);let s=new be,i=new be,a=new be;function l(u,h){return(typeof u=="number"?e.get(u):void 0)??(h?t:void 0)}return{onDidRegisterWindow:s.event,onWillUnregisterWindow:a.event,onDidUnregisterWindow:i.event,registerWindow(u){if(e.has(u.vscodeWindowId))return Je.None;let h=new ia,m={window:u,disposables:h.add(new ia)};return e.set(u.vscodeWindowId,m),h.add(zt(()=>{e.delete(u.vscodeWindowId),i.fire(u)})),h.add(qe(u,ys.BEFORE_UNLOAD,()=>{a.fire(u)})),s.fire(m),h},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return e.has(u)},getWindowById:l,getWindow(u){let h=u;if(h?.ownerDocument?.defaultView)return h.ownerDocument.defaultView.window;let m=u;return m?.view?m.view.window:pr},getDocument(u){return ji(u).document}}})(),NH=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 qe(e,t,s,i){return new NH(e,t,s,i)}var r2=function(e,t,s,i){return qe(e,t,s,i)},Dx,EH=class extends SH{constructor(e){super(),this.defaultTarget=e&&ji(e)}cancelAndSet(e,t,s){return super.cancelAndSet(e,t,s??this.defaultTarget)}},a2=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){bh(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 u=e.get(l)??[];for(t.set(l,u),e.set(l,[]),i.set(l,!0);u.length>0;)u.sort(a2.sort),u.shift().execute();i.set(l,!1)};Dx=(l,u,h=0)=>{let m=kH(l),d=new a2(u,h),p=e.get(m);return p||(p=[],e.set(m,p)),p.push(d),s.get(m)||(s.set(m,!0),l.requestAnimationFrame(()=>a(m))),d}})();function TH(e){let t=e.getBoundingClientRect(),s=ji(e);return{left:t.left+s.scrollX,top:t.top+s.scrollY,width:t.width,height:t.height}}var ys={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"},jH=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=hn(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=hn(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=hn(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=hn(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=hn(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=hn(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=hn(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=hn(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=hn(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=hn(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=hn(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=hn(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=hn(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=hn(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 hn(e){return typeof e=="number"?`${e}px`:e}function qc(e){return new jH(e)}var P3=class{constructor(){this._hooks=new ia,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(zt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{l=ji(e)}this._hooks.add(qe(l,ys.POINTER_MOVE,u=>{if(u.buttons!==s){this.stopMonitoring(!0);return}u.preventDefault(),this._pointerMoveCallback(u)})),this._hooks.add(qe(l,ys.POINTER_UP,u=>this.stopMonitoring(!0)))}};function AH(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(...u){return this.hasOwnProperty(l)||Object.defineProperty(this,l,{configurable:!1,enumerable:!1,writable:!1,value:a.apply(this,u)}),this[l]}}var Ni;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Ni||={});var Ac=class Fs extends Je{constructor(){super(),this.dispatched=!1,this.targets=new Xw,this.ignoreTargets=new Xw,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(zs.runAndSubscribe(CH,({window:t,disposables:s})=>{s.add(qe(t.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),s.add(qe(t.document,"touchend",i=>this.onTouchEnd(t,i))),s.add(qe(t.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:pr,disposables:this._store}))}static addTarget(t){if(!Fs.isTouchDevice())return Je.None;Fs.INSTANCE||(Fs.INSTANCE=new Fs);let s=Fs.INSTANCE.targets.push(t);return zt(s)}static ignoreTarget(t){if(!Fs.isTouchDevice())return Je.None;Fs.INSTANCE||(Fs.INSTANCE=new Fs);let s=Fs.INSTANCE.ignoreTargets.push(t);return zt(s)}static isTouchDevice(){return"ontouchstart"in pr||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 u=this.newGestureEvent(Ni.Start,l.target);u.pageX=l.pageX,u.pageY=l.pageY,this.dispatchEvent(u)}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,u=s.changedTouches.length;l<u;l++){let h=s.changedTouches.item(l);if(!this.activeTouches.hasOwnProperty(String(h.identifier))){console.warn("move of an UNKNOWN touch",h);continue}let m=this.activeTouches[h.identifier],d=Date.now()-m.initialTimeStamp;if(d<Fs.HOLD_DELAY&&Math.abs(m.initialPageX-En(m.rollingPageX))<30&&Math.abs(m.initialPageY-En(m.rollingPageY))<30){let p=this.newGestureEvent(Ni.Tap,m.initialTarget);p.pageX=En(m.rollingPageX),p.pageY=En(m.rollingPageY),this.dispatchEvent(p)}else if(d>=Fs.HOLD_DELAY&&Math.abs(m.initialPageX-En(m.rollingPageX))<30&&Math.abs(m.initialPageY-En(m.rollingPageY))<30){let p=this.newGestureEvent(Ni.Contextmenu,m.initialTarget);p.pageX=En(m.rollingPageX),p.pageY=En(m.rollingPageY),this.dispatchEvent(p)}else if(a===1){let p=En(m.rollingPageX),g=En(m.rollingPageY),v=En(m.rollingTimestamps)-m.rollingTimestamps[0],_=p-m.rollingPageX[0],S=g-m.rollingPageY[0],w=[...this.targets].filter(C=>m.initialTarget instanceof Node&&C.contains(m.initialTarget));this.inertia(t,w,i,Math.abs(_)/v,_>0?1:-1,p,Math.abs(S)/v,S>0?1:-1,g)}this.dispatchEvent(this.newGestureEvent(Ni.End,m.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===Ni.Tap){let s=new Date().getTime(),i=0;s-this._lastSetTapCountTime>Fs.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=s,t.tapCount=i}else(t.type===Ni.Change||t.type===Ni.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,u,h,m,d){this.handle=Dx(t,()=>{let p=Date.now(),g=p-i,v=0,_=0,S=!0;a+=Fs.SCROLL_FRICTION*g,h+=Fs.SCROLL_FRICTION*g,a>0&&(S=!1,v=l*a*g),h>0&&(S=!1,_=m*h*g);let w=this.newGestureEvent(Ni.Change);w.translationX=v,w.translationY=_,s.forEach(C=>C.dispatchEvent(w)),S||this.inertia(t,s,p,a,l,u+v,h,m,d+_)})}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 u=this.activeTouches[l.identifier],h=this.newGestureEvent(Ni.Change,u.initialTarget);h.translationX=l.pageX-En(u.rollingPageX),h.translationY=l.pageY-En(u.rollingPageY),h.pageX=l.pageX,h.pageY=l.pageY,this.dispatchEvent(h),u.rollingPageX.length>3&&(u.rollingPageX.shift(),u.rollingPageY.shift(),u.rollingTimestamps.shift()),u.rollingPageX.push(l.pageX),u.rollingPageY.push(l.pageY),u.rollingTimestamps.push(s)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Ac.SCROLL_FRICTION=-.005,Ac.HOLD_DELAY=700,Ac.CLEAR_TAP_COUNT_TIME=400,Wt([AH],Ac,"isTouchDevice",1);var MH=Ac,Ox=class extends Je{onclick(e,t){this._register(qe(e,ys.CLICK,s=>t(new th(ji(e),s))))}onmousedown(e,t){this._register(qe(e,ys.MOUSE_DOWN,s=>t(new th(ji(e),s))))}onmouseover(e,t){this._register(qe(e,ys.MOUSE_OVER,s=>t(new th(ji(e),s))))}onmouseleave(e,t){this._register(qe(e,ys.MOUSE_LEAVE,s=>t(new th(ji(e),s))))}onkeydown(e,t){this._register(qe(e,ys.KEY_DOWN,s=>t(new t2(s))))}onkeyup(e,t){this._register(qe(e,ys.KEY_UP,s=>t(new t2(s))))}oninput(e,t){this._register(qe(e,ys.INPUT,t))}onblur(e,t){this._register(qe(e,ys.BLUR,t))}onfocus(e,t){this._register(qe(e,ys.FOCUS,t))}onchange(e,t){this._register(qe(e,ys.CHANGE,t))}ignoreGesture(e){return MH.ignoreTarget(e)}},o2=11,RH=class extends Ox{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=o2+"px",this.domNode.style.height=o2+"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 P3),this._register(r2(this.bgDomNode,ys.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(r2(this.domNode,ys.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new EH),this._pointerdownScheduleRepeatTimer=this._register(new Rx)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,ji(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()}},DH=class X0{constructor(t,s,i,a,l,u,h){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(s=s|0,i=i|0,a=a|0,l=l|0,u=u|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>u&&(h=u-l),h<0&&(h=0),this.width=s,this.scrollWidth=i,this.scrollLeft=a,this.height=l,this.scrollHeight=u,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 X0(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 X0(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,u=this.height!==t.height,h=this.scrollHeight!==t.scrollHeight,m=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:u,scrollHeightChanged:h,scrollTopChanged:m}}},OH=class extends Je{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new DH(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 c2(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=c2.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)))}},l2=class{constructor(e,t,s){this.scrollLeft=e,this.scrollTop=t,this.isDone=s}};function rg(e,t){let s=t-e;return function(i){return e+s*BH(i)}}function LH(e,t,s){return function(i){return i<s?e(i/s):t((i-s)/(1-s))}}var c2=class Z0{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),LH(rg(t,a),rg(l,s),.33)}return rg(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 l2(i,a,!1)}return new l2(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,s,i){return Z0.start(t,s,i)}static start(t,s,i){i=i+10;let a=Date.now()-10;return new Z0(t,s,a,i)}};function zH(e){return Math.pow(e,3)}function BH(e){return 1-zH(1-e)}var IH=class extends Je{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 Rx)}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":"")))}},PH=140,$3=class extends Ox{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 IH(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new P3),this._shouldRender=!0,this.domNode=qc(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(qe(this.domNode.domNode,ys.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new RH(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,s,i){this.slider=qc(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(qe(this.slider.domNode,ys.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=TH(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),u=Math.abs(l-s);if(L3&&u>PH){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()}},H3=class Q0{constructor(t,s,i,a,l,u){this._scrollbarSize=Math.round(s),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(t),this._visibleSize=a,this._scrollSize=l,this._scrollPosition=u,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Q0(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 u=Math.max(0,i-t),h=Math.max(0,u-2*s),m=a>0&&a>i;if(!m)return{computedAvailableSize:Math.round(u),computedIsNeeded:m,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(u),computedIsNeeded:m,computedSliderSize:Math.round(d),computedSliderRatio:p,computedSliderPosition:Math.round(g)}}_refreshComputedValues(){let t=Q0._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)}},$H=class extends $3{constructor(e,t,s){let i=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new H3(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}},HH=class extends $3{constructor(e,t,s){let i=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new H3(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}},UH=500,u2=50,FH=class{constructor(e,t,s){this.timestamp=e,this.deltaX=t,this.deltaY=s,this.score=0}},J0=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(Ax){let s=ji(t.browserEvent),i=eH(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 FH(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),u=Math.abs(s.deltaX),h=Math.abs(s.deltaY),m=Math.max(Math.min(a,u),1),d=Math.max(Math.min(l,h),1),p=Math.max(a,u),g=Math.max(l,h);p%m===0&&g%d===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};J0.INSTANCE=new J0;var qH=J0,VH=class extends Ox{constructor(e,t,s){super(),this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new be),this.onWillScroll=this._onWillScroll.event,this._options=WH(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 HH(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new $H(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=qc(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=qc(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=qc(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 Rx),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Xa(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,Mi&&(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 n2(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Xa(this._mouseWheelToDispose),e)){let t=s=>{this._onMouseWheel(new n2(s))};this._mouseWheelToDispose.push(qe(this._listenOnDomNode,ys.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=qH.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 u=!Mi&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||u)&&!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(),m={};if(a){let d=u2*a,p=h.scrollTop-(d<0?Math.floor(d):Math.ceil(d));this._verticalScrollbar.writeScrollPosition(m,p)}if(l){let d=u2*l,p=h.scrollLeft-(d<0?Math.floor(d):Math.ceil(d));this._horizontalScrollbar.writeScrollPosition(m,p)}m=this._scrollable.validateScrollPosition(m),(h.scrollLeft!==m.scrollLeft||h.scrollTop!==m.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(m):this._scrollable.setScrollPositionNow(m),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(),UH)}},GH=class extends VH{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 WH(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,Mi&&(t.className+=" mac"),t}var eb=class extends Je{constructor(e,t,s,i,a,l,u,h){super(),this._bufferService=s,this._optionsService=u,this._renderService=h,this._onRequestScrollLines=this._register(new be),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let m=this._register(new OH({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:d=>Dx(i.window,d)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{m.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new GH(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},m)),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(zs.runAndSubscribe(l.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=l.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(zt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(zt(()=>this._styleElement.remove())),this._register(zs.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(`
|
|
160
|
+
`)})),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}};eb=Wt([we(2,en),we(3,br),we(4,y3),we(5,gl),we(6,tn),we(7,xr)],eb);var tb=class extends Je{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(zt(()=>{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()}};tb=Wt([we(1,en),we(2,br),we(3,_u),we(4,xr)],tb);var KH=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)}},wi={full:0,left:0,center:0,right:0},Qr={full:0,left:0,center:0,right:0},xc={full:0,left:0,center:0,right:0},Wh=class extends Je{constructor(e,t,s,i,a,l,u,h){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=s,this._decorationService=i,this._renderService=a,this._optionsService=l,this._themeService=u,this._coreBrowserService=h,this._colorZoneStore=new KH,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(zt(()=>this._canvas?.remove()));let m=this._canvas.getContext("2d");if(m)this._ctx=m;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);Qr.full=this._canvas.width,Qr.left=e,Qr.center=t,Qr.right=e,this._refreshDrawHeightConstants(),xc.full=1,xc.left=1,xc.center=1+Qr.left,xc.right=1+Qr.left+Qr.center}_refreshDrawHeightConstants(){wi.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);wi.left=t,wi.center=t,wi.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*wi.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*wi.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*wi.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*wi.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(xc[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-wi[e.position||"full"]/2),Qr[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+wi[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}))}};Wh=Wt([we(2,en),we(3,_u),we(4,xr),we(5,tn),we(6,gl),we(7,br)],Wh);var ue;(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=`
|
|
161
|
+
`,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=""))(ue||={});var _h;(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=""))(_h||={});var U3;(e=>e.ST=`${ue.ESC}\\`)(U3||={});var sb=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(`${ue.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)}}};sb=Wt([we(2,en),we(3,tn),we(4,no),we(5,xr)],sb);var Ss=0,ws=0,ks=0,Vt=0,d2={css:"#00000000",rgba:0},cs;(e=>{function t(a,l,u,h){return h!==void 0?`#${La(a)}${La(l)}${La(u)}${La(h)}`:`#${La(a)}${La(l)}${La(u)}`}e.toCss=t;function s(a,l,u,h=255){return(a<<24|l<<16|u<<8|h)>>>0}e.toRgba=s;function i(a,l,u,h){return{css:e.toCss(a,l,u,h),rgba:e.toRgba(a,l,u,h)}}e.toColor=i})(cs||={});var Rt;(e=>{function t(m,d){if(Vt=(d.rgba&255)/255,Vt===1)return{css:d.css,rgba:d.rgba};let p=d.rgba>>24&255,g=d.rgba>>16&255,v=d.rgba>>8&255,_=m.rgba>>24&255,S=m.rgba>>16&255,w=m.rgba>>8&255;Ss=_+Math.round((p-_)*Vt),ws=S+Math.round((g-S)*Vt),ks=w+Math.round((v-w)*Vt);let C=cs.toCss(Ss,ws,ks),E=cs.toRgba(Ss,ws,ks);return{css:C,rgba:E}}e.blend=t;function s(m){return(m.rgba&255)===255}e.isOpaque=s;function i(m,d,p){let g=yh.ensureContrastRatio(m.rgba,d.rgba,p);if(g)return cs.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=i;function a(m){let d=(m.rgba|255)>>>0;return[Ss,ws,ks]=yh.toChannels(d),{css:cs.toCss(Ss,ws,ks),rgba:d}}e.opaque=a;function l(m,d){return Vt=Math.round(d*255),[Ss,ws,ks]=yh.toChannels(m.rgba),{css:cs.toCss(Ss,ws,ks,Vt),rgba:cs.toRgba(Ss,ws,ks,Vt)}}e.opacity=l;function u(m,d){return Vt=m.rgba&255,l(m,Vt*d/255)}e.multiplyOpacity=u;function h(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=h})(Rt||={});var Ht;(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 Ss=parseInt(a.slice(1,2).repeat(2),16),ws=parseInt(a.slice(2,3).repeat(2),16),ks=parseInt(a.slice(3,4).repeat(2),16),cs.toColor(Ss,ws,ks);case 5:return Ss=parseInt(a.slice(1,2).repeat(2),16),ws=parseInt(a.slice(2,3).repeat(2),16),ks=parseInt(a.slice(3,4).repeat(2),16),Vt=parseInt(a.slice(4,5).repeat(2),16),cs.toColor(Ss,ws,ks,Vt);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 Ss=parseInt(l[1]),ws=parseInt(l[2]),ks=parseInt(l[3]),Vt=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),cs.toColor(Ss,ws,ks,Vt);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),[Ss,ws,ks,Vt]=t.getImageData(0,0,1,1).data,Vt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:cs.toRgba(Ss,ws,ks,Vt),css:a}}e.toColor=i})(Ht||={});var Xs;(e=>{function t(i){return s(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function s(i,a,l){let u=i/255,h=a/255,m=l/255,d=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),p=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),g=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return d*.2126+p*.7152+g*.0722}e.relativeLuminance2=s})(Xs||={});var yh;(e=>{function t(u,h){if(Vt=(h&255)/255,Vt===1)return h;let m=h>>24&255,d=h>>16&255,p=h>>8&255,g=u>>24&255,v=u>>16&255,_=u>>8&255;return Ss=g+Math.round((m-g)*Vt),ws=v+Math.round((d-v)*Vt),ks=_+Math.round((p-_)*Vt),cs.toRgba(Ss,ws,ks)}e.blend=t;function s(u,h,m){let d=Xs.relativeLuminance(u>>8),p=Xs.relativeLuminance(h>>8);if(fr(d,p)<m){if(p<d){let _=i(u,h,m),S=fr(d,Xs.relativeLuminance(_>>8));if(S<m){let w=a(u,h,m),C=fr(d,Xs.relativeLuminance(w>>8));return S>C?_:w}return _}let g=a(u,h,m),v=fr(d,Xs.relativeLuminance(g>>8));if(v<m){let _=i(u,h,m),S=fr(d,Xs.relativeLuminance(_>>8));return v>S?g:_}return g}}e.ensureContrastRatio=s;function i(u,h,m){let d=u>>24&255,p=u>>16&255,g=u>>8&255,v=h>>24&255,_=h>>16&255,S=h>>8&255,w=fr(Xs.relativeLuminance2(v,_,S),Xs.relativeLuminance2(d,p,g));for(;w<m&&(v>0||_>0||S>0);)v-=Math.max(0,Math.ceil(v*.1)),_-=Math.max(0,Math.ceil(_*.1)),S-=Math.max(0,Math.ceil(S*.1)),w=fr(Xs.relativeLuminance2(v,_,S),Xs.relativeLuminance2(d,p,g));return(v<<24|_<<16|S<<8|255)>>>0}e.reduceLuminance=i;function a(u,h,m){let d=u>>24&255,p=u>>16&255,g=u>>8&255,v=h>>24&255,_=h>>16&255,S=h>>8&255,w=fr(Xs.relativeLuminance2(v,_,S),Xs.relativeLuminance2(d,p,g));for(;w<m&&(v<255||_<255||S<255);)v=Math.min(255,v+Math.ceil((255-v)*.1)),_=Math.min(255,_+Math.ceil((255-_)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),w=fr(Xs.relativeLuminance2(v,_,S),Xs.relativeLuminance2(d,p,g));return(v<<24|_<<16|S<<8|255)>>>0}e.increaseLuminance=a;function l(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=l})(yh||={});function La(e){let t=e.toString(16);return t.length<2?"0"+t:t}function fr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var YH=class extends vu{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()]}},Kh=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Yn}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,u=0,h=t.getFg(0),m=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!==m){if(d-a>1){let p=this._getJoinedRanges(i,u,l,t,a);for(let g=0;g<p.length;g++)s.push(p[g])}a=d,u=l,h=this._workCell.fg,m=this._workCell.bg}l+=this._workCell.getChars().length||na.length}if(this._bufferService.cols-a>1){let d=this._getJoinedRanges(i,u,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),u=[];try{u=this._characterJoiners[0].handler(l)}catch(h){console.error(h)}for(let h=1;h<this._characterJoiners.length;h++)try{let m=this._characterJoiners[h].handler(l);for(let d=0;d<m.length;d++)Kh._mergeRanges(u,m[d])}catch(m){console.error(m)}return this._stringRangesToCellRanges(u,i,a),u}_stringRangesToCellRanges(e,t,s){let i=0,a=!1,l=0,u=e[i];if(u){for(let h=s;h<this._bufferService.cols;h++){let m=t.getWidth(h),d=t.getString(h).length||na.length;if(m!==0){if(!a&&u[0]<=l&&(u[0]=h,a=!0),u[1]<=l){if(u[1]=h,u=e[++i],!u)break;u[0]<=l?(u[0]=h,a=!0):a=!1}l+=d}}u&&(u[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}};Kh=Wt([we(0,en)],Kh);function XH(e){return 57508<=e&&e<=57558}function ZH(e){return 9472<=e&&e<=9631}function QH(e){return XH(e)||ZH(e)}function JH(){return{css:{canvas:sh(),cell:sh()},device:{canvas:sh(),cell:sh(),char:{width:0,height:0,left:0,top:0}}}}function sh(){return{width:0,height:0}}var nb=class{constructor(e,t,s,i,a,l,u){this._document=e,this._characterJoinerService=t,this._optionsService=s,this._coreBrowserService=i,this._coreService=a,this._decorationService=l,this._themeService=u,this._workCell=new Yn,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,u,h,m,d,p){let g=[],v=this._characterJoinerService.getJoinedCharacters(t),_=this._themeService.colors,S=e.getNoBgTrimmedLength();s&&S<l+1&&(S=l+1);let w,C=0,E="",T=0,N=0,j=0,R=0,z=!1,D=0,M=!1,$=0,L=0,B=[],P=d!==-1&&p!==-1;for(let F=0;F<S;F++){e.loadCell(F,this._workCell);let V=this._workCell.getWidth();if(V===0)continue;let G=!1,I=F>=L,Y=F,X=this._workCell;if(v.length>0&&F===v[0][0]&&I){let Ae=v.shift(),It=this._isCellInSelection(Ae[0],t);for(T=Ae[0]+1;T<Ae[1];T++)I&&=It===this._isCellInSelection(T,t);I&&=!s||l<Ae[0]||l>=Ae[1],I?(G=!0,X=new YH(this._workCell,e.translateToString(!0,Ae[0],Ae[1]),Ae[1]-Ae[0]),Y=Ae[1]-1,V=X.getWidth()):L=Ae[1]}let W=this._isCellInSelection(F,t),ee=s&&F===l,O=P&&F>=d&&F<=p,Z=!1;this._decorationService.forEachDecorationAtCell(F,t,void 0,Ae=>{Z=!0});let ie=X.getChars()||na;if(ie===" "&&(X.isUnderline()||X.isOverline())&&(ie=" "),$=V*h-m.get(ie,X.isBold(),X.isItalic()),!w)w=this._document.createElement("span");else if(C&&(W&&M||!W&&!M&&X.bg===N)&&(W&&M&&_.selectionForeground||X.fg===j)&&X.extended.ext===R&&O===z&&$===D&&!ee&&!G&&!Z&&I){X.isInvisible()?E+=na:E+=ie,C++;continue}else C&&(w.textContent=E),w=this._document.createElement("span"),C=0,E="";if(N=X.bg,j=X.fg,R=X.extended.ext,z=O,D=$,M=W,G&&l>=F&&l<=Y&&(l=F),!this._coreService.isCursorHidden&&ee&&this._coreService.isCursorInitialized){if(B.push("xterm-cursor"),this._coreBrowserService.isFocused)u&&B.push("xterm-cursor-blink"),B.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(a)switch(a){case"outline":B.push("xterm-cursor-outline");break;case"block":B.push("xterm-cursor-block");break;case"bar":B.push("xterm-cursor-bar");break;case"underline":B.push("xterm-cursor-underline");break}}if(X.isBold()&&B.push("xterm-bold"),X.isItalic()&&B.push("xterm-italic"),X.isDim()&&B.push("xterm-dim"),X.isInvisible()?E=na:E=X.getChars()||na,X.isUnderline()&&(B.push(`xterm-underline-${X.extended.underlineStyle}`),E===" "&&(E=" "),!X.isUnderlineColorDefault()))if(X.isUnderlineColorRGB())w.style.textDecorationColor=`rgb(${vu.toColorRGB(X.getUnderlineColor()).join(",")})`;else{let Ae=X.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&X.isBold()&&Ae<8&&(Ae+=8),w.style.textDecorationColor=_.ansi[Ae].css}X.isOverline()&&(B.push("xterm-overline"),E===" "&&(E=" ")),X.isStrikethrough()&&B.push("xterm-strikethrough"),O&&(w.style.textDecoration="underline");let de=X.getFgColor(),fe=X.getFgColorMode(),pe=X.getBgColor(),Se=X.getBgColorMode(),Le=!!X.isInverse();if(Le){let Ae=de;de=pe,pe=Ae;let It=fe;fe=Se,Se=It}let ve,Ge,ge=!1;this._decorationService.forEachDecorationAtCell(F,t,void 0,Ae=>{Ae.options.layer!=="top"&&ge||(Ae.backgroundColorRGB&&(Se=50331648,pe=Ae.backgroundColorRGB.rgba>>8&16777215,ve=Ae.backgroundColorRGB),Ae.foregroundColorRGB&&(fe=50331648,de=Ae.foregroundColorRGB.rgba>>8&16777215,Ge=Ae.foregroundColorRGB),ge=Ae.options.layer==="top")}),!ge&&W&&(ve=this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque,pe=ve.rgba>>8&16777215,Se=50331648,ge=!0,_.selectionForeground&&(fe=50331648,de=_.selectionForeground.rgba>>8&16777215,Ge=_.selectionForeground)),ge&&B.push("xterm-decoration-top");let Te;switch(Se){case 16777216:case 33554432:Te=_.ansi[pe],B.push(`xterm-bg-${pe}`);break;case 50331648:Te=cs.toColor(pe>>16,pe>>8&255,pe&255),this._addStyle(w,`background-color:#${h2((pe>>>0).toString(16),"0",6)}`);break;default:Le?(Te=_.foreground,B.push("xterm-bg-257")):Te=_.background}switch(ve||X.isDim()&&(ve=Rt.multiplyOpacity(Te,.5)),fe){case 16777216:case 33554432:X.isBold()&&de<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(de+=8),this._applyMinimumContrast(w,Te,_.ansi[de],X,ve,void 0)||B.push(`xterm-fg-${de}`);break;case 50331648:let Ae=cs.toColor(de>>16&255,de>>8&255,de&255);this._applyMinimumContrast(w,Te,Ae,X,ve,Ge)||this._addStyle(w,`color:#${h2(de.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(w,Te,_.foreground,X,ve,Ge)||Le&&B.push("xterm-fg-257")}B.length&&(w.className=B.join(" "),B.length=0),!ee&&!G&&!Z&&I?C++:w.textContent=E,$!==this.defaultSpacing&&(w.style.letterSpacing=`${$}px`),g.push(w),F=Y}return w&&C&&(w.textContent=E),g}_applyMinimumContrast(e,t,s,i,a,l){if(this._optionsService.rawOptions.minimumContrastRatio===1||QH(i.getCode()))return!1;let u=this._getContrastCache(i),h;if(!a&&!l&&(h=u.getColor(t.rgba,s.rgba)),h===void 0){let m=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);h=Rt.ensureContrastRatio(a||t,l||s,m),u.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]}};nb=Wt([we(1,k3),we(2,tn),we(3,br),we(4,no),we(5,_u),we(6,gl)],nb);function h2(e,t,s){for(;e.length<s;)e=t+e;return e}var eU=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 u=this._measure(e,0);return u>0&&(this._flat[i]=u),u}let a=e;t&&(a+="B"),s&&(a+="I");let l=this._holey.get(a);if(l===void 0){let u=0;t&&(u|=1),s&&(u|=2),l=this._measure(e,u),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}},tU=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,u=s[1]-a,h=Math.max(l,0),m=Math.min(u,e.rows-1);if(h>=e.rows||m<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=l,this.viewportEndRow=u,this.viewportCappedStartRow=h,this.viewportCappedEndRow=m,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 sU(){return new tU}var ag="xterm-dom-renderer-owner-",Un="xterm-rows",nh="xterm-fg-",f2="xterm-bg-",vc="xterm-focus",ih="xterm-selection",nU=1,ib=class extends Je{constructor(e,t,s,i,a,l,u,h,m,d,p,g,v,_){super(),this._terminal=e,this._document=t,this._element=s,this._screenElement=i,this._viewportElement=a,this._helperContainer=l,this._linkifier2=u,this._charSizeService=m,this._optionsService=d,this._bufferService=p,this._coreService=g,this._coreBrowserService=v,this._themeService=_,this._terminalClass=nU++,this._rowElements=[],this._selectionRenderModel=sU(),this.onRequestRedraw=this._register(new be).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Un),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(ih),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=JH(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(S=>this._injectCss(S))),this._injectCss(this._themeService.colors),this._rowFactory=h.createInstance(nb,document),this._element.classList.add(ag+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(S=>this._handleLinkHover(S))),this._register(this._linkifier2.onHideLinkUnderline(S=>this._handleLinkLeave(S))),this._register(zt(()=>{this._element.classList.remove(ag+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new eU(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} .${Un} 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} .${Un} { 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} .${Un} .xterm-dim { color: ${Rt.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} .${Un}.${vc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Un}.${vc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Un}.${vc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${Un} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Un} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Un} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Un} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Un} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${ih} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${ih} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${ih} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[l,u]of e.ansi.entries())t+=`${this._terminalSelector} .${nh}${l} { color: ${u.css}; }${this._terminalSelector} .${nh}${l}.xterm-dim { color: ${Rt.multiplyOpacity(u,.5).css}; }${this._terminalSelector} .${f2}${l} { background-color: ${u.css}; }`;t+=`${this._terminalSelector} .${nh}257 { color: ${Rt.opaque(e.background).css}; }${this._terminalSelector} .${nh}257.xterm-dim { color: ${Rt.multiplyOpacity(Rt.opaque(e.background),.5).css}; }${this._terminalSelector} .${f2}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(vc),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(vc),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,u=this._selectionRenderModel.viewportCappedEndRow,h=this._document.createDocumentFragment();if(s){let m=e[0]>t[0];h.appendChild(this._createSelectionElement(l,m?t[0]:e[0],m?e[0]:t[0],u-l+1))}else{let m=i===l?e[0]:0,d=l===a?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(l,m,d));let p=u-l-1;if(h.appendChild(this._createSelectionElement(l+1,0,this._bufferService.cols,p)),l!==u){let g=a===u?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(u,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,u=this.dimensions.css.cell.width*(s-t);return l+u>this.dimensions.css.canvas.width&&(u=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=`${u}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,u=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,h=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=e;m<=t;m++){let d=m+s.ydisp,p=this._rowElements[m],g=s.lines.get(d);if(!p||!g)break;p.replaceChildren(...this._rowFactory.createRow(g,d,d===i,u,h,a,l,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${ag}${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 u=this._bufferService.rows-1;s=Math.max(Math.min(s,u),0),i=Math.max(Math.min(i,u),0),a=Math.min(a,this._bufferService.cols);let h=this._bufferService.buffer,m=h.ybase+h.y,d=Math.min(h.x,a-1),p=this._optionsService.rawOptions.cursorBlink,g=this._optionsService.rawOptions.cursorStyle,v=this._optionsService.rawOptions.cursorInactiveStyle;for(let _=s;_<=i;++_){let S=_+h.ydisp,w=this._rowElements[_],C=h.lines.get(S);if(!w||!C)break;w.replaceChildren(...this._rowFactory.createRow(C,S,S===m,g,v,d,p,this.dimensions.css.cell.width,this._widthCache,l?_===s?e:0:-1,l?(_===i?t:a)-1:-1))}}};ib=Wt([we(7,Ex),we(8,xf),we(9,tn),we(10,en),we(11,no),we(12,br),we(13,gl)],ib);var rb=class extends Je{constructor(e,t,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this._register(new be),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new rU(this._optionsService))}catch{this._measureStrategy=this._register(new iU(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())}};rb=Wt([we(2,tn)],rb);var F3=class extends Je{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},iU=class extends F3{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}},rU=class extends F3{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}},aU=class extends Je{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 oU(this._window)),this._onDprChange=this._register(new be),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new be),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(zs.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(qe(this._textarea,"focus",()=>this._isFocused=!0)),this._register(qe(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}},oU=class extends Je{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new cl),this._onDprChange=this._register(new be),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(zt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=qe(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)}},lU=class extends Je{constructor(){super(),this.linkProviders=[],this._register(zt(()=>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 Lx(e,t,s){let i=s.getBoundingClientRect(),a=e.getComputedStyle(s),l=parseInt(a.getPropertyValue("padding-left")),u=parseInt(a.getPropertyValue("padding-top"));return[t.clientX-i.left-l,t.clientY-i.top-u]}function cU(e,t,s,i,a,l,u,h,m){if(!l)return;let d=Lx(e,t,s);if(d)return d[0]=Math.ceil((d[0]+(m?u/2:0))/u),d[1]=Math.ceil(d[1]/h),d[0]=Math.min(Math.max(d[0],1),i+(m?1:0)),d[1]=Math.min(Math.max(d[1],1),a),d}var ab=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,s,i,a){return cU(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=Lx(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])}}};ab=Wt([we(0,xr),we(1,xf)],ab);var uU=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=[]}},q3={};_$(q3,{getSafariVersion:()=>hU,isChromeOS:()=>K3,isFirefox:()=>V3,isIpad:()=>fU,isIphone:()=>mU,isLegacyEdge:()=>dU,isLinux:()=>zx,isMac:()=>Yh,isNode:()=>vf,isSafari:()=>G3,isWindows:()=>W3});var vf=typeof process<"u"&&"title"in process,yu=vf?"node":navigator.userAgent,Su=vf?"node":navigator.platform,V3=yu.includes("Firefox"),dU=yu.includes("Edge"),G3=/^((?!chrome|android).)*safari/i.test(yu);function hU(){if(!G3)return 0;let e=yu.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Yh=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Su),fU=Su==="iPad",mU=Su==="iPhone",W3=["Windows","Win16","Win32","WinCE"].includes(Su),zx=Su.indexOf("Linux")>=0,K3=/\bCrOS\b/.test(yu),Y3=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()}},pU=class extends Y3{_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())}}},gU=class extends Y3{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Xh=!vf&&"requestIdleCallback"in window?gU:pU,bU=class{constructor(){this._queue=new Xh}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},ob=class extends Je{constructor(e,t,s,i,a,l,u,h,m){super(),this._rowCount=e,this._optionsService=s,this._charSizeService=i,this._coreService=a,this._coreBrowserService=h,this._renderer=this._register(new cl),this._pausedResizeTask=new bU,this._observerDisposable=this._register(new cl),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 be),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new be),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new be),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new be),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new uU((d,p)=>this._renderRows(d,p),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new xU(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(zt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(u.onResize(()=>this._fullRefresh())),this._register(u.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(u.cols,u.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(u.buffer.y,u.buffer.y,!0))),this._register(m.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=zt(()=>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()}};ob=Wt([we(2,tn),we(3,xf),we(4,no),we(5,_u),we(6,en),we(7,br),we(8,gl)],ob);var xU=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 vU(e,t,s,i){let a=s.buffer.x,l=s.buffer.y;if(!s.buffer.hasScrollback)return SU(a,l,e,t,s,i)+_f(l,t,s,i)+wU(a,l,e,t,s,i);let u;if(l===t)return u=a>e?"D":"C",eu(Math.abs(a-e),Jc(u,i));u=l>t?"D":"C";let h=Math.abs(l-t),m=yU(l>t?e:a,s)+(h-1)*s.cols+1+_U(l>t?a:e);return eu(m,Jc(u,i))}function _U(e,t){return e-1}function yU(e,t){return t.cols-e}function SU(e,t,s,i,a,l){return _f(t,i,a,l).length===0?"":eu(Z3(e,t,e,t-Za(t,a),!1,a).length,Jc("D",l))}function _f(e,t,s,i){let a=e-Za(e,s),l=t-Za(t,s),u=Math.abs(a-l)-kU(e,t,s);return eu(u,Jc(X3(e,t),i))}function wU(e,t,s,i,a,l){let u;_f(t,i,a,l).length>0?u=i-Za(i,a):u=t;let h=i,m=CU(e,t,s,i,a,l);return eu(Z3(e,u,s,h,m==="C",a).length,Jc(m,l))}function kU(e,t,s){let i=0,a=e-Za(e,s),l=t-Za(t,s);for(let u=0;u<Math.abs(a-l);u++){let h=X3(e,t)==="A"?-1:1;s.buffer.lines.get(a+h*u)?.isWrapped&&i++}return i}function Za(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 CU(e,t,s,i,a,l){let u;return _f(s,i,a,l).length>0?u=i-Za(i,a):u=t,e<s&&u<=i||e>=s&&u<i?"C":"D"}function X3(e,t){return e>t?"A":"B"}function Z3(e,t,s,i,a,l){let u=e,h=t,m="";for(;(u!==s||h!==i)&&h>=0&&h<l.buffer.lines.length;)u+=a?1:-1,a&&u>l.cols-1?(m+=l.buffer.translateBufferLineToString(h,!1,e,u),u=0,e=0,h++):!a&&u<0&&(m+=l.buffer.translateBufferLineToString(h,!1,0,e+1),u=l.cols-1,e=u,h--);return m+l.buffer.translateBufferLineToString(h,!1,e,u)}function Jc(e,t){let s=t?"O":"[";return ue.ESC+s+e}function eu(e,t){e=Math.floor(e);let s="";for(let i=0;i<e;i++)s+=t;return s}var NU=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 m2(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 og=50,EU=15,TU=50,jU=500,AU=" ",MU=new RegExp(AU,"g"),lb=class extends Je{constructor(e,t,s,i,a,l,u,h,m){super(),this._element=e,this._screenElement=t,this._linkifier=s,this._bufferService=i,this._coreService=a,this._mouseService=l,this._optionsService=u,this._renderService=h,this._coreBrowserService=m,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Yn,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new be),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new be),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new be),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new be),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 NU(this._bufferService),this._activeSelectionMode=0,this._register(zt(()=>{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 u=e[1];u<=t[1];u++){let h=s.translateBufferLineToString(u,!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 u=s.lines.get(l),h=s.translateBufferLineToString(l,!0);u?.isWrapped?i[i.length-1]+=h:i.push(h)}if(e[1]!==t[1]){let l=s.lines.get(t[1]),u=s.translateBufferLineToString(t[1],!0,0,t[0]);l&&l.isWrapped?i[i.length-1]+=u:i.push(u)}}return i.map(a=>a.replace(MU," ")).join(W3?`\r
|
|
162
|
+
`:`
|
|
163
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),zx&&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=m2(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=Lx(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,-og),og),t/=og,t/Math.abs(t)+Math.round(t*(EU-1)))}shouldForceSelection(e){return Yh?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(),TU)}_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&&!(Yh&&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<jU&&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=vU(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 u=a.translateBufferLineToString(e[1],!1),h=this._convertViewportColToCharacterIndex(l,e[0]),m=h,d=e[0]-h,p=0,g=0,v=0,_=0;if(u.charAt(h)===" "){for(;h>0&&u.charAt(h-1)===" ";)h--;for(;m<u.length&&u.charAt(m+1)===" ";)m++}else{let C=e[0],E=e[0];l.getWidth(C)===0&&(p++,C--),l.getWidth(E)===2&&(g++,E++);let T=l.getString(E).length;for(T>1&&(_+=T-1,m+=T-1);C>0&&h>0&&!this._isCharWordSeparator(l.loadCell(C-1,this._workCell));){l.loadCell(C-1,this._workCell);let N=this._workCell.getChars().length;this._workCell.getWidth()===0?(p++,C--):N>1&&(v+=N-1,h-=N-1),h--,C--}for(;E<l.length&&m+1<u.length&&!this._isCharWordSeparator(l.loadCell(E+1,this._workCell));){l.loadCell(E+1,this._workCell);let N=this._workCell.getChars().length;this._workCell.getWidth()===2?(g++,E++):N>1&&(_+=N-1,m+=N-1),m++,E++}}m++;let S=h+d-p+v,w=Math.min(this._bufferService.cols,m-h+p+g-v-_);if(!(!t&&u.slice(h,m).trim()==="")){if(s&&S===0&&l.getCodePoint(0)!==32){let C=a.lines.get(e[1]-1);if(C&&l.isWrapped&&C.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;S-=T,w+=T}}}if(i&&S+w===this._bufferService.cols&&l.getCodePoint(this._bufferService.cols-1)!==32){let C=a.lines.get(e[1]+1);if(C?.isWrapped&&C.getCodePoint(0)!==32){let E=this._getWordAt([0,e[1]+1],!1,!1,!0);E&&(w+=E.length)}}return{start:S,length:w}}}_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=m2(s,this._bufferService.cols)}};lb=Wt([we(3,en),we(4,no),we(5,Tx),we(6,tn),we(7,xr),we(8,br)],lb);var p2=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={}}},g2=class{constructor(){this._color=new p2,this._css=new p2}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()}},ms=Object.freeze((()=>{let e=[Ht.toColor("#2e3436"),Ht.toColor("#cc0000"),Ht.toColor("#4e9a06"),Ht.toColor("#c4a000"),Ht.toColor("#3465a4"),Ht.toColor("#75507b"),Ht.toColor("#06989a"),Ht.toColor("#d3d7cf"),Ht.toColor("#555753"),Ht.toColor("#ef2929"),Ht.toColor("#8ae234"),Ht.toColor("#fce94f"),Ht.toColor("#729fcf"),Ht.toColor("#ad7fa8"),Ht.toColor("#34e2e2"),Ht.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:cs.toCss(i,a,l),rgba:cs.toRgba(i,a,l)})}for(let s=0;s<24;s++){let i=8+s*10;e.push({css:cs.toCss(i,i,i),rgba:cs.toRgba(i,i,i)})}return e})()),Ia=Ht.toColor("#ffffff"),Mc=Ht.toColor("#000000"),b2=Ht.toColor("#ffffff"),x2=Mc,_c={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},RU=Ia,cb=class extends Je{constructor(e){super(),this._optionsService=e,this._contrastCache=new g2,this._halfContrastCache=new g2,this._onChangeColors=this._register(new be),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Ia,background:Mc,cursor:b2,cursorAccent:x2,selectionForeground:void 0,selectionBackgroundTransparent:_c,selectionBackgroundOpaque:Rt.blend(Mc,_c),selectionInactiveBackgroundTransparent:_c,selectionInactiveBackgroundOpaque:Rt.blend(Mc,_c),scrollbarSliderBackground:Rt.opacity(Ia,.2),scrollbarSliderHoverBackground:Rt.opacity(Ia,.4),scrollbarSliderActiveBackground:Rt.opacity(Ia,.5),overviewRulerBorder:Ia,ansi:ms.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=kt(e.foreground,Ia),t.background=kt(e.background,Mc),t.cursor=Rt.blend(t.background,kt(e.cursor,b2)),t.cursorAccent=Rt.blend(t.background,kt(e.cursorAccent,x2)),t.selectionBackgroundTransparent=kt(e.selectionBackground,_c),t.selectionBackgroundOpaque=Rt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=kt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Rt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?kt(e.selectionForeground,d2):void 0,t.selectionForeground===d2&&(t.selectionForeground=void 0),Rt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Rt.opacity(t.selectionBackgroundTransparent,.3)),Rt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Rt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=kt(e.scrollbarSliderBackground,Rt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=kt(e.scrollbarSliderHoverBackground,Rt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=kt(e.scrollbarSliderActiveBackground,Rt.opacity(t.foreground,.5)),t.overviewRulerBorder=kt(e.overviewRulerBorder,RU),t.ansi=ms.slice(),t.ansi[0]=kt(e.black,ms[0]),t.ansi[1]=kt(e.red,ms[1]),t.ansi[2]=kt(e.green,ms[2]),t.ansi[3]=kt(e.yellow,ms[3]),t.ansi[4]=kt(e.blue,ms[4]),t.ansi[5]=kt(e.magenta,ms[5]),t.ansi[6]=kt(e.cyan,ms[6]),t.ansi[7]=kt(e.white,ms[7]),t.ansi[8]=kt(e.brightBlack,ms[8]),t.ansi[9]=kt(e.brightRed,ms[9]),t.ansi[10]=kt(e.brightGreen,ms[10]),t.ansi[11]=kt(e.brightYellow,ms[11]),t.ansi[12]=kt(e.brightBlue,ms[12]),t.ansi[13]=kt(e.brightMagenta,ms[13]),t.ansi[14]=kt(e.brightCyan,ms[14]),t.ansi[15]=kt(e.brightWhite,ms[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]=kt(e.extendedAnsi[i],ms[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()}}};cb=Wt([we(0,tn)],cb);function kt(e,t){if(e!==void 0)try{return Ht.toColor(e)}catch{}return t}var DU=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)}},OU=class{constructor(){this._services=new DU,this._services.set(Ex,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let s=E$(e).sort((l,u)=>l.index-u.index),i=[];for(let l of s){let u=this._services.get(l.id);if(!u)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${l.id._id}.`);i.push(u)}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)}},LU={trace:0,debug:1,info:2,warn:3,error:4,off:5},zU="xterm.js: ",ub=class extends Je{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=LU[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?"":zU)+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)}};ub=Wt([we(0,tn)],ub);var v2=class extends Je{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new be),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new be),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new be),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}},Xe=3,as=Object.freeze(new vu),rh=0,lg=2,Rc=class Q3{constructor(t,s,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Xe);let a=s||Yn.fromCharData([0,b3,1,0]);for(let l=0;l<t;++l)this.setCell(l,a);this.length=t}get(t){let s=this._data[t*Xe+0],i=s&2097151;return[this._data[t*Xe+1],s&2097152?this._combined[t]:i?ta(i):"",s>>22,s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,s){this._data[t*Xe+1]=s[0],s[1].length>1?(this._combined[t]=s[1],this._data[t*Xe+0]=t|2097152|s[2]<<22):this._data[t*Xe+0]=s[1].charCodeAt(0)|s[2]<<22}getWidth(t){return this._data[t*Xe+0]>>22}hasWidth(t){return this._data[t*Xe+0]&12582912}getFg(t){return this._data[t*Xe+1]}getBg(t){return this._data[t*Xe+2]}hasContent(t){return this._data[t*Xe+0]&4194303}getCodePoint(t){let s=this._data[t*Xe+0];return s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s&2097151}isCombined(t){return this._data[t*Xe+0]&2097152}getString(t){let s=this._data[t*Xe+0];return s&2097152?this._combined[t]:s&2097151?ta(s&2097151):""}isProtected(t){return this._data[t*Xe+2]&536870912}loadCell(t,s){return rh=t*Xe,s.content=this._data[rh+0],s.fg=this._data[rh+1],s.bg=this._data[rh+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*Xe+0]=s.content,this._data[t*Xe+1]=s.fg,this._data[t*Xe+2]=s.bg}setCellFromCodepoint(t,s,i,a){a.bg&268435456&&(this._extendedAttrs[t]=a.extended),this._data[t*Xe+0]=s|i<<22,this._data[t*Xe+1]=a.fg,this._data[t*Xe+2]=a.bg}addCodepointToCell(t,s,i){let a=this._data[t*Xe+0];a&2097152?this._combined[t]+=ta(s):a&2097151?(this._combined[t]=ta(a&2097151)+ta(s),a&=-2097152,a|=2097152):a=s|1<<22,i&&(a&=-12582913,a|=i<<22),this._data[t*Xe+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 Yn;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 Yn;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*lg<this._data.buffer.byteLength;let i=t*Xe;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 u=0;u<a.length;u++){let h=parseInt(a[u],10);h>=t&&delete this._combined[h]}let l=Object.keys(this._extendedAttrs);for(let u=0;u<l.length;u++){let h=parseInt(l[u],10);h>=t&&delete this._extendedAttrs[h]}}return this.length=t,i*4*lg<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*lg<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 Q3(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*Xe+0]&4194303)return t+(this._data[t*Xe+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Xe+0]&4194303||this._data[t*Xe+2]&50331648)return t+(this._data[t*Xe+0]>>22);return 0}copyCellsFrom(t,s,i,a,l){let u=t._data;if(l)for(let m=a-1;m>=0;m--){for(let d=0;d<Xe;d++)this._data[(i+m)*Xe+d]=u[(s+m)*Xe+d];u[(s+m)*Xe+2]&268435456&&(this._extendedAttrs[i+m]=t._extendedAttrs[s+m])}else for(let m=0;m<a;m++){for(let d=0;d<Xe;d++)this._data[(i+m)*Xe+d]=u[(s+m)*Xe+d];u[(s+m)*Xe+2]&268435456&&(this._extendedAttrs[i+m]=t._extendedAttrs[s+m])}let h=Object.keys(t._combined);for(let m=0;m<h.length;m++){let d=parseInt(h[m],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 u=this._data[s*Xe+0],h=u&2097151,m=u&2097152?this._combined[s]:h?ta(h):na;if(l+=m,a)for(let d=0;d<m.length;++d)a.push(s);s+=u>>22||1}return a&&a.push(s),l}};function BU(e,t,s,i,a,l){let u=[];for(let h=0;h<e.length-1;h++){let m=h,d=e.get(++m);if(!d.isWrapped)continue;let p=[e.get(h)];for(;m<e.length&&d.isWrapped;)p.push(d),d=e.get(++m);if(!l&&i>=h&&i<m){h+=p.length-1;continue}let g=0,v=tu(p,g,t),_=1,S=0;for(;_<p.length;){let C=tu(p,_,t),E=C-S,T=s-v,N=Math.min(E,T);p[g].copyCellsFrom(p[_],S,v,N,!1),v+=N,v===s&&(g++,v=0),S+=N,S===C&&(_++,S=0),v===0&&g!==0&&p[g-1].getWidth(s-1)===2&&(p[g].copyCellsFrom(p[g-1],s-1,v++,1,!1),p[g-1].setCell(s-1,a))}p[g].replaceCells(v,s,a);let w=0;for(let C=p.length-1;C>0&&(C>g||p[C].getTrimmedLength()===0);C--)w++;w>0&&(u.push(h+p.length-w),u.push(w)),h+=p.length-1}return u}function IU(e,t){let s=[],i=0,a=t[i],l=0;for(let u=0;u<e.length;u++)if(a===u){let h=t[++i];e.onDeleteEmitter.fire({index:u-l,amount:h}),u+=h-1,l+=h,a=t[++i]}else s.push(u);return{layout:s,countRemoved:l}}function PU(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 $U(e,t,s){let i=[],a=e.map((m,d)=>tu(e,d,t)).reduce((m,d)=>m+d),l=0,u=0,h=0;for(;h<a;){if(a-h<s){i.push(a-h);break}l+=s;let m=tu(e,u,t);l>m&&(l-=m,u++);let d=e[u].getWidth(l-1)===2;d&&l--;let p=d?s-1:s;i.push(p),h+=p}return i}function tu(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 J3=class e5{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e5._nextId++,this._onDispose=this.register(new be),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Xa(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};J3._nextId=1;var HU=J3,xs={},Pa=xs.B;xs[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:"≥","{":"π","|":"≠","}":"£","~":"·"};xs.A={"#":"£"};xs.B=void 0;xs[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};xs.C=xs[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};xs.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};xs.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};xs.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};xs.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};xs.E=xs[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};xs.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};xs.H=xs[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};xs["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var _2=4294967295,y2=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=Pa,this.markers=[],this._nullCell=Yn.fromCharData([0,b3,1,0]),this._whitespaceCell=Yn.fromCharData([0,na,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Xh,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new v2(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 Gh),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 Gh),this._whitespaceCell}getBlankLine(e,t){return new Rc(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>_2?_2: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 v2(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 u=0;u<this.lines.length;u++)i+=+this.lines.get(u).resize(e,s);let l=0;if(this._rows<t)for(let u=this._rows;u<t;u++)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 Rc(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 Rc(e,s)));else for(let u=this._rows;u>t;u--)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 u=this.lines.length-a;u>0&&(this.lines.trimStart(u),this.ybase=Math.max(this.ybase-u,0),this.ydisp=Math.max(this.ydisp-u,0),this.savedY=Math.max(this.savedY-u,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=BU(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(as),s);if(i.length>0){let a=IU(this.lines,i);PU(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 Rc(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 u=this.lines.length-1;u>=0;u--){let h=this.lines.get(u);if(!h||!h.isWrapped&&h.getTrimmedLength()<=e)continue;let m=[h];for(;h.isWrapped&&u>0;)h=this.lines.get(--u),m.unshift(h);if(!s){let N=this.ybase+this.y;if(N>=u&&N<u+m.length)continue}let d=m[m.length-1].getTrimmedLength(),p=$U(m,this._cols,e),g=p.length-m.length,v;this.ybase===0&&this.y!==this.lines.length-1?v=Math.max(0,this.y-this.lines.maxLength+g):v=Math.max(0,this.lines.length-this.lines.maxLength+g);let _=[];for(let N=0;N<g;N++){let j=this.getBlankLine(as,!0);_.push(j)}_.length>0&&(a.push({start:u+m.length+l,newLines:_}),l+=_.length),m.push(..._);let S=p.length-1,w=p[S];w===0&&(S--,w=p[S]);let C=m.length-g-1,E=d;for(;C>=0;){let N=Math.min(E,w);if(m[S]===void 0)break;if(m[S].copyCellsFrom(m[C],E-N,w-N,N,!0),w-=N,w===0&&(S--,w=p[S]),E-=N,E===0){C--;let j=Math.max(C,0);E=tu(m,j,this._cols)}}for(let N=0;N<m.length;N++)p[N]<e&&m[N].setCell(p[N],i);let T=g-v;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 u=[],h=[];for(let w=0;w<this.lines.length;w++)h.push(this.lines.get(w));let m=this.lines.length,d=m-1,p=0,g=a[p];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+l);let v=0;for(let w=Math.min(this.lines.maxLength-1,m+l-1);w>=0;w--)if(g&&g.start>d+v){for(let C=g.newLines.length-1;C>=0;C--)this.lines.set(w--,g.newLines[C]);w++,u.push({index:d+1,amount:g.newLines.length}),v+=g.newLines.length,g=a[++p]}else this.lines.set(w,h[d--]);let _=0;for(let w=u.length-1;w>=0;w--)u[w].index+=_,this.lines.onInsertEmitter.fire(u[w]),_+=u[w].amount;let S=Math.max(0,m+l-this.lines.maxLength);S>0&&this.lines.onTrimEmitter.fire(S)}}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 HU(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)}},UU=class extends Je{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new be),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 y2(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new y2(!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)}},t5=2,s5=1,db=class extends Je{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new be),this.onResize=this._onResize.event,this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t5),this.rows=Math.max(e.rawOptions.rows||0,s5),this.buffers=this._register(new UU(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 u=s.lines.isFull;l===s.lines.length-1?u?s.lines.recycle().copyFrom(i):s.lines.push(i.clone()):s.lines.splice(l+1,0,i.clone()),u?this.isUserScrolling&&(s.ydisp=Math.max(s.ydisp-1,0)):(s.ybase++,this.isUserScrolling||s.ydisp++)}else{let u=l-a+1;s.lines.shiftElements(a+1,u-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))}};db=Wt([we(0,tn)],db);var Wo={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:Yh,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},FU=["normal","bold","100","200","300","400","500","600","700","800","900"],qU=class extends Je{constructor(e){super(),this._onOptionChange=this._register(new be),this.onOptionChange=this._onOptionChange.event;let t={...Wo};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(zt(()=>{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 Wo))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},t=(s,i)=>{if(!(s in Wo))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=Wo[e]),!VU(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Wo[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=FU.includes(t)?t:Wo[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 VU(e){return e==="block"||e==="underline"||e==="bar"}function Dc(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]&&Dc(e[i],t-1);return s}var S2=Object.freeze({insertMode:!1}),w2=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),hb=class extends Je{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 be),this.onData=this._onData.event,this._onUserInput=this._register(new be),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new be),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new be),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Dc(S2),this.decPrivateModes=Dc(w2)}reset(){this.modes=Dc(S2),this.decPrivateModes=Dc(w2)}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))}};hb=Wt([we(0,en),we(1,S3),we(2,tn)],hb);var k2={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 cg(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 ug=String.fromCharCode,C2={DEFAULT:e=>{let t=[cg(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${ug(t[0])}${ug(t[1])}${ug(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${cg(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${cg(e,!0)};${e.x};${e.y}${t}`}},fb=class extends Je{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 be),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(k2))this.addProtocol(i,k2[i]);for(let i of Object.keys(C2))this.addEncoding(i,C2[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)}};fb=Wt([we(0,en),we(1,no),we(2,tn)],fb);var dg=[[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]],GU=[[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]],ps;function WU(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 KU=class{constructor(){if(this.version="6",!ps){ps=new Uint8Array(65536),ps.fill(1),ps[0]=0,ps.fill(0,1,32),ps.fill(0,127,160),ps.fill(2,4352,4448),ps[9001]=2,ps[9002]=2,ps.fill(2,11904,42192),ps[12351]=1,ps.fill(2,44032,55204),ps.fill(2,63744,64256),ps.fill(2,65040,65050),ps.fill(2,65072,65136),ps.fill(2,65280,65377),ps.fill(2,65504,65511);for(let e=0;e<dg.length;++e)ps.fill(0,dg[e][0],dg[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ps[e]:WU(e,GU)?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=Fa.extractWidth(t);a===0?i=!1:a>s&&(s=a)}return Fa.createPropertyValue(0,s,i)}},Fa=class Sh{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new be,this.onChange=this._onChange.event;let t=new KU;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 u=t.charCodeAt(l);if(55296<=u&&u<=56319){if(++l>=a)return s+this.wcwidth(u);let d=t.charCodeAt(l);56320<=d&&d<=57343?u=(u-55296)*1024+d-56320+65536:s+=this.wcwidth(d)}let h=this.charProperties(u,i),m=Sh.extractWidth(h);Sh.extractShouldJoin(h)&&(m-=Sh.extractWidth(i)),s+=m,i=h}return s}charProperties(t,s){return this._activeProvider.charProperties(t,s)}},YU=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 N2(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 yc=2147483647,XU=256,n5=class mb{constructor(t=32,s=32){if(this.maxLength=t,this.maxSubParamsLength=s,s>XU)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 mb;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 mb(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>yc?yc: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>yc?yc: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,yc):t}},Sc=[],ZU=class{constructor(){this._state=0,this._active=Sc,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=Sc}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=Sc,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Sc,!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",bf(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=Sc,this._id=-1,this._state=0}}},Tn=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=bf(e,t,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(s=>(this._data="",this._hitLimit=!1,s));return this._data="",this._hitLimit=!1,t}},wc=[],QU=class{constructor(){this._handlers=Object.create(null),this._active=wc,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=wc}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=wc,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||wc,!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",bf(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=wc,this._ident=0}},Oc=new n5;Oc.addParam(0);var E2=class{constructor(e){this._handler=e,this._data="",this._params=Oc,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Oc,this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=bf(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=Oc,this._data="",this._hitLimit=!1,s));return this._params=Oc,this._data="",this._hitLimit=!1,t}},JU=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}},Gn=160,eF=(function(){let e=new JU(4095),t=Array.apply(null,Array(256)).map((h,m)=>m),s=(h,m)=>t.slice(h,m),i=s(32,127),a=s(0,24);a.push(25),a.push.apply(a,s(28,32));let l=s(0,14),u;e.setDefault(1,0),e.addMany(i,0,2,0);for(u in l)e.addMany([24,26,153,154],u,3,0),e.addMany(s(128,144),u,3,0),e.addMany(s(144,152),u,3,0),e.add(156,u,0,0),e.add(27,u,11,1),e.add(157,u,4,8),e.addMany([152,158,159],u,0,7),e.add(155,u,11,3),e.add(144,u,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(Gn,0,2,0),e.add(Gn,8,5,8),e.add(Gn,6,0,6),e.add(Gn,11,0,11),e.add(Gn,13,13,13),e})(),tF=class extends Je{constructor(e=eF){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 n5,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(zt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new ZU),this._dcsParser=this._register(new QU),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,u;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,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&m>-1){for(;m>=0&&(u=h[m](this._params),u!==!0);m--)if(u instanceof Promise)return this._parseStack.handlerPos=m,u}this._parseStack.handlers=[];break;case 4:if(s===!1&&m>-1){for(;m>=0&&(u=h[m](),u!==!0);m--)if(u instanceof Promise)return this._parseStack.handlerPos=m,u}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],u=this._dcsParser.unhook(i!==24&&i!==26,s),u)return u;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],u=this._oscParser.end(i!==24&&i!==26,s),u)return u;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:Gn)],a>>4){case 2:for(let v=h+1;;++v){if(v>=t||(i=e[v])<32||i>126&&i<Gn){this._printHandler(e,h,v),h=v-1;break}if(++v>=t||(i=e[v])<32||i>126&&i<Gn){this._printHandler(e,h,v),h=v-1;break}if(++v>=t||(i=e[v])<32||i>126&&i<Gn){this._printHandler(e,h,v),h=v-1;break}if(++v>=t||(i=e[v])<32||i>126&&i<Gn){this._printHandler(e,h,v),h=v-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 m=this._csiHandlers[this._collect<<8|i],d=m?m.length-1:-1;for(;d>=0&&(u=m[d](this._params),u!==!0);d--)if(u instanceof Promise)return this._preserveStack(3,m,d,a,h),u;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&&(u=p[g](),u!==!0);g--)if(u instanceof Promise)return this._preserveStack(4,p,g,a,h),u;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 v=h+1;;++v)if(v>=t||(i=e[v])===24||i===26||i===27||i>127&&i<Gn){this._dcsParser.put(e,h,v),h=v-1;break}break;case 14:if(u=this._dcsParser.unhook(i!==24&&i!==26),u)return this._preserveStack(6,[],0,a,h),u;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 v=h+1;;v++)if(v>=t||(i=e[v])<32||i>127&&i<Gn){this._oscParser.put(e,h,v),h=v-1;break}break;case 6:if(u=this._oscParser.end(i!==24&&i!==26),u)return this._preserveStack(5,[],0,a,h),u;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=a&15}}},sF=/^([\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})$/,nF=/^[\da-f]+$/;function T2(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let s=sF.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),nF.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 hg(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 iF(e,t=16){let[s,i,a]=e;return`rgb:${hg(s,t)}/${hg(i,t)}/${hg(a,t)}`}var rF={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Jr=131072,j2=10;function A2(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 M2=5e3,R2=0,aF=class extends Je{constructor(e,t,s,i,a,l,u,h,m=new tF){super(),this._bufferService=e,this._charsetService=t,this._coreService=s,this._logService=i,this._optionsService=a,this._oscLinkService=l,this._coreMouseService=u,this._unicodeService=h,this._parser=m,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new C$,this._utf8Decoder=new N$,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=as.clone(),this._eraseAttrDataInternal=as.clone(),this._onRequestBell=this._register(new be),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new be),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new be),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new be),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new be),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new be),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new be),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new be),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new be),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new be),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new be),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new be),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 pb(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(ue.BEL,()=>this.bell()),this._parser.setExecuteHandler(ue.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ue.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ue.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ue.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ue.BS,()=>this.backspace()),this._parser.setExecuteHandler(ue.HT,()=>this.tab()),this._parser.setExecuteHandler(ue.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ue.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(_h.IND,()=>this.index()),this._parser.setExecuteHandler(_h.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(_h.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Tn(d=>(this.setTitle(d),this.setIconName(d),!0))),this._parser.registerOscHandler(1,new Tn(d=>this.setIconName(d))),this._parser.registerOscHandler(2,new Tn(d=>this.setTitle(d))),this._parser.registerOscHandler(4,new Tn(d=>this.setOrReportIndexedColor(d))),this._parser.registerOscHandler(8,new Tn(d=>this.setHyperlink(d))),this._parser.registerOscHandler(10,new Tn(d=>this.setOrReportFgColor(d))),this._parser.registerOscHandler(11,new Tn(d=>this.setOrReportBgColor(d))),this._parser.registerOscHandler(12,new Tn(d=>this.setOrReportCursorColor(d))),this._parser.registerOscHandler(104,new Tn(d=>this.restoreIndexedColor(d))),this._parser.registerOscHandler(110,new Tn(d=>this.restoreFgColor(d))),this._parser.registerOscHandler(111,new Tn(d=>this.restoreBgColor(d))),this._parser.registerOscHandler(112,new Tn(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 xs)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 E2((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"),M2))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${M2} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let s,i=this._activeBuffer.x,a=this._activeBuffer.y,l=0,u=this._parseStack.paused;if(u){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>Jr&&(l=this._parseStack.position+Jr)}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<Jr&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Jr))),u||this._dirtyRowTracker.clearRange(),e.length>Jr)for(let d=l;d<e.length;d+=Jr){let p=d+Jr<e.length?d+Jr: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(!u){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),m=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);m<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(m,this._bufferService.rows-1),end:Math.min(h,this._bufferService.rows-1)})}print(e,t,s){let i,a,l=this._charsetService.charset,u=this._optionsService.rawOptions.screenReaderMode,h=this._bufferService.cols,m=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 v=this._parser.precedingJoinState;for(let _=t;_<s;++_){if(i=e[_],i<127&&l){let E=l[String.fromCharCode(i)];E&&(i=E.charCodeAt(0))}let S=this._unicodeService.charProperties(i,v);a=Fa.extractWidth(S);let w=Fa.extractShouldJoin(S),C=w?Fa.extractWidth(v):0;if(v=S,u&&this._onA11yChar.fire(ta(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+a-C>h){if(m){let E=g,T=this._activeBuffer.x-C;for(this._activeBuffer.x=C,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),C>0&&g instanceof Rc&&g.copyCellsFrom(E,T,0,C,!1);T<h;)E.setCellFromCodepoint(T++,0,1,p)}else if(this._activeBuffer.x=h-1,a===2)continue}if(w&&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-C;--T>=0;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,p);continue}if(d&&(g.insertCells(this._activeBuffer.x,a-C,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=v,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=>A2(s.params[0],this._optionsService.rawOptions.windowOptions)?t(s):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new E2(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Tn(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=Fa.extractWidth(t),a=this._activeBuffer.x-i,l=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(a),u=new Uint32Array(l.length*s),h=0;for(let d=0;d<l.length;){let p=l.codePointAt(d)||0;u[h++]=p,d+=p>65535?2:1}let m=h;for(let d=1;d<s;++d)u.copyWithin(m,0,h),m+=h;return this.print(u,0,m),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ue.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ue.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ue.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ue.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ue.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,Pa),this._charsetService.setgCharset(1,Pa),this._charsetService.setgCharset(2,Pa),this._charsetService.setgCharset(3,Pa);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;(w=>(w[w.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",w[w.SET=1]="SET",w[w.RESET=2]="RESET",w[w.PERMANENTLY_SET=3]="PERMANENTLY_SET",w[w.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(s||={});let i=this._coreService.decPrivateModes,{activeProtocol:a,activeEncoding:l}=this._coreMouseService,u=this._coreService,{buffers:h,cols:m}=this._bufferService,{active:d,alt:p}=h,g=this._optionsService.rawOptions,v=(w,C)=>(u.triggerDataEvent(`${ue.ESC}[${t?"":"?"}${w};${C}$y`),!0),_=w=>w?1:2,S=e.params[0];return t?S===2?v(S,4):S===4?v(S,_(u.modes.insertMode)):S===12?v(S,3):S===20?v(S,_(g.convertEol)):v(S,0):S===1?v(S,_(i.applicationCursorKeys)):S===3?v(S,g.windowOptions.setWinLines?m===80?2:m===132?1:0:0):S===6?v(S,_(i.origin)):S===7?v(S,_(i.wraparound)):S===8?v(S,3):S===9?v(S,_(a==="X10")):S===12?v(S,_(g.cursorBlink)):S===25?v(S,_(!u.isCursorHidden)):S===45?v(S,_(i.reverseWraparound)):S===66?v(S,_(i.applicationKeypad)):S===67?v(S,4):S===1e3?v(S,_(a==="VT200")):S===1002?v(S,_(a==="DRAG")):S===1003?v(S,_(a==="ANY")):S===1004?v(S,_(i.sendFocus)):S===1005?v(S,4):S===1006?v(S,_(l==="SGR")):S===1015?v(S,4):S===1016?v(S,_(l==="SGR_PIXELS")):S===1048?v(S,1):S===47||S===1047||S===1049?v(S,_(d===p)):S===2004?v(S,_(i.bracketedPasteMode)):S===2026?v(S,_(i.synchronizedOutput)):v(S,0)}_updateAttrColor(e,t,s,i,a){return t===2?(e|=50331648,e&=-16777216,e|=vu.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 u=e.getSubParams(t+l),h=0;do i[1]===5&&(a=1),i[l+h+1+a]=u[h];while(++h<u.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 u=2;u<i.length;++u)i[u]===-1&&(i[u]=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(`${ue.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ue.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(`${ue.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(!A2(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(`${ue.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>j2&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>j2&&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(D2(l))if(a==="?")t.push({type:0,index:l});else{let u=T2(a);u&&t.push({type:1,index:l,color:u})}}}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=T2(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]);D2(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,Pa),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(rF[e[0]],xs[e[1]]||Pa),!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 Yn;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=u=>(this._coreService.triggerDataEvent(`${ue.ESC}${u}${ue.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)}},pb=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&&(R2=e,e=t,t=R2),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};pb=Wt([we(0,en)],pb);function D2(e){return 0<=e&&e<256}var oF=5e7,O2=12,lF=50,cF=class extends Je{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new be),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>oF)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 u=h=>performance.now()-s>=O2?setTimeout(()=>this._innerWrite(0,h)):this._innerWrite(s,h);a.catch(h=>(queueMicrotask(()=>{throw h}),Promise.resolve(!1))).then(u);return}let l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-s>=O2)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>lF&&(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()}},gb=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),m={data:e,id:this._nextId++,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(m,h)),this._dataByLinkId.set(m.id,m),m.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),u={id:this._nextId++,key:this._getEntryIdKey(s),data:s,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(u,l)),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.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)))}};gb=Wt([we(0,en)],gb);var L2=!1,uF=class extends Je{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new cl),this._onBinary=this._register(new be),this.onBinary=this._onBinary.event,this._onData=this._register(new be),this.onData=this._onData.event,this._onLineFeed=this._register(new be),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new be),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new be),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new be),this._instantiationService=new OU,this.optionsService=this._register(new qU(e)),this._instantiationService.setService(tn,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(db)),this._instantiationService.setService(en,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(ub)),this._instantiationService.setService(S3,this._logService),this.coreService=this._register(this._instantiationService.createInstance(hb)),this._instantiationService.setService(no,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(fb)),this._instantiationService.setService(y3,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Fa)),this._instantiationService.setService(A$,this.unicodeService),this._charsetService=this._instantiationService.createInstance(YU),this._instantiationService.setService(j$,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(gb),this._instantiationService.setService(w3,this._oscLinkService),this._inputHandler=this._register(new aF(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(zs.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(zs.forward(this._bufferService.onResize,this._onResize)),this._register(zs.forward(this.coreService.onData,this._onData)),this._register(zs.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 cF((t,s)=>this._inputHandler.parse(t,s))),this._register(zs.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new be),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&&!L2&&(this._logService.warn("writeSync is unreliable and will be removed soon."),L2=!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,t5),t=Math.max(t,s5),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(N2.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(N2(this._bufferService),!1))),this._windowsWrappingHeuristics.value=zt(()=>{for(let t of e)t.dispose()})}}},dF={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 hF(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=ue.ESC+"OA":a.key=ue.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?a.key=ue.ESC+"OD":a.key=ue.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?a.key=ue.ESC+"OC":a.key=ue.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?a.key=ue.ESC+"OB":a.key=ue.ESC+"[B");break;case 8:a.key=e.ctrlKey?"\b":ue.DEL,e.altKey&&(a.key=ue.ESC+a.key);break;case 9:if(e.shiftKey){a.key=ue.ESC+"[Z";break}a.key=ue.HT,a.cancel=!0;break;case 13:a.key=e.altKey?ue.ESC+ue.CR:ue.CR,a.cancel=!0;break;case 27:a.key=ue.ESC,e.altKey&&(a.key=ue.ESC+ue.ESC),a.cancel=!0;break;case 37:if(e.metaKey)break;l?a.key=ue.ESC+"[1;"+(l+1)+"D":t?a.key=ue.ESC+"OD":a.key=ue.ESC+"[D";break;case 39:if(e.metaKey)break;l?a.key=ue.ESC+"[1;"+(l+1)+"C":t?a.key=ue.ESC+"OC":a.key=ue.ESC+"[C";break;case 38:if(e.metaKey)break;l?a.key=ue.ESC+"[1;"+(l+1)+"A":t?a.key=ue.ESC+"OA":a.key=ue.ESC+"[A";break;case 40:if(e.metaKey)break;l?a.key=ue.ESC+"[1;"+(l+1)+"B":t?a.key=ue.ESC+"OB":a.key=ue.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(a.key=ue.ESC+"[2~");break;case 46:l?a.key=ue.ESC+"[3;"+(l+1)+"~":a.key=ue.ESC+"[3~";break;case 36:l?a.key=ue.ESC+"[1;"+(l+1)+"H":t?a.key=ue.ESC+"OH":a.key=ue.ESC+"[H";break;case 35:l?a.key=ue.ESC+"[1;"+(l+1)+"F":t?a.key=ue.ESC+"OF":a.key=ue.ESC+"[F";break;case 33:e.shiftKey?a.type=2:e.ctrlKey?a.key=ue.ESC+"[5;"+(l+1)+"~":a.key=ue.ESC+"[5~";break;case 34:e.shiftKey?a.type=3:e.ctrlKey?a.key=ue.ESC+"[6;"+(l+1)+"~":a.key=ue.ESC+"[6~";break;case 112:l?a.key=ue.ESC+"[1;"+(l+1)+"P":a.key=ue.ESC+"OP";break;case 113:l?a.key=ue.ESC+"[1;"+(l+1)+"Q":a.key=ue.ESC+"OQ";break;case 114:l?a.key=ue.ESC+"[1;"+(l+1)+"R":a.key=ue.ESC+"OR";break;case 115:l?a.key=ue.ESC+"[1;"+(l+1)+"S":a.key=ue.ESC+"OS";break;case 116:l?a.key=ue.ESC+"[15;"+(l+1)+"~":a.key=ue.ESC+"[15~";break;case 117:l?a.key=ue.ESC+"[17;"+(l+1)+"~":a.key=ue.ESC+"[17~";break;case 118:l?a.key=ue.ESC+"[18;"+(l+1)+"~":a.key=ue.ESC+"[18~";break;case 119:l?a.key=ue.ESC+"[19;"+(l+1)+"~":a.key=ue.ESC+"[19~";break;case 120:l?a.key=ue.ESC+"[20;"+(l+1)+"~":a.key=ue.ESC+"[20~";break;case 121:l?a.key=ue.ESC+"[21;"+(l+1)+"~":a.key=ue.ESC+"[21~";break;case 122:l?a.key=ue.ESC+"[23;"+(l+1)+"~":a.key=ue.ESC+"[23~";break;case 123:l?a.key=ue.ESC+"[24;"+(l+1)+"~":a.key=ue.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=ue.NUL:e.keyCode>=51&&e.keyCode<=55?a.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?a.key=ue.DEL:e.keyCode===219?a.key=ue.ESC:e.keyCode===220?a.key=ue.FS:e.keyCode===221&&(a.key=ue.GS);else if((!s||i)&&e.altKey&&!e.metaKey){let u=dF[e.keyCode]?.[e.shiftKey?1:0];if(u)a.key=ue.ESC+u;else if(e.keyCode>=65&&e.keyCode<=90){let h=e.ctrlKey?e.keyCode-64:e.keyCode+32,m=String.fromCharCode(h);e.shiftKey&&(m=m.toUpperCase()),a.key=ue.ESC+m}else if(e.keyCode===32)a.key=ue.ESC+(e.ctrlKey?ue.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let h=e.code.slice(3,4);e.shiftKey||(h=h.toLowerCase()),a.key=ue.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=ue.US),e.key==="@"&&(a.key=ue.NUL));break}return a}var Jt=0,fF=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Xh,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Xh,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||(Jt=this._search(t),Jt===-1)||this._getKey(this._array[Jt])!==t)return!1;do if(this._array[Jt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Jt),!0;while(++Jt<this._array.length&&this._getKey(this._array[Jt])===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&&(Jt=this._search(e),!(Jt<0||Jt>=this._array.length)&&this._getKey(this._array[Jt])===e))do yield this._array[Jt];while(++Jt<this._array.length&&this._getKey(this._array[Jt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Jt=this._search(e),!(Jt<0||Jt>=this._array.length)&&this._getKey(this._array[Jt])===e))do t(this._array[Jt]);while(++Jt<this._array.length&&this._getKey(this._array[Jt])===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}},fg=0,z2=0,mF=class extends Je{constructor(){super(),this._decorations=new fF(e=>e?.marker.line),this._onDecorationRegistered=this._register(new be),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new be),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(zt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new pF(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=>{fg=a.options.x??0,z2=fg+(a.options.width??1),e>=fg&&e<z2&&(!s||(a.options.layer??"bottom")===s)&&i(a)})}},pF=class extends ia{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new be),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new be),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=Ht.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Ht.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},gF=1e3,bF=class{constructor(e,t=gF){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)}},B2=20,Zh=class extends Je{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 bF(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(`
|
|
164
|
+
`))),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(qe(a,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(zt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<B2+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
165
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===B2+1&&(this._liveRegion.textContent+=z0.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),u=[],h=l?.translateToString(!0,void 0,void 0,u)||"",m=(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,u)),d.setAttribute("aria-posinset",m),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 u,h;if(t===0?(u=s,h=this._rowElements.pop(),this._rowContainer.removeChild(h)):(u=this._rowElements.shift(),h=s,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),h.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let m=this._createAccessibilityTreeNode();this._rowElements.unshift(m),this._rowContainer.insertAdjacentElement("afterbegin",m)}else{let m=this._createAccessibilityTreeNode();this._rowElements.push(m),this._rowContainer.appendChild(m)}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:m})=>{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 v=m<g.length?g[m]:g.slice(-1)[0]+1;return v>=this._terminal.cols&&(++p,v=0),{row:p,column:v}},l=a(t),u=a(s);if(!(!l||!u)){if(l.row>u.row||l.row===u.row&&l.column>=u.column)throw new Error("invalid range");this._terminal.select(l.column,l.row,(u.row-l.row)*this._terminal.cols-l.column+u.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})`}};Zh=Wt([we(1,Ex),we(2,br),we(3,xr)],Zh);var bb=class extends Je{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 be),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new be),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(zt(()=>{Xa(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(qe(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(qe(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(qe(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(qe(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 u=l?.map(h=>({link:h}));this._activeProviderReplies?.set(i,u),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 u=a[l],h=u.link.range.start.y<e?0:u.link.range.start.x,m=u.link.range.end.y>e?this._bufferService.cols:u.link.range.end.x;for(let d=h;d<=m;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(u=>this._linkAtPosition(u.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 u=this._activeProviderReplies.get(l)?.find(h=>this._linkAtPosition(h.link,t));if(u){s=!0,this._handleNewLink(u);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&&xF(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,Xa(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}}};bb=Wt([we(1,Tx),we(2,xr),we(3,en),we(4,C3)],bb);function xF(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 vF=class extends uF{constructor(e={}){super(e),this._linkifier=this._register(new cl),this.browser=q3,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new cl),this._onCursorMove=this._register(new be),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new be),this.onKey=this._onKey.event,this._onRender=this._register(new be),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new be),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new be),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new be),this.onBell=this._onBell.event,this._onFocus=this._register(new be),this._onBlur=this._register(new be),this._onA11yCharEmitter=this._register(new be),this._onA11yTabEmitter=this._register(new be),this._onWillOpen=this._register(new be),this._setup(),this._decorationService=this._instantiationService.createInstance(mF),this._instantiationService.setService(_u,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(lU),this._instantiationService.setService(C3,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(I0)),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(zs.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(zs.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(zs.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(zs.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(zt(()=>{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=Rt.toColorRGB(s==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[s]);this.coreService.triggerDataEvent(`${ue.ESC}]${i};${iF(a)}${U3.ST}`);break;case 1:if(s==="ansi")this._themeService.modifyColors(l=>l.ansi[t.index]=cs.toColor(...t.color));else{let l=s;this._themeService.modifyColors(u=>u[l]=cs.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(Zh,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ue.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(ue.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,u=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=u+"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(qe(this.element,"copy",t=>{this.hasSelection()&&w$(t,this._selectionService)}));let e=t=>k$(t,this.textarea,this.coreService,this.optionsService);this._register(qe(this.textarea,"paste",e)),this._register(qe(this.element,"paste",e)),V3?this._register(qe(this.element,"mousedown",t=>{t.button===2&&Ww(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(qe(this.element,"contextmenu",t=>{Ww(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),zx&&this._register(qe(this.element,"auxclick",t=>{t.button===1&&g3(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(qe(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(qe(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(qe(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(qe(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(qe(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(qe(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(qe(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(qe(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",L0.get()),K3||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(aU,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(br,this._coreBrowserService),this._register(qe(this.textarea,"focus",a=>this._handleTextAreaFocus(a))),this._register(qe(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(rb,this._document,this._helperContainer),this._instantiationService.setService(xf,this._charSizeService),this._themeService=this._instantiationService.createInstance(cb),this._instantiationService.setService(gl,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Kh),this._instantiationService.setService(k3,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(ob,this.rows,this.screenElement)),this._instantiationService.setService(xr,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(sb,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(ab),this._instantiationService.setService(Tx,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(bb,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(eb,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(lb,this.element,this.screenElement,i)),this._instantiationService.setService(R$,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(zs.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(tb,this.screenElement)),this._register(qe(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(Zh,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",a=>this._handleScreenReaderModeOptionChange(a))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Wh,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",a=>{!this._overviewRulerRenderer&&a&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Wh,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(ib,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function s(l){let u=e._mouseService.getMouseReportCoords(l,e.screenElement);if(!u)return!1;let h,m;switch(l.overrideType||l.type){case"mousemove":m=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":m=0,h=l.button<3?l.button:3;break;case"mousedown":m=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;m=d<0?0:1,h=4;break;default:return!1}return m===void 0||h===void 0||h>4?!1:e.coreMouseService.triggerMouseEvent({col:u.col,row:u.row,x:u.x,y:u.y,button:h,action:m,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(qe(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(qe(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 u=ue.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(l.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(u,!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){p3(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=hF(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===ue.ETX||s.key===ue.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)&&(_F(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(ue.ESC+"[I"):this.coreService.triggerDataEvent(ue.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(`${ue.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(`${ue.ESC}[6;${a};${i}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function _F(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var yF=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)}},SF=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 Yn)}translateToString(e,t,s){return this._line.translateToString(e,t,s)}},I2=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 SF(t)}getNullCell(){return new Yn}},wF=class extends Je{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new be),this.onBufferChange=this._onBufferChange.event,this._normal=new I2(this._core.buffers.normal,"normal"),this._alternate=new I2(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)}},kF=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)}},CF=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}},NF=["cols","rows"],ki=0,EF=class extends Je{constructor(e){super(),this._core=this._register(new vF(e)),this._addonManager=this._register(new yF),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(NF.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 kF(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new CF(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 wF(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
|
|
166
|
+
`,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 L0.get()},set promptLabel(e){L0.set(e)},get tooMuchOutput(){return z0.get()},set tooMuchOutput(e){z0.set(e)}}}_verifyIntegers(...e){for(ki of e)if(ki===1/0||isNaN(ki)||ki%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(ki of e)if(ki&&(ki===1/0||isNaN(ki)||ki%1!==0||ki<0))throw new Error("This API only accepts positive integers")}};function i5({sessionId:e,active:t,toolbarExtra:s}){const i=y.useRef(null),a=y.useRef(null),l=y.useRef(null),u=y.useRef(null),[h,m]=y.useState("Local workspace"),[d,p]=y.useState("connecting"),[g,v]=y.useState("Opening shell"),_=y.useCallback(()=>{const w=u.current,C=l.current;if(!w||w.readyState!==WebSocket.OPEN||!C)return;C.fit();const E=C.proposeDimensions();E&&w.send(JSON.stringify({cols:E.cols,rows:E.rows,type:"resize"}))},[]);y.useEffect(()=>{if(!i.current)return;const w=new EF({allowProposedApi:!0,cursorBlink:!0,fontFamily:'"SF Mono", "JetBrains Mono", ui-monospace, Menlo, monospace',fontSize:12,lineHeight:1.25,scrollback:4e3,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"}}),C=new x$;w.loadAddon(C),w.open(i.current),a.current=w,l.current=C;const E=new WebSocket(TF(e));u.current=E;const T=w.onData(j=>{E.readyState===WebSocket.OPEN&&E.send(JSON.stringify({data:j,type:"input"}))});E.addEventListener("open",()=>{p("running"),v("Shell connected"),_()}),E.addEventListener("message",j=>{const R=jF(j.data);if(R){if(R.type==="output"){w.write(R.data);return}if(R.type==="error"){p("error"),v(R.error);return}p(R.state==="idle"?"connecting":R.state),R.cwd&&m(R.cwd),v(R.error??R.shell??"Shell connected")}}),E.addEventListener("close",()=>{p(j=>j==="exited"?j:"exited"),v("Socket closed")}),E.addEventListener("error",()=>{p("error"),v("Terminal socket error")}),window.addEventListener("resize",_),window.setTimeout(_,0);const N=new ResizeObserver(()=>_());return N.observe(i.current),()=>{window.removeEventListener("resize",_),N.disconnect(),T.dispose(),E.close(),w.dispose(),u.current=null,a.current=null,l.current=null}},[e,_]),y.useEffect(()=>{if(!t)return;const w=window.setTimeout(()=>{_(),a.current?.focus()},0);return()=>window.clearTimeout(w)},[t,_]);const S=y.useCallback(w=>{const C=u.current;if(!C||C.readyState!==WebSocket.OPEN)return;const E=l.current?.proposeDimensions();C.send(JSON.stringify({cols:E?.cols,rows:E?.rows,...w}))},[]);return o.jsxs("section",{className:le("flex h-full min-h-0 flex-col bg-[#090909] text-white",!t&&"hidden"),children:[o.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:[o.jsx("div",{className:"min-w-0",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{className:le("border-white/15 bg-white/10 text-white shadow-none",d==="running"&&"border-emerald-400/35 text-emerald-200",d==="error"&&"border-red-400/35 text-red-200"),variant:"outline",children:d}),o.jsxs("span",{className:"truncate font-mono text-[11px] text-white/55",children:[h," · ",g]})]})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(se,{"aria-label":"Restart terminal",className:"border-white/15 bg-white/5 text-white hover:bg-white/10",size:"sm",variant:"outline",onClick:()=>S({type:"restart"}),type:"button",children:[o.jsx(Ob,{}),"Restart"]}),o.jsxs(se,{"aria-label":"Stop terminal",className:"border-white/15 bg-white/5 text-white hover:bg-white/10",size:"sm",variant:"outline",onClick:()=>S({type:"stop"}),type:"button",children:[o.jsx(lu,{}),"Stop"]}),s]})]}),o.jsx("div",{"aria-label":"terminal viewport",className:"min-h-0 flex-1 overflow-hidden px-3 py-0.5",children:o.jsx("div",{className:"h-full w-full",ref:i})})]})}function TF(e){const t=window.location.protocol==="https:"?"wss:":"ws:",s=encodeURIComponent(e);return`${t}//${window.location.host}/api/terminal/socket?id=${s}`}function jF(e){if(typeof e!="string")return null;try{const t=JSON.parse(e);return typeof t?.type=="string"?t:null}catch{return null}}function AF({serviceName:e,active:t}){const[s,i]=y.useState(null),[a,l]=y.useState(null),[u,h]=y.useState(!1),m=y.useRef(!1);y.useEffect(()=>{if(!t||m.current)return;m.current=!0;let g=!1;return(async()=>{try{const v=await lh({serviceName:e});g||i(v.id)}catch(v){g||l(v instanceof Error?v.message:String(v))}})(),()=>{g=!0}},[t,e]);const d=o.jsxs(se,{"aria-label":u?"Exit fullscreen terminal":"Expand terminal",className:"border-white/15 bg-white/5 text-white hover:bg-white/10",onClick:()=>h(g=>!g),size:"sm",type:"button",variant:"outline",children:[u?o.jsx(yC,{}):o.jsx(_C,{}),u?"Exit":"Expand"]}),p=a?o.jsxs("div",{className:"p-3 font-mono text-[11px] text-destructive",children:["Could not open terminal: ",a]}):s?o.jsx(i5,{active:t,sessionId:s,toolbarExtra:d}):o.jsx("div",{className:"p-3 font-mono text-[11px] text-muted-foreground",children:"Opening terminal…"});return u&&t?o.jsx(Nx,{onClose:()=>h(!1),title:`Terminal — ${e}`,children:p}):o.jsx("div",{className:le("h-[60vh] min-h-[24rem] overflow-hidden rounded-md border border-border",!t&&"hidden"),children:p})}const MF=500;function RF(e){const[t,s]=y.useState(),[i,a]=y.useState([]),[l,u]=y.useState(),[h,m]=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`),v=_=>{try{const S=JSON.parse(_.data);S.run.id!==d.current&&(d.current=S.run.id,a([])),s(S.run),S.line&&a(w=>[...w,S.line].slice(-MF))}catch{}};return g.addEventListener("status",v),g.addEventListener("output",v),()=>g.close()},[e]);const p=y.useCallback(async g=>{m(!0),u(void 0);try{await wR(e,g)}catch(v){u(v instanceof Error?v.message:String(v))}finally{m(!1)}},[e]);return{run:t,lines:i,error:l,starting:h,start:p}}const DF={running:"secondary",passed:"success",failed:"error",error:"error"},OF={running:"Running",passed:"Passed",failed:"Failed",error:"Error"};function LF({serviceName:e}){const{run:t,lines:s,error:i,starting:a,start:l}=RF(e),[u,h]=y.useState(""),m=t?.status==="running"||a,d=t?.status==="failed"||t?.status==="error";return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("form",{className:"flex items-center gap-2",onSubmit:p=>{p.preventDefault(),m||l(u.trim()||void 0)},children:[o.jsx(nt,{className:"h-7 flex-1 text-[11px]",disabled:m,onChange:p=>h(p.target.value),placeholder:"Optional test pattern (e.g. config-store)",value:u}),o.jsx(se,{disabled:m,size:"sm",type:"submit",children:m?"Running…":"Run tests"})]}),i?o.jsx("div",{className:"text-red-600",children:i}):null,t?o.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-muted-foreground",children:[o.jsx(Pe,{size:"small",variant:DF[t.status],children:OF[t.status]}),o.jsx("code",{className:"font-mono text-[11px]",children:t.command}),t.failingCount>0?o.jsxs("span",{children:["· ",t.failingCount," failing"]}):null,t.exitCode!=null?o.jsxs("span",{children:["· exit ",t.exitCode]}):null]}):o.jsx("div",{className:"text-muted-foreground",children:"No test runs yet."}),s.length>0?o.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)=>o.jsx("div",{className:le(p.stream==="stderr"&&"text-red-500"),children:p.text},g))}):null,d?o.jsxs("div",{className:"rounded border border-border bg-muted/40 p-2",children:["Failures were piped into the"," ",o.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 zF({serviceName:e,status:t,health:s,timeline:i,onRefresh:a}){const[l,u]=y.useState("metrics"),h=s?.processTree?.processes??[];return o.jsxs("div",{className:"border-t border-border bg-muted/30 px-3 py-2 text-xs",children:[o.jsxs("div",{className:"mb-2 flex gap-1",children:[o.jsx(za,{active:l==="logs",onClick:()=>u("logs"),children:"Logs"}),o.jsxs(za,{active:l==="processes",onClick:()=>u("processes"),children:["Processes ",h.length?o.jsx(Pe,{variant:"secondary",size:"small",children:h.length}):null]}),o.jsx(za,{active:l==="metrics",onClick:()=>u("metrics"),children:"Metrics"}),o.jsxs(za,{active:l==="http",onClick:()=>u("http"),children:["HTTP",t?.inspector?.enabled?o.jsx(Pe,{variant:"success",size:"small",children:"on"}):null]}),o.jsx(za,{active:l==="env",onClick:()=>u("env"),children:"Env"}),o.jsx(za,{active:l==="tests",onClick:()=>u("tests"),children:"Tests"}),o.jsx(za,{active:l==="terminal",onClick:()=>u("terminal"),children:"Terminal"})]}),l==="processes"?o.jsx(p$,{rows:h}):null,l==="metrics"?o.jsx(c$,{serviceName:e}):null,l==="http"?o.jsx(a$,{serviceName:e,status:t,timeline:i,onRefresh:a}):null,l==="env"?o.jsx(r$,{serviceName:e}):null,l==="tests"?o.jsx(LF,{serviceName:e}):null,l==="logs"?o.jsx(ZP,{serviceName:e}):null,o.jsx(AF,{active:l==="terminal",serviceName:e},e)]})}function za({active:e,onClick:t,children:s}){return o.jsx("button",{className:le("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 BF={high:"success",medium:"warning",low:"secondary"};function IF({onClose:e,onRefresh:t}){const s=Ns(),{sendToAgent:i}=Bt(),[a,l]=y.useState("url"),[u,h]=y.useState(""),[m,d]=y.useState(!1),[p,g]=y.useState(null),[v,_]=y.useState(null),[S,w]=y.useState([]),[C,E]=y.useState([]),[T,N]=y.useState(null),j=T?.kind==="docker-compose"?C.find(M=>M.composeService===T.composeService):void 0;async function R(){if(u.trim()){d(!0),g(null);try{const M=await cR(u.trim());_(M.profile),w(M.proposals),E(M.databases),N(M.proposals[0]??null),M.proposals.length===0&&g("Cloned, but couldn't detect how to run this repo. Refine with AI or add it manually."),l("review")}catch(M){g(M instanceof Error?M.message:String(M))}finally{d(!1)}}}function z(){i({prompt:`Onboard this repository and register it as a NoMoreIDE service: ${u.trim()}
|
|
167
|
+
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: ${u.trim()}`}),e()}async function D(M){if(T){d(!0),g(null);try{await uR(T,M,j),await t(),s.success(`${T.name} registered${j?" (+ database)":""}${M?" and starting":""}.`),e()}catch($){g($ instanceof Error?$.message:String($))}finally{d(!1)}}}return o.jsxs(Zn,{icon:o.jsx(pn,{}),onClose:e,size:"lg",title:"Add from GitHub",children:[a==="url"?o.jsx(PF,{url:u,busy:m,error:p,onChange:h,onScan:R,onRefine:z}):null,a==="review"&&v?o.jsx($F,{profile:v,proposals:S,selected:T,database:j,error:p,onSelect:N,onEdit:N,onBack:()=>l("url"),onRefine:z,onContinue:()=>l("install")}):null,a==="install"&&T?o.jsx(UF,{proposal:T,busy:m,error:p,onBack:()=>l("review"),onRegister:D}):null]})}function PF({url:e,busy:t,error:s,onChange:i,onScan:a,onRefine:l}){return o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"Paste a repository URL. NoMoreIDE clones it, detects how it runs, and proposes a service."}),o.jsx(nt,{autoFocus:!0,placeholder:"https://github.com/owner/repo",value:e,onChange:u=>i(u.target.value),onKeyDown:u=>{u.key==="Enter"&&!t&&a()}}),s?o.jsx("p",{className:"text-sm text-destructive",children:s}):null,o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs(se,{variant:"ghost",size:"sm",onClick:l,disabled:!e.trim(),children:[o.jsx(zi,{className:"size-3.5"}),"Refine with AI"]}),o.jsxs(se,{onClick:a,disabled:t||!e.trim(),children:[t?o.jsx(pt,{className:"size-4 animate-spin"}):o.jsx(pn,{className:"size-4"}),t?"Cloning…":"Clone & detect"]})]})]})}function $F({profile:e,proposals:t,selected:s,database:i,error:a,onSelect:l,onEdit:u,onBack:h,onRefine:m,onContinue:d}){return o.jsxs("div",{className:"flex flex-col gap-4",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[o.jsx("span",{className:"text-sm font-medium",children:e.name}),e.languages.map(p=>o.jsx(Pe,{variant:"outline",size:"small",label:p},p))]}),a?o.jsx("p",{className:"text-sm text-destructive",children:a}):null,t.length>0?o.jsxs("div",{className:"flex flex-col gap-2",children:[o.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 o.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:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"font-medium",children:p.name}),o.jsx(Pe,{variant:BF[p.confidence],size:"small",label:p.confidence})]}),o.jsx("div",{className:"mt-0.5 font-mono text-xs text-muted-foreground",children:p.kind==="docker-compose"?`compose · ${p.composeService}`:p.command}),o.jsx("div",{className:"text-[11px] text-muted-foreground",children:p.reason})]},p.name)})]}):null,s?o.jsx(HF,{proposal:s,onChange:u}):null,i?o.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:[o.jsx(Xn,{className:"size-3.5"}),o.jsxs("span",{children:["Also registers database ",o.jsx("span",{className:"font-medium",children:i.name})," (",i.engine,") so it shows in the Database tab."]})]}):null,e.envKeys.length>0?o.jsxs("div",{className:"text-xs text-muted-foreground",children:[o.jsx("span",{className:"font-medium",children:"Env from .env.example:"})," ",e.envKeys.join(", ")]}):null,e.readmeExcerpt?o.jsxs("details",{className:"rounded-md border border-border bg-muted/30 p-2 text-xs",children:[o.jsx("summary",{className:"cursor-pointer font-medium",children:"README excerpt"}),o.jsx("pre",{className:"mt-2 max-h-40 overflow-auto whitespace-pre-wrap font-mono",children:e.readmeExcerpt})]}):null,o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs(se,{variant:"ghost",size:"sm",onClick:h,children:[o.jsx(au,{className:"size-3.5"}),"Back"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(se,{variant:"outline",size:"sm",onClick:m,children:[o.jsx(zi,{className:"size-3.5"}),"Refine with AI"]}),o.jsx(se,{onClick:d,disabled:!s,children:"Continue"})]})]})]})}function HF({proposal:e,onChange:t}){return o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsx(Lc,{label:"Service name",children:o.jsx(nt,{value:e.name,onChange:s=>t({...e,name:s.target.value})})}),o.jsx(Lc,{label:"Port (optional)",children:o.jsx(nt,{value:e.port?.toString()??"",placeholder:"auto",onChange:s=>t({...e,port:s.target.value?Number(s.target.value):void 0})})}),e.kind==="docker-compose"?o.jsx(Lc,{label:"Compose service",className:"col-span-2",children:o.jsx(nt,{value:e.composeService??"",onChange:s=>t({...e,composeService:s.target.value})})}):o.jsx(Lc,{label:"Run command",className:"col-span-2",children:o.jsx(nt,{value:e.command??"",onChange:s=>t({...e,command:s.target.value})})})]})}function UF({proposal:e,busy:t,error:s,onBack:i,onRegister:a}){const[l,u]=y.useState(e.installCommand??""),[h,m]=y.useState([]),[d,p]=y.useState(!1),[g,v]=y.useState(!1),_=y.useRef(null);function S(C){m(E=>[...E,C]),queueMicrotask(()=>{const E=_.current;E&&(E.scrollTop=E.scrollHeight)})}async function w(){l.trim()&&(p(!0),v(!1),m([]),await dR({clonePath:e.cwd,command:l.trim()},{onLine:C=>S(C.text),onDone:C=>{S(C===0?"✓ install complete":`✗ install exited ${C}`),p(!1),v(C===0)},onError:C=>{S(`✗ ${C}`),p(!1)}}))}return o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsxs("div",{className:"flex items-end gap-2",children:[o.jsx(Lc,{label:"Install command (optional)",className:"flex-1",children:o.jsx(nt,{value:l,placeholder:"e.g. npm install",onChange:C=>u(C.target.value)})}),o.jsxs(se,{variant:"outline",onClick:w,disabled:d||!l.trim(),children:[d?o.jsx(pt,{className:"size-4 animate-spin"}):o.jsx(uC,{className:"size-4"}),"Install"]})]}),h.length>0?o.jsx("pre",{ref:_,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(`
|
|
168
|
+
`)}):null,s?o.jsx("p",{className:"text-sm text-destructive",children:s}):null,o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs(se,{variant:"ghost",size:"sm",onClick:i,children:[o.jsx(au,{className:"size-3.5"}),"Back"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(se,{variant:"outline",onClick:()=>a(!1),disabled:t,children:"Register only"}),o.jsxs(se,{onClick:()=>a(!0),disabled:t,children:[t?o.jsx(pt,{className:"size-4 animate-spin"}):o.jsx(eo,{className:"size-4"}),g||!l.trim()?"Register & start":"Skip install & start"]})]})]})]})}function Lc({label:e,className:t,children:s}){return o.jsxs("label",{className:`flex flex-col gap-1 text-xs ${t??""}`,children:[o.jsx("span",{className:"font-medium text-muted-foreground",children:e}),s]})}function FF({data:e,onRefresh:t,focusService:s,onServiceFocused:i}){const a=e.config.services[0]?.name??"",[l,u]=y.useState(a),[h,m]=y.useState(null),[d,p]=y.useState(!1),{sendToAgent:g,startOnboard:v}=Bt(),[_,S]=y.useState(!1),[w,C]=y.useState(!1),[E,T]=y.useState(!1),[N,j]=y.useState(!1),R=y.useRef({}),{error:z,message:D,success:M}=Ns(),$=y.useMemo(()=>new Set(e.config.bundles.flatMap(O=>O.services)),[e.config.bundles]),L=y.useMemo(()=>{const O=new Map;for(const Z of e.config.bundles)for(const ie of Z.services)O.has(ie)||O.set(ie,Z.name);return O},[e.config.bundles]),B=y.useMemo(()=>e.config.services.filter(O=>!$.has(O.name)),[e.config.services,$]),P=e.health??{},F=e.config.bundles.length>0||B.length>0;y.useEffect(()=>{!e.config.services.some(Z=>Z.name===l)&&a&&u(a)},[e.config.services,a,l]),y.useEffect(()=>{s&&e.config.services.some(O=>O.name===s)&&(u(s),i?.())},[s,e.config.services,i]);const V=y.useMemo(()=>e.config.services.find(O=>O.name===l),[e.config.services,l]),G=l?e.runtime.services[l]:void 0,I=l?P[l]:void 0;async function Y(O,Z){if(!O.services.includes(Z))try{await pR(O.name,O.services,Z),M(`Added ${Z} to ${O.name}.`),await t()}catch(ie){z(ie instanceof Error?ie.message:String(ie))}}async function X(){if(V){if(Uc(G?.state)){z(`Stop ${V.name} before deleting it.`);return}if(window.confirm(`Delete service "${V.name}"? This removes it from your config.`))try{await mR(V.name),M(`Deleted ${V.name}.`),await t()}catch(O){z(O instanceof Error?O.message:String(O))}}}async function W(O){const Z=e.config.bundles.filter(ie=>ie.services.includes(O));if(Z.length!==0)try{for(const ie of Z)await gR(ie.name,ie.services,O);D({text:`Removed ${O} from ${Z.map(ie=>ie.name).join(", ")}.`}),await t()}catch(ie){z(ie instanceof Error?ie.message:String(ie))}}y.useEffect(()=>{const O=Object.fromEntries(e.config.services.map(ie=>[ie.name,e.runtime.services[ie.name]?.state??"stopped"])),Z=R.current;if(Object.keys(Z).length){const ie=new Map,de=new Map;for(const fe of e.config.services){const pe=O[fe.name],Se=Z[fe.name];if(!Se||Se===pe)continue;const Le=e.runtime.services[fe.name],ve=L.get(fe.name);if(ve){const Ge=ie.get(ve)??new Map;if(Ge.set(pe,(Ge.get(pe)??0)+1),ie.set(ve,Ge),pe==="exited"){const ge=de.get(ve)??[];ge.push(Le?.exitCode),de.set(ve,ge)}continue}if(pe==="running")M(`${fe.name} is running.`);else if(pe==="stopped")D({text:`${fe.name} stopped.`});else if(pe==="starting")D({text:`${fe.name} is starting.`});else if(pe==="exited"){const Ge=Le?.exitCode===void 0||Le.exitCode===null?"":` with code ${Le.exitCode}`;z(`${fe.name} exited${Ge}.`)}}for(const[fe,pe]of ie)VF({exitCodes:de.get(fe)??[],groupName:fe,showErrorToast:z,showMessageToast:D,showSuccessToast:M,transitions:pe})}R.current=O},[e.config.services,e.runtime.services,L,z,D,M]);const ee=e.config.services.length>0;return o.jsxs(o.Fragment,{children:[ee?o.jsxs("div",{className:le("grid h-full min-h-0 overflow-hidden bg-card/85",w?"lg:grid-cols-[320px_minmax(0,1fr)]":"lg:grid-cols-[320px_minmax(0,1fr)_340px]"),children:[o.jsx("div",{className:"min-h-0 min-w-0 overflow-auto border-r border-border",children:o.jsxs(fi,{className:"min-w-0 rounded-none border-0 border-b border-border bg-transparent",children:[o.jsx(mi,{className:"border-b border-border px-3 py-2",children:o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx(pi,{className:"text-sm",children:"Services"}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsxs(se,{"aria-haspopup":"dialog",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>S(!0),size:"sm",type:"button",variant:"outline",children:[o.jsx(kC,{className:"size-3.5"}),"Logs"]}),o.jsx(qF,{onCreateGroup:()=>m("group"),onCreateService:()=>m("service"),onOnboardRepo:()=>p(!0),onOnboardWithAi:v,canGroupWithAi:B.length>1,onCreateWithAi:()=>g({prompt:pw,source:{type:"service-setup",label:"Add a service"},label:"Help me add a new service, one step at a time."}),onGroupWithAi:()=>g({prompt:sz(B),source:{type:"group-services",label:"Group services"},label:"Propose how to group my ungrouped services."})})]})]})}),o.jsx(gi,{className:"p-0",children:F?o.jsxs("div",{className:"divide-y divide-border",children:[e.config.bundles.map(O=>o.jsx(aB,{group:O,onRefresh:t,ports:e.ports,allServices:e.config.services,health:P,services:e.config.services.filter(Z=>O.services.includes(Z.name)),statuses:e.runtime.services,timeline:e.timeline,selectedService:l,onSelectService:u,onDropService:Z=>{Y(O,Z)}},O.name)),B.length?o.jsxs("div",{className:le("transition-colors",N&&"bg-primary/5 outline-dashed outline-2 -outline-offset-2 outline-primary/60"),onDragOver:O=>{O.dataTransfer.types.includes(Qc)&&(O.preventDefault(),O.dataTransfer.dropEffect="move",j(!0))},onDragLeave:()=>j(!1),onDrop:O=>{O.preventDefault(),j(!1);const Z=O.dataTransfer.getData(Qc);Z&&W(Z)},children:[o.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:[o.jsx("span",{children:"Ungrouped"}),o.jsx("span",{className:"text-muted-foreground/80",children:B.length})]}),o.jsx("div",{className:"divide-y divide-border",children:B.map(O=>o.jsx(YE,{service:O,status:e.runtime.services[O.name],health:P[O.name],ports:e.ports,onRefresh:t,timeline:e.timeline,selected:l===O.name,onSelect:()=>u(O.name)},O.name))})]}):null]}):o.jsx(qh,{label:"No services registered yet."})})]})}),o.jsx("div",{className:"min-h-0 min-w-0 overflow-auto",children:V?o.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[o.jsxs("div",{className:"shrink-0 space-y-2 border-b border-border bg-background/60 px-4 py-3",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.jsx("h2",{className:"min-w-0 truncate text-base font-semibold",children:V.name}),o.jsx(px,{state:G?.state??"stopped"}),o.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1.5",children:[(()=>{const O=G?.url??(V.port?lB(V.port):void 0);return O?o.jsx(il,{label:`Open ${O}`,children:o.jsx(se,{"aria-label":"Open in browser",className:"size-7",onClick:()=>window.open(O,"_blank","noopener,noreferrer"),size:"icon",type:"button",variant:"outline",children:o.jsx(aa,{})})}):null})(),I?.agentContext&&V?o.jsx(il,{label:"Debug this service with AI",children:o.jsx(se,{"aria-label":"Debug this service with AI",className:"size-7",onClick:()=>g({prompt:nz({service:V.name,context:I.agentContext}),source:{type:"service-debug",label:V.name},label:`Debug \`${V.name}\` with its current context.`}),size:"icon",type:"button",variant:"outline",children:o.jsx(Gt,{className:"size-3.5"})})}):null,o.jsx(mx,{active:Uc(G?.state),baseUrl:`/api/services/${encodeURIComponent(V.name)}`,compact:!0,targetLabel:V.name,onRefresh:t}),o.jsx(c3,{className:"size-7 border border-border bg-background opacity-100 hover:border-foreground/30",items:[{icon:o.jsx(Gc,{className:"size-3.5"}),label:"Edit service",onSelect:()=>T(!0)},...Uc(G?.state)?[]:[{icon:o.jsx(ua,{className:"size-3.5 text-destructive"}),label:"Delete service",onSelect:()=>{X()}}]],label:`More actions for ${V.name}`}),o.jsx(il,{label:w?"Show Ports & Timeline":"Hide Ports & Timeline",side:"left",children:o.jsx(se,{"aria-label":w?"Show Ports & Timeline":"Hide Ports & Timeline",className:"size-7",onClick:()=>C(O=>!O),size:"icon",type:"button",variant:"ghost",children:w?o.jsx(UA,{}):o.jsx(Li,{})})})]})]}),V.command?o.jsxs("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:V.command,children:["$ ",V.command]}):null,V.cwd?o.jsx("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:V.cwd,children:V.cwd}):null,o.jsx(zP,{health:I})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:o.jsx(zF,{serviceName:V.name,status:G,health:I,timeline:e.timeline??[],onRefresh:t},V.name)})]}):o.jsx(qh,{label:"Select a service to see details."})}),w?null:o.jsxs("div",{className:"min-h-0 overflow-auto border-l border-border",children:[o.jsx(HP,{ports:e.ports}),o.jsx(NP,{events:e.timeline??[]})]})]}):o.jsx(LP,{onOnboardRepo:()=>p(!0),onOnboardWithAi:v,onCreateService:()=>m("service"),onCreateWithAi:()=>g({prompt:pw,source:{type:"service-setup",label:"Add a service"},label:"Help me add a new service, one step at a time."})}),E&&V?o.jsx(Zn,{icon:o.jsx(Gc,{}),onClose:()=>T(!1),size:"lg",title:`Edit Service — ${V.name}`,children:o.jsx(ww,{cwd:e.cwd,initialService:V,onRefresh:t,onSaved:()=>T(!1)})}):null,h?o.jsx(Zn,{icon:h==="service"?o.jsx(Cs,{}):o.jsx(aC,{}),onClose:()=>m(null),size:h==="service"?"lg":"md",title:h==="service"?"Add Service":"Create Group",children:h==="service"?o.jsx(ww,{cwd:e.cwd,onRefresh:t,onSaved:()=>m(null)}):o.jsx(KE,{services:B,onRefresh:t,onSaved:()=>m(null)})}):null,d?o.jsx(IF,{onClose:()=>p(!1),onRefresh:t}):null,_?o.jsx(e$,{initialService:l||void 0,onClose:()=>S(!1),services:e.config.services.map(O=>O.name)}):null]})}function qF({onCreateService:e,onCreateGroup:t,onCreateWithAi:s,onGroupWithAi:i,canGroupWithAi:a,onOnboardRepo:l,onOnboardWithAi:u}){const[h,m]=y.useState(!1);function d(p){m(!1),p()}return o.jsxs("div",{className:"relative",children:[o.jsx(il,{label:"Add",side:"bottom",children:o.jsx(se,{"aria-expanded":h,"aria-haspopup":"menu","aria-label":"Add service or group",className:"size-7",onClick:()=>m(p=>!p),size:"icon",type:"button",variant:"ghost",children:o.jsx(Cs,{})})}),h?o.jsxs(o.Fragment,{children:[o.jsx("button",{"aria-hidden":!0,className:"fixed inset-0 z-[40] cursor-default",onClick:()=>m(!1),tabIndex:-1,type:"button"}),o.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:[o.jsxs("div",{className:"group flex items-stretch",children:[o.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:[o.jsx(Cs,{}),"Create Service"]}),o.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:[o.jsx(Gt,{className:"size-3.5 shrink-0"}),"AI"]})]}),o.jsxs("div",{className:"group flex items-stretch",children:[o.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:[o.jsx(aC,{}),"Create Group"]}),a?o.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:[o.jsx(Gt,{className:"size-3.5 shrink-0"}),"AI"]}):null]}),o.jsxs("div",{className:"group flex items-stretch",children:[o.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:[o.jsx(pn,{}),"Add from GitHub"]}),o.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(u),role:"menuitem",title:"Onboard with AI — the agent clones, detects and runs it for you",type:"button",children:[o.jsx(Gt,{className:"size-3.5 shrink-0"}),"AI"]})]})]})]}):null]})}function VF({exitCodes:e,groupName:t,showErrorToast:s,showMessageToast:i,showSuccessToast:a,transitions:l}){if(l.size===1){const[m]=l.keys();if(m==="running")a(`${t} group is running.`);else if(m==="stopped")i({text:`${t} group stopped.`});else if(m==="starting")i({text:`${t} group is starting.`});else if(m==="exited"){const d=e.filter(g=>g!=null),p=d.length?` with code ${d.join(", ")}`:"";s(`${t} group exited${p}.`)}return}const u=[...l.entries()].map(([m,d])=>`${d} ${m}`).join(", "),h=`${t} group updated: ${u}.`;l.has("exited")?s(h):i({text:h})}function GF({data:e,onOpenService:t}){const s=y.useMemo(()=>WF(e),[e]);return s.length?o.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:[o.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 font-mono text-[10px] uppercase tracking-wider text-muted-foreground",children:[o.jsx(qa,{className:"size-3"}),"Running"]}),o.jsx("div",{className:"flex min-w-0 items-center gap-2",children:s.map(i=>o.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:[o.jsx("span",{className:le("size-2 shrink-0 rounded-full",YF(i.tone))}),o.jsx("span",{className:"max-w-40 truncate font-medium text-foreground",children:i.name}),i.port?o.jsxs("span",{className:"text-muted-foreground",children:[":",i.port]}):null,i.uptime?o.jsxs("span",{className:"text-muted-foreground/70",children:["↑",i.uptime]}):null]},i.name))})]}):null}function WF(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:KF(s,e.health[s.name]),port:t.get(s.name)??XF(s.url),uptime:s.state==="running"?ZF(s.startedAt):"starting…",url:s.url})).sort((s,i)=>s.name.localeCompare(i.name))}function KF(e,t){return e.state==="starting"?"starting":t?.status==="healthy"?"healthy":t?.status==="warning"?"warning":t?.status==="unhealthy"?"unhealthy":"healthy"}function YF(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 XF(e){if(e)try{const t=new URL(e).port;return t?Number(t):void 0}catch{return}}function ZF(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 QF(){const[e,t]=y.useState([]),[s,i]=y.useState(null),[a,l]=y.useState(!1);y.useEffect(()=>{let m=!1;return(async()=>{let d=await kR().catch(()=>[]);if(d.length===0){const p=await lh().catch(()=>null);d=p?[p]:[]}m||(t(d),i(d[0]?.id??null))})(),()=>{m=!0}},[]);const u=y.useCallback(async()=>{l(!0);try{const m=await lh();t(d=>[...d,m]),i(m.id)}finally{l(!1)}},[]),h=y.useCallback(async m=>{l(!0);try{await CR(m);const d=e.findIndex(g=>g.id===m),p=e.filter(g=>g.id!==m);if(p.length===0){const g=await lh();t([g]),i(g.id);return}if(t(p),s===m){const g=p[Math.min(d,p.length-1)];i(g.id)}}finally{l(!1)}},[e,s]);return o.jsxs("section",{className:"flex h-full min-h-0 flex-col bg-[#090909] text-white",children:[o.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:[e.map((m,d)=>{const p=m.label??`Terminal ${d+1}`;return o.jsxs("div",{className:le("group flex items-center gap-1 rounded-md border border-transparent px-2 py-1 text-xs",m.id===s?"border-white/15 bg-white/10 text-white":"text-white/60 hover:bg-white/5"),children:[o.jsx("button",{"aria-selected":m.id===s,className:"max-w-[160px] truncate font-medium",onClick:()=>i(m.id),role:"tab",type:"button",children:p}),o.jsx("button",{"aria-label":`Close ${p}`,className:"rounded p-0.5 text-white/40 opacity-0 transition hover:bg-white/10 hover:text-white group-hover:opacity-100",disabled:a,onClick:()=>{h(m.id)},type:"button",children:o.jsx(Gs,{className:"size-3"})})]},m.id)}),o.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:a,onClick:()=>{u()},type:"button",children:o.jsx(Cs,{className:"size-4"})})]}),o.jsx("div",{className:"relative min-h-0 flex-1",children:e.length===0?o.jsx("div",{className:"flex h-full items-center justify-center font-mono text-[11px] text-white/40",children:"Starting terminal…"}):e.map(m=>o.jsx("div",{className:"absolute inset-0",children:o.jsx(i5,{active:m.id===s,sessionId:m.id})},m.id))})]})}const JF=800;function Bx({activeHunkIndex:e=0,diff:t}){const s=tq(t),i=y.useRef(null),a=y.useRef([]),[l,u]=y.useState(!1),h=y.useMemo(()=>s.reduce((d,p)=>Math.max(d,p.content.length),0),[s]),m=h>JF;if(y.useEffect(()=>{u(!1)},[t]),y.useEffect(()=>{if(m&&!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,m,l]),m&&!l){const d=s.filter(g=>g.kind==="add").length,p=s.filter(g=>g.kind==="delete").length;return o.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-card p-6",children:o.jsxs("div",{className:"max-w-sm space-y-3 text-center",children:[o.jsx("p",{className:"text-[13px] font-medium text-foreground",children:"Diff hidden for this data file"}),o.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."]}),o.jsxs("p",{className:"font-mono text-[11px]",children:[o.jsxs("span",{className:"text-emerald-700",children:["+",d]})," ",o.jsxs("span",{className:"text-red-700",children:["-",p]})," lines changed"]}),o.jsx(se,{onClick:()=>u(!0),size:"sm",type:"button",variant:"outline",children:"Show diff anyway"})]})})}return o.jsx("div",{className:"absolute inset-0 overflow-auto bg-card text-xs leading-6 text-foreground",ref:i,children:o.jsx("div",{className:"min-w-full font-mono",children:s.map((d,p)=>o.jsxs("div",{className:le("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",P2(s,p)&&d.hunkIndex===e&&"outline outline-1 outline-offset-[-1px] outline-primary/35"),ref:d.hunkIndex!==null&&P2(s,p)?g=>{a.current[d.hunkIndex??0]=g}:void 0,children:[o.jsx($2,{value:d.oldLine}),o.jsx($2,{value:d.newLine}),o.jsx("span",{className:"min-w-0 whitespace-pre-wrap break-all px-2",children:d.content||" "})]},`${p}-${d.content}`))})})}function eq(e){return e.split(`
|
|
169
|
+
`).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 tq(e){const t=sq(e);return t.some(s=>s.kind==="hunk")?t.filter(s=>s.kind!=="meta"&&s.kind!=="hunk"):t}function sq(e){let t=null,s=null,i=null;return e.split(`
|
|
170
|
+
`).map(a=>{if(nq(a))return t=null,s=null,i=null,{content:a,hunkIndex:i,kind:"meta",oldLine:null,newLine:null};if(a.startsWith("@@")){const u=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(a);return u&&(t=Number(u[1]),s=Number(u[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 u={content:a,hunkIndex:i,kind:"add",oldLine:null,newLine:s};return s+=1,u}if(a.startsWith("-")&&!a.startsWith("---")){const u={content:a,hunkIndex:i,kind:"delete",oldLine:t,newLine:null};return t+=1,u}const l={content:a,hunkIndex:i,kind:"context",oldLine:t,newLine:s};return t+=1,s+=1,l})}function P2(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 nq(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 $2({value:e}){return o.jsx("span",{className:le("select-none border-r border-border/70 px-2 text-right text-muted-foreground",e===null&&"text-transparent"),children:e??"-"})}function r5({branch:e}){return o.jsx("span",{className:"min-w-0 max-w-40",title:e,children:o.jsx(Pe,{className:"w-full max-w-full shadow-none",variant:"outline",children:e})})}function iq({branch:e,error:t,files:s,selectedFile:i,onSelectFile:a,root:l,staging:u}){const h=y.useMemo(()=>lq(s).filter(p=>p.files.length),[s]),[m,d]=y.useState({staged:!1,unstaged:!1,untracked:!1});return o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[o.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:[o.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[12px] font-semibold tracking-tight",children:[o.jsx(pn,{className:"size-3.5"}),o.jsx("span",{className:"truncate",children:"Changes"})]}),o.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[e?o.jsx(r5,{branch:e}):null,o.jsx(Pe,{variant:"secondary",children:s.length})]})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-auto py-1",children:h.length?h.map(p=>o.jsx(rq,{collapsed:m[p.id],group:p,onSelectFile:a,onToggle:()=>d(g=>({...g,[p.id]:!g[p.id]})),root:l,selectedFile:i,staging:u},p.id)):o.jsx(Qe,{variant:"muted",className:"m-3 text-center",children:t??"No changed files."})})]})}function rq({collapsed:e,group:t,onSelectFile:s,onToggle:i,root:a,selectedFile:l,staging:u}){const h=e?Li:Mn,m=t.files.map(p=>p.path),d=u?t.id==="staged"?{label:"Unstage all",run:()=>u.onUnstage(m)}:{label:"Stage all",run:()=>u.onStage(m)}:null;return o.jsxs("section",{className:"border-b border-border last:border-b-0",children:[o.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:[o.jsxs("button",{className:"flex min-w-0 flex-1 items-center gap-1.5 text-left",onClick:i,type:"button",children:[o.jsx(h,{className:"size-3.5"}),o.jsx("span",{className:"truncate",children:t.label})]}),d?o.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:u?.busy,onClick:d.run,type:"button",children:d.label}):null,o.jsx(Pe,{className:"min-w-6 justify-center font-mono shadow-none",size:"small",variant:"outline",children:t.files.length})]}),e?null:o.jsx("div",{children:t.files.map(p=>o.jsx(aq,{active:l===p.path,file:p,group:t.id,onClick:()=>s(p.path),root:a,staging:u},p.path))})]})}function aq({active:e,file:t,group:s,onClick:i,root:a,staging:l}){const u=t.path.split("/").pop()||t.path,h=t.path.split("/").slice(0,-1).join("/"),m=a?WE(bu(a,t.path)):{},d=s==="staged";return o.jsxs("div",{className:le("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:[o.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",...m,children:[o.jsx(gx,{path:t.path}),o.jsxs("span",{className:"flex min-w-0 flex-1 items-baseline gap-1.5 truncate",children:[o.jsx("span",{"data-testid":"changed-file-name",className:"shrink-0 truncate",children:u}),h?o.jsx("span",{"data-testid":"changed-file-dir",className:"min-w-0 truncate text-muted-foreground",children:h}):null]})]}),l?o.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?o.jsx(gM,{className:"size-3.5"}):o.jsx(Cs,{className:"size-3.5"})}):null,o.jsx("span",{className:le("ml-1 shrink-0 font-mono text-[10px] font-semibold",s==="untracked"&&"text-amber-700",s==="staged"&&"text-emerald-700",s==="unstaged"&&"text-zinc-800"),children:oq(t,s)})]})}function oq(e,t){return t==="untracked"?"?":t==="staged"?e.index.trim():e.workingTree.trim()}function lq(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 cq({branch:e,files:t,onDone:s}){const{sendToAgent:i}=Bt(),[a,l]=y.useState(""),[u,h]=y.useState(null),[m,d]=y.useState(null),[p,g]=y.useState(null),v=y.useMemo(()=>t.filter(C=>C.index.trim()&&C.index!=="?").map(C=>C.path),[t]),_=v.length>0&&a.trim().length>0&&u===null;async function S(C,E){h(C),d(null),g(null);try{if(await zC(a.trim()),E){const T=await of();g(`Committed and pushed ${T.branch}.`)}else g("Committed staged changes.");l(""),s()}catch(T){d(T instanceof Error?T.message:String(T))}finally{h(null)}}function w(){i({prompt:Q9({branch:e,stagedFiles:v}),source:{type:"git-commit",label:"commit message"},mode:"send",label:"Suggest a commit message"})}return o.jsxs("div",{className:"shrink-0 space-y-2 border-t border-border bg-card/95 p-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-tight text-muted-foreground",children:"Commit"}),o.jsxs("span",{className:"flex items-center gap-1.5",children:[o.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[v.length," staged"]}),o.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:w,title:"Ask the agent to draft a commit message from the staged diff",type:"button",children:[o.jsx(Gt,{className:"size-3.5"}),"AI message"]})]})]}),o.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:C=>{l(C.target.value),d(null),g(null)},placeholder:v.length?"Commit message…":"Stage files to commit",value:a}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs(se,{disabled:!_,onClick:()=>{S("commit",!1)},size:"sm",type:"button",variant:"outline",children:[u==="commit"?o.jsx(pt,{className:"size-3.5 animate-spin"}):o.jsx(hi,{className:"size-3.5"}),"Commit"]}),o.jsxs(se,{disabled:!_,onClick:()=>{S("push",!0)},size:"sm",type:"button",children:[u==="push"?o.jsx(pt,{className:"size-3.5 animate-spin"}):o.jsx(Lb,{className:"size-3.5"}),"Commit & push"]})]}),m?o.jsx(Qe,{className:"px-2.5 py-1.5 text-[11px]",variant:"destructive",children:m}):p?o.jsx(Qe,{className:"px-2.5 py-1.5 text-[11px]",variant:"muted",children:p}):null]})}function uq(e){const t={name:"",path:"",children:[],isFile:!1},s=new Map;s.set("",t);const i=[...e].sort();for(const l of i){const u=l.split("/");let h="";for(let m=0;m<u.length;m+=1){const d=u[m],p=m===u.length-1,g=h?`${h}/${d}`:d;let v=s.get(g);v||(v={name:d,path:g,children:[],isFile:p},s.set(g,v),s.get(h)?.children.push(v)),h=g}}const a=l=>{l.children.sort((u,h)=>u.isFile!==h.isFile?u.isFile?1:-1:u.name.localeCompare(h.name)),l.children.forEach(a)};return a(t),t}function H2(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 U2({defaultExpandAll:e=!1,paths:t,status:s,selectedFile:i,onSelectFile:a,branch:l,emptyMessage:u="No tracked files.",root:h,title:m="Files"}){const d=y.useMemo(()=>uq(t),[t]),p=y.useMemo(()=>H2(d,e),[e,d]),g=y.useMemo(()=>H2(d,!0),[d]),v=Math.max(0,Object.keys(g).length-1),_=y.useMemo(()=>{const R=new Map;for(const z of s)R.set(z.path,z);return R},[s]),[S,w]=y.useState(p),[C,E]=y.useState(!1);y.useEffect(()=>{C||d.children.length===0||(w(p),E(!0))},[p,C,d.children.length]);function T(R){w(z=>({...z,[R]:!z[R]}))}function N(){w(g)}function j(){w({"":!0})}return o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[o.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:[o.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[12px] font-semibold tracking-tight",children:[o.jsx(Ja,{className:"size-3.5"}),o.jsx("span",{className:"truncate",children:m})]}),o.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[v>0?o.jsxs("span",{className:"flex items-center gap-0.5",children:[o.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:N,title:"Expand all folders",type:"button",children:o.jsx(J4,{className:"size-3.5"})}),o.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:j,title:"Collapse all folders",type:"button",children:o.jsx(Z4,{className:"size-3.5"})})]}):null,l?o.jsx(r5,{branch:l}):null,o.jsx(Pe,{variant:"secondary",children:t.length})]})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-auto py-1",children:d.children.length===0?o.jsx(Qe,{variant:"muted",className:"m-3 text-center",children:u}):d.children.map(R=>o.jsx(a5,{depth:0,expanded:S,node:R,onSelectFile:a,onToggle:T,root:h,selectedFile:i,statusByPath:_},R.path))})]})}function a5({depth:e,expanded:t,node:s,onSelectFile:i,onToggle:a,root:l,selectedFile:u,statusByPath:h}){const m=t[s.path]??!1,d=6+e*12,p=l?WE(bu(l,s.path)):{};if(s.isFile){const _=h.get(s.path),S=u===s.path;return o.jsxs("button",{className:le("flex w-full items-center gap-1.5 px-1 py-0.5 text-left text-[12px] hover:bg-muted",S&&"bg-muted font-medium"),onClick:()=>i(s.path),style:{paddingLeft:d},type:"button",...p,children:[o.jsx(gx,{path:s.path}),o.jsx("span",{className:"min-w-0 flex-1 truncate",children:s.name}),_?o.jsx(dq,{file:_}):null]})}const g=m?Mn:Li,v=m?rf:Ja;return o.jsxs("div",{children:[o.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:[o.jsx(g,{className:"size-3.5 shrink-0 text-muted-foreground"}),o.jsx(v,{className:"size-3.5 shrink-0 text-amber-600"}),o.jsx("span",{className:"min-w-0 flex-1 truncate",children:s.name})]}),m?s.children.map(_=>o.jsx(a5,{depth:e+1,expanded:t,node:_,onSelectFile:i,onToggle:a,root:l,selectedFile:u,statusByPath:h},_.path)):null]})}function dq({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":t==="?"?"text-amber-700":"text-zinc-700";return o.jsx("span",{className:le("ml-1 shrink-0 font-mono text-[10px] font-semibold",s),children:t})}const hq="modulepreload",fq=function(e){return"/"+e},F2={},mq=function(t,s,i){let a=Promise.resolve();if(s&&s.length>0){let m=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 u=document.querySelector("meta[property=csp-nonce]"),h=u?.nonce||u?.getAttribute("nonce");a=m(s.map(d=>{if(d=fq(d),d in F2)return;F2[d]=!0;const p=d.endsWith(".css"),g=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${g}`))return;const v=document.createElement("link");if(v.rel=p?"stylesheet":hq,p||(v.as="script"),v.crossOrigin="",v.href=d,h&&v.setAttribute("nonce",h),document.head.appendChild(v),p)return new Promise((_,S)=>{v.addEventListener("load",_),v.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${d}`)))})}))}function l(u){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=u,window.dispatchEvent(h),!h.defaultPrevented)throw u}return a.then(u=>{for(const h of u||[])h.status==="rejected"&&l(h.reason);return t().catch(l)})};var mg,q2;function pq(){if(q2)return mg;q2=1;function e(U){return U instanceof Map?U.clear=U.delete=U.set=function(){throw new Error("map is read-only")}:U instanceof Set&&(U.add=U.clear=U.delete=function(){throw new Error("set is read-only")}),Object.freeze(U),Object.getOwnPropertyNames(U).forEach(ae=>{const ye=U[ae],Fe=typeof ye;(Fe==="object"||Fe==="function")&&!Object.isFrozen(ye)&&e(ye)}),U}class t{constructor(ae){ae.data===void 0&&(ae.data={}),this.data=ae.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function s(U){return U.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function i(U,...ae){const ye=Object.create(null);for(const Fe in U)ye[Fe]=U[Fe];return ae.forEach(function(Fe){for(const jt in Fe)ye[jt]=Fe[jt]}),ye}const a="</span>",l=U=>!!U.scope,u=(U,{prefix:ae})=>{if(U.startsWith("language:"))return U.replace("language:","language-");if(U.includes(".")){const ye=U.split(".");return[`${ae}${ye.shift()}`,...ye.map((Fe,jt)=>`${Fe}${"_".repeat(jt+1)}`)].join(" ")}return`${ae}${U}`};class h{constructor(ae,ye){this.buffer="",this.classPrefix=ye.classPrefix,ae.walk(this)}addText(ae){this.buffer+=s(ae)}openNode(ae){if(!l(ae))return;const ye=u(ae.scope,{prefix:this.classPrefix});this.span(ye)}closeNode(ae){l(ae)&&(this.buffer+=a)}value(){return this.buffer}span(ae){this.buffer+=`<span class="${ae}">`}}const m=(U={})=>{const ae={children:[]};return Object.assign(ae,U),ae};class d{constructor(){this.rootNode=m(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(ae){this.top.children.push(ae)}openNode(ae){const ye=m({scope:ae});this.add(ye),this.stack.push(ye)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(ae){return this.constructor._walk(ae,this.rootNode)}static _walk(ae,ye){return typeof ye=="string"?ae.addText(ye):ye.children&&(ae.openNode(ye),ye.children.forEach(Fe=>this._walk(ae,Fe)),ae.closeNode(ye)),ae}static _collapse(ae){typeof ae!="string"&&ae.children&&(ae.children.every(ye=>typeof ye=="string")?ae.children=[ae.children.join("")]:ae.children.forEach(ye=>{d._collapse(ye)}))}}class p extends d{constructor(ae){super(),this.options=ae}addText(ae){ae!==""&&this.add(ae)}startScope(ae){this.openNode(ae)}endScope(){this.closeNode()}__addSublanguage(ae,ye){const Fe=ae.root;ye&&(Fe.scope=`language:${ye}`),this.add(Fe)}toHTML(){return new h(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function g(U){return U?typeof U=="string"?U:U.source:null}function v(U){return w("(?=",U,")")}function _(U){return w("(?:",U,")*")}function S(U){return w("(?:",U,")?")}function w(...U){return U.map(ye=>g(ye)).join("")}function C(U){const ae=U[U.length-1];return typeof ae=="object"&&ae.constructor===Object?(U.splice(U.length-1,1),ae):{}}function E(...U){return"("+(C(U).capture?"":"?:")+U.map(Fe=>g(Fe)).join("|")+")"}function T(U){return new RegExp(U.toString()+"|").exec("").length-1}function N(U,ae){const ye=U&&U.exec(ae);return ye&&ye.index===0}const j=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function R(U,{joinWith:ae}){let ye=0;return U.map(Fe=>{ye+=1;const jt=ye;let Ct=g(Fe),Me="";for(;Ct.length>0;){const ke=j.exec(Ct);if(!ke){Me+=Ct;break}Me+=Ct.substring(0,ke.index),Ct=Ct.substring(ke.index+ke[0].length),ke[0][0]==="\\"&&ke[1]?Me+="\\"+String(Number(ke[1])+jt):(Me+=ke[0],ke[0]==="("&&ye++)}return Me}).map(Fe=>`(${Fe})`).join(ae)}const z=/\b\B/,D="[a-zA-Z]\\w*",M="[a-zA-Z_]\\w*",$="\\b\\d+(\\.\\d+)?",L="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",B="\\b(0b[01]+)",P="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",F=(U={})=>{const ae=/^#![ ]*\//;return U.binary&&(U.begin=w(ae,/.*\b/,U.binary,/\b.*/)),i({scope:"meta",begin:ae,end:/$/,relevance:0,"on:begin":(ye,Fe)=>{ye.index!==0&&Fe.ignoreMatch()}},U)},V={begin:"\\\\[\\s\\S]",relevance:0},G={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/},X=function(U,ae,ye={}){const Fe=i({scope:"comment",begin:U,end:ae,contains:[]},ye);Fe.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 jt=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 Fe.contains.push({begin:w(/[ ]+/,"(",jt,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Fe},W=X("//","$"),ee=X("/\\*","\\*/"),O=X("#","$"),Z={scope:"number",begin:$,relevance:0},ie={scope:"number",begin:L,relevance:0},de={scope:"number",begin:B,relevance:0},fe={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[V,{begin:/\[/,end:/\]/,relevance:0,contains:[V]}]},pe={scope:"title",begin:D,relevance:0},Se={scope:"title",begin:M,relevance:0},Le={begin:"\\.\\s*"+M,relevance:0};var Ge=Object.freeze({__proto__:null,APOS_STRING_MODE:G,BACKSLASH_ESCAPE:V,BINARY_NUMBER_MODE:de,BINARY_NUMBER_RE:B,COMMENT:X,C_BLOCK_COMMENT_MODE:ee,C_LINE_COMMENT_MODE:W,C_NUMBER_MODE:ie,C_NUMBER_RE:L,END_SAME_AS_BEGIN:function(U){return Object.assign(U,{"on:begin":(ae,ye)=>{ye.data._beginMatch=ae[1]},"on:end":(ae,ye)=>{ye.data._beginMatch!==ae[1]&&ye.ignoreMatch()}})},HASH_COMMENT_MODE:O,IDENT_RE:D,MATCH_NOTHING_RE:z,METHOD_GUARD:Le,NUMBER_MODE:Z,NUMBER_RE:$,PHRASAL_WORDS_MODE:Y,QUOTE_STRING_MODE:I,REGEXP_MODE:fe,RE_STARTERS_RE:P,SHEBANG:F,TITLE_MODE:pe,UNDERSCORE_IDENT_RE:M,UNDERSCORE_TITLE_MODE:Se});function ge(U,ae){U.input[U.index-1]==="."&&ae.ignoreMatch()}function Te(U,ae){U.className!==void 0&&(U.scope=U.className,delete U.className)}function Ae(U,ae){ae&&U.beginKeywords&&(U.begin="\\b("+U.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",U.__beforeBegin=ge,U.keywords=U.keywords||U.beginKeywords,delete U.beginKeywords,U.relevance===void 0&&(U.relevance=0))}function It(U,ae){Array.isArray(U.illegal)&&(U.illegal=E(...U.illegal))}function Pi(U,ae){if(U.match){if(U.begin||U.end)throw new Error("begin & end are not supported with match");U.begin=U.match,delete U.match}}function ti(U,ae){U.relevance===void 0&&(U.relevance=1)}const vr=(U,ae)=>{if(!U.beforeMatch)return;if(U.starts)throw new Error("beforeMatch cannot be used with starts");const ye=Object.assign({},U);Object.keys(U).forEach(Fe=>{delete U[Fe]}),U.keywords=ye.keywords,U.begin=w(ye.beforeMatch,v(ye.begin)),U.starts={relevance:0,contains:[Object.assign(ye,{endsParent:!0})]},U.relevance=0,delete ye.beforeMatch},$i=["of","and","for","in","not","or","if","then","parent","list","value"],Hi="keyword";function _e(U,ae,ye=Hi){const Fe=Object.create(null);return typeof U=="string"?jt(ye,U.split(" ")):Array.isArray(U)?jt(ye,U):Object.keys(U).forEach(function(Ct){Object.assign(Fe,_e(U[Ct],ae,Ct))}),Fe;function jt(Ct,Me){ae&&(Me=Me.map(ke=>ke.toLowerCase())),Me.forEach(function(ke){const Ue=ke.split("|");Fe[Ue[0]]=[Ct,ht(Ue[0],Ue[1])]})}}function ht(U,ae){return ae?Number(ae):gn(U)?0:1}function gn(U){return $i.includes(U.toLowerCase())}const Ts={},gt=U=>{console.error(U)},si=(U,...ae)=>{console.log(`WARN: ${U}`,...ae)},ds=(U,ae)=>{Ts[`${U}/${ae}`]||(console.log(`Deprecated as of ${U}. ${ae}`),Ts[`${U}/${ae}`]=!0)},Ui=new Error;function Fi(U,ae,{key:ye}){let Fe=0;const jt=U[ye],Ct={},Me={};for(let ke=1;ke<=ae.length;ke++)Me[ke+Fe]=jt[ke],Ct[ke+Fe]=!0,Fe+=T(ae[ke-1]);U[ye]=Me,U[ye]._emit=Ct,U[ye]._multi=!0}function io(U){if(Array.isArray(U.begin)){if(U.skip||U.excludeBegin||U.returnBegin)throw gt("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Ui;if(typeof U.beginScope!="object"||U.beginScope===null)throw gt("beginScope must be object"),Ui;Fi(U,U.begin,{key:"beginScope"}),U.begin=R(U.begin,{joinWith:""})}}function _r(U){if(Array.isArray(U.end)){if(U.skip||U.excludeEnd||U.returnEnd)throw gt("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Ui;if(typeof U.endScope!="object"||U.endScope===null)throw gt("endScope must be object"),Ui;Fi(U,U.end,{key:"endScope"}),U.end=R(U.end,{joinWith:""})}}function xl(U){U.scope&&typeof U.scope=="object"&&U.scope!==null&&(U.beginScope=U.scope,delete U.scope)}function ro(U){xl(U),typeof U.beginScope=="string"&&(U.beginScope={_wrap:U.beginScope}),typeof U.endScope=="string"&&(U.endScope={_wrap:U.endScope}),io(U),_r(U)}function qi(U){function ae(Me,ke){return new RegExp(g(Me),"m"+(U.case_insensitive?"i":"")+(U.unicodeRegex?"u":"")+(ke?"g":""))}class ye{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(ke,Ue){Ue.position=this.position++,this.matchIndexes[this.matchAt]=Ue,this.regexes.push([Ue,ke]),this.matchAt+=T(ke)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const ke=this.regexes.map(Ue=>Ue[1]);this.matcherRe=ae(R(ke,{joinWith:"|"}),!0),this.lastIndex=0}exec(ke){this.matcherRe.lastIndex=this.lastIndex;const Ue=this.matcherRe.exec(ke);if(!Ue)return null;const Kt=Ue.findIndex((Vi,oo)=>oo>0&&Vi!==void 0),Ot=this.matchIndexes[Kt];return Ue.splice(0,Kt),Object.assign(Ue,Ot)}}class Fe{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(ke){if(this.multiRegexes[ke])return this.multiRegexes[ke];const Ue=new ye;return this.rules.slice(ke).forEach(([Kt,Ot])=>Ue.addRule(Kt,Ot)),Ue.compile(),this.multiRegexes[ke]=Ue,Ue}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(ke,Ue){this.rules.push([ke,Ue]),Ue.type==="begin"&&this.count++}exec(ke){const Ue=this.getMatcher(this.regexIndex);Ue.lastIndex=this.lastIndex;let Kt=Ue.exec(ke);if(this.resumingScanAtSamePosition()&&!(Kt&&Kt.index===this.lastIndex)){const Ot=this.getMatcher(0);Ot.lastIndex=this.lastIndex+1,Kt=Ot.exec(ke)}return Kt&&(this.regexIndex+=Kt.position+1,this.regexIndex===this.count&&this.considerAll()),Kt}}function jt(Me){const ke=new Fe;return Me.contains.forEach(Ue=>ke.addRule(Ue.begin,{rule:Ue,type:"begin"})),Me.terminatorEnd&&ke.addRule(Me.terminatorEnd,{type:"end"}),Me.illegal&&ke.addRule(Me.illegal,{type:"illegal"}),ke}function Ct(Me,ke){const Ue=Me;if(Me.isCompiled)return Ue;[Te,Pi,ro,vr].forEach(Ot=>Ot(Me,ke)),U.compilerExtensions.forEach(Ot=>Ot(Me,ke)),Me.__beforeBegin=null,[Ae,It,ti].forEach(Ot=>Ot(Me,ke)),Me.isCompiled=!0;let Kt=null;return typeof Me.keywords=="object"&&Me.keywords.$pattern&&(Me.keywords=Object.assign({},Me.keywords),Kt=Me.keywords.$pattern,delete Me.keywords.$pattern),Kt=Kt||/\w+/,Me.keywords&&(Me.keywords=_e(Me.keywords,U.case_insensitive)),Ue.keywordPatternRe=ae(Kt,!0),ke&&(Me.begin||(Me.begin=/\B|\b/),Ue.beginRe=ae(Ue.begin),!Me.end&&!Me.endsWithParent&&(Me.end=/\B|\b/),Me.end&&(Ue.endRe=ae(Ue.end)),Ue.terminatorEnd=g(Ue.end)||"",Me.endsWithParent&&ke.terminatorEnd&&(Ue.terminatorEnd+=(Me.end?"|":"")+ke.terminatorEnd)),Me.illegal&&(Ue.illegalRe=ae(Me.illegal)),Me.contains||(Me.contains=[]),Me.contains=[].concat(...Me.contains.map(function(Ot){return Rn(Ot==="self"?Me:Ot)})),Me.contains.forEach(function(Ot){Ct(Ot,Ue)}),Me.starts&&Ct(Me.starts,ke),Ue.matcher=jt(Ue),Ue}if(U.compilerExtensions||(U.compilerExtensions=[]),U.contains&&U.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return U.classNameAliases=i(U.classNameAliases||{}),Ct(U)}function vs(U){return U?U.endsWithParent||vs(U.starts):!1}function Rn(U){return U.variants&&!U.cachedVariants&&(U.cachedVariants=U.variants.map(function(ae){return i(U,{variants:null},ae)})),U.cachedVariants?U.cachedVariants:vs(U)?i(U,{starts:U.starts?i(U.starts):null}):Object.isFrozen(U)?i(U):U}var js="11.11.1";class vl extends Error{constructor(ae,ye){super(ae),this.name="HTMLInjectionError",this.html=ye}}const fa=s,ao=i,lt=Symbol("nomatch"),ni=7,bn=function(U){const ae=Object.create(null),ye=Object.create(null),Fe=[];let jt=!0;const Ct="Could not find the language '{}', did you forget to load/include a language module?",Me={disableAutodetect:!0,name:"Plain text",contains:[]};let ke={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:p};function Ue(me){return ke.noHighlightRe.test(me)}function Kt(me){let ze=me.className+" ";ze+=me.parentNode?me.parentNode.className:"";const et=ke.languageDetectRe.exec(ze);if(et){const bt=Ks(et[1]);return bt||(si(Ct.replace("{}",et[1])),si("Falling back to no-highlight mode for this block.",me)),bt?et[1]:"no-highlight"}return ze.split(/\s+/).find(bt=>Ue(bt)||Ks(bt))}function Ot(me,ze,et){let bt="",Xt="";typeof ze=="object"?(bt=me,et=ze.ignoreIllegals,Xt=ze.language):(ds("10.7.0","highlight(lang, code, ...args) has been deprecated."),ds("10.7.0",`Please use highlight(code, options) instead.
|
|
171
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),Xt=me,bt=ze),et===void 0&&(et=!0);const Hs={code:bt,language:Xt};pa("before:highlight",Hs);const xn=Hs.result?Hs.result:Vi(Hs.language,Hs.code,et);return xn.code=Hs.code,pa("after:highlight",xn),xn}function Vi(me,ze,et,bt){const Xt=Object.create(null);function Hs(xe,Re){return xe.keywords[Re]}function xn(){if(!He.keywords){ts.addText(xt);return}let xe=0;He.keywordPatternRe.lastIndex=0;let Re=He.keywordPatternRe.exec(xt),We="";for(;Re;){We+=xt.substring(xe,Re.index);const it=As.case_insensitive?Re[0].toLowerCase():Re[0],Pt=Hs(He,it);if(Pt){const[Dn,Cl]=Pt;if(ts.addText(We),We="",Xt[it]=(Xt[it]||0)+1,Xt[it]<=ni&&(kr+=Cl),Dn.startsWith("_"))We+=Re[0];else{const ju=As.classNameAliases[Dn]||Dn;vn(Re[0],ju)}}else We+=Re[0];xe=He.keywordPatternRe.lastIndex,Re=He.keywordPatternRe.exec(xt)}We+=xt.substring(xe),ts.addText(We)}function sn(){if(xt==="")return;let xe=null;if(typeof He.subLanguage=="string"){if(!ae[He.subLanguage]){ts.addText(xt);return}xe=Vi(He.subLanguage,xt,!0,Tu[He.subLanguage]),Tu[He.subLanguage]=xe._top}else xe=lo(xt,He.subLanguage.length?He.subLanguage:null);He.relevance>0&&(kr+=xe.relevance),ts.__addSublanguage(xe._emitter,xe.language)}function Tt(){He.subLanguage!=null?sn():xn(),xt=""}function vn(xe,Re){xe!==""&&(ts.startScope(Re),ts.addText(xe),ts.endScope())}function Nu(xe,Re){let We=1;const it=Re.length-1;for(;We<=it;){if(!xe._emit[We]){We++;continue}const Pt=As.classNameAliases[xe[We]]||xe[We],Dn=Re[We];Pt?vn(Dn,Pt):(xt=Dn,xn(),xt=""),We++}}function uo(xe,Re){return xe.scope&&typeof xe.scope=="string"&&ts.openNode(As.classNameAliases[xe.scope]||xe.scope),xe.beginScope&&(xe.beginScope._wrap?(vn(xt,As.classNameAliases[xe.beginScope._wrap]||xe.beginScope._wrap),xt=""):xe.beginScope._multi&&(Nu(xe.beginScope,Re),xt="")),He=Object.create(xe,{parent:{value:He}}),He}function Sl(xe,Re,We){let it=N(xe.endRe,We);if(it){if(xe["on:end"]){const Pt=new t(xe);xe["on:end"](Re,Pt),Pt.isMatchIgnored&&(it=!1)}if(it){for(;xe.endsParent&&xe.parent;)xe=xe.parent;return xe}}if(xe.endsWithParent)return Sl(xe.parent,Re,We)}function ho(xe){return He.matcher.regexIndex===0?(xt+=xe[0],1):(Cr=!0,0)}function Sf(xe){const Re=xe[0],We=xe.rule,it=new t(We),Pt=[We.__beforeBegin,We["on:begin"]];for(const Dn of Pt)if(Dn&&(Dn(xe,it),it.isMatchIgnored))return ho(Re);return We.skip?xt+=Re:(We.excludeBegin&&(xt+=Re),Tt(),!We.returnBegin&&!We.excludeBegin&&(xt=Re)),uo(We,xe),We.returnBegin?0:Re.length}function nn(xe){const Re=xe[0],We=ze.substring(xe.index),it=Sl(He,xe,We);if(!it)return lt;const Pt=He;He.endScope&&He.endScope._wrap?(Tt(),vn(Re,He.endScope._wrap)):He.endScope&&He.endScope._multi?(Tt(),Nu(He.endScope,xe)):Pt.skip?xt+=Re:(Pt.returnEnd||Pt.excludeEnd||(xt+=Re),Tt(),Pt.excludeEnd&&(xt=Re));do He.scope&&ts.closeNode(),!He.skip&&!He.subLanguage&&(kr+=He.relevance),He=He.parent;while(He!==it.parent);return it.starts&&uo(it.starts,xe),Pt.returnEnd?0:Re.length}function wl(){const xe=[];for(let Re=He;Re!==As;Re=Re.parent)Re.scope&&xe.unshift(Re.scope);xe.forEach(Re=>ts.openNode(Re))}let ga={};function fo(xe,Re){const We=Re&&Re[0];if(xt+=xe,We==null)return Tt(),0;if(ga.type==="begin"&&Re.type==="end"&&ga.index===Re.index&&We===""){if(xt+=ze.slice(Re.index,Re.index+1),!jt){const it=new Error(`0 width match regex (${me})`);throw it.languageName=me,it.badRule=ga.rule,it}return 1}if(ga=Re,Re.type==="begin")return Sf(Re);if(Re.type==="illegal"&&!et){const it=new Error('Illegal lexeme "'+We+'" for mode "'+(He.scope||"<unnamed>")+'"');throw it.mode=He,it}else if(Re.type==="end"){const it=nn(Re);if(it!==lt)return it}if(Re.type==="illegal"&&We==="")return xt+=`
|
|
172
|
+
`,1;if(kl>1e5&&kl>Re.index*3)throw new Error("potential infinite loop, way more iterations than matches");return xt+=We,We.length}const As=Ks(me);if(!As)throw gt(Ct.replace("{}",me)),new Error('Unknown language: "'+me+'"');const Eu=qi(As);let mo="",He=bt||Eu;const Tu={},ts=new ke.__emitter(ke);wl();let xt="",kr=0,Ki=0,kl=0,Cr=!1;try{if(As.__emitTokens)As.__emitTokens(ze,ts);else{for(He.matcher.considerAll();;){kl++,Cr?Cr=!1:He.matcher.considerAll(),He.matcher.lastIndex=Ki;const xe=He.matcher.exec(ze);if(!xe)break;const Re=ze.substring(Ki,xe.index),We=fo(Re,xe);Ki=xe.index+We}fo(ze.substring(Ki))}return ts.finalize(),mo=ts.toHTML(),{language:me,value:mo,relevance:kr,illegal:!1,_emitter:ts,_top:He}}catch(xe){if(xe.message&&xe.message.includes("Illegal"))return{language:me,value:fa(ze),illegal:!0,relevance:0,_illegalBy:{message:xe.message,index:Ki,context:ze.slice(Ki-100,Ki+100),mode:xe.mode,resultSoFar:mo},_emitter:ts};if(jt)return{language:me,value:fa(ze),illegal:!1,relevance:0,errorRaised:xe,_emitter:ts,_top:He};throw xe}}function oo(me){const ze={value:fa(me),illegal:!1,relevance:0,_top:Me,_emitter:new ke.__emitter(ke)};return ze._emitter.addText(me),ze}function lo(me,ze){ze=ze||ke.languages||Object.keys(ae);const et=oo(me),bt=ze.filter(Ks).filter(Sr).map(Tt=>Vi(Tt,me,!1));bt.unshift(et);const Xt=bt.sort((Tt,vn)=>{if(Tt.relevance!==vn.relevance)return vn.relevance-Tt.relevance;if(Tt.language&&vn.language){if(Ks(Tt.language).supersetOf===vn.language)return 1;if(Ks(vn.language).supersetOf===Tt.language)return-1}return 0}),[Hs,xn]=Xt,sn=Hs;return sn.secondBest=xn,sn}function bi(me,ze,et){const bt=ze&&ye[ze]||et;me.classList.add("hljs"),me.classList.add(`language-${bt}`)}function Yt(me){let ze=null;const et=Kt(me);if(Ue(et))return;if(pa("before:highlightElement",{el:me,language:et}),me.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",me);return}if(me.children.length>0&&(ke.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(me)),ke.throwUnescapedHTML))throw new vl("One of your code blocks includes unescaped HTML.",me.innerHTML);ze=me;const bt=ze.textContent,Xt=et?Ot(bt,{language:et,ignoreIllegals:!0}):lo(bt);me.innerHTML=Xt.value,me.dataset.highlighted="yes",bi(me,et,Xt.language),me.result={language:Xt.language,re:Xt.relevance,relevance:Xt.relevance},Xt.secondBest&&(me.secondBest={language:Xt.secondBest.language,relevance:Xt.secondBest.relevance}),pa("after:highlightElement",{el:me,result:Xt,text:bt})}function $s(me){ke=ao(ke,me)}const yr=()=>{co(),ds("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function _l(){co(),ds("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let wu=!1;function co(){function me(){co()}if(document.readyState==="loading"){wu||window.addEventListener("DOMContentLoaded",me,!1),wu=!0;return}document.querySelectorAll(ke.cssSelector).forEach(Yt)}function ku(me,ze){let et=null;try{et=ze(U)}catch(bt){if(gt("Language definition for '{}' could not be registered.".replace("{}",me)),jt)gt(bt);else throw bt;et=Me}et.name||(et.name=me),ae[me]=et,et.rawDefinition=ze.bind(null,U),et.aliases&&Gi(et.aliases,{languageName:me})}function ma(me){delete ae[me];for(const ze of Object.keys(ye))ye[ze]===me&&delete ye[ze]}function yl(){return Object.keys(ae)}function Ks(me){return me=(me||"").toLowerCase(),ae[me]||ae[ye[me]]}function Gi(me,{languageName:ze}){typeof me=="string"&&(me=[me]),me.forEach(et=>{ye[et.toLowerCase()]=ze})}function Sr(me){const ze=Ks(me);return ze&&!ze.disableAutodetect}function wr(me){me["before:highlightBlock"]&&!me["before:highlightElement"]&&(me["before:highlightElement"]=ze=>{me["before:highlightBlock"](Object.assign({block:ze.el},ze))}),me["after:highlightBlock"]&&!me["after:highlightElement"]&&(me["after:highlightElement"]=ze=>{me["after:highlightBlock"](Object.assign({block:ze.el},ze))})}function es(me){wr(me),Fe.push(me)}function Cu(me){const ze=Fe.indexOf(me);ze!==-1&&Fe.splice(ze,1)}function pa(me,ze){const et=me;Fe.forEach(function(bt){bt[et]&&bt[et](ze)})}function Wi(me){return ds("10.7.0","highlightBlock will be removed entirely in v12.0"),ds("10.7.0","Please use highlightElement now."),Yt(me)}Object.assign(U,{highlight:Ot,highlightAuto:lo,highlightAll:co,highlightElement:Yt,highlightBlock:Wi,configure:$s,initHighlighting:yr,initHighlightingOnLoad:_l,registerLanguage:ku,unregisterLanguage:ma,listLanguages:yl,getLanguage:Ks,registerAliases:Gi,autoDetection:Sr,inherit:ao,addPlugin:es,removePlugin:Cu}),U.debugMode=function(){jt=!1},U.safeMode=function(){jt=!0},U.versionString=js,U.regex={concat:w,lookahead:v,either:E,optional:S,anyNumberOfTimes:_};for(const me in Ge)typeof Ge[me]=="object"&&e(Ge[me]);return Object.assign(U,Ge),U},Ps=bn({});return Ps.newInstance=()=>bn({}),mg=Ps,Ps.HighlightJS=Ps,Ps.default=Ps,mg}var pg,V2;function gq(){if(V2)return pg;V2=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]+;/},u={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},h=t.inherit(u,{begin:/\(/,end:/\)/}),m=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:[u,d,m,h,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[u,h,d,m]}]}]},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 pg=e,pg}var gg,G2;function bq(){if(G2)return gg;G2=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]},u=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"})]}},m={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,i,l]};l.contains.push(m);const d={match:/\\"/},p={className:"string",begin:/'/,end:/'/},g={match:/\\'/},v={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,i]},_=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],S=t.SHEBANG({binary:`(${_.join("|")})`,relevance:10}),w={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},C=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],E=["true","false"],T={match:/(\/[a-z._-]+)+/},N=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],j=["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"],z=["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:C,literal:E,built_in:[...N,...j,"set","shopt",...R,...z]},contains:[S,t.SHEBANG(),w,v,u,h,T,m,d,p,g,i]}}return gg=e,gg}var bg,W2;function xq(){if(W2)return bg;W2=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("<[^<>]+>")+")",m={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},v={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]},_={className:"title",begin:s.optional(l)+t.IDENT_RE,relevance:0},S=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=[v,m,i,t.C_BLOCK_COMMENT_MODE,g,p],N={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},j={begin:"("+h+"[\\*&\\s]+)+"+S,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:E,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:a,keywords:E,relevance:0},{begin:S,returnBegin:!0,contains:[t.inherit(_,{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,m,{begin:/\(/,end:/\)/,keywords:E,relevance:0,contains:["self",i,t.C_BLOCK_COMMENT_MODE,p,g,m]}]},m,i,t.C_BLOCK_COMMENT_MODE,v]};return{name:"C",aliases:["h"],keywords:E,disableAutodetect:!0,illegal:"</",contains:[].concat(N,j,T,[v,{begin:t.IDENT_RE+"::",keywords:E},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:v,strings:p,keywords:E}}}return bg=e,bg}var xg,K2;function vq(){if(K2)return xg;K2=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("<[^<>]+>")+")",m={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},v={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]},_={className:"title",begin:s.optional(l)+t.IDENT_RE,relevance:0},S=s.optional(l)+t.IDENT_RE+"\\s*\\(",w=["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"],C=["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:C,keyword:w,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:E},z={className:"function.dispatch",relevance:0,keywords:{_hint:T},begin:s.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,s.lookahead(/(<[^<>]+>|)\s*\(/))},D=[z,v,m,i,t.C_BLOCK_COMMENT_MODE,g,p],M={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:R,contains:D.concat([{begin:/\(/,end:/\)/,keywords:R,contains:D.concat(["self"]),relevance:0}]),relevance:0},$={className:"function",begin:"("+h+"[\\*&\\s]+)+"+S,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:R,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:a,keywords:R,relevance:0},{begin:S,returnBegin:!0,contains:[_],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,m,{begin:/\(/,end:/\)/,keywords:R,relevance:0,contains:["self",i,t.C_BLOCK_COMMENT_MODE,p,g,m]}]},m,i,t.C_BLOCK_COMMENT_MODE,v]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:R,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(M,$,z,D,[v,{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",m]},{begin:t.IDENT_RE+"::",keywords:R},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}return xg=e,xg}var vg,Y2;function _q(){if(Y2)return vg;Y2=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"],u=["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(u),built_in:s,literal:a},m=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:'""'}]},v=t.inherit(g,{illegal:/\n/}),_={className:"subst",begin:/\{/,end:/\}/,keywords:h},S=t.inherit(_,{illegal:/\n/}),w={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},t.BACKSLASH_ESCAPE,S]},C={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},_]},E=t.inherit(C,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},S]});_.contains=[C,w,g,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,d,t.C_BLOCK_COMMENT_MODE],S.contains=[E,w,v,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,d,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const T={variants:[p,C,w,g,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},N={begin:"<",end:">",contains:[{beginKeywords:"in out"},m]},j=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"},m,N,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[m,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[m,N,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:"("+j+"\\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,N],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 vg=e,vg}var _g,X2;function yq(){if(X2)return _g;X2=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(),u=["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 m(d){const p=d.regex,g=e(d),v={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},_="and or not only",S=/@-?\w[\w]*(-\w+)*/,w="[a-zA-Z-][a-zA-Z0-9_-]*",C=[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,v,g.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+w,relevance:0},g.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+l.join("|")+")"},{begin:":(:)?("+u.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,...C,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...C,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},g.FUNCTION_DISPATCH]},{begin:p.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:S},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:_,attribute:a.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...C,g.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+i.join("|")+")\\b"}]}}return _g=m,_g}var yg,Z2;function Sq(){if(Z2)return yg;Z2=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}]},u={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}]},m=/[A-Za-z][A-Za-z0-9+.-]*/,d={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:s.concat(/\[.+?\]\(/,m,/:\/\/.*?\)/),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}]},v=t.inherit(p,{contains:[]}),_=t.inherit(g,{contains:[]});p.contains.push(_),g.contains.push(v);let S=[i,d];return[p,g,v,_].forEach(T=>{T.contains=T.contains.concat(S)}),S=S.concat(p,g),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:S},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:S}]}]},i,u,p,g,{className:"quote",begin:"^>\\s+",contains:S,end:"$"},l,a,d,h,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}return yg=e,yg}var Sg,Q2;function wq(){if(Q2)return Sg;Q2=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 Sg=e,Sg}var wg,J2;function kq(){if(J2)return wg;J2=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"]},m={className:"doctag",begin:"@[A-Za-z]+"},d={begin:"#<",end:">"},p=[t.COMMENT("#","$",{contains:[m]}),t.COMMENT("^=begin","^=end",{contains:[m],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],g={className:"subst",begin:/#\{/,end:/\}/,keywords:h},v={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]})]}]},_="[1-9](_?[0-9])*|0",S="[0-9](_?[0-9])*",w={className:"number",relevance:0,variants:[{begin:`\\b(${_})(\\.(${S}))?([eE][+-]?(${S})|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"}]},C={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:h}]},D=[v,{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:[C]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[v,{begin:i}],relevance:0},w,{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=D,C.contains=D;const B=[{begin:/^\s*=>/,starts:{end:"$",contains:D}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:h,contains:D}}];return p.unshift(d),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:h,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(B).concat(p).concat(D)}}return wg=e,wg}var kg,ek;function Cq(){if(ek)return kg;ek=1;function e(t){const u={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:u,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:u,illegal:/["']/}]}]}}return kg=e,kg}var Cg,tk;function Nq(){if(tk)return Cg;tk=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 Cg=e,Cg}var Ng,sk;function Eq(){if(sk)return Ng;sk=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:/\$\{(.*?)\}/}]},u={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:"'"}]},m={begin:/\[/,end:/\]/,contains:[a,u,l,h,i,"self"],relevance:0},d=/[A-Za-z0-9_-]+/,p=/"(\\"|[^"])*"/,g=/'[^']*'/,v=s.either(d,p,g),_=s.concat(v,"(\\s*\\.\\s*",v,")*",s.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[a,{className:"section",begin:/\[+/,end:/\]+/},{begin:_,className:"attr",starts:{end:/$/,contains:[a,m,u,l,h,i]}}]}}return Ng=e,Ng}var Eg,nk;function Tq(){if(nk)return Eg;nk=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(u,h,m){return m===-1?"":u.replace(h,d=>a(u,h,m-1))}function l(u){const h=u.regex,m="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",d=m+a("(?:<"+m+"~~~(?:\\s*,\\s*"+m+"~~~)*>)?",/~~~/g,2),S={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"]},w={className:"meta",begin:"@"+m,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},C={className:"params",begin:/\(/,end:/\)/,keywords:S,relevance:0,contains:[u.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:S,illegal:/<\/|#/,contains:[u.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},u.C_LINE_COMMENT_MODE,u.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[u.BACKSLASH_ESCAPE]},u.APOS_STRING_MODE,u.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,m],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[h.concat(/(?!else)/,m),/\s+/,m,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,m],className:{1:"keyword",3:"title.class"},contains:[C,u.C_LINE_COMMENT_MODE,u.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+d+"\\s+)",u.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:S,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:S,relevance:0,contains:[w,u.APOS_STRING_MODE,u.QUOTE_STRING_MODE,i,u.C_BLOCK_COMMENT_MODE]},u.C_LINE_COMMENT_MODE,u.C_BLOCK_COMMENT_MODE]},i,w]}}return Eg=l,Eg}var Tg,ik;function jq(){if(ik)return Tg;ik=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"],u=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],h=[].concat(l,i,a);function m(d){const p=d.regex,g=(Se,{after:Le})=>{const ve="</"+Se[0].slice(1);return Se.input.indexOf(ve,Le)!==-1},v=e,_={begin:"<>",end:"</>"},S=/<[A-Za-z0-9\\._:-]+\s*\/>/,w={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Se,Le)=>{const ve=Se[0].length+Se.index,Ge=Se.input[ve];if(Ge==="<"||Ge===","){Le.ignoreMatch();return}Ge===">"&&(g(Se,{after:ve})||Le.ignoreMatch());let ge;const Te=Se.input.substring(ve);if(ge=Te.match(/^\s*=/)){Le.ignoreMatch();return}if((ge=Te.match(/^\s+extends\s+/))&&ge.index===0){Le.ignoreMatch();return}}},C={$pattern:e,keyword:t,literal:s,built_in:h,"variable.language":u},E="[0-9](_?[0-9])*",T=`\\.(${E})`,N="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",j={className:"number",variants:[{begin:`(\\b(${N})((${T})|\\.)?|(${T}))[eE][+-]?(${E})\\b`},{begin:`\\b(${N})\\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:C,contains:[]},z={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[d.BACKSLASH_ESCAPE,R],subLanguage:"xml"}},D={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[d.BACKSLASH_ESCAPE,R],subLanguage:"css"}},M={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[d.BACKSLASH_ESCAPE,R],subLanguage:"graphql"}},$={className:"string",begin:"`",end:"`",contains:[d.BACKSLASH_ESCAPE,R]},B={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:v+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),d.C_BLOCK_COMMENT_MODE,d.C_LINE_COMMENT_MODE]},P=[d.APOS_STRING_MODE,d.QUOTE_STRING_MODE,z,D,M,$,{match:/\$\d+/},j];R.contains=P.concat({begin:/\{/,end:/\}/,keywords:C,contains:["self"].concat(P)});const F=[].concat(B,R.contains),V=F.concat([{begin:/(\s*)\(/,end:/\)/,keywords:C,contains:["self"].concat(F)}]),G={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:C,contains:V},I={variants:[{match:[/class/,/\s+/,v,/\s+/,/extends/,/\s+/,p.concat(v,"(",p.concat(/\./,v),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,v],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]}},X={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},W={variants:[{match:[/function/,/\s+/,v,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[G],illegal:/%/},ee={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function O(Se){return p.concat("(?!",Se.join("|"),")")}const Z={match:p.concat(/\b/,O([...l,"super","import"].map(Se=>`${Se}\\s*\\(`)),v,p.lookahead(/\s*\(/)),className:"title.function",relevance:0},ie={begin:p.concat(/\./,p.lookahead(p.concat(v,/(?![0-9A-Za-z$_(])/))),end:v,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},de={match:[/get|set/,/\s+/,v,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},G]},fe="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+d.UNDERSCORE_IDENT_RE+")\\s*=>",pe={match:[/const|var|let/,/\s+/,v,/\s*/,/=\s*/,/(async\s*)?/,p.lookahead(fe)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[G]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:C,exports:{PARAMS_CONTAINS:V,CLASS_REFERENCE:Y},illegal:/#(?![$_A-z])/,contains:[d.SHEBANG({label:"shebang",binary:"node",relevance:5}),X,d.APOS_STRING_MODE,d.QUOTE_STRING_MODE,z,D,M,$,B,{match:/\$\d+/},j,Y,{scope:"attr",match:v+p.lookahead(":"),relevance:0},pe,{begin:"("+d.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[B,d.REGEXP_MODE,{className:"function",begin:fe,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:C,contains:V}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:_.begin,end:_.end},{match:S},{begin:w.begin,"on:begin":w.isTrulyOpeningTag,end:w.end}],subLanguage:"xml",contains:[{begin:w.begin,end:w.end,skip:!0,contains:["self"]}]}]},W,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+d.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[G,d.inherit(d.TITLE_MODE,{begin:v,className:"title.function"})]},{match:/\.\.\./,relevance:0},ie,{match:"\\$"+v,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[G]},Z,ee,I,de,{match:/\$[(.]/}]}}return Tg=m,Tg}var jg,rk;function Aq(){if(rk)return jg;rk=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 jg=e,jg}var Ag,ak;function Mq(){if(ak)return Ag;ak=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 u={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+/}]}},m={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 v={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+l.UNDERSCORE_IDENT_RE+")?"},_={className:"meta",begin:"@"+l.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[l.inherit(g,{className:"string"}),"self"]}]},S=i,w=l.COMMENT("/\\*","\\*/",{contains:[l.C_BLOCK_COMMENT_MODE]}),C={variants:[{className:"type",begin:l.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},E=C;return E.variants[1].contains=[C],C.variants[1].contains=[E],{name:"Kotlin",aliases:["kt","kts"],keywords:u,contains:[l.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),l.C_LINE_COMMENT_MODE,w,h,m,v,_,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:u,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:u,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[C,l.C_LINE_COMMENT_MODE,w],relevance:0},l.C_LINE_COMMENT_MODE,w,v,_,g,l.C_NUMBER_MODE]},w]},{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},v,_]},g,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
|
|
173
|
+
`},S]}}return Ag=a,Ag}var Mg,ok;function Rq(){if(ok)return Mg;ok=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(),u=["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(),m=l.concat(u).sort().reverse();function d(p){const g=e(p),v=m,_="and or not only",S="[\\w-]+",w="("+S+"|@\\{"+S+"\\})",C=[],E=[],T=function(F){return{className:"string",begin:"~?"+F+".*?"+F}},N=function(F,V,G){return{className:F,begin:V,relevance:G}},j={$pattern:/[a-z-]+/,keyword:_,attribute:a.join(" ")},R={begin:"\\(",end:"\\)",contains:E,keywords:j,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,N("variable","@@?"+S,10),N("variable","@\\{"+S+"\\}"),N("built_in","~?`[^`]*?`"),{className:"attribute",begin:S+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},g.IMPORTANT,{beginKeywords:"and not"},g.FUNCTION_DISPATCH);const z=E.concat({begin:/\{/,end:/\}/,contains:C}),D={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(E)},M={begin:w+"\\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}}]},$={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:j,returnEnd:!0,contains:E,relevance:0}},L={className:"variable",variants:[{begin:"@"+S+"\\s*:",relevance:15},{begin:"@"+S}],starts:{end:"[;}]",returnEnd:!0,contains:z}},B={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:w,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[p.C_LINE_COMMENT_MODE,p.C_BLOCK_COMMENT_MODE,D,N("keyword","all\\b"),N("variable","@\\{"+S+"\\}"),{begin:"\\b("+i.join("|")+")\\b",className:"selector-tag"},g.CSS_NUMBER_MODE,N("selector-tag",w,0),N("selector-id","#"+w),N("selector-class","\\."+w,0),N("selector-tag","&",0),g.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+l.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+u.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:z},{begin:"!important"},g.FUNCTION_DISPATCH]},P={begin:S+`:(:)?(${v.join("|")})`,returnBegin:!0,contains:[B]};return C.push(p.C_LINE_COMMENT_MODE,p.C_BLOCK_COMMENT_MODE,$,L,P,M,B,D,g.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:C}}return Mg=d,Mg}var Rg,lk;function Dq(){if(lk)return Rg;lk=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 Rg=e,Rg}var Dg,ck;function Oq(){if(ck)return Dg;ck=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*(?=[:+?]?=)"},u={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,u,h]}}return Dg=e,Dg}var Og,uk;function Lq(){if(uk)return Og;uk=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(" ")},u={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:l},h={begin:/->\{/,end:/\}/},m={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:[m]},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,u,d],v=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],_=(C,E,T="\\1")=>{const N=T==="\\1"?T:s.concat(T,E);return s.concat(s.concat("(?:",C,")"),E,/(?:\\.|[^\\\/])*?/,N,/(?:\\.|[^\\\/])*?/,T,a)},S=(C,E,T)=>s.concat(s.concat("(?:",C,")"),E,/(?:\\.|[^\\\/])*?/,T,a),w=[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:_("s|tr|y",s.either(...v,{capture:!0}))},{begin:_("s|tr|y","\\(","\\)")},{begin:_("s|tr|y","\\[","\\]")},{begin:_("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:S("(?:m|qr)?",/\//,/\//)},{begin:S("m|qr",s.either(...v,{capture:!0}),/\1/)},{begin:S("m|qr",/\(/,/\)/)},{begin:S("m|qr",/\[/,/\]/)},{begin:S("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,m]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,m,p]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return u.contains=w,h.contains=w,{name:"Perl",aliases:["pl","pm"],keywords:l,contains:w}}return Og=e,Og}var Lg,dk;function zq(){if(dk)return Lg;dk=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_]*/,m={"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:m,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 Lg=e,Lg}var zg,hk;function Bq(){if(hk)return zg;hk=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),u=s.concat(/[A-Z]+/,i),h={scope:"variable",match:"\\$+"+a},m={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)}),v={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(d),"on:begin":(G,I)=>{I.data._beginMatch=G[1]||G[2]},"on:end":(G,I)=>{I.data._beginMatch!==G[1]&&I.ignoreMatch()}},_=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),S=`[
|
|
174
|
+
]`,w={scope:"string",variants:[g,p,v,_]},C={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"],N=["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:(G=>{const I=[];return G.forEach(Y=>{I.push(Y),Y.toLowerCase()===Y?I.push(Y.toUpperCase()):I.push(Y.toLowerCase())}),I})(E),built_in:N},z=G=>G.map(I=>I.replace(/\|\d+$/,"")),D={variants:[{match:[/new/,s.concat(S,"+"),s.concat("(?!",z(N).join("\\b|"),"\\b)"),l],scope:{1:"keyword",4:"title.class"}}]},M=s.concat(a,"\\b(?!\\()"),$={variants:[{match:[s.concat(/::/,s.lookahead(/(?!class\b)/)),M],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[l,s.concat(/::/,s.lookahead(/(?!class\b)/)),M],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"}}]},L={scope:"attr",match:s.concat(a,s.lookahead(":"),s.lookahead(/(?!::)/))},B={relevance:0,begin:/\(/,end:/\)/,keywords:R,contains:[L,h,$,t.C_BLOCK_COMMENT_MODE,w,C,D]},P={relevance:0,match:[/\b/,s.concat("(?!fn\\b|function\\b|",z(T).join("\\b|"),"|",z(N).join("\\b|"),"\\b)"),a,s.concat(S,"*"),s.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[B]};B.contains.push(P);const F=[L,$,t.C_BLOCK_COMMENT_MODE,w,C,D],V={begin:s.concat(/#\[\s*\\?/,s.either(l,u)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:E,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:E,keyword:["new","array"]},contains:["self",...F]},...F,{scope:"meta",variants:[{match:l},{match:u}]}]};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}]}},m,{scope:"variable.language",match:/\$this\b/},h,P,$,{match:[/const/,/\s/,a],scope:{1:"keyword",3:"variable.constant"}},D,{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,$,t.C_BLOCK_COMMENT_MODE,w,C]}]},{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]},w,C]}}return zg=e,zg}var Bg,fk;function Iq(){if(fk)return Bg;fk=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 Bg=e,Bg}var Ig,mk;function Pq(){if(mk)return Ig;mk=1;function e(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}return Ig=e,Ig}var Pg,pk;function $q(){if(pk)return Pg;pk=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"],m={$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:m,illegal:/#/},g={begin:/\{\{/,relevance:0},v={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]},_="[0-9](_?[0-9])*",S=`(\\b(${_}))?\\.(${_})|\\b(${_})\\.`,w=`\\b|${a.join("|")}`,C={className:"number",relevance:0,variants:[{begin:`(\\b(${_})|(${S}))[eE][+-]?(${_})[jJ]?(?=${w})`},{begin:`(${S})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${w})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${w})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${w})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${w})`},{begin:`\\b(${_})[jJ](?=${w})`}]},E={className:"comment",begin:s.lookahead(/# type:/),end:/$/,keywords:m,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:m,contains:["self",d,C,v,t.HASH_COMMENT_MODE]}]};return p.contains=[v,C,d],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:m,illegal:/(<\/|\?)|=>/,contains:[d,C,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},v,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:[C,T,v]}]}}return Pg=e,Pg}var $g,gk;function Hq(){if(gk)return $g;gk=1;function e(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}return $g=e,$g}var Hg,bk;function Uq(){if(bk)return Hg;bk=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=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,u=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:[u,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:u},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}return Hg=e,Hg}var Ug,xk;function Fq(){if(xk)return Ug;xk=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),u={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))?",m=["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:m,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:"->"},u]}}return Ug=e,Ug}var Fg,vk;function qq(){if(vk)return Fg;vk=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(),u=["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 m(d){const p=e(d),g=u,v=l,_="@[a-z-]+",S="and or not only",C={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:":("+v.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+g.join("|")+")"},C,{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,C,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:_,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:S,attribute:a.join(" ")},contains:[{begin:_,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},C,d.QUOTE_STRING_MODE,d.APOS_STRING_MODE,p.HEXCOLOR,p.CSS_NUMBER_MODE]},p.FUNCTION_DISPATCH]}}return Fg=m,Fg}var qg,_k;function Vq(){if(_k)return qg;_k=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 qg=e,qg}var Vg,yk;function Gq(){if(yk)return Vg;yk=1;function e(t){const s=t.regex,i=t.COMMENT("--","$"),a={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},l={begin:/"/,end:/"/,contains:[{match:/""/}]},u=["true","false","unknown"],h=["double precision","large object","with timezone","without timezone"],m=["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"],v=["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"],_=["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"],S=g,w=[...p,...d].filter(z=>!g.includes(z)),C={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},E={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},T={match:s.concat(/\b/,s.either(...S),/\s*\(/),relevance:0,keywords:{built_in:S}};function N(z){return s.concat(/\b/,s.either(...z.map(D=>D.replace(/\s+/,"\\s+"))),/\b/)}const j={scope:"keyword",match:N(_),relevance:0};function R(z,{exceptions:D,when:M}={}){const $=M;return D=D||[],z.map(L=>L.match(/\|\d+$/)||D.includes(L)?L:$(L)?`${L}|0`:L)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:R(w,{when:z=>z.length<3}),literal:u,type:m,built_in:v},contains:[{scope:"type",match:N(h)},j,T,C,a,l,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,i,E]}}return Vg=e,Vg}var Gg,Sk;function Wq(){if(Sk)return Gg;Sk=1;function e(M){return M?typeof M=="string"?M:M.source:null}function t(M){return s("(?=",M,")")}function s(...M){return M.map(L=>e(L)).join("")}function i(M){const $=M[M.length-1];return typeof $=="object"&&$.constructor===Object?(M.splice(M.length-1,1),$):{}}function a(...M){return"("+(i(M).capture?"":"?:")+M.map(B=>e(B)).join("|")+")"}const l=M=>s(/\b/,M,/\w$/.test(M)?/\b/:/\B/),u=["Protocol","Type"].map(l),h=["init","self"].map(l),m=["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"],v=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],_=["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"],S=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]/),w=a(S,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),C=s(S,w,"*"),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]/),N=s(E,T,"*"),j=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\(/,N,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],z=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function D(M){const $={match:/\s+/,relevance:0},L=M.COMMENT("/\\*","\\*/",{contains:["self"]}),B=[M.C_LINE_COMMENT_MODE,L],P={match:[/\./,a(...u,...h)],className:{2:"keyword"}},F={match:s(/\./,a(...d)),relevance:0},V=d.filter(lt=>typeof lt=="string").concat(["_|0"]),G=d.filter(lt=>typeof lt!="string").concat(m).map(l),I={variants:[{className:"keyword",match:a(...G,...h)}]},Y={$pattern:a(/\b\w+/,/#\w+/),keyword:V.concat(v),literal:p},X=[P,F,I],W={match:s(/\./,a(..._)),relevance:0},ee={className:"built_in",match:s(/\b/,a(..._),/(?=\()/)},O=[W,ee],Z={match:/->/,relevance:0},ie={className:"operator",relevance:0,variants:[{match:C},{match:`\\.(\\.|${w})+`}]},de=[Z,ie],fe="([0-9]_*)+",pe="([0-9a-fA-F]_*)+",Se={className:"number",relevance:0,variants:[{match:`\\b(${fe})(\\.(${fe}))?([eE][+-]?(${fe}))?\\b`},{match:`\\b0x(${pe})(\\.(${pe}))?([pP][+-]?(${fe}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},Le=(lt="")=>({className:"subst",variants:[{match:s(/\\/,lt,/[0\\tnr"']/)},{match:s(/\\/,lt,/u\{[0-9a-fA-F]{1,8}\}/)}]}),ve=(lt="")=>({className:"subst",match:s(/\\/,lt,/[\t ]*(?:[\r\n]|\r\n)/)}),Ge=(lt="")=>({className:"subst",label:"interpol",begin:s(/\\/,lt,/\(/),end:/\)/}),ge=(lt="")=>({begin:s(lt,/"""/),end:s(/"""/,lt),contains:[Le(lt),ve(lt),Ge(lt)]}),Te=(lt="")=>({begin:s(lt,/"/),end:s(/"/,lt),contains:[Le(lt),Ge(lt)]}),Ae={className:"string",variants:[ge(),ge("#"),ge("##"),ge("###"),Te(),Te("#"),Te("##"),Te("###")]},It=[M.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[M.BACKSLASH_ESCAPE]}],Pi={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:It},ti=lt=>{const ni=s(lt,/\//),bn=s(/\//,lt);return{begin:ni,end:bn,contains:[...It,{scope:"comment",begin:`#(?!.*${bn})`,end:/$/}]}},vr={scope:"regexp",variants:[ti("###"),ti("##"),ti("#"),Pi]},$i={match:s(/`/,N,/`/)},Hi={className:"variable",match:/\$\d+/},_e={className:"variable",match:`\\$${T}+`},ht=[$i,Hi,_e],gn={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:z,contains:[...de,Se,Ae]}]}},Ts={scope:"keyword",match:s(/@/,a(...R),t(a(/\(/,/\s+/)))},gt={scope:"meta",match:s(/@/,N)},si=[gn,Ts,gt],ds={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:j,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:s(/\s+&\s+/,t(j)),relevance:0}]},Ui={begin:/</,end:/>/,keywords:Y,contains:[...B,...X,...si,Z,ds]};ds.contains.push(Ui);const Fi={match:s(N,/\s*:/),keywords:"_|0",relevance:0},io={begin:/\(/,end:/\)/,relevance:0,keywords:Y,contains:["self",Fi,...B,vr,...X,...O,...de,Se,Ae,...ht,...si,ds]},_r={begin:/</,end:/>/,keywords:"repeat each",contains:[...B,ds]},xl={begin:a(t(s(N,/\s*:/)),t(s(N,/\s+/,N,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:N}]},ro={begin:/\(/,end:/\)/,keywords:Y,contains:[xl,...B,...X,...de,Se,Ae,...si,ds,io],endsParent:!0,illegal:/["']/},qi={match:[/(func|macro)/,/\s+/,a($i.match,N,C)],className:{1:"keyword",3:"title.function"},contains:[_r,ro,$],illegal:[/\[/,/%/]},vs={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[_r,ro,$],illegal:/\[|%/},Rn={match:[/operator/,/\s+/,C],className:{1:"keyword",3:"title"}},js={begin:[/precedencegroup/,/\s+/,j],className:{1:"keyword",3:"title"},contains:[ds],keywords:[...g,...p],end:/}/},vl={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},fa={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},ao={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,N,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:Y,contains:[_r,...X,{begin:/:/,end:/\{/,keywords:Y,contains:[{scope:"title.class.inherited",match:j},...X],relevance:0}]};for(const lt of Ae.variants){const ni=lt.contains.find(Ps=>Ps.label==="interpol");ni.keywords=Y;const bn=[...X,...O,...de,Se,Ae,...ht];ni.contains=[...bn,{begin:/\(/,end:/\)/,contains:["self",...bn]}]}return{name:"Swift",keywords:Y,contains:[...B,qi,vs,vl,fa,ao,Rn,js,{beginKeywords:"import",end:/$/,contains:[...B],relevance:0},vr,...X,...O,...de,Se,Ae,...ht,...si,ds,io]}}return Gg=D,Gg}var Wg,wk;function Kq(){if(wk)return Wg;wk=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:/\}/}]},u={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]},m=t.inherit(h,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),_={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"},S={end:",",endsWithParent:!0,excludeEnd:!0,keywords:s,relevance:0},w={begin:/\{/,end:/\}/,contains:[S],illegal:"\\n",relevance:0},C={begin:"\\[",end:"\\]",contains:[S],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}},_,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},w,C,u,h],T=[...E];return T.pop(),T.push(m),S.contains=T,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:E}}return Wg=e,Wg}var Kg,kk;function Yq(){if(kk)return Kg;kk=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"],u=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],h=[].concat(l,i,a);function m(p){const g=p.regex,v=(Le,{after:ve})=>{const Ge="</"+Le[0].slice(1);return Le.input.indexOf(Ge,ve)!==-1},_=e,S={begin:"<>",end:"</>"},w=/<[A-Za-z0-9\\._:-]+\s*\/>/,C={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Le,ve)=>{const Ge=Le[0].length+Le.index,ge=Le.input[Ge];if(ge==="<"||ge===","){ve.ignoreMatch();return}ge===">"&&(v(Le,{after:Ge})||ve.ignoreMatch());let Te;const Ae=Le.input.substring(Ge);if(Te=Ae.match(/^\s*=/)){ve.ignoreMatch();return}if((Te=Ae.match(/^\s+extends\s+/))&&Te.index===0){ve.ignoreMatch();return}}},E={$pattern:e,keyword:t,literal:s,built_in:h,"variable.language":u},T="[0-9](_?[0-9])*",N=`\\.(${T})`,j="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",R={className:"number",variants:[{begin:`(\\b(${j})((${N})|\\.)?|(${N}))[eE][+-]?(${T})\\b`},{begin:`\\b(${j})\\b((${N})\\b|\\.)?|(${N})\\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},z={className:"subst",begin:"\\$\\{",end:"\\}",keywords:E,contains:[]},D={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[p.BACKSLASH_ESCAPE,z],subLanguage:"xml"}},M={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[p.BACKSLASH_ESCAPE,z],subLanguage:"css"}},$={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[p.BACKSLASH_ESCAPE,z],subLanguage:"graphql"}},L={className:"string",begin:"`",end:"`",contains:[p.BACKSLASH_ESCAPE,z]},P={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:_+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),p.C_BLOCK_COMMENT_MODE,p.C_LINE_COMMENT_MODE]},F=[p.APOS_STRING_MODE,p.QUOTE_STRING_MODE,D,M,$,L,{match:/\$\d+/},R];z.contains=F.concat({begin:/\{/,end:/\}/,keywords:E,contains:["self"].concat(F)});const V=[].concat(P,z.contains),G=V.concat([{begin:/(\s*)\(/,end:/\)/,keywords:E,contains:["self"].concat(V)}]),I={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:E,contains:G},Y={variants:[{match:[/class/,/\s+/,_,/\s+/,/extends/,/\s+/,g.concat(_,"(",g.concat(/\./,_),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,_],scope:{1:"keyword",3:"title.class"}}]},X={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]}},W={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},ee={variants:[{match:[/function/,/\s+/,_,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[I],illegal:/%/},O={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Z(Le){return g.concat("(?!",Le.join("|"),")")}const ie={match:g.concat(/\b/,Z([...l,"super","import"].map(Le=>`${Le}\\s*\\(`)),_,g.lookahead(/\s*\(/)),className:"title.function",relevance:0},de={begin:g.concat(/\./,g.lookahead(g.concat(_,/(?![0-9A-Za-z$_(])/))),end:_,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},fe={match:[/get|set/,/\s+/,_,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},I]},pe="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+p.UNDERSCORE_IDENT_RE+")\\s*=>",Se={match:[/const|var|let/,/\s+/,_,/\s*/,/=\s*/,/(async\s*)?/,g.lookahead(pe)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[I]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:E,exports:{PARAMS_CONTAINS:G,CLASS_REFERENCE:X},illegal:/#(?![$_A-z])/,contains:[p.SHEBANG({label:"shebang",binary:"node",relevance:5}),W,p.APOS_STRING_MODE,p.QUOTE_STRING_MODE,D,M,$,L,P,{match:/\$\d+/},R,X,{scope:"attr",match:_+g.lookahead(":"),relevance:0},Se,{begin:"("+p.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[P,p.REGEXP_MODE,{className:"function",begin:pe,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:G}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:S.begin,end:S.end},{match:w},{begin:C.begin,"on:begin":C.isTrulyOpeningTag,end:C.end}],subLanguage:"xml",contains:[{begin:C.begin,end:C.end,skip:!0,contains:["self"]}]}]},ee,{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:_,className:"title.function"})]},{match:/\.\.\./,relevance:0},de,{match:"\\$"+_,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[I]},ie,O,Y,fe,{match:/\$[(.]/}]}}function d(p){const g=p.regex,v=m(p),_=e,S=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],w={begin:[/namespace/,/\s+/,p.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},C={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:S},contains:[v.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"],N={$pattern:e,keyword:t.concat(T),literal:s,built_in:h.concat(S),"variable.language":u},j={className:"meta",begin:"@"+_},R=($,L,B)=>{const P=$.contains.findIndex(F=>F.label===L);if(P===-1)throw new Error("can not find mode to replace");$.contains.splice(P,1,B)};Object.assign(v.keywords,N),v.exports.PARAMS_CONTAINS.push(j);const z=v.contains.find($=>$.scope==="attr"),D=Object.assign({},z,{match:g.concat(_,g.lookahead(/\s*\?:/))});v.exports.PARAMS_CONTAINS.push([v.exports.CLASS_REFERENCE,z,D]),v.contains=v.contains.concat([j,w,C,D]),R(v,"shebang",p.SHEBANG()),R(v,"use_strict",E);const M=v.contains.find($=>$.label==="func.def");return M.relevance=0,Object.assign(v,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),v}return Kg=d,Kg}var Yg,Ck;function Xq(){if(Ck)return Yg;Ck=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}/,u=/\d{4}-\d{1,2}-\d{1,2}/,h=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,m=/\d{1,2}(:\d{1,2}){1,2}/,d={className:"literal",variants:[{begin:s.concat(/# */,s.either(u,l),/ *#/)},{begin:s.concat(/# */,m,/ *#/)},{begin:s.concat(/# */,h,/ *#/)},{begin:s.concat(/# */,s.either(u,l),/ +/,s.either(h,m),/ *#/)}]},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+:/},v=t.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),_=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,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:[_]}]}}return Yg=e,Yg}var Xg,Nk;function Zq(){if(Nk)return Xg;Nk=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"}},u={className:"variable",begin:/\$[\w_]+/},h={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},m={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"}},u,h,l,t.QUOTE_STRING_MODE,d,p,m]}}return Xg=e,Xg}var Zg,Ek;function Qq(){if(Ek)return Zg;Ek=1;var e=pq();return e.registerLanguage("xml",gq()),e.registerLanguage("bash",bq()),e.registerLanguage("c",xq()),e.registerLanguage("cpp",vq()),e.registerLanguage("csharp",_q()),e.registerLanguage("css",yq()),e.registerLanguage("markdown",Sq()),e.registerLanguage("diff",wq()),e.registerLanguage("ruby",kq()),e.registerLanguage("go",Cq()),e.registerLanguage("graphql",Nq()),e.registerLanguage("ini",Eq()),e.registerLanguage("java",Tq()),e.registerLanguage("javascript",jq()),e.registerLanguage("json",Aq()),e.registerLanguage("kotlin",Mq()),e.registerLanguage("less",Rq()),e.registerLanguage("lua",Dq()),e.registerLanguage("makefile",Oq()),e.registerLanguage("perl",Lq()),e.registerLanguage("objectivec",zq()),e.registerLanguage("php",Bq()),e.registerLanguage("php-template",Iq()),e.registerLanguage("plaintext",Pq()),e.registerLanguage("python",$q()),e.registerLanguage("python-repl",Hq()),e.registerLanguage("r",Uq()),e.registerLanguage("rust",Fq()),e.registerLanguage("scss",qq()),e.registerLanguage("shell",Vq()),e.registerLanguage("sql",Gq()),e.registerLanguage("swift",Wq()),e.registerLanguage("yaml",Kq()),e.registerLanguage("typescript",Yq()),e.registerLanguage("vbnet",Xq()),e.registerLanguage("wasm",Zq()),e.HighlightJS=e,e.default=e,Zg=e,Zg}var Jq=Qq();const xb=lA(Jq);function eV(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 tV({content:e}){const t=y.useMemo(()=>{const i=mt.parse(e,{async:!1,gfm:!0,breaks:!1});return eV(i)},[e]),s=y.useRef(null);return y.useEffect(()=>{const i=s.current;i&&i.querySelectorAll("pre code").forEach(a=>{xb.highlightElement(a)})},[t]),o.jsx("div",{ref:s,className:"md-preview min-w-0 px-6 py-5",dangerouslySetInnerHTML:{__html:t}})}function o5(e){return typeof e>"u"||e===null}function sV(e){return typeof e=="object"&&e!==null}function nV(e){return Array.isArray(e)?e:o5(e)?[]:[e]}function iV(e,t){var s,i,a,l;if(t)for(l=Object.keys(t),s=0,i=l.length;s<i;s+=1)a=l[s],e[a]=t[a];return e}function rV(e,t){var s="",i;for(i=0;i<t;i+=1)s+=e;return s}function aV(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var oV=o5,lV=sV,cV=nV,uV=rV,dV=aV,hV=iV,bs={isNothing:oV,isObject:lV,toArray:cV,repeat:uV,isNegativeZero:dV,extend:hV};function l5(e,t){var s="",i=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(s+='in "'+e.mark.name+'" '),s+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(s+=`
|
|
175
|
+
|
|
176
|
+
`+e.mark.snippet),i+" "+s):i}function su(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=l5(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}su.prototype=Object.create(Error.prototype);su.prototype.constructor=su;su.prototype.toString=function(t){return this.name+": "+l5(this,t)};var Zs=su;function Qg(e,t,s,i,a){var l="",u="",h=Math.floor(a/2)-1;return i-t>h&&(l=" ... ",t=i-h+l.length),s-i>h&&(u=" ...",s=i+h-u.length),{str:l+e.slice(t,s).replace(/\t/g,"→")+u,pos:i-t+l.length}}function Jg(e,t){return bs.repeat(" ",t-e.length)+e}function fV(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var s=/\r?\n|\r|\0/g,i=[0],a=[],l,u=-1;l=s.exec(e.buffer);)a.push(l.index),i.push(l.index+l[0].length),e.position<=l.index&&u<0&&(u=i.length-2);u<0&&(u=i.length-1);var h="",m,d,p=Math.min(e.line+t.linesAfter,a.length).toString().length,g=t.maxLength-(t.indent+p+3);for(m=1;m<=t.linesBefore&&!(u-m<0);m++)d=Qg(e.buffer,i[u-m],a[u-m],e.position-(i[u]-i[u-m]),g),h=bs.repeat(" ",t.indent)+Jg((e.line-m+1).toString(),p)+" | "+d.str+`
|
|
177
|
+
`+h;for(d=Qg(e.buffer,i[u],a[u],e.position,g),h+=bs.repeat(" ",t.indent)+Jg((e.line+1).toString(),p)+" | "+d.str+`
|
|
178
|
+
`,h+=bs.repeat("-",t.indent+p+3+d.pos)+`^
|
|
179
|
+
`,m=1;m<=t.linesAfter&&!(u+m>=a.length);m++)d=Qg(e.buffer,i[u+m],a[u+m],e.position-(i[u]-i[u+m]),g),h+=bs.repeat(" ",t.indent)+Jg((e.line+m+1).toString(),p)+" | "+d.str+`
|
|
180
|
+
`;return h.replace(/\n$/,"")}var mV=fV,pV=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],gV=["scalar","sequence","mapping"];function bV(e){var t={};return e!==null&&Object.keys(e).forEach(function(s){e[s].forEach(function(i){t[String(i)]=s})}),t}function xV(e,t){if(t=t||{},Object.keys(t).forEach(function(s){if(pV.indexOf(s)===-1)throw new Zs('Unknown option "'+s+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(s){return s},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=bV(t.styleAliases||null),gV.indexOf(this.kind)===-1)throw new Zs('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var Is=xV;function Tk(e,t){var s=[];return e[t].forEach(function(i){var a=s.length;s.forEach(function(l,u){l.tag===i.tag&&l.kind===i.kind&&l.multi===i.multi&&(a=u)}),s[a]=i}),s}function vV(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,s;function i(a){a.multi?(e.multi[a.kind].push(a),e.multi.fallback.push(a)):e[a.kind][a.tag]=e.fallback[a.tag]=a}for(t=0,s=arguments.length;t<s;t+=1)arguments[t].forEach(i);return e}function vb(e){return this.extend(e)}vb.prototype.extend=function(t){var s=[],i=[];if(t instanceof Is)i.push(t);else if(Array.isArray(t))i=i.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(s=s.concat(t.implicit)),t.explicit&&(i=i.concat(t.explicit));else throw new Zs("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");s.forEach(function(l){if(!(l instanceof Is))throw new Zs("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(l.loadKind&&l.loadKind!=="scalar")throw new Zs("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(l.multi)throw new Zs("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),i.forEach(function(l){if(!(l instanceof Is))throw new Zs("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var a=Object.create(vb.prototype);return a.implicit=(this.implicit||[]).concat(s),a.explicit=(this.explicit||[]).concat(i),a.compiledImplicit=Tk(a,"implicit"),a.compiledExplicit=Tk(a,"explicit"),a.compiledTypeMap=vV(a.compiledImplicit,a.compiledExplicit),a};var c5=vb,u5=new Is("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),d5=new Is("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),h5=new Is("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),f5=new c5({explicit:[u5,d5,h5]});function _V(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function yV(){return null}function SV(e){return e===null}var m5=new Is("tag:yaml.org,2002:null",{kind:"scalar",resolve:_V,construct:yV,predicate:SV,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function wV(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}function kV(e){return e==="true"||e==="True"||e==="TRUE"}function CV(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var p5=new Is("tag:yaml.org,2002:bool",{kind:"scalar",resolve:wV,construct:kV,predicate:CV,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function NV(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function EV(e){return 48<=e&&e<=55}function TV(e){return 48<=e&&e<=57}function jV(e){if(e===null)return!1;var t=e.length,s=0,i=!1,a;if(!t)return!1;if(a=e[s],(a==="-"||a==="+")&&(a=e[++s]),a==="0"){if(s+1===t)return!0;if(a=e[++s],a==="b"){for(s++;s<t;s++)if(a=e[s],a!=="_"){if(a!=="0"&&a!=="1")return!1;i=!0}return i&&a!=="_"}if(a==="x"){for(s++;s<t;s++)if(a=e[s],a!=="_"){if(!NV(e.charCodeAt(s)))return!1;i=!0}return i&&a!=="_"}if(a==="o"){for(s++;s<t;s++)if(a=e[s],a!=="_"){if(!EV(e.charCodeAt(s)))return!1;i=!0}return i&&a!=="_"}}if(a==="_")return!1;for(;s<t;s++)if(a=e[s],a!=="_"){if(!TV(e.charCodeAt(s)))return!1;i=!0}return!(!i||a==="_")}function AV(e){var t=e,s=1,i;if(t.indexOf("_")!==-1&&(t=t.replace(/_/g,"")),i=t[0],(i==="-"||i==="+")&&(i==="-"&&(s=-1),t=t.slice(1),i=t[0]),t==="0")return 0;if(i==="0"){if(t[1]==="b")return s*parseInt(t.slice(2),2);if(t[1]==="x")return s*parseInt(t.slice(2),16);if(t[1]==="o")return s*parseInt(t.slice(2),8)}return s*parseInt(t,10)}function MV(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!bs.isNegativeZero(e)}var g5=new Is("tag:yaml.org,2002:int",{kind:"scalar",resolve:jV,construct:AV,predicate:MV,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),RV=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function DV(e){return!(e===null||!RV.test(e)||e[e.length-1]==="_")}function OV(e){var t,s;return t=e.replace(/_/g,"").toLowerCase(),s=t[0]==="-"?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),t===".inf"?s===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:s*parseFloat(t,10)}var LV=/^[-+]?[0-9]+e/;function zV(e,t){var s;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(bs.isNegativeZero(e))return"-0.0";return s=e.toString(10),LV.test(s)?s.replace("e",".e"):s}function BV(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||bs.isNegativeZero(e))}var b5=new Is("tag:yaml.org,2002:float",{kind:"scalar",resolve:DV,construct:OV,predicate:BV,represent:zV,defaultStyle:"lowercase"}),x5=f5.extend({implicit:[m5,p5,g5,b5]}),v5=x5,_5=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),y5=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 IV(e){return e===null?!1:_5.exec(e)!==null||y5.exec(e)!==null}function PV(e){var t,s,i,a,l,u,h,m=0,d=null,p,g,v;if(t=_5.exec(e),t===null&&(t=y5.exec(e)),t===null)throw new Error("Date resolve error");if(s=+t[1],i=+t[2]-1,a=+t[3],!t[4])return new Date(Date.UTC(s,i,a));if(l=+t[4],u=+t[5],h=+t[6],t[7]){for(m=t[7].slice(0,3);m.length<3;)m+="0";m=+m}return t[9]&&(p=+t[10],g=+(t[11]||0),d=(p*60+g)*6e4,t[9]==="-"&&(d=-d)),v=new Date(Date.UTC(s,i,a,l,u,h,m)),d&&v.setTime(v.getTime()-d),v}function $V(e){return e.toISOString()}var S5=new Is("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:IV,construct:PV,instanceOf:Date,represent:$V});function HV(e){return e==="<<"||e===null}var w5=new Is("tag:yaml.org,2002:merge",{kind:"scalar",resolve:HV}),Ix=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
181
|
+
\r`;function UV(e){if(e===null)return!1;var t,s,i=0,a=e.length,l=Ix;for(s=0;s<a;s++)if(t=l.indexOf(e.charAt(s)),!(t>64)){if(t<0)return!1;i+=6}return i%8===0}function FV(e){var t,s,i=e.replace(/[\r\n=]/g,""),a=i.length,l=Ix,u=0,h=[];for(t=0;t<a;t++)t%4===0&&t&&(h.push(u>>16&255),h.push(u>>8&255),h.push(u&255)),u=u<<6|l.indexOf(i.charAt(t));return s=a%4*6,s===0?(h.push(u>>16&255),h.push(u>>8&255),h.push(u&255)):s===18?(h.push(u>>10&255),h.push(u>>2&255)):s===12&&h.push(u>>4&255),new Uint8Array(h)}function qV(e){var t="",s=0,i,a,l=e.length,u=Ix;for(i=0;i<l;i++)i%3===0&&i&&(t+=u[s>>18&63],t+=u[s>>12&63],t+=u[s>>6&63],t+=u[s&63]),s=(s<<8)+e[i];return a=l%3,a===0?(t+=u[s>>18&63],t+=u[s>>12&63],t+=u[s>>6&63],t+=u[s&63]):a===2?(t+=u[s>>10&63],t+=u[s>>4&63],t+=u[s<<2&63],t+=u[64]):a===1&&(t+=u[s>>2&63],t+=u[s<<4&63],t+=u[64],t+=u[64]),t}function VV(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var k5=new Is("tag:yaml.org,2002:binary",{kind:"scalar",resolve:UV,construct:FV,predicate:VV,represent:qV}),GV=Object.prototype.hasOwnProperty,WV=Object.prototype.toString;function KV(e){if(e===null)return!0;var t=[],s,i,a,l,u,h=e;for(s=0,i=h.length;s<i;s+=1){if(a=h[s],u=!1,WV.call(a)!=="[object Object]")return!1;for(l in a)if(GV.call(a,l))if(!u)u=!0;else return!1;if(!u)return!1;if(t.indexOf(l)===-1)t.push(l);else return!1}return!0}function YV(e){return e!==null?e:[]}var C5=new Is("tag:yaml.org,2002:omap",{kind:"sequence",resolve:KV,construct:YV}),XV=Object.prototype.toString;function ZV(e){if(e===null)return!0;var t,s,i,a,l,u=e;for(l=new Array(u.length),t=0,s=u.length;t<s;t+=1){if(i=u[t],XV.call(i)!=="[object Object]"||(a=Object.keys(i),a.length!==1))return!1;l[t]=[a[0],i[a[0]]]}return!0}function QV(e){if(e===null)return[];var t,s,i,a,l,u=e;for(l=new Array(u.length),t=0,s=u.length;t<s;t+=1)i=u[t],a=Object.keys(i),l[t]=[a[0],i[a[0]]];return l}var N5=new Is("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:ZV,construct:QV}),JV=Object.prototype.hasOwnProperty;function eG(e){if(e===null)return!0;var t,s=e;for(t in s)if(JV.call(s,t)&&s[t]!==null)return!1;return!0}function tG(e){return e!==null?e:{}}var E5=new Is("tag:yaml.org,2002:set",{kind:"mapping",resolve:eG,construct:tG}),Px=v5.extend({implicit:[S5,w5],explicit:[k5,C5,N5,E5]}),ca=Object.prototype.hasOwnProperty,Qh=1,T5=2,j5=3,Jh=4,e0=1,sG=2,jk=3,nG=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,iG=/[\x85\u2028\u2029]/,rG=/[,\[\]\{\}]/,A5=/^(?:!|!!|![a-z\-]+!)$/i,M5=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Ak(e){return Object.prototype.toString.call(e)}function Ri(e){return e===10||e===13}function Ka(e){return e===9||e===32}function fn(e){return e===9||e===32||e===10||e===13}function sl(e){return e===44||e===91||e===93||e===123||e===125}function aG(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function oG(e){return e===120?2:e===117?4:e===85?8:0}function lG(e){return 48<=e&&e<=57?e-48:-1}function Mk(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
|
|
182
|
+
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"
":e===95?" ":e===76?"\u2028":e===80?"\u2029":""}function cG(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function R5(e,t,s){t==="__proto__"?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:s}):e[t]=s}var D5=new Array(256),O5=new Array(256);for(var Ko=0;Ko<256;Ko++)D5[Ko]=Mk(Ko)?1:0,O5[Ko]=Mk(Ko);function uG(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||Px,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function L5(e,t){var s={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return s.snippet=mV(s),new Zs(t,s)}function Be(e,t){throw L5(e,t)}function ef(e,t){e.onWarning&&e.onWarning.call(null,L5(e,t))}var Rk={YAML:function(t,s,i){var a,l,u;t.version!==null&&Be(t,"duplication of %YAML directive"),i.length!==1&&Be(t,"YAML directive accepts exactly one argument"),a=/^([0-9]+)\.([0-9]+)$/.exec(i[0]),a===null&&Be(t,"ill-formed argument of the YAML directive"),l=parseInt(a[1],10),u=parseInt(a[2],10),l!==1&&Be(t,"unacceptable YAML version of the document"),t.version=i[0],t.checkLineBreaks=u<2,u!==1&&u!==2&&ef(t,"unsupported YAML version of the document")},TAG:function(t,s,i){var a,l;i.length!==2&&Be(t,"TAG directive accepts exactly two arguments"),a=i[0],l=i[1],A5.test(a)||Be(t,"ill-formed tag handle (first argument) of the TAG directive"),ca.call(t.tagMap,a)&&Be(t,'there is a previously declared suffix for "'+a+'" tag handle'),M5.test(l)||Be(t,"ill-formed tag prefix (second argument) of the TAG directive");try{l=decodeURIComponent(l)}catch{Be(t,"tag prefix is malformed: "+l)}t.tagMap[a]=l}};function ra(e,t,s,i){var a,l,u,h;if(t<s){if(h=e.input.slice(t,s),i)for(a=0,l=h.length;a<l;a+=1)u=h.charCodeAt(a),u===9||32<=u&&u<=1114111||Be(e,"expected valid JSON character");else nG.test(h)&&Be(e,"the stream contains non-printable characters");e.result+=h}}function Dk(e,t,s,i){var a,l,u,h;for(bs.isObject(s)||Be(e,"cannot merge mappings; the provided source object is unacceptable"),a=Object.keys(s),u=0,h=a.length;u<h;u+=1)l=a[u],ca.call(t,l)||(R5(t,l,s[l]),i[l]=!0)}function nl(e,t,s,i,a,l,u,h,m){var d,p;if(Array.isArray(a))for(a=Array.prototype.slice.call(a),d=0,p=a.length;d<p;d+=1)Array.isArray(a[d])&&Be(e,"nested arrays are not supported inside keys"),typeof a=="object"&&Ak(a[d])==="[object Object]"&&(a[d]="[object Object]");if(typeof a=="object"&&Ak(a)==="[object Object]"&&(a="[object Object]"),a=String(a),t===null&&(t={}),i==="tag:yaml.org,2002:merge")if(Array.isArray(l))for(d=0,p=l.length;d<p;d+=1)Dk(e,t,l[d],s);else Dk(e,t,l,s);else!e.json&&!ca.call(s,a)&&ca.call(t,a)&&(e.line=u||e.line,e.lineStart=h||e.lineStart,e.position=m||e.position,Be(e,"duplicated mapping key")),R5(t,a,l),delete s[a];return t}function $x(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):Be(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function us(e,t,s){for(var i=0,a=e.input.charCodeAt(e.position);a!==0;){for(;Ka(a);)a===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),a=e.input.charCodeAt(++e.position);if(t&&a===35)do a=e.input.charCodeAt(++e.position);while(a!==10&&a!==13&&a!==0);if(Ri(a))for($x(e),a=e.input.charCodeAt(e.position),i++,e.lineIndent=0;a===32;)e.lineIndent++,a=e.input.charCodeAt(++e.position);else break}return s!==-1&&i!==0&&e.lineIndent<s&&ef(e,"deficient indentation"),i}function yf(e){var t=e.position,s;return s=e.input.charCodeAt(t),!!((s===45||s===46)&&s===e.input.charCodeAt(t+1)&&s===e.input.charCodeAt(t+2)&&(t+=3,s=e.input.charCodeAt(t),s===0||fn(s)))}function Hx(e,t){t===1?e.result+=" ":t>1&&(e.result+=bs.repeat(`
|
|
183
|
+
`,t-1))}function dG(e,t,s){var i,a,l,u,h,m,d,p,g=e.kind,v=e.result,_;if(_=e.input.charCodeAt(e.position),fn(_)||sl(_)||_===35||_===38||_===42||_===33||_===124||_===62||_===39||_===34||_===37||_===64||_===96||(_===63||_===45)&&(a=e.input.charCodeAt(e.position+1),fn(a)||s&&sl(a)))return!1;for(e.kind="scalar",e.result="",l=u=e.position,h=!1;_!==0;){if(_===58){if(a=e.input.charCodeAt(e.position+1),fn(a)||s&&sl(a))break}else if(_===35){if(i=e.input.charCodeAt(e.position-1),fn(i))break}else{if(e.position===e.lineStart&&yf(e)||s&&sl(_))break;if(Ri(_))if(m=e.line,d=e.lineStart,p=e.lineIndent,us(e,!1,-1),e.lineIndent>=t){h=!0,_=e.input.charCodeAt(e.position);continue}else{e.position=u,e.line=m,e.lineStart=d,e.lineIndent=p;break}}h&&(ra(e,l,u,!1),Hx(e,e.line-m),l=u=e.position,h=!1),Ka(_)||(u=e.position+1),_=e.input.charCodeAt(++e.position)}return ra(e,l,u,!1),e.result?!0:(e.kind=g,e.result=v,!1)}function hG(e,t){var s,i,a;if(s=e.input.charCodeAt(e.position),s!==39)return!1;for(e.kind="scalar",e.result="",e.position++,i=a=e.position;(s=e.input.charCodeAt(e.position))!==0;)if(s===39)if(ra(e,i,e.position,!0),s=e.input.charCodeAt(++e.position),s===39)i=e.position,e.position++,a=e.position;else return!0;else Ri(s)?(ra(e,i,a,!0),Hx(e,us(e,!1,t)),i=a=e.position):e.position===e.lineStart&&yf(e)?Be(e,"unexpected end of the document within a single quoted scalar"):(e.position++,a=e.position);Be(e,"unexpected end of the stream within a single quoted scalar")}function fG(e,t){var s,i,a,l,u,h;if(h=e.input.charCodeAt(e.position),h!==34)return!1;for(e.kind="scalar",e.result="",e.position++,s=i=e.position;(h=e.input.charCodeAt(e.position))!==0;){if(h===34)return ra(e,s,e.position,!0),e.position++,!0;if(h===92){if(ra(e,s,e.position,!0),h=e.input.charCodeAt(++e.position),Ri(h))us(e,!1,t);else if(h<256&&D5[h])e.result+=O5[h],e.position++;else if((u=oG(h))>0){for(a=u,l=0;a>0;a--)h=e.input.charCodeAt(++e.position),(u=aG(h))>=0?l=(l<<4)+u:Be(e,"expected hexadecimal character");e.result+=cG(l),e.position++}else Be(e,"unknown escape sequence");s=i=e.position}else Ri(h)?(ra(e,s,i,!0),Hx(e,us(e,!1,t)),s=i=e.position):e.position===e.lineStart&&yf(e)?Be(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}Be(e,"unexpected end of the stream within a double quoted scalar")}function mG(e,t){var s=!0,i,a,l,u=e.tag,h,m=e.anchor,d,p,g,v,_,S=Object.create(null),w,C,E,T;if(T=e.input.charCodeAt(e.position),T===91)p=93,_=!1,h=[];else if(T===123)p=125,_=!0,h={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=h),T=e.input.charCodeAt(++e.position);T!==0;){if(us(e,!0,t),T=e.input.charCodeAt(e.position),T===p)return e.position++,e.tag=u,e.anchor=m,e.kind=_?"mapping":"sequence",e.result=h,!0;s?T===44&&Be(e,"expected the node content, but found ','"):Be(e,"missed comma between flow collection entries"),C=w=E=null,g=v=!1,T===63&&(d=e.input.charCodeAt(e.position+1),fn(d)&&(g=v=!0,e.position++,us(e,!0,t))),i=e.line,a=e.lineStart,l=e.position,ul(e,t,Qh,!1,!0),C=e.tag,w=e.result,us(e,!0,t),T=e.input.charCodeAt(e.position),(v||e.line===i)&&T===58&&(g=!0,T=e.input.charCodeAt(++e.position),us(e,!0,t),ul(e,t,Qh,!1,!0),E=e.result),_?nl(e,h,S,C,w,E,i,a,l):g?h.push(nl(e,null,S,C,w,E,i,a,l)):h.push(w),us(e,!0,t),T=e.input.charCodeAt(e.position),T===44?(s=!0,T=e.input.charCodeAt(++e.position)):s=!1}Be(e,"unexpected end of the stream within a flow collection")}function pG(e,t){var s,i,a=e0,l=!1,u=!1,h=t,m=0,d=!1,p,g;if(g=e.input.charCodeAt(e.position),g===124)i=!1;else if(g===62)i=!0;else return!1;for(e.kind="scalar",e.result="";g!==0;)if(g=e.input.charCodeAt(++e.position),g===43||g===45)e0===a?a=g===43?jk:sG:Be(e,"repeat of a chomping mode identifier");else if((p=lG(g))>=0)p===0?Be(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?Be(e,"repeat of an indentation width identifier"):(h=t+p-1,u=!0);else break;if(Ka(g)){do g=e.input.charCodeAt(++e.position);while(Ka(g));if(g===35)do g=e.input.charCodeAt(++e.position);while(!Ri(g)&&g!==0)}for(;g!==0;){for($x(e),e.lineIndent=0,g=e.input.charCodeAt(e.position);(!u||e.lineIndent<h)&&g===32;)e.lineIndent++,g=e.input.charCodeAt(++e.position);if(!u&&e.lineIndent>h&&(h=e.lineIndent),Ri(g)){m++;continue}if(e.lineIndent<h){a===jk?e.result+=bs.repeat(`
|
|
184
|
+
`,l?1+m:m):a===e0&&l&&(e.result+=`
|
|
185
|
+
`);break}for(i?Ka(g)?(d=!0,e.result+=bs.repeat(`
|
|
186
|
+
`,l?1+m:m)):d?(d=!1,e.result+=bs.repeat(`
|
|
187
|
+
`,m+1)):m===0?l&&(e.result+=" "):e.result+=bs.repeat(`
|
|
188
|
+
`,m):e.result+=bs.repeat(`
|
|
189
|
+
`,l?1+m:m),l=!0,u=!0,m=0,s=e.position;!Ri(g)&&g!==0;)g=e.input.charCodeAt(++e.position);ra(e,s,e.position,!1)}return!0}function Ok(e,t){var s,i=e.tag,a=e.anchor,l=[],u,h=!1,m;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=l),m=e.input.charCodeAt(e.position);m!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,Be(e,"tab characters must not be used in indentation")),!(m!==45||(u=e.input.charCodeAt(e.position+1),!fn(u))));){if(h=!0,e.position++,us(e,!0,-1)&&e.lineIndent<=t){l.push(null),m=e.input.charCodeAt(e.position);continue}if(s=e.line,ul(e,t,j5,!1,!0),l.push(e.result),us(e,!0,-1),m=e.input.charCodeAt(e.position),(e.line===s||e.lineIndent>t)&&m!==0)Be(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return h?(e.tag=i,e.anchor=a,e.kind="sequence",e.result=l,!0):!1}function gG(e,t,s){var i,a,l,u,h,m,d=e.tag,p=e.anchor,g={},v=Object.create(null),_=null,S=null,w=null,C=!1,E=!1,T;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=g),T=e.input.charCodeAt(e.position);T!==0;){if(!C&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,Be(e,"tab characters must not be used in indentation")),i=e.input.charCodeAt(e.position+1),l=e.line,(T===63||T===58)&&fn(i))T===63?(C&&(nl(e,g,v,_,S,null,u,h,m),_=S=w=null),E=!0,C=!0,a=!0):C?(C=!1,a=!0):Be(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,T=i;else{if(u=e.line,h=e.lineStart,m=e.position,!ul(e,s,T5,!1,!0))break;if(e.line===l){for(T=e.input.charCodeAt(e.position);Ka(T);)T=e.input.charCodeAt(++e.position);if(T===58)T=e.input.charCodeAt(++e.position),fn(T)||Be(e,"a whitespace character is expected after the key-value separator within a block mapping"),C&&(nl(e,g,v,_,S,null,u,h,m),_=S=w=null),E=!0,C=!1,a=!1,_=e.tag,S=e.result;else if(E)Be(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=d,e.anchor=p,!0}else if(E)Be(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=d,e.anchor=p,!0}if((e.line===l||e.lineIndent>t)&&(C&&(u=e.line,h=e.lineStart,m=e.position),ul(e,t,Jh,!0,a)&&(C?S=e.result:w=e.result),C||(nl(e,g,v,_,S,w,u,h,m),_=S=w=null),us(e,!0,-1),T=e.input.charCodeAt(e.position)),(e.line===l||e.lineIndent>t)&&T!==0)Be(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return C&&nl(e,g,v,_,S,null,u,h,m),E&&(e.tag=d,e.anchor=p,e.kind="mapping",e.result=g),E}function bG(e){var t,s=!1,i=!1,a,l,u;if(u=e.input.charCodeAt(e.position),u!==33)return!1;if(e.tag!==null&&Be(e,"duplication of a tag property"),u=e.input.charCodeAt(++e.position),u===60?(s=!0,u=e.input.charCodeAt(++e.position)):u===33?(i=!0,a="!!",u=e.input.charCodeAt(++e.position)):a="!",t=e.position,s){do u=e.input.charCodeAt(++e.position);while(u!==0&&u!==62);e.position<e.length?(l=e.input.slice(t,e.position),u=e.input.charCodeAt(++e.position)):Be(e,"unexpected end of the stream within a verbatim tag")}else{for(;u!==0&&!fn(u);)u===33&&(i?Be(e,"tag suffix cannot contain exclamation marks"):(a=e.input.slice(t-1,e.position+1),A5.test(a)||Be(e,"named tag handle cannot contain such characters"),i=!0,t=e.position+1)),u=e.input.charCodeAt(++e.position);l=e.input.slice(t,e.position),rG.test(l)&&Be(e,"tag suffix cannot contain flow indicator characters")}l&&!M5.test(l)&&Be(e,"tag name cannot contain such characters: "+l);try{l=decodeURIComponent(l)}catch{Be(e,"tag name is malformed: "+l)}return s?e.tag=l:ca.call(e.tagMap,a)?e.tag=e.tagMap[a]+l:a==="!"?e.tag="!"+l:a==="!!"?e.tag="tag:yaml.org,2002:"+l:Be(e,'undeclared tag handle "'+a+'"'),!0}function xG(e){var t,s;if(s=e.input.charCodeAt(e.position),s!==38)return!1;for(e.anchor!==null&&Be(e,"duplication of an anchor property"),s=e.input.charCodeAt(++e.position),t=e.position;s!==0&&!fn(s)&&!sl(s);)s=e.input.charCodeAt(++e.position);return e.position===t&&Be(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function vG(e){var t,s,i;if(i=e.input.charCodeAt(e.position),i!==42)return!1;for(i=e.input.charCodeAt(++e.position),t=e.position;i!==0&&!fn(i)&&!sl(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&Be(e,"name of an alias node must contain at least one character"),s=e.input.slice(t,e.position),ca.call(e.anchorMap,s)||Be(e,'unidentified alias "'+s+'"'),e.result=e.anchorMap[s],us(e,!0,-1),!0}function ul(e,t,s,i,a){var l,u,h,m=1,d=!1,p=!1,g,v,_,S,w,C;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,l=u=h=Jh===s||j5===s,i&&us(e,!0,-1)&&(d=!0,e.lineIndent>t?m=1:e.lineIndent===t?m=0:e.lineIndent<t&&(m=-1)),m===1)for(;bG(e)||xG(e);)us(e,!0,-1)?(d=!0,h=l,e.lineIndent>t?m=1:e.lineIndent===t?m=0:e.lineIndent<t&&(m=-1)):h=!1;if(h&&(h=d||a),(m===1||Jh===s)&&(Qh===s||T5===s?w=t:w=t+1,C=e.position-e.lineStart,m===1?h&&(Ok(e,C)||gG(e,C,w))||mG(e,w)?p=!0:(u&&pG(e,w)||hG(e,w)||fG(e,w)?p=!0:vG(e)?(p=!0,(e.tag!==null||e.anchor!==null)&&Be(e,"alias node should not have any properties")):dG(e,w,Qh===s)&&(p=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):m===0&&(p=h&&Ok(e,C))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&Be(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),g=0,v=e.implicitTypes.length;g<v;g+=1)if(S=e.implicitTypes[g],S.resolve(e.result)){e.result=S.construct(e.result),e.tag=S.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(ca.call(e.typeMap[e.kind||"fallback"],e.tag))S=e.typeMap[e.kind||"fallback"][e.tag];else for(S=null,_=e.typeMap.multi[e.kind||"fallback"],g=0,v=_.length;g<v;g+=1)if(e.tag.slice(0,_[g].tag.length)===_[g].tag){S=_[g];break}S||Be(e,"unknown tag !<"+e.tag+">"),e.result!==null&&S.kind!==e.kind&&Be(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+S.kind+'", not "'+e.kind+'"'),S.resolve(e.result,e.tag)?(e.result=S.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):Be(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||p}function _G(e){var t=e.position,s,i,a,l=!1,u;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(u=e.input.charCodeAt(e.position))!==0&&(us(e,!0,-1),u=e.input.charCodeAt(e.position),!(e.lineIndent>0||u!==37));){for(l=!0,u=e.input.charCodeAt(++e.position),s=e.position;u!==0&&!fn(u);)u=e.input.charCodeAt(++e.position);for(i=e.input.slice(s,e.position),a=[],i.length<1&&Be(e,"directive name must not be less than one character in length");u!==0;){for(;Ka(u);)u=e.input.charCodeAt(++e.position);if(u===35){do u=e.input.charCodeAt(++e.position);while(u!==0&&!Ri(u));break}if(Ri(u))break;for(s=e.position;u!==0&&!fn(u);)u=e.input.charCodeAt(++e.position);a.push(e.input.slice(s,e.position))}u!==0&&$x(e),ca.call(Rk,i)?Rk[i](e,i,a):ef(e,'unknown document directive "'+i+'"')}if(us(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,us(e,!0,-1)):l&&Be(e,"directives end mark is expected"),ul(e,e.lineIndent-1,Jh,!1,!0),us(e,!0,-1),e.checkLineBreaks&&iG.test(e.input.slice(t,e.position))&&ef(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&yf(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,us(e,!0,-1));return}if(e.position<e.length-1)Be(e,"end of the stream or a document separator is expected");else return}function z5(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
|
|
190
|
+
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var s=new uG(e,t),i=e.indexOf("\0");for(i!==-1&&(s.position=i,Be(s,"null byte is not allowed in input")),s.input+="\0";s.input.charCodeAt(s.position)===32;)s.lineIndent+=1,s.position+=1;for(;s.position<s.length-1;)_G(s);return s.documents}function yG(e,t,s){t!==null&&typeof t=="object"&&typeof s>"u"&&(s=t,t=null);var i=z5(e,s);if(typeof t!="function")return i;for(var a=0,l=i.length;a<l;a+=1)t(i[a])}function SG(e,t){var s=z5(e,t);if(s.length!==0){if(s.length===1)return s[0];throw new Zs("expected a single document in the stream, but found more")}}var wG=yG,kG=SG,B5={loadAll:wG,load:kG},I5=Object.prototype.toString,P5=Object.prototype.hasOwnProperty,Ux=65279,CG=9,nu=10,NG=13,EG=32,TG=33,jG=34,_b=35,AG=37,MG=38,RG=39,DG=42,$5=44,OG=45,tf=58,LG=61,zG=62,BG=63,IG=64,H5=91,U5=93,PG=96,F5=123,$G=124,q5=125,Ws={};Ws[0]="\\0";Ws[7]="\\a";Ws[8]="\\b";Ws[9]="\\t";Ws[10]="\\n";Ws[11]="\\v";Ws[12]="\\f";Ws[13]="\\r";Ws[27]="\\e";Ws[34]='\\"';Ws[92]="\\\\";Ws[133]="\\N";Ws[160]="\\_";Ws[8232]="\\L";Ws[8233]="\\P";var HG=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],UG=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function FG(e,t){var s,i,a,l,u,h,m;if(t===null)return{};for(s={},i=Object.keys(t),a=0,l=i.length;a<l;a+=1)u=i[a],h=String(t[u]),u.slice(0,2)==="!!"&&(u="tag:yaml.org,2002:"+u.slice(2)),m=e.compiledTypeMap.fallback[u],m&&P5.call(m.styleAliases,h)&&(h=m.styleAliases[h]),s[u]=h;return s}function qG(e){var t,s,i;if(t=e.toString(16).toUpperCase(),e<=255)s="x",i=2;else if(e<=65535)s="u",i=4;else if(e<=4294967295)s="U",i=8;else throw new Zs("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+s+bs.repeat("0",i-t.length)+t}var VG=1,iu=2;function GG(e){this.schema=e.schema||Px,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=bs.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=FG(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?iu:VG,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Lk(e,t){for(var s=bs.repeat(" ",t),i=0,a=-1,l="",u,h=e.length;i<h;)a=e.indexOf(`
|
|
191
|
+
`,i),a===-1?(u=e.slice(i),i=h):(u=e.slice(i,a+1),i=a+1),u.length&&u!==`
|
|
192
|
+
`&&(l+=s),l+=u;return l}function yb(e,t){return`
|
|
193
|
+
`+bs.repeat(" ",e.indent*t)}function WG(e,t){var s,i,a;for(s=0,i=e.implicitTypes.length;s<i;s+=1)if(a=e.implicitTypes[s],a.resolve(t))return!0;return!1}function sf(e){return e===EG||e===CG}function ru(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==Ux||65536<=e&&e<=1114111}function zk(e){return ru(e)&&e!==Ux&&e!==NG&&e!==nu}function Bk(e,t,s){var i=zk(e),a=i&&!sf(e);return(s?i:i&&e!==$5&&e!==H5&&e!==U5&&e!==F5&&e!==q5)&&e!==_b&&!(t===tf&&!a)||zk(t)&&!sf(t)&&e===_b||t===tf&&a}function KG(e){return ru(e)&&e!==Ux&&!sf(e)&&e!==OG&&e!==BG&&e!==tf&&e!==$5&&e!==H5&&e!==U5&&e!==F5&&e!==q5&&e!==_b&&e!==MG&&e!==DG&&e!==TG&&e!==$G&&e!==LG&&e!==zG&&e!==RG&&e!==jG&&e!==AG&&e!==IG&&e!==PG}function YG(e){return!sf(e)&&e!==tf}function zc(e,t){var s=e.charCodeAt(t),i;return s>=55296&&s<=56319&&t+1<e.length&&(i=e.charCodeAt(t+1),i>=56320&&i<=57343)?(s-55296)*1024+i-56320+65536:s}function V5(e){var t=/^\n* /;return t.test(e)}var G5=1,Sb=2,W5=3,K5=4,Zo=5;function XG(e,t,s,i,a,l,u,h){var m,d=0,p=null,g=!1,v=!1,_=i!==-1,S=-1,w=KG(zc(e,0))&&YG(zc(e,e.length-1));if(t||u)for(m=0;m<e.length;d>=65536?m+=2:m++){if(d=zc(e,m),!ru(d))return Zo;w=w&&Bk(d,p,h),p=d}else{for(m=0;m<e.length;d>=65536?m+=2:m++){if(d=zc(e,m),d===nu)g=!0,_&&(v=v||m-S-1>i&&e[S+1]!==" ",S=m);else if(!ru(d))return Zo;w=w&&Bk(d,p,h),p=d}v=v||_&&m-S-1>i&&e[S+1]!==" "}return!g&&!v?w&&!u&&!a(e)?G5:l===iu?Zo:Sb:s>9&&V5(e)?Zo:u?l===iu?Zo:Sb:v?K5:W5}function ZG(e,t,s,i,a){e.dump=(function(){if(t.length===0)return e.quotingType===iu?'""':"''";if(!e.noCompatMode&&(HG.indexOf(t)!==-1||UG.test(t)))return e.quotingType===iu?'"'+t+'"':"'"+t+"'";var l=e.indent*Math.max(1,s),u=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-l),h=i||e.flowLevel>-1&&s>=e.flowLevel;function m(d){return WG(e,d)}switch(XG(t,h,e.indent,u,m,e.quotingType,e.forceQuotes&&!i,a)){case G5:return t;case Sb:return"'"+t.replace(/'/g,"''")+"'";case W5:return"|"+Ik(t,e.indent)+Pk(Lk(t,l));case K5:return">"+Ik(t,e.indent)+Pk(Lk(QG(t,u),l));case Zo:return'"'+JG(t)+'"';default:throw new Zs("impossible error: invalid scalar style")}})()}function Ik(e,t){var s=V5(e)?String(t):"",i=e[e.length-1]===`
|
|
194
|
+
`,a=i&&(e[e.length-2]===`
|
|
195
|
+
`||e===`
|
|
196
|
+
`),l=a?"+":i?"":"-";return s+l+`
|
|
197
|
+
`}function Pk(e){return e[e.length-1]===`
|
|
198
|
+
`?e.slice(0,-1):e}function QG(e,t){for(var s=/(\n+)([^\n]*)/g,i=(function(){var d=e.indexOf(`
|
|
199
|
+
`);return d=d!==-1?d:e.length,s.lastIndex=d,$k(e.slice(0,d),t)})(),a=e[0]===`
|
|
200
|
+
`||e[0]===" ",l,u;u=s.exec(e);){var h=u[1],m=u[2];l=m[0]===" ",i+=h+(!a&&!l&&m!==""?`
|
|
201
|
+
`:"")+$k(m,t),a=l}return i}function $k(e,t){if(e===""||e[0]===" ")return e;for(var s=/ [^ ]/g,i,a=0,l,u=0,h=0,m="";i=s.exec(e);)h=i.index,h-a>t&&(l=u>a?u:h,m+=`
|
|
202
|
+
`+e.slice(a,l),a=l+1),u=h;return m+=`
|
|
203
|
+
`,e.length-a>t&&u>a?m+=e.slice(a,u)+`
|
|
204
|
+
`+e.slice(u+1):m+=e.slice(a),m.slice(1)}function JG(e){for(var t="",s=0,i,a=0;a<e.length;s>=65536?a+=2:a++)s=zc(e,a),i=Ws[s],!i&&ru(s)?(t+=e[a],s>=65536&&(t+=e[a+1])):t+=i||qG(s);return t}function eW(e,t,s){var i="",a=e.tag,l,u,h;for(l=0,u=s.length;l<u;l+=1)h=s[l],e.replacer&&(h=e.replacer.call(s,String(l),h)),(gr(e,t,h,!1,!1)||typeof h>"u"&&gr(e,t,null,!1,!1))&&(i!==""&&(i+=","+(e.condenseFlow?"":" ")),i+=e.dump);e.tag=a,e.dump="["+i+"]"}function Hk(e,t,s,i){var a="",l=e.tag,u,h,m;for(u=0,h=s.length;u<h;u+=1)m=s[u],e.replacer&&(m=e.replacer.call(s,String(u),m)),(gr(e,t+1,m,!0,!0,!1,!0)||typeof m>"u"&&gr(e,t+1,null,!0,!0,!1,!0))&&((!i||a!=="")&&(a+=yb(e,t)),e.dump&&nu===e.dump.charCodeAt(0)?a+="-":a+="- ",a+=e.dump);e.tag=l,e.dump=a||"[]"}function tW(e,t,s){var i="",a=e.tag,l=Object.keys(s),u,h,m,d,p;for(u=0,h=l.length;u<h;u+=1)p="",i!==""&&(p+=", "),e.condenseFlow&&(p+='"'),m=l[u],d=s[m],e.replacer&&(d=e.replacer.call(s,m,d)),gr(e,t,m,!1,!1)&&(e.dump.length>1024&&(p+="? "),p+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),gr(e,t,d,!1,!1)&&(p+=e.dump,i+=p));e.tag=a,e.dump="{"+i+"}"}function sW(e,t,s,i){var a="",l=e.tag,u=Object.keys(s),h,m,d,p,g,v;if(e.sortKeys===!0)u.sort();else if(typeof e.sortKeys=="function")u.sort(e.sortKeys);else if(e.sortKeys)throw new Zs("sortKeys must be a boolean or a function");for(h=0,m=u.length;h<m;h+=1)v="",(!i||a!=="")&&(v+=yb(e,t)),d=u[h],p=s[d],e.replacer&&(p=e.replacer.call(s,d,p)),gr(e,t+1,d,!0,!0,!0)&&(g=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,g&&(e.dump&&nu===e.dump.charCodeAt(0)?v+="?":v+="? "),v+=e.dump,g&&(v+=yb(e,t)),gr(e,t+1,p,!0,g)&&(e.dump&&nu===e.dump.charCodeAt(0)?v+=":":v+=": ",v+=e.dump,a+=v));e.tag=l,e.dump=a||"{}"}function Uk(e,t,s){var i,a,l,u,h,m;for(a=s?e.explicitTypes:e.implicitTypes,l=0,u=a.length;l<u;l+=1)if(h=a[l],(h.instanceOf||h.predicate)&&(!h.instanceOf||typeof t=="object"&&t instanceof h.instanceOf)&&(!h.predicate||h.predicate(t))){if(s?h.multi&&h.representName?e.tag=h.representName(t):e.tag=h.tag:e.tag="?",h.represent){if(m=e.styleMap[h.tag]||h.defaultStyle,I5.call(h.represent)==="[object Function]")i=h.represent(t,m);else if(P5.call(h.represent,m))i=h.represent[m](t,m);else throw new Zs("!<"+h.tag+'> tag resolver accepts not "'+m+'" style');e.dump=i}return!0}return!1}function gr(e,t,s,i,a,l,u){e.tag=null,e.dump=s,Uk(e,s,!1)||Uk(e,s,!0);var h=I5.call(e.dump),m=i,d;i&&(i=e.flowLevel<0||e.flowLevel>t);var p=h==="[object Object]"||h==="[object Array]",g,v;if(p&&(g=e.duplicates.indexOf(s),v=g!==-1),(e.tag!==null&&e.tag!=="?"||v||e.indent!==2&&t>0)&&(a=!1),v&&e.usedDuplicates[g])e.dump="*ref_"+g;else{if(p&&v&&!e.usedDuplicates[g]&&(e.usedDuplicates[g]=!0),h==="[object Object]")i&&Object.keys(e.dump).length!==0?(sW(e,t,e.dump,a),v&&(e.dump="&ref_"+g+e.dump)):(tW(e,t,e.dump),v&&(e.dump="&ref_"+g+" "+e.dump));else if(h==="[object Array]")i&&e.dump.length!==0?(e.noArrayIndent&&!u&&t>0?Hk(e,t-1,e.dump,a):Hk(e,t,e.dump,a),v&&(e.dump="&ref_"+g+e.dump)):(eW(e,t,e.dump),v&&(e.dump="&ref_"+g+" "+e.dump));else if(h==="[object String]")e.tag!=="?"&&ZG(e,e.dump,t,l,m);else{if(h==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new Zs("unacceptable kind of an object to dump "+h)}e.tag!==null&&e.tag!=="?"&&(d=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?d="!"+d:d.slice(0,18)==="tag:yaml.org,2002:"?d="!!"+d.slice(18):d="!<"+d+">",e.dump=d+" "+e.dump)}return!0}function nW(e,t){var s=[],i=[],a,l;for(wb(e,s,i),a=0,l=i.length;a<l;a+=1)t.duplicates.push(s[i[a]]);t.usedDuplicates=new Array(l)}function wb(e,t,s){var i,a,l;if(e!==null&&typeof e=="object")if(a=t.indexOf(e),a!==-1)s.indexOf(a)===-1&&s.push(a);else if(t.push(e),Array.isArray(e))for(a=0,l=e.length;a<l;a+=1)wb(e[a],t,s);else for(i=Object.keys(e),a=0,l=i.length;a<l;a+=1)wb(e[i[a]],t,s)}function iW(e,t){t=t||{};var s=new GG(t);s.noRefs||nW(e,s);var i=e;return s.replacer&&(i=s.replacer.call({"":i},"",i)),gr(s,0,i,!0,!0)?s.dump+`
|
|
205
|
+
`:""}var rW=iW,aW={dump:rW};function Fx(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var oW=Is,lW=c5,cW=f5,uW=x5,dW=v5,hW=Px,fW=B5.load,mW=B5.loadAll,pW=aW.dump,gW=Zs,bW={binary:k5,float:b5,map:h5,null:m5,pairs:N5,set:E5,timestamp:S5,bool:p5,int:g5,merge:w5,omap:C5,seq:d5,str:u5},xW=Fx("safeLoad","load"),vW=Fx("safeLoadAll","loadAll"),_W=Fx("safeDump","dump"),yW={Type:oW,Schema:lW,FAILSAFE_SCHEMA:cW,JSON_SCHEMA:uW,CORE_SCHEMA:dW,DEFAULT_SCHEMA:hW,load:fW,loadAll:mW,dump:pW,YAMLException:gW,types:bW,safeLoad:xW,safeLoadAll:vW,safeDump:_W};function Y5(e){return e!==null&&typeof e=="object"}function X5(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 Z5(e){return e==null?"null":typeof e=="string"?e===""?'""':e:String(e)}function Q5({label:e,value:t,depth:s,defaultOpen:i}){const[a,l]=y.useState(i),u={paddingLeft:`${s*1.1}rem`};if(!Y5(t))return o.jsxs("div",{className:"flex items-baseline gap-2 py-[1px]",style:u,children:[o.jsxs("span",{className:"text-muted-foreground",children:[e,":"]}),o.jsx("span",{className:le("whitespace-pre-wrap break-words",X5(t)),children:Z5(t)})]});const h=Array.isArray(t)?t.map((d,p)=>[String(p),d]):Object.entries(t),m=Array.isArray(t)?`[${h.length}]`:`{${h.length}}`;return o.jsxs("div",{children:[o.jsxs("button",{type:"button",onClick:()=>l(d=>!d),className:"flex w-full items-center gap-1 py-[1px] text-left hover:bg-muted",style:u,children:[a?o.jsx(Mn,{className:"size-3.5 shrink-0 text-muted-foreground"}):o.jsx(Li,{className:"size-3.5 shrink-0 text-muted-foreground"}),o.jsx("span",{className:"font-medium text-foreground",children:e}),o.jsx("span",{className:"text-muted-foreground",children:m})]}),a?h.map(([d,p])=>o.jsx(Q5,{label:d,value:p,depth:s+1,defaultOpen:s<1},d)):null]})}function SW({content:e}){const t=y.useMemo(()=>{try{const i=yW.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 o.jsx("div",{className:"p-4",children:o.jsxs(Qe,{variant:"destructive",children:["Could not parse YAML: ",t.error]})});if(!Y5(t.value))return o.jsx("div",{className:"p-4 font-mono text-[12px]",children:o.jsx("span",{className:X5(t.value),children:Z5(t.value)})});const s=Array.isArray(t.value)?t.value.map((i,a)=>[String(a),i]):Object.entries(t.value);return o.jsx("div",{className:"min-w-max px-4 py-3 font-mono text-[12px] leading-[1.6]",children:s.map(([i,a])=>o.jsx(Q5,{label:i,value:a,depth:0,defaultOpen:!0},i))})}const wW=y.lazy(()=>mq(()=>import("./code-editor-DH7Sl3iw.js"),[]).then(e=>({default:e.CodeEditor})));function kW(e){const t=e.split("/").pop()?.toLowerCase().split(".").pop()??"";return t==="md"||t==="mdx"||t==="markdown"?"markdown":t==="yml"||t==="yaml"?"yaml":null}function CW(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 NW(e,t){const s=e.endsWith(`
|
|
206
|
+
`)?e.slice(0,-1):e;return!t||!xb.getLanguage(t)?s.split(`
|
|
207
|
+
`).map(Fk):s.split(`
|
|
208
|
+
`).map(i=>{if(!i)return"";try{return xb.highlight(i,{language:t,ignoreIllegals:!0}).value}catch{return Fk(i)}})}function Fk(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function EW({content:e,path:t}){const s=y.useMemo(()=>CW(t),[t]),i=y.useMemo(()=>NW(e,s),[e,s]),a=`${Math.max(2,String(i.length).length)}ch`;return o.jsx("div",{className:"min-w-max font-mono text-[12px] leading-[1.5]",children:i.map((l,u)=>o.jsxs("div",{className:"flex",children:[o.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:u+1}),o.jsx("span",{className:"hljs whitespace-pre px-3 text-zinc-800 dark:text-zinc-100",dangerouslySetInnerHTML:{__html:l||" "}})]},u))})}function TW({path:e,isModified:t,onViewDiff:s,onFileSaved:i,onSendToAi:a}){const[l,u]=y.useState(null),[h,m]=y.useState(""),[d,p]=y.useState(!1),[g,v]=y.useState(null),[_,S]=y.useState(!1),[w,C]=y.useState(!1),{success:E,error:T}=Ns(),N=y.useMemo(()=>kW(e),[e]),[j,R]=y.useState("preview"),z=!!(l&&!l.binary&&!l.truncated),D=l?h!==l.content:!1;y.useEffect(()=>{R(N?"preview":"source"),p(!1)},[N]),y.useEffect(()=>{if(!e){u(null);return}let L=!0;return S(!0),v(null),p(!1),F6(e).then(B=>{L&&(u(B),m(B.content),S(!1))}).catch(B=>{L&&(v(B instanceof Error?B.message:String(B)),S(!1))}),()=>{L=!1}},[e]);async function M(){if(!(!e||!l||!D||w)){C(!0);try{await q6(e,h);const L={...l,content:h,size:new TextEncoder().encode(h).length};u(L),p(!1),E(`Saved ${e}.`),i?.(e)}catch(L){T(L instanceof Error?L.message:String(L))}finally{C(!1)}}}function $(){m(l?.content??""),p(!1)}return e?o.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col border-l border-border bg-card",children:[o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-1.5",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:e}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground",children:[o.jsx("span",{children:"Read-only view of tracked file."}),l?.truncated?o.jsx("span",{className:"text-amber-700",children:"Truncated — file exceeds 1MB."}):null,l?.binary?o.jsx("span",{className:"text-amber-700",children:"Binary file."}):null]})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[N&&!l?.binary?o.jsxs("div",{className:"flex items-center rounded-md border border-border p-0.5",children:[o.jsxs("button",{type:"button",onClick:()=>R("preview"),"aria-pressed":j==="preview",className:le("flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition-colors",j==="preview"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"),children:[o.jsx(Rb,{className:"size-3.5"}),"Preview"]}),o.jsxs("button",{type:"button",onClick:()=>R("source"),"aria-pressed":j==="source",className:le("flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition-colors",j==="source"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"),children:[o.jsx(cC,{className:"size-3.5"}),"Source"]})]}):null,t?o.jsx(se,{onClick:s,size:"sm",type:"button",variant:"outline",children:"View diff"}):null,a?o.jsx(se,{"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:o.jsx(Gt,{className:"size-4"})}):null,d?o.jsxs(o.Fragment,{children:[o.jsxs(se,{disabled:!D||w,onClick:()=>{M()},size:"sm",type:"button",children:[o.jsx(wC,{}),"Apply"]}),o.jsxs(se,{disabled:w,onClick:$,size:"sm",type:"button",variant:"outline",children:[o.jsx(Gs,{}),"Cancel"]})]}):z?o.jsxs(se,{onClick:()=>{R("source"),p(!0)},size:"sm",type:"button",variant:"outline",children:[o.jsx(Gc,{}),"Edit"]}):null]})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-auto bg-zinc-50 dark:bg-zinc-950",children:g?o.jsx("div",{className:"p-4",children:o.jsx(Qe,{variant:"destructive",children:g})}):_?o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading…"}):l?.binary?o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Cannot display binary content."}):l?d?o.jsx(y.Suspense,{fallback:o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading editor…"}),children:o.jsx(wW,{path:e,value:h,onChange:m})}):N&&j==="preview"?N==="markdown"?o.jsx(tV,{content:l.content}):o.jsx(SW,{content:l.content}):o.jsx(EW,{content:l.content,path:e}):null})]}):o.jsx("div",{className:"p-4",children:o.jsx(Qe,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a file to view its contents."})})}function jW({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),u=t[l+1];return u?i===u?{kind:"file",filePath:u}:{kind:"confirm-next-file",filePath:u}:{kind:"none"}}function qk(e){const t={name:"",fullPath:"",children:new Map};for(const s of e){const i=s.name.split("/");let a=t;i.forEach((l,u)=>{let h=a.children.get(l);h||(h={name:l,fullPath:i.slice(0,u+1).join("/"),children:new Map},a.children.set(l,h)),a=h}),a.branch=s}return t}function Vk({label:e,tree:t,onSelect:s,defaultOpen:i,forceOpen:a}){const[l,u]=y.useState(i??!1),h=a||l,m=t.children.size===0;return o.jsxs("div",{className:"mb-1",children:[o.jsxs("button",{type:"button",onClick:()=>u(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?o.jsx(Mn,{size:12}):o.jsx(Li,{size:12}),e,m?null:o.jsxs("span",{className:"ml-1 text-[10px] font-normal",children:["(",t.children.size,")"]})]}),h&&!m?o.jsx("ul",{children:Array.from(t.children.values()).map(d=>o.jsx(J5,{node:d,depth:1,onSelect:s,forceOpen:a},d.fullPath))}):null]})}function J5({node:e,depth:t,onSelect:s,forceOpen:i}){const[a,l]=y.useState(!0),u=i||a,h=e.children.size>0,m=e.branch,d={paddingLeft:`${t*10}px`};return!h&&m?o.jsx("li",{children:o.jsxs("button",{type:"button",onClick:()=>s(m),style:d,title:m.name,className:`flex w-full items-center gap-1.5 py-0.5 pr-2 text-left text-[12px] hover:bg-muted/60 ${m.current?"font-semibold text-emerald-700":""}`,children:[o.jsx(pn,{size:11,className:"shrink-0 opacity-70"}),o.jsx("span",{className:"truncate",children:e.name}),m.current?o.jsx("span",{className:"text-[10px]",children:"●"}):null]})}):o.jsxs("li",{children:[o.jsxs("button",{type:"button",onClick:()=>{m?s(m):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?u?o.jsx(Mn,{size:11}):o.jsx(Li,{size:11}):o.jsx("span",{className:"inline-block w-[11px]"}),o.jsx("span",{className:"truncate",children:e.name})]}),u&&h?o.jsx("ul",{children:Array.from(e.children.values()).map(p=>o.jsx(J5,{node:p,depth:t+1,onSelect:s,forceOpen:i},p.fullPath))}):null]})}function AW({selectedCommit:e,selectedFile:t,diff:s,diffLoading:i,diffError:a}){return o.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col bg-card border-b border-border",children:[o.jsx("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-1.5",children:o.jsxs("div",{className:"min-w-0",children:[o.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:t??(e?e.subject:"Commit")}),e?o.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground",children:[o.jsx("span",{className:"font-mono",children:e.hash.slice(0,12)}),o.jsxs("span",{children:[e.author," <",e.email,">"]}),o.jsx("span",{children:new Date(e.timestamp*1e3).toLocaleString()})]}):null]})}),o.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:a?o.jsx("div",{className:"p-4",children:o.jsx(Qe,{variant:"destructive",children:a})}):e?i?o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading diff…"}):s?o.jsx(Bx,{activeHunkIndex:0,diff:s}):o.jsx("div",{className:"p-4",children:o.jsx(Qe,{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."})}):o.jsx("div",{className:"p-4",children:o.jsx(Qe,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a commit to inspect its diff."})})})]})}function MW({files:e,filesError:t,selectedHash:s,selectedFile:i,onSelect:a}){return o.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[o.jsx("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:o.jsxs("h2",{className:"text-[13px] font-semibold tracking-tight",children:["Files",e.length?o.jsx("span",{className:"ml-2 text-[11px] font-normal text-muted-foreground",children:e.length}):null]})}),o.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:t?o.jsx("div",{className:"p-3",children:o.jsx(Qe,{variant:"destructive",children:t})}):s?e.length===0?o.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"No file changes."}):o.jsx("ul",{className:"divide-y divide-border",children:e.map(l=>o.jsx("li",{children:o.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:[o.jsx("span",{className:RW(l.index),children:l.index.trim()||"·"}),o.jsx("span",{className:"truncate font-mono",children:l.path})]})},l.path))}):o.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"Select a commit to see its files."})})]})}function RW(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`;case"D":return`${t} bg-red-100 text-red-800`;case"M":return`${t} bg-amber-100 text-amber-800`;case"R":return`${t} bg-blue-100 text-blue-800`;case"C":return`${t} bg-indigo-100 text-indigo-800`;default:return`${t} bg-slate-100 text-slate-700`}}const Gk=["#3b82f6","#10b981","#f59e0b","#ec4899","#8b5cf6","#14b8a6","#ef4444","#84cc16"];function kc(e){return Gk[e%Gk.length]}function DW({lane:e,laneCount:t,edges:s,throughLanes:i,isMerge:a,height:l=28,laneWidth:u=14}){const m=Math.max(e+1,t,1)*u,d=l/2,p=Cc(e,u),g=a?4:3.5;return o.jsxs("svg",{width:m,height:l,viewBox:`0 0 ${m} ${l}`,style:{flex:"0 0 auto",display:"block"},children:[i.map(v=>o.jsx("line",{x1:Cc(v,u),y1:0,x2:Cc(v,u),y2:l,stroke:kc(v),strokeWidth:1.5},`t-${v}`)),o.jsx("line",{x1:p,y1:0,x2:p,y2:d,stroke:kc(e),strokeWidth:1.5}),s.map((v,_)=>{const S=Cc(v.fromLane,u),w=Cc(v.toLane,u);if(S===w)return o.jsx("line",{x1:S,y1:d,x2:w,y2:l,stroke:kc(v.toLane),strokeWidth:1.5},`e-${_}`);const C=d+(l-d)/2;return o.jsx("path",{d:`M ${S} ${d} C ${S} ${C}, ${w} ${C}, ${w} ${l}`,fill:"none",stroke:kc(v.toLane),strokeWidth:1.5},`e-${_}`)}),o.jsx("circle",{cx:p,cy:d,r:g,fill:kc(e),stroke:"var(--background, #fff)",strokeWidth:1.5})]})}function Cc(e,t){return e*t+t/2}const OW=5,kb=new Map,t0=new Map,Cb=[];let Nb=0;function Wk(){for(;Nb<OW&&Cb.length>0;){const e=Cb.shift();e&&(Nb++,e())}}function LW(e){return kb.get(e)}function zW(e){const t=kb.get(e);if(t)return Promise.resolve(t);const s=t0.get(e);if(s)return s;const i=new Promise((a,l)=>{Cb.push(()=>{rR(e).then(u=>{u.state!=="pending"&&kb.set(e,u),a(u)}).catch(l).finally(()=>{Nb--,t0.delete(e),Wk()})})});return t0.set(e,i),Wk(),i}function BW({sha:e}){const[t,s]=y.useState(()=>LW(e)??null),i=y.useRef(null);if(y.useEffect(()=>{if(t)return;const u=i.current;if(!u||typeof IntersectionObserver>"u")return;let h=!0;const m=new IntersectionObserver(d=>{d.some(p=>p.isIntersecting)&&(m.disconnect(),zW(e).then(p=>{h&&s(p)}).catch(()=>{}))},{rootMargin:"200px"});return m.observe(u),()=>{h=!1,m.disconnect()}},[e,t]),!t||t.state==="unknown"||t.totalCount===0)return o.jsx("span",{ref:i,"aria-hidden":!0,className:"inline-block size-2 shrink-0"});const a=IW(t.state),l=`CI: ${t.state} (${t.totalCount} check${t.totalCount!==1?"s":""})`;return o.jsx("span",{"aria-label":l,className:`shrink-0 size-2 rounded-full ${a}`,title:l})}function IW(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 Kk=28;function PW({commits:e,loading:t,error:s,selectedHash:i,maxLanes:a,rowRefs:l,onSelect:u,onLoadMore:h}){const{sendToAgent:m}=Bt(),[d,p]=y.useState(null);function g(v,_){p(null),m({prompt:Z9(v,_),source:{type:"git-commit",label:v.hash.slice(0,7)},label:`${v.hash.slice(0,7)}: ${_}`})}return o.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[o.jsxs("h2",{className:"text-[13px] font-semibold tracking-tight",children:["Commit tree",e.length?o.jsxs("span",{className:"ml-2 text-[11px] font-normal text-muted-foreground",children:[e.length," commits"]}):null]}),o.jsx(se,{disabled:t,onClick:h,size:"sm",type:"button",variant:"outline",children:"Load more"})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:s?o.jsx("div",{className:"p-3",children:o.jsx(Qe,{variant:"destructive",children:s})}):t&&e.length===0?o.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"Loading commits…"}):e.length===0?o.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"No commits."}):o.jsx("ul",{className:"divide-y divide-border",children:e.map(v=>o.jsxs("li",{ref:_=>{_?l.current.set(v.hash,_):l.current.delete(v.hash)},className:"group flex flex-col",children:[o.jsxs("div",{className:`flex items-center transition-colors hover:bg-muted/60 ${i===v.hash?"bg-muted":""}`,children:[o.jsxs("button",{onClick:()=>u(v.hash),type:"button",className:"flex min-w-0 flex-1 items-center gap-2 px-2 py-0.5 text-left",style:{minHeight:Kk},title:`${v.hash}
|
|
209
|
+
${v.author} <${v.email}>
|
|
210
|
+
${v.subject}`,children:[o.jsx(DW,{lane:v.lane,laneCount:Math.max(v.laneCount,a),edges:v.edges,throughLanes:v.throughLanes,isMerge:v.parents.length>1,height:Kk}),o.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] text-muted-foreground",children:[v.hash.slice(0,7),o.jsx(BW,{sha:v.hash})]}),o.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[v.refs.map(_=>o.jsx("span",{className:HW(_.kind),children:_.name},`${_.kind}-${_.name}`)),o.jsx("span",{className:"truncate text-[12px]",children:v.subject})]}),o.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:v.author}),o.jsx("span",{className:"shrink-0 font-mono text-[10px] tabular-nums text-muted-foreground/70",title:new Date(v.timestamp*1e3).toLocaleString(),children:$W(v.timestamp)})]}),o.jsx(ll,{className:`mr-1 shrink-0 ${d===v.hash?"opacity-100":""}`,label:`Ask AI about commit ${v.hash.slice(0,7)}`,onAsk:()=>p(_=>_===v.hash?null:v.hash)})]}),d===v.hash?o.jsx("div",{className:"px-2 pb-1.5 pt-0.5",children:o.jsx(pu,{placeholder:"What should the agent do with this commit? (explain, summarize, find regressions…)",onSubmit:_=>g(v,_),onCancel:()=>p(null)})}):null]},v.hash))})})]})}function $W(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 HW(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 Yk=200;function UW(){const[e,t]=y.useState([]),[s,i]=y.useState(Yk),[a,l]=y.useState(!0),[u,h]=y.useState(null),[m,d]=y.useState(null),[p,g]=y.useState([]),[v,_]=y.useState(!1),[S,w]=y.useState(null),[C,E]=y.useState(null),[T,N]=y.useState(""),[j,R]=y.useState(!1),[z,D]=y.useState(null),M=y.useCallback(B=>{d(B),g([]),E(null),N("")},[]);y.useEffect(()=>{let B=!0;return l(!0),h(null),I6(s).then(P=>{B&&(t(P),P.length>0&&!P.some(F=>F.hash===m)&&M(P[0].hash))}).catch(P=>{B&&h(P instanceof Error?P.message:String(P))}).finally(()=>{B&&l(!1)}),()=>{B=!1}},[s]),y.useEffect(()=>{if(!m){g([]),E(null),_(!1);return}let B=!0;return w(null),_(!0),$6(m).then(P=>{B&&(g(P),E(P[0]?.path??null))}).catch(P=>{B&&w(P instanceof Error?P.message:String(P))}).finally(()=>{B&&_(!1)}),()=>{B=!1}},[m]),y.useEffect(()=>{if(!m||!C){N(""),R(!1);return}let B=!0;return D(null),R(!0),P6(m,C).then(P=>{B&&N(P)}).catch(P=>{B&&D(P instanceof Error?P.message:String(P))}).finally(()=>{B&&R(!1)}),()=>{B=!1}},[m,C]);const $=y.useMemo(()=>e.reduce((B,P)=>Math.max(B,P.laneCount),1),[e]),L=e.find(B=>B.hash===m)??null;return{commits:e,loading:a,error:u,selectedHash:m,setSelectedHash:M,files:p,filesError:S,selectedFile:C,setSelectedFile:E,diff:T,diffLoading:j||v,diffError:z,maxLanes:$,selectedCommit:L,loadMore:()=>i(B=>B+Yk)}}function FW({branches:e=[]}){const{commits:t,loading:s,error:i,selectedHash:a,setSelectedHash:l,files:u,filesError:h,selectedFile:m,setSelectedFile:d,diff:p,diffLoading:g,diffError:v,maxLanes:_,selectedCommit:S,loadMore:w}=UW(),[C,E]=y.useState(""),T=y.useMemo(()=>{const M=C.trim().toLowerCase();return M?e.filter($=>$.name.toLowerCase().includes(M)):e},[e,C]),N=y.useMemo(()=>qk(T.filter(M=>!M.remote)),[T]),j=y.useMemo(()=>qk(T.filter(M=>M.remote)),[T]),R=C.trim().length>0,z=y.useRef(new Map);function D(M){const $=M.remote?"remote":"branch",L=t.find(F=>F.refs.some(V=>V.kind===$&&V.name===M.name));if(!L)return;l(L.hash);const B=z.current.get(L.hash),P=B?.parentElement?.parentElement;!B||!P||P.scrollTo({top:Math.max(B.offsetTop-P.clientHeight/2+B.clientHeight/2,0),behavior:"smooth"})}return o.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 grid-cols-[220px_minmax(0,1fr)]",children:[o.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[o.jsxs("div",{className:"flex shrink-0 flex-col gap-1 border-b border-border px-3 py-1.5",children:[o.jsx("h2",{className:"text-[13px] font-semibold tracking-tight",children:"Branches"}),o.jsx("input",{type:"search",value:C,onChange:M=>E(M.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"})]}),o.jsxs("div",{className:"min-h-0 flex-1 overflow-auto py-1",children:[o.jsx(Vk,{label:"Local",tree:N,onSelect:D,defaultOpen:!0,forceOpen:R}),o.jsx(Vk,{label:"Remote",tree:j,onSelect:D,forceOpen:R})]})]}),o.jsxs("div",{className:"grid min-h-0 min-w-0 grid-rows-[minmax(0,3fr)_minmax(0,2fr)]",children:[o.jsx(AW,{selectedCommit:S,selectedFile:m,diff:p,diffLoading:g,diffError:v}),o.jsxs("div",{className:"grid min-h-0 min-w-0 grid-cols-[minmax(0,1fr)_280px]",children:[o.jsx(PW,{commits:t,loading:s,error:i,selectedHash:a,maxLanes:_,rowRefs:z,onSelect:l,onLoadMore:w}),o.jsx(MW,{files:u,filesError:h,selectedHash:a,selectedFile:m,onSelect:d})]})]})]})}const Eb=300,qW=600,VW=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 GW(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:!VW.has(t.slice(s+1))}function WW(e){return e>=qW?"danger":e>=Eb?"warn":"ok"}const KW={ok:"bg-emerald-500/60",warn:"bg-amber-500/70",danger:"bg-destructive/70"},YW={ok:"text-muted-foreground",warn:"text-amber-600 dark:text-amber-400",danger:"text-destructive"};function XW({onOpenFile:e,root:t}){const[s,i]=y.useState([]),[a,l]=y.useState(!0),[u,h]=y.useState(null),[m,d]=y.useState(!0);function p(){l(!0),h(null),U6().then(i).catch(w=>h(w instanceof Error?w.message:String(w))).finally(()=>l(!1))}y.useEffect(()=>{p()},[]);const g=y.useMemo(()=>m?s.filter(w=>GW(w.path)):s,[s,m]),v=s.length-g.length,_=g[0]?.lines??1,S=g.filter(w=>w.lines>=Eb).length;return o.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[o.jsx(mC,{className:"size-4"}),o.jsx("span",{className:"font-semibold text-foreground",children:"Largest files"}),!a&&!u?o.jsxs("span",{children:[g.length," files · ",S," over ",Eb," lines",m&&v>0?` · ${v} data/docs hidden`:""]}):null]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsxs(se,{size:"sm",variant:m?"default":"outline",className:"h-7",onClick:()=>d(w=>!w),title:"Hide docs, data, config and generated files",type:"button",children:[o.jsx(cC,{}),"Code only"]}),o.jsxs(se,{size:"sm",variant:"outline",className:"h-7",onClick:p,disabled:a,type:"button",children:[a?o.jsx(pt,{className:"animate-spin"}):o.jsx(ou,{}),"Refresh"]})]})]}),u?o.jsx(Qe,{variant:"destructive",className:"m-3",children:u}):a&&s.length===0?o.jsxs("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:[o.jsx(pt,{className:"mr-2 size-4 animate-spin"}),"Scanning tracked files…"]}):g.length===0?o.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."}):o.jsx("ul",{className:"min-h-0 flex-1 divide-y divide-border/60 overflow-auto",children:g.map((w,C)=>{const E=WW(w.lines);return o.jsxs("li",{className:"group flex items-center gap-3 px-3 transition-colors hover:bg-muted/50",children:[o.jsx("span",{className:"w-6 shrink-0 text-right font-mono text-[10px] text-muted-foreground",children:C+1}),o.jsx("button",{type:"button",onClick:()=>e(w.path),className:"min-w-0 flex-1 py-1.5 text-left",children:o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("span",{className:"truncate font-mono text-[11px]",children:w.path}),o.jsxs("span",{className:le("shrink-0 font-mono text-[11px] tabular-nums",YW[E]),children:[w.truncated?"≥":"",w.lines.toLocaleString()," lines"]})]}),o.jsx("div",{className:"mt-1 h-1 w-full overflow-hidden rounded-full bg-muted",children:o.jsx("div",{className:le("h-full rounded-full",KW[E]),style:{width:`${Math.max(2,w.lines/_*100)}%`}})})]})}),o.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-0.5",children:[o.jsx(ZW,{file:w,root:t}),o.jsx(QW,{file:w,root:t})]})]},w.path)})})]})}function ZW({file:e,root:t}){const{sendToAgent:s}=Bt(),i=bu(t,e.path),a=e.path.split("/").pop()??e.path;function l(){s({prompt:X9({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 u(){s({prompt:i,source:{label:a,type:"large-file"},mode:"draft"})}return o.jsx(eT,{label:`AI actions for ${e.path}`,trigger:o.jsx(Gt,{className:"size-3.5"}),children:h=>o.jsxs(o.Fragment,{children:[o.jsx(Vc,{icon:o.jsx(Gt,{className:"size-3.5"}),onSelect:()=>{h(),l()},children:"Ask AI to split this file"}),o.jsx(Vc,{icon:o.jsx(fC,{className:"size-3.5"}),onSelect:()=>{h(),u()},children:"Send file path to AI"})]})})}function QW({file:e,root:t}){const{error:s,success:i}=Ns(),a=bu(t,e.path),l=e.path.split("/").pop()??e.path;async function u(h,m){try{await navigator.clipboard.writeText(h),i(`Copied ${m}.`)}catch(d){s(d instanceof Error?d.message:`Could not copy ${m}.`)}}return o.jsx(eT,{label:`Copy path for ${e.path}`,trigger:o.jsxs(o.Fragment,{children:[o.jsx(dC,{className:"size-3.5"}),o.jsx("span",{className:"sr-only",children:"More actions"})]}),children:h=>o.jsxs(o.Fragment,{children:[o.jsx(Vc,{icon:o.jsx(pC,{className:"size-3.5"}),onSelect:()=>{h(),u(l,"file name")},children:"Copy file name"}),o.jsx(Vc,{icon:o.jsx(kh,{className:"size-3.5"}),onSelect:()=>{h(),u(e.path,"relative path")},children:"Copy relative path"}),o.jsx(Vc,{icon:o.jsx(kh,{className:"size-3.5"}),onSelect:()=>{h(),u(a,"absolute path")},children:"Copy absolute path"})]})})}function eT({children:e,label:t,trigger:s}){const[i,a]=y.useState(!1),[l,u]=y.useState({right:0,top:0}),h=y.useRef(null),m=y.useRef(null);function d(){a(!1)}function p(){const g=h.current?.getBoundingClientRect();g&&u({top:g.bottom+6,right:window.innerWidth-g.right}),a(v=>!v)}return y.useEffect(()=>{if(!i)return;function g(_){const S=_.target;h.current?.contains(S)||m.current?.contains(S)||d()}function v(_){_.key==="Escape"&&d()}return document.addEventListener("mousedown",g),document.addEventListener("keydown",v),window.addEventListener("scroll",d,!0),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",v),window.removeEventListener("scroll",d,!0)}},[i]),o.jsxs(o.Fragment,{children:[o.jsx("button",{"aria-label":t,className:le("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?gu.createPortal(o.jsx("div",{className:"fixed z-50 w-56 overflow-hidden rounded-md border border-border bg-card p-1 shadow-md",ref:m,style:{top:l.top,right:l.right},children:e(d)}),document.body):null]})}function Vc({children:e,icon:t,onSelect:s}){return o.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:[o.jsx("span",{className:"text-muted-foreground",children:t}),o.jsx("span",{className:"min-w-0 flex-1 truncate",children:e})]})}function JW(){const[e,t]=y.useState(!1),[s,i]=y.useState(!1),[a,l]=y.useState(!0);function u(){l(!0),K6().then(h=>{t(h.configured),i(h.deviceFlowAvailable)}).catch(()=>{t(!1),i(!1)}).finally(()=>l(!1))}return y.useEffect(()=>{u()},[]),{configured:e,deviceFlowAvailable:s,loading:a,refresh:u}}const s0=30;function eK(e="open"){const[t,s]=y.useState([]),[i,a]=y.useState(!0),[l,u]=y.useState(!1),[h,m]=y.useState(!1),[d,p]=y.useState(1),[g,v]=y.useState(null),[_,S]=y.useState(null),[w,C]=y.useState(null),[E,T]=y.useState(""),[N,j]=y.useState(!1),[R,z]=y.useState(null);y.useEffect(()=>{let $=!0;return a(!0),v(null),p(1),Ap(e,1).then(L=>{$&&(s(L),m(L.length===s0),L.length>0&&!L.some(B=>B.number===_)&&S(L[0]?.number??null))}).catch(L=>{$&&v(L instanceof Error?L.message:String(L))}).finally(()=>{$&&a(!1)}),()=>{$=!1}},[e]),y.useEffect(()=>{if(!_){C(null);return}let $=!0;return Q6(_).then(L=>{$&&C(L)}).catch(()=>{}),()=>{$=!1}},[_]),y.useEffect(()=>{if(!_){T("");return}let $=!0;return j(!0),z(null),J6(_).then(L=>{$&&T(L)}).catch(L=>{$&&z(L instanceof Error?L.message:String(L))}).finally(()=>{$&&j(!1)}),()=>{$=!1}},[_]);function D(){if(l||!h)return;const $=d+1;u(!0),Ap(e,$).then(L=>{s(B=>{const P=new Set(B.map(F=>F.number));return[...B,...L.filter(F=>!P.has(F.number))]}),m(L.length===s0),p($)}).catch(L=>v(L instanceof Error?L.message:String(L))).finally(()=>u(!1))}function M(){let $=!0;return a(!0),v(null),p(1),Ap(e,1).then(L=>{$&&(s(L),m(L.length===s0))}).catch(L=>{$&&v(L instanceof Error?L.message:String(L))}).finally(()=>{$&&a(!1)}),()=>{$=!1}}return{prs:t,loading:i,loadingMore:l,hasMore:h,error:g,selectedNumber:_,setSelectedNumber:S,selectedPR:w,diff:E,diffLoading:N,diffError:R,loadMore:D,refresh:M}}const n0=30;function tK(e="open"){const[t,s]=y.useState([]),[i,a]=y.useState(!0),[l,u]=y.useState(!1),[h,m]=y.useState(!1),[d,p]=y.useState(1),[g,v]=y.useState(null),[_,S]=y.useState(null),[w,C]=y.useState(null),[E,T]=y.useState([]),[N,j]=y.useState(!1),[R,z]=y.useState(null),[D,M]=y.useState(!1);y.useEffect(()=>{let P=!0;return a(!0),v(null),p(1),Mp(e,1).then(F=>{P&&(s(F),m(F.length===n0),F.length>0&&!F.some(V=>V.number===_)&&S(F[0]?.number??null))}).catch(F=>{P&&v(F instanceof Error?F.message:String(F))}).finally(()=>{P&&a(!1)}),()=>{P=!1}},[e]),y.useEffect(()=>{if(!_){C(null),T([]);return}let P=!0;return j(!0),Promise.all([sR(_),nR(_)]).then(([F,V])=>{P&&(C(F),T(V))}).catch(()=>{}).finally(()=>{P&&j(!1)}),()=>{P=!1}},[_]);async function $(P){if(_){M(!0),z(null);try{const F=await iR(_,P);T(V=>[...V,F])}catch(F){z(F instanceof Error?F.message:String(F))}finally{M(!1)}}}function L(){if(l||!h)return;const P=d+1;u(!0),Mp(e,P).then(F=>{s(V=>{const G=new Set(V.map(I=>I.number));return[...V,...F.filter(I=>!G.has(I.number))]}),m(F.length===n0),p(P)}).catch(F=>v(F instanceof Error?F.message:String(F))).finally(()=>u(!1))}function B(){let P=!0;return a(!0),p(1),Mp(e,1).then(F=>{P&&(s(F),m(F.length===n0))}).catch(()=>{}).finally(()=>{P&&a(!1)}),()=>{P=!1}}return{issues:t,loading:i,loadingMore:l,hasMore:h,error:g,selectedNumber:_,setSelectedNumber:S,selectedIssue:w,comments:E,commentsLoading:N,commentError:R,submitting:D,addComment:$,loadMore:L,refresh:B}}function tT({className:e}){return o.jsx("svg",{className:le("size-3.5",e),viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:o.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"})})}function sK({deviceFlowAvailable:e,onSaved:t}){const[s,i]=y.useState(e?"choose":"pat");return s==="device-pending"?o.jsx(nK,{onSuccess:t,onCancel:()=>i("choose")}):s==="pat"?o.jsx(iK,{onSaved:t,onBack:e?()=>i("choose"):void 0}):o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-6 p-8",children:[o.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[o.jsx("div",{className:"flex size-12 items-center justify-center rounded-xl bg-muted",children:o.jsx(Ly,{className:"size-6 text-muted-foreground"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-base font-semibold",children:"Connect GitHub"}),o.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."})]})]}),o.jsxs("div",{className:"flex w-full max-w-xs flex-col gap-2",children:[o.jsxs(se,{className:"w-full",onClick:()=>i("device-pending"),type:"button",children:[o.jsx(Ly,{className:"mr-2 size-4"}),"Authorize with GitHub"]}),o.jsx("button",{className:"text-[12px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",onClick:()=>i("pat"),type:"button",children:"Use a Personal Access Token instead"})]})]})}function nK({onSuccess:e,onCancel:t}){const[s,i]=y.useState(null),[a,l]=y.useState(null),[u,h]=y.useState(!0),[m,d]=y.useState(!1),p=y.useRef(null),g=y.useRef(5),v=y.useRef(!1);y.useEffect(()=>{let C=!0;return Y6().then(E=>{if(!C)return;i(E),g.current=E.interval,h(!1);const T=E.verification_uri_complete||E.verification_uri;T&&window.open(T,"_blank","noopener,noreferrer"),_(E.device_code,E.interval),setTimeout(()=>{v.current=!0},E.expires_in*1e3)}).catch(E=>{C&&(l(E instanceof Error?E.message:String(E)),h(!1))}),()=>{C=!1,p.current&&clearTimeout(p.current)}},[]);function _(C,E){p.current=setTimeout(()=>{S(C,E)},E*1e3)}async function S(C,E){if(v.current){l("Authorization expired. Please try again.");return}try{const T=await X6(C);if(T.done){e();return}const N=T.slowDown?E+5:E;g.current=N,_(C,N)}catch{_(C,g.current)}}function w(){s&&navigator.clipboard.writeText(s.user_code).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)})}return u?o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[o.jsx(zy,{className:"size-6 animate-spin text-muted-foreground"}),o.jsx("p",{className:"text-[13px] text-muted-foreground",children:"Requesting authorization…"})]})}):a?o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-4 p-8",children:[o.jsx(Qe,{variant:"destructive",children:a}),o.jsx(se,{onClick:t,variant:"outline",children:"Go back"})]}):o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-6 p-8",children:[o.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[o.jsx("div",{className:"flex size-12 items-center justify-center rounded-xl bg-emerald-100 dark:bg-emerald-500/15",children:o.jsx(Mb,{className:"size-6 text-emerald-600 dark:text-emerald-400"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-base font-semibold",children:"Authorize on GitHub"}),o.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"," ",o.jsx("strong",{children:"Authorize"}),"."]})]})]}),o.jsxs("div",{className:"flex flex-col items-center gap-2",children:[o.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:w,title:"Click to copy",children:s?.user_code}),o.jsx("button",{className:"text-[11px] text-muted-foreground transition-colors hover:text-foreground",onClick:w,type:"button",children:m?"Copied!":"Click code to copy"})]}),o.jsxs("div",{className:"flex flex-col items-center gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-muted-foreground",children:[o.jsx(zy,{className:"size-3.5 animate-spin"}),"Waiting for authorization…"]}),o.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"}),o.jsx("button",{className:"text-[12px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",onClick:t,type:"button",children:"Cancel"})]})]})}function iK({onSaved:e,onBack:t}){const[s,i]=y.useState(""),[a,l]=y.useState(!1),[u,h]=y.useState(null);async function m(d){d.preventDefault();const p=s.trim();if(p){l(!0),h(null);try{await Z6("github.com",p),e()}catch(g){h(g instanceof Error?g.message:String(g))}finally{l(!1)}}}return o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-6 p-8",children:[o.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[o.jsx("div",{className:"flex size-12 items-center justify-center rounded-xl bg-muted",children:o.jsx(xC,{className:"size-6 text-muted-foreground"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-base font-semibold",children:"Personal Access Token"}),o.jsxs("p",{className:"mt-1 max-w-sm text-[13px] text-muted-foreground",children:["Create a token at"," ",o.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 ",o.jsx("code",{className:"rounded bg-muted px-1 py-px text-[11px]",children:"repo"})," and"," ",o.jsx("code",{className:"rounded bg-muted px-1 py-px text-[11px]",children:"workflow"})," scopes."]})]})]}),o.jsxs("form",{className:"flex w-full max-w-sm flex-col gap-3",onSubmit:d=>{m(d)},children:[o.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}),u?o.jsx(Qe,{variant:"destructive",children:u}):null,o.jsx(se,{disabled:!s.trim()||a,type:"submit",children:a?"Saving…":"Save token"}),t?o.jsx("button",{className:"text-[12px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",onClick:t,type:"button",children:"← Back"}):null]})]})}function qx({hasMore:e,loading:t,onLoadMore:s}){return e?o.jsx("div",{className:"p-2",children:o.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?o.jsx(pt,{className:"size-3 animate-spin"}):null,t?"Loading…":"Load more"]})}):null}function rK({prs:e,loading:t,loadingMore:s,hasMore:i,error:a,selectedNumber:l,onSelect:u,onLoadMore:h}){return t&&e.length===0?o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading pull requests…"}):a?o.jsx("div",{className:"p-4 text-[12px] text-red-500",children:a}):e.length===0?o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No pull requests found."}):o.jsxs(o.Fragment,{children:[o.jsx("ul",{className:"divide-y divide-border",children:e.map(m=>o.jsx("li",{children:o.jsxs("button",{className:`flex w-full items-start gap-3 px-3 py-2.5 text-left transition-colors hover:bg-muted/60 ${l===m.number?"bg-muted":""}`,onClick:()=>u(m.number),type:"button",children:[o.jsx("span",{className:"mt-0.5 shrink-0",children:o.jsx(aK,{pr:m})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-[13px] font-medium",children:m.title}),o.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["#",m.number," · ",m.base.ref," ← ",m.head.ref," · ",m.user.login]})]}),m.draft?o.jsx("span",{className:"shrink-0 rounded border border-border px-1.5 py-px text-[10px] text-muted-foreground",children:"Draft"}):null]})},m.number))}),o.jsx(qx,{hasMore:i,loading:s,onLoadMore:h})]})}function aK({pr:e}){return e.state==="merged"?o.jsx(Db,{className:"size-4 text-purple-500"}):e.state==="closed"?o.jsx(P4,{className:"size-4 text-red-500"}):o.jsx(F4,{className:"size-4 text-emerald-500"})}function oK({pr:e,diff:t,diffLoading:s,diffError:i,onMerged:a}){const[l,u]=y.useState("overview"),[h,m]=y.useState(!1),[d,p]=y.useState(null);if(!e)return o.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Select a pull request"});const g=e.state==="open"&&!e.draft;async function v(){if(!(!e||h)&&window.confirm(`Squash & merge PR #${e.number} "${e.title}" into ${e.base.ref}?`)){m(!0),p(null);try{await tR(e.number,{method:"squash"}),a?.()}catch(S){p(S instanceof Error?S.message:String(S))}finally{m(!1)}}}const _=S=>`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${S?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`;return o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[o.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-semibold",children:e.title}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[o.jsx("button",{className:_(l==="overview"),onClick:()=>u("overview"),type:"button",children:"Overview"}),o.jsx("button",{className:_(l==="diff"),onClick:()=>u("diff"),type:"button",children:"Diff"})]}),g?o.jsxs("button",{className:"flex shrink-0 items-center gap-1 rounded bg-emerald-600 px-2 py-0.5 text-[11px] font-medium text-white transition-colors hover:bg-emerald-700 disabled:opacity-60",disabled:h,onClick:()=>{v()},title:"Squash & merge this pull request",type:"button",children:[h?o.jsx(pt,{className:"size-3 animate-spin"}):o.jsx(Db,{className:"size-3"}),"Squash & merge"]}):null,o.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:o.jsx(aa,{className:"size-3.5"})})]}),d?o.jsx("div",{className:"shrink-0 border-b border-border bg-red-500/10 px-3 py-1.5 text-[11px] text-red-500",children:d}):null,l==="overview"?o.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:o.jsxs("div",{className:"space-y-4 p-4",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 text-[12px]",children:[o.jsx(lK,{pr:e}),o.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:[o.jsx(pn,{className:"size-3 shrink-0 text-muted-foreground"}),e.base.ref,o.jsx(au,{className:"size-3 shrink-0 text-muted-foreground"}),e.head.ref]}),o.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[o.jsx(f6,{className:"size-3 shrink-0"}),e.user.login]}),o.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[o.jsx(IA,{className:"size-3 shrink-0"}),new Date(e.created_at).toLocaleDateString()]})]}),e.body?o.jsx("div",{className:"whitespace-pre-wrap rounded-md border border-border bg-muted/30 p-3 font-mono text-[12px]",children:e.body}):o.jsx("p",{className:"text-[12px] text-muted-foreground italic",children:"No description provided."})]})}):o.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:s?o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading diff…"}):i?o.jsx("div",{className:"p-4 text-[12px] text-red-500",children:i}):t?o.jsx(Bx,{diff:t}):o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No diff available."})})]})}function lK({pr:e}){const{label:t,cls:s}=e.state==="merged"?{label:"Merged",cls:"border-purple-300 bg-purple-100 text-purple-800 dark:border-purple-400/30 dark:bg-purple-500/15 dark:text-purple-300"}:e.state==="closed"?{label:"Closed",cls:"border-red-300 bg-red-100 text-red-800 dark:border-red-400/30 dark:bg-red-500/15 dark:text-red-300"}:e.draft?{label:"Draft",cls:"border-border bg-muted text-muted-foreground"}:{label:"Open",cls:"border-emerald-300 bg-emerald-100 text-emerald-800 dark:border-emerald-400/30 dark:bg-emerald-500/15 dark:text-emerald-300"};return o.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium ${s}`,children:[t==="Merged"?o.jsx(Db,{className:"size-3"}):null,t]})}function cK({issues:e,loading:t,loadingMore:s,hasMore:i,error:a,selectedNumber:l,onSelect:u,onLoadMore:h}){return t&&e.length===0?o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading issues…"}):a?o.jsx("div",{className:"p-4 text-[12px] text-red-500",children:a}):e.length===0?o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No issues found."}):o.jsxs(o.Fragment,{children:[o.jsx("ul",{className:"divide-y divide-border",children:e.map(m=>o.jsx("li",{children:o.jsxs("button",{className:`flex w-full items-start gap-3 px-3 py-2.5 text-left transition-colors hover:bg-muted/60 ${l===m.number?"bg-muted":""}`,onClick:()=>u(m.number),type:"button",children:[o.jsx(ZA,{className:`mt-0.5 size-4 shrink-0 ${m.state==="open"?"text-emerald-500":"text-red-500"}`}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-[13px] font-medium",children:m.title}),o.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["#",m.number," · ",m.user.login," · ",m.comments," comment",m.comments!==1?"s":""]})]}),m.labels.length>0?o.jsx("span",{className:"flex shrink-0 flex-wrap gap-1",children:m.labels.slice(0,3).map(d=>o.jsx("span",{className:"rounded-full px-1.5 py-px text-[10px] font-medium text-white",style:{backgroundColor:`#${d.color}`},children:d.name},d.name))}):null]})},m.number))}),o.jsx(qx,{hasMore:i,loading:s,onLoadMore:h})]})}function uK({issue:e,comments:t,commentsLoading:s,commentError:i,submitting:a,onAddComment:l}){const[u,h]=y.useState("");if(!e)return o.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Select an issue"});async function m(d){d.preventDefault();const p=u.trim();p&&(await l(p),h(""))}return o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[o.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-semibold",children:e.title}),o.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:o.jsx(aa,{className:"size-3.5"})})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:o.jsxs("div",{className:"space-y-3 p-4",children:[o.jsxs("div",{className:"flex flex-wrap gap-2 text-[12px]",children:[o.jsxs("span",{className:"rounded border border-border bg-muted/50 px-2 py-0.5 text-[11px]",children:[o.jsx("span",{className:"text-muted-foreground",children:"Author: "}),o.jsx("span",{className:"font-medium",children:e.user.login})]}),o.jsxs("span",{className:"rounded border border-border bg-muted/50 px-2 py-0.5 text-[11px]",children:[o.jsx("span",{className:"text-muted-foreground",children:"Opened: "}),o.jsx("span",{className:"font-medium",children:new Date(e.created_at).toLocaleDateString()})]}),e.labels.map(d=>o.jsx("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-medium text-white",style:{backgroundColor:`#${d.color}`},children:d.name},d.name))]}),e.body?o.jsx("div",{className:"whitespace-pre-wrap rounded-md border border-border bg-muted/30 p-3 font-mono text-[12px]",children:e.body}):o.jsx("p",{className:"text-[12px] text-muted-foreground italic",children:"No description provided."}),s?o.jsx("p",{className:"text-[12px] text-muted-foreground",children:"Loading comments…"}):o.jsx("div",{className:"space-y-2",children:t.map(d=>o.jsxs("div",{className:"rounded-md border border-border bg-muted/20 p-3",children:[o.jsxs("div",{className:"mb-1 flex items-baseline gap-2",children:[o.jsx("span",{className:"text-[11px] font-semibold",children:d.user.login}),o.jsx("span",{className:"text-[10px] text-muted-foreground",children:new Date(d.created_at).toLocaleDateString()})]}),o.jsx("p",{className:"whitespace-pre-wrap font-mono text-[12px]",children:d.body})]},d.id))})]})}),o.jsx("div",{className:"shrink-0 border-t border-border p-3",children:o.jsxs("form",{className:"flex flex-col gap-2",onSubmit:d=>{m(d)},children:[o.jsx("textarea",{className:"w-full resize-none rounded-md border border-border bg-background px-3 py-2 font-mono text-[12px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring",onChange:d=>h(d.target.value),placeholder:"Add a comment…",rows:3,value:u}),i?o.jsx(Qe,{variant:"destructive",children:i}):null,o.jsx(se,{className:"self-end",disabled:!u.trim()||a,size:"sm",type:"submit",children:a?"Posting…":"Comment"})]})})]})}const Xk=30;function dK(e){const[t,s]=y.useState([]),[i,a]=y.useState(null),[l,u]=y.useState([]),[h,m]=y.useState(!0),[d,p]=y.useState(!1),[g,v]=y.useState(!1),[_,S]=y.useState(1),[w,C]=y.useState(!1),[E,T]=y.useState(null),[N,j]=y.useState(null);function R(){let D=!0;return m(!0),T(null),S(1),i0(e,1).then(M=>{D&&(s(M),v(M.length===Xk))}).catch(M=>{D&&T(M instanceof Error?M.message:String(M))}).finally(()=>{D&&m(!1)}),()=>{D=!1}}function z(){if(d||!g)return;const D=_+1;p(!0),i0(e,D).then(M=>{s($=>{const L=new Set($.map(B=>B.id));return[...$,...M.filter(B=>!L.has(B.id))]}),v(M.length===Xk),S(D)}).catch(M=>T(M instanceof Error?M.message:String(M))).finally(()=>p(!1))}return y.useEffect(R,[e]),y.useEffect(()=>{a(D=>D&&t.some(M=>M.id===D)?D:t[0]?.id??null)},[t]),y.useEffect(()=>{if(!i){u([]);return}let D=!0;return C(!0),j(null),aR(i).then(M=>{D&&u(M)}).catch(M=>{D&&j(M instanceof Error?M.message:String(M))}).finally(()=>{D&&C(!1)}),()=>{D=!1}},[i]),{runs:t,selectedRunId:i,jobs:l,loading:h,loadingMore:d,hasMore:g,jobsLoading:w,error:E,jobsError:N,loadMore:z,refresh:R,setSelectedRunId:a}}function hK(){const{runs:e,selectedRunId:t,jobs:s,loading:i,loadingMore:a,hasMore:l,jobsLoading:u,error:h,jobsError:m,loadMore:d,refresh:p,setSelectedRunId:g}=dK(),v=e.find(_=>_.id===t)??null;return o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[o.jsx("h2",{className:"text-[13px] font-semibold",children:"Workflow Runs"}),o.jsxs(se,{disabled:i,onClick:()=>{p()},size:"sm",type:"button",variant:"outline",children:[o.jsx(ou,{className:`mr-1 size-3.5 ${i?"animate-spin":""}`}),"Refresh"]})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:h?o.jsx("div",{className:"p-4 text-[12px] text-red-500",children:h}):i&&e.length===0?o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading workflow runs…"}):e.length===0?o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No workflow runs found."}):o.jsxs("div",{className:"grid h-full min-h-0 grid-cols-[minmax(280px,380px)_minmax(0,1fr)] divide-x divide-border",children:[o.jsxs("div",{className:"min-h-0 overflow-auto",children:[o.jsx("ul",{className:"divide-y divide-border",children:e.map(_=>o.jsx("li",{children:o.jsxs("button",{className:`flex w-full items-center gap-3 px-3 py-2.5 text-left transition-colors hover:bg-muted/60 ${_.id===t?"bg-muted/70":""}`,onClick:()=>g(_.id),type:"button",children:[o.jsx(fK,{run:_}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-[13px] font-medium",children:_.name}),o.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["#",_.run_number," · ",_.head_branch," · ",_.event," ·"," ",new Date(_.created_at).toLocaleDateString()]})]}),o.jsx(mK,{run:_})]})},_.id))}),o.jsx(qx,{hasMore:l,loading:a,onLoadMore:d})]}),o.jsx(pK,{error:m,jobs:s,loading:u,run:v})]})})]})}function fK({run:e}){return e.status==="in_progress"||e.status==="queued"?o.jsx(wh,{className:"size-4 shrink-0 animate-pulse text-amber-400"}):e.conclusion==="success"?o.jsx(Mb,{className:"size-4 shrink-0 text-emerald-500"}):e.conclusion==="failure"||e.conclusion==="timed_out"?o.jsx(lC,{className:"size-4 shrink-0 text-red-500"}):o.jsx(wh,{className:"size-4 shrink-0 text-zinc-400"})}function mK({run:e}){const t=e.status==="completed"?e.conclusion??"completed":e.status,s=t==="success"?"border-emerald-200 bg-emerald-100 text-emerald-800 dark:border-emerald-400/30 dark:bg-emerald-500/15 dark:text-emerald-300":t==="failure"||t==="timed_out"?"border-red-200 bg-red-100 text-red-800 dark:border-red-400/30 dark:bg-red-500/15 dark:text-red-300":t==="in_progress"||t==="queued"?"border-amber-200 bg-amber-100 text-amber-800 dark:border-amber-400/30 dark:bg-amber-500/15 dark:text-amber-300":"border-border bg-muted/50 text-muted-foreground";return o.jsx("span",{className:`shrink-0 rounded border px-1.5 py-px text-[10px] font-medium ${s}`,children:t})}function pK({run:e,jobs:t,loading:s,error:i}){return e?o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-[13px] font-semibold",children:e.name}),o.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["Run #",e.run_number," · ",e.head_branch," · ",e.head_sha.slice(0,7)]})]}),o.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:o.jsx(aa,{className:"size-3.5"})})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:i?o.jsx("div",{className:"p-4 text-[12px] text-red-500",children:i}):s?o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading jobs…"}):t.length===0?o.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No jobs found for this run."}):o.jsx("ul",{className:"divide-y divide-border",children:t.map(a=>o.jsxs("li",{className:"px-3 py-3",children:[o.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[o.jsx(Zk,{item:a}),o.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium",children:a.name}),o.jsx("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground",children:Qk(a.started_at,a.completed_at)}),o.jsx("a",{"aria-label":`Open ${a.name} job on GitHub`,className:"shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",href:a.html_url,rel:"noopener noreferrer",target:"_blank",title:"Open job on GitHub",children:o.jsx(aa,{className:"size-3.5"})})]}),a.steps.length?o.jsx("ol",{className:"space-y-1.5 pl-6",children:a.steps.map(l=>o.jsxs("li",{className:"flex items-center gap-2 text-[12px]",children:[o.jsx(Zk,{item:l}),o.jsx("span",{className:"min-w-0 flex-1 truncate",children:l.name}),o.jsx("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground",children:Qk(l.started_at,l.completed_at)})]},`${a.id}:${l.number}`))}):o.jsx("p",{className:"pl-6 text-[12px] text-muted-foreground",children:"No step details available."})]},a.id))})})]}):o.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Select a workflow run"})}function Zk({item:e}){return e.status==="in_progress"||e.status==="queued"?o.jsx(wh,{className:"size-3.5 shrink-0 animate-pulse text-amber-400"}):e.conclusion==="success"||e.conclusion==="skipped"?o.jsx(Mb,{className:"size-3.5 shrink-0 text-emerald-500"}):e.conclusion==="failure"||e.conclusion==="timed_out"||e.conclusion==="cancelled"?o.jsx(lC,{className:"size-3.5 shrink-0 text-red-500"}):o.jsx(wh,{className:"size-3.5 shrink-0 text-zinc-400"})}function Qk(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),u=a%60;return u?`${l}m ${u}s`:`${l}m`}function gK(){const{configured:e,deviceFlowAvailable:t,loading:s,refresh:i}=JW();return s?o.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Loading…"}):e?o.jsx(bK,{}):o.jsx(sK,{deviceFlowAvailable:t,onSaved:i})}function bK(){const[e,t]=y.useState("prs"),[s,i]=y.useState("open"),[a,l]=y.useState("open"),[u,h]=y.useState(!1),m=eK(s),d=tK(a),p=v=>`rounded px-2.5 py-1 text-[11px] font-medium transition-colors ${v?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,g=v=>`rounded px-2 py-0.5 text-[10px] font-medium transition-colors ${v?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`;return o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-3 py-2",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-foreground",children:[o.jsx(tT,{className:"size-4"}),o.jsx("span",{className:"text-[12px] font-semibold tracking-tight",children:"GitHub"})]}),o.jsx("div",{className:"h-4 w-px bg-border"}),o.jsxs("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5",children:[o.jsx("button",{className:p(e==="prs"),onClick:()=>t("prs"),type:"button",children:"Pull Requests"}),o.jsx("button",{className:p(e==="issues"),onClick:()=>t("issues"),type:"button",children:"Issues"}),o.jsx("button",{className:p(e==="actions"),onClick:()=>t("actions"),type:"button",children:"Actions"})]}),e==="prs"?o.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[o.jsxs("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5",children:[o.jsx("button",{className:g(s==="open"),onClick:()=>i("open"),type:"button",children:"Open"}),o.jsx("button",{className:g(s==="closed"),onClick:()=>i("closed"),type:"button",children:"Closed"})]}),o.jsx(se,{onClick:()=>h(!0),size:"sm",type:"button",variant:"outline",children:"New PR"})]}):e==="issues"?o.jsxs("div",{className:"ml-auto flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5",children:[o.jsx("button",{className:g(a==="open"),onClick:()=>l("open"),type:"button",children:"Open"}),o.jsx("button",{className:g(a==="closed"),onClick:()=>l("closed"),type:"button",children:"Closed"})]}):null]}),u?o.jsx(xK,{onCreated:()=>{h(!1),m.refresh()},onCancel:()=>h(!1)}):o.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e==="prs"?o.jsxs("div",{className:"grid h-full min-h-0 grid-cols-2 divide-x divide-border",children:[o.jsx("div",{className:"min-h-0 overflow-auto",children:o.jsx(rK,{error:m.error,hasMore:m.hasMore,loading:m.loading,loadingMore:m.loadingMore,onLoadMore:m.loadMore,onSelect:m.setSelectedNumber,prs:m.prs,selectedNumber:m.selectedNumber})}),o.jsx("div",{className:"flex min-h-0 min-w-0 flex-col overflow-hidden",children:o.jsx(oK,{diff:m.diff,diffError:m.diffError,diffLoading:m.diffLoading,onMerged:()=>m.refresh(),pr:m.selectedPR})})]}):e==="issues"?o.jsxs("div",{className:"grid h-full min-h-0 grid-cols-2 divide-x divide-border",children:[o.jsx("div",{className:"min-h-0 overflow-auto",children:o.jsx(cK,{error:d.error,hasMore:d.hasMore,issues:d.issues,loading:d.loading,loadingMore:d.loadingMore,onLoadMore:d.loadMore,onSelect:d.setSelectedNumber,selectedNumber:d.selectedNumber})}),o.jsx("div",{className:"flex min-h-0 min-w-0 flex-col overflow-hidden",children:o.jsx(uK,{commentError:d.commentError,comments:d.comments,commentsLoading:d.commentsLoading,issue:d.selectedIssue,onAddComment:d.addComment,submitting:d.submitting})})]}):o.jsx(hK,{})})]})}function xK({onCreated:e,onCancel:t}){const[s,i]=y.useState(""),[a,l]=y.useState(""),[u,h]=y.useState(""),[m,d]=y.useState("main"),[p,g]=y.useState(!1),[v,_]=y.useState(!1),[S,w]=y.useState(null);async function C(T){if(T.preventDefault(),!(!s.trim()||!u.trim()||!m.trim())){_(!0),w(null);try{await eR({title:s.trim(),body:a.trim()||void 0,head:u.trim(),base:m.trim(),draft:p}),e()}catch(N){w(N instanceof Error?N.message:String(N))}finally{_(!1)}}}const E="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";return o.jsxs("form",{className:"flex flex-col gap-3 overflow-auto p-4",onSubmit:T=>{C(T)},children:[o.jsx("h3",{className:"text-[13px] font-semibold",children:"New Pull Request"}),o.jsx("input",{className:E,onChange:T=>i(T.target.value),placeholder:"Title",required:!0,value:s}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsx("input",{className:E,onChange:T=>h(T.target.value),placeholder:"Head branch",required:!0,value:u}),o.jsx("input",{className:E,onChange:T=>d(T.target.value),placeholder:"Base branch (e.g. main)",required:!0,value:m})]}),o.jsx("textarea",{className:`${E} resize-none`,onChange:T=>l(T.target.value),placeholder:"Description (optional)",rows:5,value:a}),o.jsxs("label",{className:"flex items-center gap-2 text-[12px]",children:[o.jsx("input",{checked:p,className:"size-3.5",onChange:T=>g(T.target.checked),type:"checkbox"}),"Create as draft"]}),S?o.jsx(Qe,{variant:"destructive",children:S}):null,o.jsxs("div",{className:"flex gap-2",children:[o.jsx(se,{disabled:v,type:"submit",children:v?"Creating…":"Create PR"}),o.jsx(se,{onClick:t,type:"button",variant:"outline",children:"Cancel"})]})]})}function Jk(e,t,s){const i=e.trim(),a=i.toLowerCase(),l=[],u=/\breview|check|inspect|audit\b/.test(a),h=/\btest|verify|ci\b/.test(a),m=/\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=_K(a,s);return u&&(l.push(ah("gate-review","Approve review","Review the current changes?")),l.push(Nc("review","Review changes","Review the current git changes. Summarize risks, likely bugs, and anything that should change before committing.",oh(g,["skills","mcpServers"])))),h&&l.push(Nc("verify","Run verification","Run the relevant tests or checks for this repository. If something fails, stop and explain the failure.",oh(g,["skills","mcpServers","plugins"]))),m&&(l.push(ah("gate-commit","Approve commit","Create one commit from the current changes?")),l.push(Nc("commit","Commit changes","Stage the appropriate changed files, inspect the staged diff briefly, and create one conventional commit.",oh(g,["skills"]),"committed"))),d&&(l.push(ah("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(Nc("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.",oh(g,["mcpServers","plugins"]))),l.length||(l.push(ah("gate-start","Approve start","Run this workflow?")),l.push(Nc("ai-step","AI step",i||"Complete this workflow step.",g))),{id:SK(sT(eC(a))||"custom-workflow",t),name:eC(a),description:i||"Custom AI-authored workflow.",builtin:!1,steps:yK(l)}}function vK(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" }'," ]","}","","Use gates before mutating git or GitHub state. Prefer intent-level AI steps over direct MCP tool calls."].join(`
|
|
211
|
+
`)}function eC(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 ah(e,t,s){return{kind:"gate",id:e,title:t,message:s}}function Nc(e,t,s,i,a){return{kind:"agent",id:e,title:t,prompt:s,capabilities:Vx(i),verify:a}}function _K(e,t){return Vx({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 oh(e,t){const s={};for(const i of t){const a=e[i];a?.length&&(s[i]=a)}return Vx(s)}function Vx(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 yK(e){const t=new Map;return e.map(s=>{const i=sT(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 SK(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 sT(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function wK(){const{run:e,start:t,approve:s,skip:i,stop:a,dismiss:l}=yB(),[u,h]=y.useState([]),[m,d]=y.useState(null),[p,g]=y.useState(null),[v,_]=y.useState(null),[S,w]=y.useState(!0),[C,E]=y.useState(!0);y.useEffect(()=>{let z=!0;return w(!0),Promise.all([NR(),MC().catch(()=>null)]).then(([D,M])=>{z&&(h(D),d(M))}).catch(D=>{z&&_(D instanceof Error?D.message:String(D))}).finally(()=>{z&&w(!1)}),()=>{z=!1}},[]);function T(z){t(z,C)}async function N(z){_(null);try{const D=await ER(z);h(D),g(null)}catch(D){_(D instanceof Error?D.message:String(D))}}async function j(z){if(!z.builtin&&window.confirm(`Delete workflow "${z.name}"?`)){_(null);try{h(await TR(z.id))}catch(D){_(D instanceof Error?D.message:String(D))}}}function R(z){g({...z,id:Gx(`${z.id}-copy`,u),name:`${z.name} copy`,builtin:!1,steps:z.steps.map((D,M)=>({...D,id:`${D.id}-${M+1}`}))})}return e?o.jsx(RK,{run:e,onApprove:s,onSkip:i,onStop:a,onBack:l}):p?o.jsx(CK,{agent:m?LK(m):null,existing:u,initial:p,onCancel:()=>g(null),onSave:z=>{N(z)}}):o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-auto bg-card/85",children:[o.jsxs("div",{className:"border-b border-border px-4 py-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{children:[o.jsxs("h2",{className:"flex items-center gap-1.5 text-[13px] font-semibold",children:[o.jsx(Gt,{className:"size-4"})," AI Workflows"]}),o.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:"One-click rituals that exceed the IDE — the agent does the work in the dock, pausing at each gate for your OK."})]}),o.jsxs(se,{onClick:()=>g(BK(u)),size:"sm",type:"button",variant:"outline",children:[o.jsx(Cs,{className:"size-3.5"})," New"]})]}),o.jsxs("label",{className:"mt-2 flex w-fit items-center gap-1.5 text-[11px] text-muted-foreground",children:[o.jsx("input",{checked:C,className:"size-3.5 accent-primary",onChange:z=>E(z.target.checked),type:"checkbox"}),"Run without step-by-step prompts",o.jsx("span",{className:"text-muted-foreground/60",children:"— gates still pause; risky shell still asks."})]})]}),v?o.jsx(Qe,{variant:"destructive",className:"m-4",children:v}):S?o.jsxs("div",{className:"flex flex-1 items-center justify-center text-[12px] text-muted-foreground",children:[o.jsx(pt,{className:"mr-2 size-4 animate-spin"})," Loading workflows…"]}):o.jsx("div",{className:"grid gap-3 p-4 sm:grid-cols-2 xl:grid-cols-3",children:u.map(z=>o.jsx(kK,{workflow:z,onDelete:()=>{j(z)},onDuplicate:()=>R(z),onEdit:()=>g(z),onRun:()=>T(z)},z.id))})]})}function kK({workflow:e,onDelete:t,onDuplicate:s,onEdit:i,onRun:a}){return o.jsxs("div",{className:"flex flex-col rounded-lg border border-border bg-background p-3.5 shadow-sm",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsx("h3",{className:"text-[13px] font-semibold",children:e.name}),e.builtin?o.jsx("span",{className:"rounded-full border border-border px-1.5 py-px text-[9px] uppercase tracking-wide text-muted-foreground",children:"Template"}):null]}),e.description?o.jsx("p",{className:"mt-1 text-[11px] leading-snug text-muted-foreground",children:e.description}):null,o.jsx("ol",{className:"mt-2.5 space-y-1",children:e.steps.map(l=>o.jsxs("li",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[o.jsx(VK,{kind:l.kind}),o.jsx("span",{className:"truncate",children:Wx(l)})]},l.id))}),o.jsxs(se,{className:"mt-3 w-full",onClick:a,size:"sm",type:"button",children:[o.jsx(eo,{className:"size-3.5"})," Run"]}),o.jsxs("div",{className:"mt-2 grid grid-cols-3 gap-1.5",children:[o.jsxs(se,{onClick:i,size:"sm",type:"button",variant:"outline",children:[o.jsx(OM,{className:"size-3.5"})," Edit"]}),o.jsxs(se,{onClick:s,size:"sm",type:"button",variant:"outline",children:[o.jsx(kh,{className:"size-3.5"})," Copy"]}),o.jsxs(se,{disabled:e.builtin,onClick:t,size:"sm",title:e.builtin?"Duplicate or edit to create your own version first":"Delete workflow",type:"button",variant:"outline",children:[o.jsx(ua,{className:"size-3.5"})," Delete"]})]})]})}function CK({agent:e,existing:t,initial:s,onCancel:i,onSave:a}){const[l,u]=y.useState(()=>structuredClone(s)),[h,m]=y.useState(s.description??""),d=zK(e),{sendToAgent:p}=Bt(),g=!l.id.trim()||!l.name.trim()||l.steps.length===0;function v(N,j){u(R=>({...R,steps:R.steps.map((z,D)=>D===N?j(z):z)}))}function _(N,j){u(R=>{const z=N+j;if(z<0||z>=R.steps.length)return R;const D=[...R.steps],[M]=D.splice(N,1);return D.splice(z,0,M),{...R,steps:D}})}function S(N){u(j=>({...j,steps:j.steps.filter((R,z)=>z!==N)}))}function w(N=h){const j=Jk(N,t,d);u(j)}function C(N){const j=Jk(N,[],d);u(R=>({...R,steps:[...R.steps,...j.steps]}))}function E(){p({prompt:vK(h||l.description||l.name),source:{type:"workflow",label:"Workflow composer"},mode:"draft"})}function T(){const N=rl(l.id)||Gx(rl(l.name)||"workflow",t);a({...l,id:N,name:l.name.trim(),description:(h||l.description)?.trim()||void 0,builtin:!1,steps:l.steps.map(IK)})}return o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-auto bg-card/85",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border px-4 py-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs("h2",{className:"flex items-center gap-1.5 text-[13px] font-semibold",children:[o.jsx(Gt,{className:"size-4"})," Workflow Composer"]}),o.jsx("p",{className:"mt-0.5 truncate text-[11px] text-muted-foreground",children:"Describe the ritual. NoMoreIDE turns it into a gated timeline you can tune."})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsxs(se,{onClick:i,size:"sm",type:"button",variant:"outline",children:[o.jsx(au,{className:"size-3.5"})," Back"]}),o.jsxs(se,{disabled:g,onClick:T,size:"sm",type:"button",children:[o.jsx(hi,{className:"size-3.5"})," Save"]})]})]}),o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[o.jsxs("section",{className:"shrink-0 border-b border-border p-4",children:[o.jsxs("div",{className:"grid gap-3 xl:grid-cols-[minmax(280px,0.9fr)_minmax(0,1.1fr)]",children:[o.jsxs("div",{className:"rounded-lg border border-border bg-background p-3 shadow-sm",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx(Qa,{children:"Workflow identity"}),o.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:l.id})]}),o.jsx("input",{className:"w-full bg-transparent text-lg font-semibold outline-none",onChange:N=>u(j=>({...j,name:N.target.value,id:rl(N.target.value)||j.id})),value:l.name})]}),o.jsxs("div",{className:"rounded-lg border border-border bg-background p-3 shadow-sm",children:[o.jsx(Qa,{children:"Describe workflow"}),o.jsx("textarea",{className:"min-h-16 w-full resize-none bg-transparent text-[13px] leading-relaxed outline-none placeholder:text-muted-foreground",onChange:N=>m(N.target.value),placeholder:"Review my changes with code-review, ask before commit, push, then open a PR with GitHub...",value:h}),o.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[o.jsxs(se,{onClick:()=>w(),size:"sm",type:"button",children:[o.jsx(zi,{className:"size-3.5"})," Draft timeline"]}),o.jsxs(se,{onClick:E,size:"sm",type:"button",variant:"outline",children:[o.jsx(fM,{className:"size-3.5"})," Ask AI"]}),["Commit safely","Review then push","Fix CI then PR","File issue from changes"].map(N=>o.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:()=>{m(N),w(N)},type:"button",children:N},N))]})]})]}),o.jsxs("div",{className:"mt-3 grid gap-3 xl:grid-cols-[minmax(0,1fr)_minmax(280px,0.45fr)]",children:[o.jsx(EK,{capabilities:d}),o.jsx(NK,{onAdd:C})]})]}),o.jsx("main",{className:"min-h-0 flex-1 overflow-auto p-4",children:l.steps.length?o.jsx("ol",{className:"mx-auto max-w-6xl space-y-0",children:l.steps.map((N,j)=>o.jsxs("li",{className:"relative pb-5 pl-14 last:pb-0",children:[o.jsx(jK,{index:j,kind:N.kind}),j===l.steps.length-1?null:o.jsx(AK,{}),o.jsx(TK,{capabilities:d,index:j,isFirst:j===0,isLast:j===l.steps.length-1,onMove:_,onRemove:S,onUpdate:v,step:N})]},`${N.kind}:${N.id}`))}):o.jsx("div",{className:"flex h-52 items-center justify-center rounded-lg border border-dashed border-border text-[12px] text-muted-foreground",children:"Add a step to start."})})]})]})}function NK({onAdd:e}){const[t,s]=y.useState("");return o.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:[o.jsx(Qa,{children:"Add a step"}),o.jsxs("div",{className:"flex gap-2",children:[o.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}),o.jsxs(se,{size:"sm",type:"submit",variant:"outline",children:[o.jsx(Cs,{className:"size-3.5"})," Add"]})]})]})}function EK({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?o.jsxs("div",{className:"rounded-lg border border-border bg-background p-3",children:[o.jsx(Qa,{children:"Detected capabilities"}),o.jsx("div",{className:"flex max-h-20 flex-wrap gap-1.5 overflow-hidden",children:t.map(s=>o.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 TK({capabilities:e,index:t,isFirst:s,isLast:i,onMove:a,onRemove:l,onUpdate:u,step:h}){const m=PK(h);return o.jsx("section",{className:"group rounded-lg border border-border bg-background p-3 shadow-sm",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(iT,{kind:h.kind}),o.jsx("input",{className:"min-w-0 flex-1 bg-transparent text-[13px] font-semibold outline-none",onChange:d=>u(t,p=>({...p,title:d.target.value})),value:h.title})]}),o.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:d=>{const p=d.target.value;u(t,g=>$K(g,p))},value:m}),h.kind==="agent"?o.jsx(MK,{capabilities:e,selected:h.capabilities,onToggle:(d,p)=>u(t,g=>g.kind==="agent"?{...g,capabilities:HK(g.capabilities,d,p)}:g)}):null]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1 opacity-70 transition-opacity group-hover:opacity-100",children:[o.jsx(se,{disabled:s,onClick:()=>a(t,-1),size:"sm",type:"button",variant:"ghost",children:"↑"}),o.jsx(se,{disabled:i,onClick:()=>a(t,1),size:"sm",type:"button",variant:"ghost",children:"↓"}),o.jsx(se,{onClick:()=>l(t),size:"sm",type:"button",variant:"ghost",children:o.jsx(ua,{className:"size-3.5"})})]})]})})}function jK({index:e,kind:t}){return o.jsxs("div",{className:"absolute left-0 top-2 z-10 flex size-9 items-center justify-center rounded-full border border-border bg-card shadow-sm",children:[o.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}),o.jsx(FK,{kind:t})]})}function AK(){return o.jsxs("svg",{"aria-hidden":!0,className:"absolute bottom-1 left-[18px] top-12 w-6 overflow-visible text-border",preserveAspectRatio:"none",viewBox:"0 0 24 100",children:[o.jsx("title",{children:"Next step connector"}),o.jsx("line",{stroke:"currentColor",strokeDasharray:"4 5",strokeLinecap:"round",strokeWidth:"2",x1:"12",x2:"12",y1:"0",y2:"82"}),o.jsx("path",{d:"M6 78 L12 88 L18 78",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})]})}function MK({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 o.jsxs("div",{className:"space-y-2",children:[o.jsx(Qa,{children:"Capabilities"}),i.map(a=>o.jsxs("div",{children:[o.jsx("div",{className:"mb-1 text-[10px] text-muted-foreground",children:a.label}),a.values.length?o.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.values.map(l=>{const u=s?.[a.key]?.includes(l)??!1;return o.jsx("button",{className:le("rounded-md border px-2 py-1 text-[11px] transition-colors",u?"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)})}):o.jsx("p",{className:"text-[11px] text-muted-foreground/70",children:"None detected."})]},a.key))]})}function RK({run:e,onApprove:t,onSkip:s,onStop:i,onBack:a}){const l=e.outcome!=="running",[u,h]=y.useState(()=>new Set);y.useEffect(()=>{const d=e.workflow.steps[e.index],p=e.statuses[e.index];d&&(p==="running"||p==="waiting")&&h(g=>g.has(d.id)?g:new Set(g).add(d.id))},[e.index,e.statuses,e.workflow.steps]);const m=d=>h(p=>{const g=new Set(p);return g.has(d)?g.delete(d):g.add(d),g});return o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-auto bg-card/85",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs("h2",{className:"flex items-center gap-1.5 text-[13px] font-semibold",children:[o.jsx(Gt,{className:"size-4"})," ",e.workflow.name]}),o.jsxs("p",{className:"mt-0.5 flex items-center gap-1 text-[11px] text-muted-foreground",children:[o.jsx(af,{className:"size-3"})," Watch the agent work in the dock below."]})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(UK,{outcome:e.outcome}),l?o.jsxs(se,{onClick:a,size:"sm",type:"button",variant:"outline",children:[o.jsx(au,{className:"size-3.5"})," Workflows"]}):o.jsxs(se,{onClick:i,size:"sm",type:"button",variant:"outline",children:[o.jsx(lu,{className:"size-3.5"})," Stop"]})]})]}),o.jsx("ol",{className:"px-4 py-4",children:e.workflow.steps.map((d,p)=>{const g=e.statuses[p],v=p===e.workflow.steps.length-1,_=d.kind==="gate"&&g==="waiting",S=u.has(d.id)||g==="waiting"||g==="failed"||g==="blocked",w=g==="running"||g==="waiting";return o.jsxs("li",{className:"relative pb-3 pl-10 last:pb-0",children:[v?null:o.jsx("span",{"aria-hidden":!0,className:"absolute bottom-0 left-[19px] top-9 w-px bg-border"}),o.jsx("span",{className:le("absolute left-1 top-1 flex size-8 items-center justify-center rounded-full border bg-card",g==="failed"?"border-destructive/50":g==="blocked"?"border-amber-500/50":w?"border-primary/50":g==="done"?"border-emerald-500/50":"border-border"),children:o.jsx(qK,{status:g,kind:d.kind})}),o.jsxs("section",{className:le("overflow-hidden rounded-lg border transition-colors",g==="failed"?"border-destructive/40 bg-destructive/[0.03]":g==="blocked"?"border-amber-500/40 bg-amber-500/[0.04]":w?"border-primary/40 bg-primary/[0.03]":"border-border bg-background"),children:[o.jsxs("button",{className:"flex w-full items-center gap-2 px-3 py-2.5 text-left transition-colors hover:bg-muted/40",onClick:()=>m(d.id),type:"button",children:[o.jsx("span",{className:"min-w-0 flex-1 truncate text-[12px] font-medium",children:Wx(d)}),o.jsx(iT,{kind:d.kind}),o.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground/70",children:DK(g)}),S?o.jsx(Mn,{className:"size-3.5 shrink-0 text-muted-foreground/60"}):o.jsx(Li,{className:"size-3.5 shrink-0 text-muted-foreground/60"})]}),S?o.jsxs("div",{className:"border-t border-border px-3 py-2.5 text-[11px] leading-relaxed",children:[o.jsx(OK,{step:d,status:g,output:e.outputs[p]}),_?o.jsxs("div",{className:"mt-2.5 flex items-center gap-1.5",children:[o.jsxs(se,{onClick:t,size:"sm",type:"button",children:[o.jsx(hi,{className:"size-3.5"})," Approve"]}),o.jsxs(se,{onClick:s,size:"sm",type:"button",variant:"outline",children:[o.jsx(TC,{className:"size-3.5"})," Skip"]}),o.jsxs(se,{onClick:i,size:"sm",type:"button",variant:"outline",children:[o.jsx(Gs,{className:"size-3.5"})," Stop"]})]}):null,g==="failed"&&e.error?o.jsx("p",{className:"mt-2 text-destructive",children:e.error}):null,g==="blocked"&&e.error?o.jsx("p",{className:"mt-2 text-amber-700 dark:text-amber-400",children:e.error}):null]}):null]})]},d.id)})})]})}function DK(e){return e==="running"?"Running":e==="waiting"?"Waiting":e==="done"?"Done":e==="blocked"?"Needs you":e==="failed"?"Failed":e==="skipped"?"Skipped":"Queued"}function OK({step:e,status:t,output:s}){if(e.kind==="gate")return o.jsx("p",{className:"text-muted-foreground",children:e.message});if(e.kind==="action")return o.jsx("p",{className:"text-muted-foreground",children:e.op==="push"?"Pushes the current branch to its remote.":"Stages and commits all changes."});const i=t==="done"||t==="failed"||t==="skipped";return s?o.jsxs("div",{children:[o.jsx(Qa,{children:"Result"}),o.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:s})]}):o.jsxs("div",{children:[o.jsx(Qa,{children:i?"Result":"Task"}),i?o.jsx("p",{className:"italic text-muted-foreground",children:"No text reply — see the dock for what the agent did."}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-muted-foreground",children:e.prompt}),t==="running"?o.jsxs("p",{className:"mt-1.5 flex items-center gap-1 text-muted-foreground/80",children:[o.jsx(pt,{className:"size-3 animate-spin"})," Working in the dock…"]}):null]})]})}function LK(e){return e.detected.name==="codex"?e.agents.codex:e.agents["claude-code"]??e}function zK(e){return e?{skills:Bc(e.skills.map(t=>t.name)),mcpServers:Bc(e.mcpServers.map(t=>t.name)),plugins:Bc(e.plugins.map(t=>t.name)),hooks:Bc(e.hooks.map(t=>t.matcher?`${t.event}: ${t.matcher}`:t.event))}:{skills:[],mcpServers:[],plugins:[],hooks:[]}}function BK(e){return{id:Gx("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 IK(e){const t=rl(e.id)||e.kind,s=e.title.trim()||Wx(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=nT(e.capabilities);return{...e,id:t,title:s,prompt:e.prompt.trim()||"Complete this workflow step.",capabilities:i}}function PK(e){return e.kind==="gate"?e.message:e.kind==="agent"?e.prompt:e.op==="push"?"Push the current branch to its remote.":"Stage and commit changed files."}function $K(e,t){return e.kind==="gate"?{...e,message:t}:e.kind==="agent"?{...e,prompt:t}:{...e,op:/\bpush\b/i.test(t)?"push":/\bcommit\b/i.test(t)?"commit":e.op,title:t.trim()||e.title}}function nT(e){if(!e)return;const t={};for(const s of["skills","mcpServers","plugins","hooks"]){const i=Bc((e[s]??[]).map(a=>a.trim()).filter(Boolean));i.length&&(t[s]=i)}return Object.keys(t).length?t:void 0}function HK(e,t,s){const i=e?.[t]??[],a=i.includes(s)?i.filter(l=>l!==s):[...i,s];return nT({...e??{},[t]:a})}function Gx(e,t){const s=new Set(t.map(l=>l.id));let i=rl(e)||"workflow",a=2;for(;s.has(i);)i=`${rl(e)||"workflow"}-${a}`,a++;return i}function rl(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Bc(e){return Array.from(new Set(e.filter(Boolean)))}function Qa({children:e}){return o.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:e})}function UK({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 o.jsx("span",{className:le("rounded-full border px-2 py-0.5 text-[10px] font-medium",i),children:s})}function FK({kind:e}){return e==="gate"?o.jsx(EC,{className:"size-4 text-amber-600 dark:text-amber-400"}):e==="agent"?o.jsx(zi,{className:"size-4 text-primary"}):o.jsx(eo,{className:"size-4 text-muted-foreground"})}function qK({status:e,kind:t}){return e==="running"?o.jsx(pt,{className:"size-4 shrink-0 animate-spin text-primary"}):e==="waiting"?o.jsx(EC,{className:"size-4 shrink-0 text-primary"}):e==="done"?o.jsx(hi,{className:"size-4 shrink-0 text-emerald-600 dark:text-emerald-400"}):e==="blocked"?o.jsx(GA,{className:"size-4 shrink-0 text-amber-600 dark:text-amber-400"}):e==="failed"?o.jsx(cu,{className:"size-4 shrink-0 text-destructive"}):e==="skipped"?o.jsx(TC,{className:"size-4 shrink-0 text-muted-foreground/60"}):t==="agent"?o.jsx(zi,{className:"size-4 shrink-0 text-muted-foreground/50"}):o.jsx(YA,{className:"size-4 shrink-0 text-muted-foreground/50"})}function VK(e){return o.jsx(Li,{className:"size-3 shrink-0 text-muted-foreground/40","aria-hidden":!0})}function iT({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 o.jsx("span",{className:le("shrink-0 rounded-full border px-1.5 py-px text-[9px] uppercase tracking-wide",s),children:t})}function Wx(e){return e.title}function GK({data:e,onRefresh:t}){const{insertPath:s}=Bt(),[i,a]=y.useState(!1),[l,u]=y.useState("changes"),[h,m]=y.useState("changes"),[d,p]=y.useState(e.git.status?.files[0]?.path??""),[g,v]=y.useState(""),[_,S]=y.useState([]),[w,C]=y.useState(null),[E,T]=y.useState(""),[N,j]=y.useState(null),[R,z]=y.useState(0),[D,M]=y.useState(null),[$,L]=y.useState(()=>new Set),B=e.git.status?.files??[],P=y.useMemo(()=>{const ge=new Set(B.map(Ae=>Ae.path)),Te=[...$].filter(Ae=>!ge.has(Ae)).sort().map(Ae=>({path:Ae,index:" ",workingTree:"M"}));return[...B,...Te]},[B,$]),F=y.useMemo(()=>P.map(ge=>ge.path),[P]),V=y.useMemo(()=>eq(E),[E]),G=y.useCallback(async(ge,Te)=>{if(Te.length){a(!0);try{await ge(Te),t?.()}finally{a(!1)}}},[t]),I=t?{busy:i,onStage:ge=>{G(LC,ge)},onUnstage:ge=>{G(G6,ge)}}:void 0;y.useEffect(()=>{const ge=P[0]?.path??"";p(Te=>Te&&P.some(Ae=>Ae.path===Te)?Te:ge)},[P]),y.useEffect(()=>{if(l!=="all"||_.length>0)return;let ge=!0;return C(null),H6().then(Te=>{ge&&S(Te)}).catch(Te=>{ge&&C(Te instanceof Error?Te.message:String(Te))}),()=>{ge=!1}},[l,_.length]),y.useEffect(()=>{if(!d){T("");return}let ge=!0;return j(null),V6(d).then(Te=>{ge&&(T(Te),z(0),M(null))}).catch(Te=>{ge&&j(Te instanceof Error?Te.message:String(Te))}),()=>{ge=!1}},[d]);function Y(ge){z(0),M(null),p(ge)}function X(){const ge=jW({activeHunkIndex:R,filePaths:F,hunkCount:V.hunks,pendingNextFilePath:D,selectedFile:d});ge.kind==="hunk"?(M(null),z(ge.activeHunkIndex)):ge.kind==="confirm-next-file"?M(ge.filePath):ge.kind==="file"?Y(ge.filePath):M(null)}function W(){if(M(null),R>0){z(Ae=>Ae-1);return}const ge=P.findIndex(Ae=>Ae.path===d),Te=P[ge-1];Te&&Y(Te.path)}const ee=P.findIndex(ge=>ge.path===d),O=!!(V.hunks&&R<V.hunks-1||P[ee+1]),Z=!!(R>0||P[ee-1]),ie=D?`End of file. Click Next again to open ${D}.`:null,de=ge=>`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${ge?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,fe=ge=>`flex-1 px-2 py-0.5 text-[11px] font-medium transition-colors ${ge?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,pe=y.useMemo(()=>{const ge=new Set(P.map(Te=>Te.path));for(const Te of $)ge.add(Te);return ge},[P,$]);if(!e.git.selectedRepository)return o.jsx(WK,{});function Se(){g&&(u("changes"),m("changes"),Y(g))}function Le(ge){L(Te=>new Set(Te).add(ge)),v(ge),u("changes"),m("changes"),Y(ge)}function ve(ge){v(ge),u("all")}function Ge(ge){ge&&s(bu(e.git.cwd,ge))}return o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card/95 px-3 py-1",children:[o.jsx("button",{type:"button",className:de(l==="changes"),onClick:()=>u("changes"),children:"Changes"}),o.jsx("button",{type:"button","aria-label":"Open all tracked files",className:de(l==="all"),onClick:()=>u("all"),children:"All files"}),o.jsx("button",{type:"button",className:de(l==="graph"),onClick:()=>u("graph"),children:"Tree"}),o.jsx("button",{type:"button",className:de(l==="largest"),onClick:()=>u("largest"),children:"Largest files"}),o.jsx("button",{type:"button",className:de(l==="github"),onClick:()=>u("github"),children:o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(tT,{className:"size-3"}),"GitHub"]})}),o.jsx("button",{type:"button",className:de(l==="workflows"),onClick:()=>u("workflows"),children:o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(Gt,{className:"size-3"}),"Workflows"]})})]}),o.jsx("div",{className:"min-h-0 flex-1",children:l==="workflows"?o.jsx(wK,{}):l==="github"?o.jsx(gK,{}):l==="graph"?o.jsx(FW,{branches:e.git.branches??[]}):l==="largest"?o.jsx(XW,{onOpenFile:ve,root:e.git.cwd}):l==="all"?o.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 xl:grid-cols-[320px_minmax(0,1fr)]",children:[o.jsx("aside",{className:"flex min-h-0 flex-col overflow-hidden",children:w?o.jsx(Qe,{variant:"destructive",className:"m-3",children:w}):o.jsx(U2,{branch:e.git.status?.branch||void 0,onSelectFile:v,paths:_,root:e.git.cwd,selectedFile:g,status:P})}),o.jsx(TW,{isModified:pe.has(g),onFileSaved:Le,onSendToAi:()=>Ge(g),onViewDiff:Se,path:g})]}):o.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 xl:grid-cols-[320px_minmax(0,1fr)]",children:[o.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex shrink-0 gap-0.5 border-b border-border bg-card/95 p-1",children:[o.jsx("button",{"aria-label":"Show changed files as a list",className:fe(h==="changes"),onClick:()=>m("changes"),type:"button",children:"Changes"}),o.jsx("button",{"aria-label":"Show changed files as a tree",className:fe(h==="tree"),onClick:()=>m("tree"),type:"button",children:"Tree"})]}),h==="changes"?o.jsx(iq,{branch:e.git.status?.branch||void 0,error:e.git.error,files:P,selectedFile:d,onSelectFile:Y,root:e.git.cwd,staging:I}):o.jsx(U2,{branch:e.git.status?.branch||void 0,defaultExpandAll:!0,emptyMessage:e.git.error??"No changed files.",onSelectFile:Y,paths:F,root:e.git.cwd,selectedFile:d,status:P,title:"Changes"}),t&&e.git.status?o.jsx(cq,{branch:e.git.status.branch||void 0,files:P,onDone:t}):null]}),o.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col border-l border-border bg-card",children:[o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-1.5",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:d||"Diff"}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground",children:[o.jsx("span",{children:"Long rows wrap inside the editor pane."}),V.additions||V.deletions?o.jsxs("span",{className:"flex items-center gap-1 font-mono",children:[o.jsxs("span",{className:"text-emerald-700",children:["+",V.additions]}),o.jsxs("span",{className:"text-red-700",children:["-",V.deletions]})]}):null]})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[ie?o.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:ie}):null,o.jsxs(se,{disabled:!d||!Z,onClick:W,size:"sm",type:"button",variant:"outline",children:[o.jsx(Ab,{}),"Previous"]}),o.jsxs(se,{disabled:!d||!O,onClick:X,size:"sm",type:"button",variant:"outline",children:[o.jsx(jb,{}),"Next"]}),o.jsx(se,{"aria-label":"Send selected file to AI input",className:"size-8",disabled:!d,onClick:()=>Ge(d),size:"icon",title:"Send selected file path to AI input",type:"button",variant:"outline",children:o.jsx(Gt,{className:"size-4"})})]})]}),o.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:N?o.jsx("div",{className:"p-4",children:o.jsx(Qe,{variant:"destructive",children:N})}):d?o.jsx(Bx,{activeHunkIndex:R,diff:E||"No unstaged diff for this file."}):o.jsx("div",{className:"p-4",children:o.jsx(Qe,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a changed file to inspect its diff."})})})]})]})})]})}function WK(){return o.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center",children:o.jsxs("div",{className:"max-w-sm",children:[o.jsx(C4,{className:"mx-auto size-8 text-muted-foreground/50"}),o.jsx("p",{className:"mt-3 text-sm font-medium",children:"No Git project registered"}),o.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 picker in the header to add one."})]})})}function KK({initialPath:e,onSelect:t,selectedPath:s}){const[i,a]=y.useState(e),[l,u]=y.useState(null),[h,m]=y.useState(null),[d,p]=y.useState(!1),g=YK(l);return y.useEffect(()=>{a(e)},[e]),y.useEffect(()=>{let v=!0;return p(!0),m(null),IC(i).then(_=>{v&&(u(_),t(_.path))}).catch(_=>{v&&m(_ instanceof Error?_.message:String(_))}).finally(()=>{v&&p(!1)}),()=>{v=!1}},[i,t]),o.jsxs("div",{className:"rounded-md border border-border bg-background",children:[o.jsxs("div",{className:"flex items-center gap-2 border-b border-border p-2",children:[g?o.jsx(se,{"aria-label":"Open parent folder",onClick:()=>l&&a(l.parent),size:"icon",type:"button",variant:"ghost",children:o.jsx(Mn,{className:"rotate-90"})}):null,o.jsx("div",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:l?.path??i}),d?o.jsx(pt,{className:"size-4 animate-spin text-muted-foreground"}):null]}),o.jsxs("div",{className:"max-h-56 overflow-auto p-1",children:[h?o.jsx(Qe,{variant:"destructive",className:"m-1",children:h}):null,!h&&l?.entries.length===0?o.jsx(Qe,{variant:"muted",className:"m-1 text-center",children:"No folders here."}):null,l?.entries.map(v=>o.jsxs(se,{className:le("h-8 w-full justify-start rounded-sm px-2 text-left",s===v.path&&"bg-muted"),onClick:()=>a(v.path),title:v.path,type:"button",variant:"ghost",children:[o.jsx(Ja,{className:"text-accent"}),o.jsx("span",{className:"truncate",children:v.name})]},v.path))]})]})}function YK(e){return!!(e&&e.parent!==e.path)}function tC(e){return e.split(/[\\/]/).filter(Boolean).pop()??"project"}function XK({data:e,onRefresh:t}){const[s,i]=y.useState(!1),[a,l]=y.useState(e.git.cwd),[u,h]=y.useState(null),[m,d]=y.useState(!1),[p,g]=y.useState(e.git.cwd),v=y.useRef(null),_=e.git.selectedRepository,S=_?.name??(e.git.cwd?tC(e.git.cwd):"Add Git project"),{error:w,success:C}=Ns(),E=QK({gitCwd:e.git.cwd});y.useEffect(()=>{l(e.git.cwd),g(e.git.cwd)},[e.git.cwd]),y.useEffect(()=>{if(!s)return;function D(M){v.current&&M.target instanceof Node&&!v.current.contains(M.target)&&i(!1)}return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[s]);async function T(D){try{await mn("/api/git/select",{name:D}),i(!1),await t(),C(`Switched to ${D}.`)}catch(M){w(M instanceof Error?M.message:String(M))}}async function N(D){const M=D.trim();if(!ZK(M)){const $="Please add an absolute path. Paths beginning with ~ are not expanded here.";return h($),w($),!1}try{const $=tC(M);return await mn("/api/git/repositories",{name:$,path:M}),h(null),await t(),C(`Added Git project ${$}.`),!0}catch($){const L=$ instanceof Error?$.message:String($);return h(L),w(L),!1}}async function j(D){try{await W6(D),await t(),C(`Removed Git project ${D}.`)}catch(M){w(M instanceof Error?M.message:String(M))}}async function R(D){D.preventDefault(),await N(a)&&i(!1)}function z(){h(null),g(E.selectedPath),d(!0)}return o.jsxs("div",{className:"relative z-50 flex items-center gap-2",ref:v,children:[o.jsxs(se,{className:"max-w-[220px] justify-start gap-2 rounded-md border-border bg-card",onClick:()=>i(D=>!D),size:"sm",type:"button",variant:"outline",children:[o.jsx(Ja,{className:"text-muted-foreground"}),o.jsx("span",{className:"truncate",children:S}),o.jsx(Mn,{className:le("ml-auto transition-transform",s&&"rotate-180")})]}),o.jsx(se,{"aria-label":"Add Git project",onClick:z,size:"sm",type:"button",variant:"outline",children:o.jsx(Cs,{})}),s?o.jsxs("div",{className:"absolute right-0 top-10 z-50 w-[min(380px,calc(100vw-2rem))] overflow-hidden rounded-lg border border-border bg-card shadow-lg",children:[o.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[o.jsx(d4,{className:"size-3.5 text-muted-foreground"}),o.jsx("div",{className:"text-xs font-semibold",children:"Git Projects"}),o.jsx(Pe,{className:"ml-auto h-5 px-1.5 text-[10px]",variant:"outline",children:e.config.gitRepositories.length})]}),o.jsx("div",{className:"max-h-72 overflow-auto",children:e.config.gitRepositories.length?o.jsx("div",{className:"divide-y divide-border",children:e.config.gitRepositories.map(D=>{const M=D.name===_?.name;return o.jsxs("div",{className:le("group grid w-full grid-cols-[1fr_auto_auto] items-center gap-2 px-3 py-1.5 text-left transition-colors hover:bg-muted",M&&"bg-muted/70"),children:[o.jsxs("button",{className:"min-w-0 text-left",onClick:()=>{T(D.name)},type:"button",children:[o.jsx("span",{className:"block truncate text-sm font-medium leading-tight",children:D.name}),o.jsx("span",{className:"block truncate font-mono text-[10px] leading-tight text-muted-foreground",children:D.path})]}),M?o.jsx(hi,{className:"size-3.5"}):o.jsx("span",{className:"size-3.5"}),o.jsx(se,{"aria-label":`Remove ${D.name}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>{j(D.name)},size:"icon",title:`Remove ${D.name}`,type:"button",variant:"ghost",children:o.jsx(ua,{className:"size-3.5 text-destructive"})})]},D.name)})}):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No saved Git projects yet."})}),o.jsxs("div",{className:"border-t border-border bg-muted/20 p-2",children:[o.jsxs("form",{className:"flex gap-1.5",onSubmit:R,children:[o.jsx(nt,{"aria-label":"Paste absolute path",className:"h-7 flex-1 px-2 font-mono text-[11px]",onChange:D=>{l(D.target.value),h(null)},placeholder:"/absolute/path",value:a}),o.jsxs(se,{className:"h-7 px-2 text-[11px]",size:"sm",type:"submit",children:[o.jsx(Cs,{className:"size-3"}),"Add"]}),o.jsx(se,{"aria-label":"Browse and add Git project",className:"h-7 px-2",onClick:z,size:"sm",type:"button",variant:"outline",children:o.jsx(T4,{className:"size-3"})})]}),u?o.jsx("div",{className:"mt-1.5 truncate text-[10px] text-destructive",children:u}):null]})]}):null,m?o.jsx(JK,{confirmLabel:E.confirmLabel,errorMessage:u,initialPath:E.initialPath,selectedPath:p,title:"Add Git Project",onCancel:()=>d(!1),onSelect:g,onUse:async()=>{await N(p)&&(d(!1),i(!1))}}):null]})}function ZK(e){return e.startsWith("/")}function QK({gitCwd:e}){return{confirmLabel:"Add Git project",initialPath:e,selectedPath:e}}function JK({confirmLabel:e="Use this folder",errorMessage:t,initialPath:s,onCancel:i,onSelect:a,onUse:l,selectedPath:u,title:h="Choose Git Project Folder"}){return gu.createPortal(o.jsx("div",{className:"fixed inset-0 z-[1000] grid place-items-center bg-black/35 px-4",children:o.jsxs("div",{className:"w-full max-w-2xl rounded-xl border border-border bg-card p-4 shadow-xl",children:[o.jsxs("div",{className:"mb-3 flex items-center gap-3",children:[o.jsx("div",{className:"flex size-8 items-center justify-center rounded-lg border border-border bg-background",children:o.jsx(Ja,{className:"size-4"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("div",{className:"text-sm font-semibold",children:h}),o.jsx("div",{className:"truncate font-mono text-xs text-muted-foreground",children:u})]}),o.jsx(se,{"aria-label":"Close folder picker",onClick:i,size:"icon",variant:"ghost",children:o.jsx(Gs,{})})]}),o.jsx(KK,{initialPath:s,onSelect:a,selectedPath:u}),t?o.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,o.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[o.jsx(se,{onClick:i,type:"button",variant:"outline",children:"Cancel"}),o.jsx(se,{onClick:()=>{l()},type:"button",children:e})]})]})}),document.body)}function eY({ahead:e=0,behind:t=0,branches:s,currentBranch:i,disabled:a,onRefresh:l,upstream:u}){const[h,m]=y.useState(!1),[d,p]=y.useState(""),[g,v]=y.useState(null),[_,S]=y.useState(null),[w,C]=y.useState(null),E=s.filter($=>!$.remote),T=s.filter($=>$.remote);async function N($,L){v($),C(null),S(null);try{await L(),await l()}catch(B){C(B instanceof Error?B.message:String(B))}finally{v(null)}}async function j($){await N(`switch:${$}`,async()=>{await mn("/api/git/branches/switch",{name:$}),m(!1)})}async function R(){await N("fetch",async()=>{await mn("/api/git/fetch",{}),S("Fetched latest branch refs.")})}async function z(){await N("push",async()=>{const $=await of();S($.setUpstream?`Pushed ${$.branch} and set upstream.`:`Pushed ${$.branch}.`)})}const D=!!i&&(e>0||!u&&t===0);async function M($){$.preventDefault();const L=d.trim();if(!L){C("Branch name is required.");return}await N("create",async()=>{await mn("/api/git/branches",{name:L}),p(""),m(!1)})}return o.jsxs("div",{className:"fixed bottom-12 right-4 z-50 flex items-end",children:[h?o.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:[o.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border p-3",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(pn,{className:"size-4 text-muted-foreground"}),o.jsx("span",{className:"truncate text-sm font-semibold",children:i||"Branches"})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[D?o.jsxs(se,{"aria-label":"Push current branch",className:"gap-1.5 px-2 text-xs",disabled:a||g!==null,onClick:()=>{z()},size:"sm",title:u?`Push ${e} commit${e===1?"":"s"} to ${u}`:"Push and set upstream",type:"button",variant:"default",children:[o.jsx(Lb,{className:le("size-3.5",g==="push"&&"animate-pulse")}),"Push",e>0?` ${e}`:""]}):null,o.jsx(se,{"aria-label":"Fetch branches",disabled:a||g!==null,onClick:()=>{R()},size:"icon",title:"Fetch branches",type:"button",variant:"ghost",children:o.jsx(ou,{className:le(g==="fetch"&&"animate-spin")})}),o.jsx(se,{"aria-label":"Close branch dialog",onClick:()=>m(!1),size:"icon",type:"button",variant:"ghost",children:o.jsx(Gs,{})})]})]}),o.jsx("div",{className:"max-h-72 overflow-auto",children:s.length?o.jsxs(o.Fragment,{children:[o.jsx(sC,{branches:E,busy:g!==null,disabled:a,label:"Local",onSwitch:j}),o.jsx(sC,{branches:T,busy:g!==null,disabled:a,label:"Remote",onSwitch:j})]}):o.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"No branches found."})}),o.jsxs("div",{className:"border-t border-border p-3",children:[o.jsxs("form",{className:"grid gap-2 sm:grid-cols-[1fr_auto]",onSubmit:M,children:[o.jsx(nt,{"aria-label":"New branch name",disabled:a||g!==null,onChange:$=>{p($.target.value),C(null),S(null)},placeholder:"feature/new-work",value:d}),o.jsxs(se,{disabled:a||g!==null,type:"submit",children:[o.jsx(H4,{}),"Create"]})]}),w||_?o.jsx(Qe,{className:"mt-3 px-3 py-2 text-xs",variant:w?"destructive":"muted",children:w??_}):null]})]}):null,o.jsxs(se,{className:"h-8 max-w-[260px] gap-2 rounded-md shadow-lg",disabled:a,onClick:()=>m($=>!$),size:"sm",title:"Switch Git branch",type:"button",variant:"default",children:[o.jsx(pn,{className:"size-4"}),o.jsx("span",{className:"truncate font-mono text-xs",children:i||"No branch"}),i&&(e>0||t>0)?o.jsxs("span",{className:"flex items-center gap-1 font-mono text-[11px] tabular-nums",title:u?`${e} ahead / ${t} behind ${u}`:`${e} ahead / ${t} behind`,children:[t>0?o.jsxs("span",{className:"flex items-center",children:[o.jsx(jb,{className:"size-3"}),t]}):null,e>0?o.jsxs("span",{className:"flex items-center",children:[o.jsx(Ab,{className:"size-3"}),e]}):null]}):null,o.jsx(Mn,{className:le("size-4 transition-transform",h&&"rotate-180")})]})]})}function sC({branches:e,busy:t,disabled:s,label:i,onSwitch:a}){return o.jsxs("section",{children:[o.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=>o.jsxs("button",{className:le("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:[o.jsxs("span",{className:"min-w-0",children:[o.jsx("span",{className:"block truncate font-medium",children:l.name}),l.upstream?o.jsxs("span",{className:"block truncate font-mono text-[11px] text-muted-foreground",children:["tracks ",l.upstream]}):null]}),o.jsx(Pe,{variant:l.current?"success":l.remote?"outline":"secondary",children:l.current?"current":l.remote?"remote":"local"})]},`${l.remote?"remote":"local"}:${l.name}`)):o.jsxs("div",{className:"border-b border-border px-3 py-3 text-sm text-muted-foreground",children:["No ",i.toLowerCase()," branches."]})]})}const rT="nomoreide-theme-choice";function tY(){if(typeof window>"u")return"dark";const e=window.localStorage.getItem(rT);return e==="light"||e==="dark"?e:"dark"}function sY(e){const t=document.documentElement;t.classList.toggle("dark",e==="dark"),t.style.colorScheme=e}function nY(){const[e,t]=y.useState(()=>tY()),s=y.useRef(null);y.useEffect(()=>{sY(e),window.localStorage.setItem(rT,e)},[e]);const i=y.useCallback(()=>{const a=e==="dark"?"light":"dark",l=s.current,u=document;if(!l||!u.startViewTransition||window.matchMedia("(prefers-reduced-motion: reduce)").matches){t(a);return}const h=l.getBoundingClientRect(),m=h.left+h.width/2,d=h.top+h.height/2,p=Math.hypot(Math.max(m,window.innerWidth-m),Math.max(d,window.innerHeight-d));u.startViewTransition(()=>{t(a)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${m}px ${d}px)`,`circle(${p}px at ${m}px ${d}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},[e]);return o.jsxs("button",{ref:s,onClick:i,title:e==="dark"?"Switch to light mode":"Switch to dark mode","aria-label":"Toggle theme",className:zh(),children:[o.jsx("span",{className:Bh(),children:e==="dark"?o.jsx(a6,{}):o.jsx(xM,{})}),o.jsx("span",{className:Ih(),children:"Theme"})]})}function iY(e=!1){return le("group/sidebar hidden h-full shrink-0 overflow-x-hidden overflow-y-auto border-r border-border bg-card/85 py-5 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 rY(e,t=!1){return le("relative grid h-12 grid-cols-[48px_minmax(0,1fr)] items-center justify-start gap-0 overflow-hidden rounded-md px-0 text-[15px] 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 aY(e=!1,t=!1){return le("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 oY(e=!1){return le("flex size-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 lY({docked:e,onToggleDock:t}){return o.jsxs("div",{className:le("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:[o.jsxs("span",{className:le("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:[o.jsx("span",{children:"Made with"}),o.jsx(V4,{"aria-label":"love",className:"size-3 shrink-0 fill-red-500 text-red-500"}),o.jsx("span",{children:"by Robert Wang"}),o.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:o.jsx("svg",{"aria-hidden":!0,className:"size-3 fill-current",role:"img",viewBox:"0 0 24 24",children:o.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"})})})]}),o.jsx("button",{"aria-label":e?"Undock sidebar":"Dock sidebar","aria-pressed":e,className:le("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?o.jsx(kM,{}):o.jsx(NM,{})})]})}function cY({className:e}){return o.jsxs("div",{className:le("min-w-0",e),children:[o.jsxs("div",{className:"flex items-baseline gap-1.5",children:[o.jsx("div",{className:"text-sm font-semibold",children:"NoMoreIDE"}),o.jsxs("div",{className:"font-mono text-[10px] text-muted-foreground",children:["v","0.1.48"]})]}),o.jsx("div",{className:"font-mono text-[11px] text-muted-foreground",children:"127.0.0.1 console"})]})}function uY({syncLocation:e=!0}={}){const[t,s]=y.useState(()=>e?window.location.pathname.startsWith("/agent")?"agent":window.location.pathname.startsWith("/errors")?"errors":window.location.pathname.startsWith("/database")?"database":window.location.pathname.startsWith("/terminal")?"terminal":window.location.pathname.startsWith("/git")?"git":"services":"services"),[i,a]=y.useState(null),[l,u]=y.useState(null),[h,m]=y.useState(null),[d,p]=y.useState(null),[g,v]=y.useState(!0),{error:_,success:S}=Ns(),[w,C]=y.useState(()=>window.localStorage.getItem("nomoreide:sidebar-docked")==="true"),E=y.useCallback(async(N={})=>{N.silent||v(!0),p(null);try{a(await fR()),N.notify&&S("Dashboard refreshed.")}catch(j){const R=j instanceof Error?j.message:String(j);p(R),_(R)}finally{v(!1)}},[_,S]);y.useEffect(()=>{E()},[E]),y.useEffect(()=>{function N(){document.visibilityState==="visible"&&E({silent:!0})}const j=window.setInterval(N,5e3);return window.addEventListener("focus",N),document.addEventListener("visibilitychange",N),()=>{window.clearInterval(j),window.removeEventListener("focus",N),document.removeEventListener("visibilitychange",N)}},[t,E]),y.useEffect(()=>{if(!e)return;const N=t==="git"?"/git":t==="agent"?"/agent":t==="errors"?"/errors":t==="database"?"/database":t==="terminal"?"/terminal":"/";window.location.pathname!==N&&window.history.pushState(null,"",N)},[t,e]),y.useEffect(()=>{window.localStorage.setItem("nomoreide:sidebar-docked",String(w))},[w]);const T=y.useMemo(()=>i?Object.values(i.runtime.services).filter(N=>N.state==="running").length:0,[i]);return o.jsx(k9,{children:o.jsx(_B,{onRefresh:()=>{E({silent:!0})},children:o.jsxs("div",{className:"h-screen overflow-hidden pb-9",children:[o.jsxs("div",{className:"mx-auto flex h-full max-w-[1500px]",children:[o.jsxs("aside",{className:iY(w),children:[o.jsxs("div",{className:le("grid h-12 grid-cols-[48px_minmax(0,1fr)] items-center overflow-hidden transition-[width] duration-150",w?"w-full":"w-12 group-hover/sidebar:w-full"),children:[o.jsx("div",{className:"flex size-12 items-center justify-center",children:o.jsx("div",{className:"flex size-9 items-center justify-center overflow-hidden rounded-md bg-primary text-primary-foreground",children:o.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:[o.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"}),o.jsx("path",{d:"M22 31L30 39L22 47",stroke:"hsl(var(--primary))",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"4.5"}),o.jsx("path",{d:"M36 47H48",stroke:"hsl(var(--primary))",strokeLinecap:"round",strokeWidth:"4.5"})]})})}),o.jsx(cY,{className:le("min-w-0 translate-x-1 overflow-hidden transition-opacity duration-200",w?"opacity-100":"opacity-0 group-hover/sidebar:opacity-100")})]}),o.jsxs("nav",{className:"mt-5 grid flex-1 content-start gap-1",children:[o.jsx(Yo,{active:t==="services",badge:T,docked:w,icon:o.jsx(CC,{}),label:"Services",onClick:()=>s("services")}),o.jsx(Yo,{active:t==="git",docked:w,icon:o.jsx(pn,{}),label:"Git Review",onClick:()=>s("git")}),o.jsx(Yo,{active:t==="errors",docked:w,icon:o.jsx(Ch,{}),label:"Error Inbox",onClick:()=>s("errors")}),o.jsx(Yo,{active:t==="database",docked:w,icon:o.jsx(Xn,{}),label:"Database",onClick:()=>s("database")}),o.jsx(Yo,{active:t==="terminal",docked:w,icon:o.jsx(n6,{}),label:"Terminal",onClick:()=>s("terminal")}),o.jsx(Yo,{active:t==="agent",docked:w,icon:o.jsx(RA,{}),label:"Agent",onClick:()=>s("agent")})]}),o.jsx(lY,{docked:w,onToggleDock:()=>C(N=>!N)})]}),o.jsxs("main",{className:"flex h-full min-w-0 flex-1 flex-col px-0 py-0",children:[o.jsxs("header",{className:le("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:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(TM,{className:"size-4 text-muted-foreground md:hidden"}),o.jsxs("div",{children:[o.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:t==="git"?"Git Review":t==="agent"?"Agent":t==="errors"?"Error Inbox":t==="database"?"Database":t==="terminal"?"Terminal":"Services"}),o.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:i?.git.selectedRepository?.name??i?.git.cwd??"Local workspace"})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[d?o.jsx(Pe,{variant:"danger",children:d}):null,i&&t==="git"?o.jsx(XK,{data:i,onRefresh:E}):null,o.jsxs("div",{"aria-label":"Dashboard quick actions",className:"flex items-center gap-1 rounded-lg border border-border bg-background p-px",role:"group",children:[o.jsxs("button",{"aria-label":"Refresh dashboard",className:zh(),onClick:()=>{E({notify:!0})},title:"Refresh dashboard",type:"button",children:[o.jsx("span",{className:Bh(),children:o.jsx(ou,{className:le(g&&"animate-spin")})}),o.jsx("span",{className:Ih(),children:"Refresh"})]}),o.jsx(nY,{}),o.jsxs("a",{"aria-label":"Open NoMoreIDE documentation",className:zh(),href:"https://www.nomoreide.com/docs",rel:"noreferrer",target:"_blank",title:"Open NoMoreIDE documentation",children:[o.jsx("span",{className:Bh(),children:o.jsx(AA,{})}),o.jsx("span",{className:Ih(),children:"Docs"})]}),i?o.jsx(cB,{data:i}):null]})]})]}),i?o.jsx(GF,{data:i,onOpenService:N=>{u(N),s("services"),E({silent:!0})}}):null,g&&!i?o.jsx(Qe,{variant:"muted",children:"Loading NoMoreIDE state..."}):null,o.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden",children:[i&&t==="services"?o.jsx(FF,{data:i,onRefresh:E,focusService:l,onServiceFocused:()=>u(null)}):null,i&&t==="git"?o.jsx(GK,{data:i,onRefresh:()=>{E({silent:!0})}}):null,t==="agent"?o.jsx(Pz,{}):null,t==="errors"?o.jsx(kP,{}):null,t==="database"?o.jsx(xP,{staged:h,onStageConsumed:()=>m(null)}):null,t==="terminal"?o.jsx(QF,{}):null]})]})]}),i&&t==="git"?o.jsx(eY,{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:E,upstream:i.git.status?.upstream}):null,o.jsx(II,{git:i?.git,onGitRefresh:()=>{E({silent:!0})},onOpenAgentPage:t==="agent"?void 0:()=>s("agent"),onOpenService:N=>{u(N),s("services"),E({silent:!0})},onOpenSqlConsole:(N,j)=>{m(R=>({connection:N,sql:j,nonce:(R?.nonce??0)+1})),s("database")}})]})})})}function Yo({active:e,badge:t,docked:s,icon:i,label:a,onClick:l}){const u=t!==void 0&&t>0;return o.jsxs(se,{"aria-label":a,title:a,className:rY(e,s),variant:"ghost",onClick:l,type:"button",children:[o.jsx("span",{className:oY(s),children:i}),o.jsx("span",{className:aY(s,u),children:a}),t!==void 0&&t>0?o.jsx(Pe,{appearance:t>0?"solid":"outline",className:le("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]})}iC.createRoot(document.getElementById("root")).render(o.jsx(y.StrictMode,{children:o.jsx(uY,{})}));export{o as j,y as r};
|