openfox 1.6.40 → 1.6.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,153 @@
1
+ var X1=Object.defineProperty;var Z1=(e,r,s)=>r in e?X1(e,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[r]=s;var dr=(e,r,s)=>Z1(e,typeof r!="symbol"?r+"":r,s);function Q1(e,r){for(var s=0;s<r.length;s++){const i=r[s];if(typeof i!="string"&&!Array.isArray(i)){for(const c in i)if(c!=="default"&&!(c in e)){const u=Object.getOwnPropertyDescriptor(i,c);u&&Object.defineProperty(e,c,u.get?u:{enumerable:!0,get:()=>i[c]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))i(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&i(f)}).observe(document,{childList:!0,subtree:!0});function s(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(c){if(c.ep)return;c.ep=!0;const u=s(c);fetch(c.href,u)}})();function sc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Rd={exports:{}},Ba={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var vx;function J1(){if(vx)return Ba;vx=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function s(i,c,u){var f=null;if(u!==void 0&&(f=""+u),c.key!==void 0&&(f=""+c.key),"key"in c){u={};for(var l in c)l!=="key"&&(u[l]=c[l])}else u=c;return c=u.ref,{$$typeof:e,type:i,key:f,ref:c!==void 0?c:null,props:u}}return Ba.Fragment=r,Ba.jsx=s,Ba.jsxs=s,Ba}var bx;function eS(){return bx||(bx=1,Rd.exports=J1()),Rd.exports}var o=eS(),Od={exports:{}},Ge={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var yx;function tS(){if(yx)return Ge;yx=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),f=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),b=Symbol.iterator;function _(R){return R===null||typeof R!="object"?null:(R=b&&R[b]||R["@@iterator"],typeof R=="function"?R:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,y={};function v(R,F,U){this.props=R,this.context=F,this.refs=y,this.updater=U||E}v.prototype.isReactComponent={},v.prototype.setState=function(R,F){if(typeof R!="object"&&typeof R!="function"&&R!=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,R,F,"setState")},v.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function x(){}x.prototype=v.prototype;function S(R,F,U){this.props=R,this.context=F,this.refs=y,this.updater=U||E}var j=S.prototype=new x;j.constructor=S,C(j,v.prototype),j.isPureReactComponent=!0;var T=Array.isArray;function N(){}var D={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function z(R,F,U){var ne=U.ref;return{$$typeof:e,type:R,key:F,ref:ne!==void 0?ne:null,props:U}}function O(R,F){return z(R.type,F,R.props)}function q(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function G(R){var F={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(U){return F[U]})}var W=/\/+/g;function I(R,F){return typeof R=="object"&&R!==null&&R.key!=null?G(""+R.key):F.toString(36)}function $(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(N,N):(R.status="pending",R.then(function(F){R.status==="pending"&&(R.status="fulfilled",R.value=F)},function(F){R.status==="pending"&&(R.status="rejected",R.reason=F)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function B(R,F,U,ne,Q){var ee=typeof R;(ee==="undefined"||ee==="boolean")&&(R=null);var Y=!1;if(R===null)Y=!0;else switch(ee){case"bigint":case"string":case"number":Y=!0;break;case"object":switch(R.$$typeof){case e:case r:Y=!0;break;case g:return Y=R._init,B(Y(R._payload),F,U,ne,Q)}}if(Y)return Q=Q(R),Y=ne===""?"."+I(R,0):ne,T(Q)?(U="",Y!=null&&(U=Y.replace(W,"$&/")+"/"),B(Q,F,U,"",function(re){return re})):Q!=null&&(q(Q)&&(Q=O(Q,U+(Q.key==null||R&&R.key===Q.key?"":(""+Q.key).replace(W,"$&/")+"/")+Y)),F.push(Q)),1;Y=0;var V=ne===""?".":ne+":";if(T(R))for(var oe=0;oe<R.length;oe++)ne=R[oe],ee=V+I(ne,oe),Y+=B(ne,F,U,ee,Q);else if(oe=_(R),typeof oe=="function")for(R=oe.call(R),oe=0;!(ne=R.next()).done;)ne=ne.value,ee=V+I(ne,oe++),Y+=B(ne,F,U,ee,Q);else if(ee==="object"){if(typeof R.then=="function")return B($(R),F,U,ne,Q);throw F=String(R),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.")}return Y}function X(R,F,U){if(R==null)return R;var ne=[],Q=0;return B(R,ne,"","",function(ee){return F.call(U,ee,Q++)}),ne}function Z(R){if(R._status===-1){var F=R._result;F=F(),F.then(function(U){(R._status===0||R._status===-1)&&(R._status=1,R._result=U)},function(U){(R._status===0||R._status===-1)&&(R._status=2,R._result=U)}),R._status===-1&&(R._status=0,R._result=F)}if(R._status===1)return R._result.default;throw R._result}var H=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var F=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(F))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)},L={map:X,forEach:function(R,F,U){X(R,function(){F.apply(this,arguments)},U)},count:function(R){var F=0;return X(R,function(){F++}),F},toArray:function(R){return X(R,function(F){return F})||[]},only:function(R){if(!q(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return Ge.Activity=m,Ge.Children=L,Ge.Component=v,Ge.Fragment=s,Ge.Profiler=c,Ge.PureComponent=S,Ge.StrictMode=i,Ge.Suspense=d,Ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(R){return D.H.useMemoCache(R)}},Ge.cache=function(R){return function(){return R.apply(null,arguments)}},Ge.cacheSignal=function(){return null},Ge.cloneElement=function(R,F,U){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var ne=C({},R.props),Q=R.key;if(F!=null)for(ee in F.key!==void 0&&(Q=""+F.key),F)!A.call(F,ee)||ee==="key"||ee==="__self"||ee==="__source"||ee==="ref"&&F.ref===void 0||(ne[ee]=F[ee]);var ee=arguments.length-2;if(ee===1)ne.children=U;else if(1<ee){for(var Y=Array(ee),V=0;V<ee;V++)Y[V]=arguments[V+2];ne.children=Y}return z(R.type,Q,ne)},Ge.createContext=function(R){return R={$$typeof:f,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:u,_context:R},R},Ge.createElement=function(R,F,U){var ne,Q={},ee=null;if(F!=null)for(ne in F.key!==void 0&&(ee=""+F.key),F)A.call(F,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(Q[ne]=F[ne]);var Y=arguments.length-2;if(Y===1)Q.children=U;else if(1<Y){for(var V=Array(Y),oe=0;oe<Y;oe++)V[oe]=arguments[oe+2];Q.children=V}if(R&&R.defaultProps)for(ne in Y=R.defaultProps,Y)Q[ne]===void 0&&(Q[ne]=Y[ne]);return z(R,ee,Q)},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(R){return{$$typeof:l,render:R}},Ge.isValidElement=q,Ge.lazy=function(R){return{$$typeof:g,_payload:{_status:-1,_result:R},_init:Z}},Ge.memo=function(R,F){return{$$typeof:p,type:R,compare:F===void 0?null:F}},Ge.startTransition=function(R){var F=D.T,U={};D.T=U;try{var ne=R(),Q=D.S;Q!==null&&Q(U,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(N,H)}catch(ee){H(ee)}finally{F!==null&&U.types!==null&&(F.types=U.types),D.T=F}},Ge.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},Ge.use=function(R){return D.H.use(R)},Ge.useActionState=function(R,F,U){return D.H.useActionState(R,F,U)},Ge.useCallback=function(R,F){return D.H.useCallback(R,F)},Ge.useContext=function(R){return D.H.useContext(R)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(R,F){return D.H.useDeferredValue(R,F)},Ge.useEffect=function(R,F){return D.H.useEffect(R,F)},Ge.useEffectEvent=function(R){return D.H.useEffectEvent(R)},Ge.useId=function(){return D.H.useId()},Ge.useImperativeHandle=function(R,F,U){return D.H.useImperativeHandle(R,F,U)},Ge.useInsertionEffect=function(R,F){return D.H.useInsertionEffect(R,F)},Ge.useLayoutEffect=function(R,F){return D.H.useLayoutEffect(R,F)},Ge.useMemo=function(R,F){return D.H.useMemo(R,F)},Ge.useOptimistic=function(R,F){return D.H.useOptimistic(R,F)},Ge.useReducer=function(R,F,U){return D.H.useReducer(R,F,U)},Ge.useRef=function(R){return D.H.useRef(R)},Ge.useState=function(R){return D.H.useState(R)},Ge.useSyncExternalStore=function(R,F,U){return D.H.useSyncExternalStore(R,F,U)},Ge.useTransition=function(){return D.H.useTransition()},Ge.version="19.2.4",Ge}var _x;function ic(){return _x||(_x=1,Od.exports=tS()),Od.exports}var P=ic();const mn=sc(P),nS=Q1({__proto__:null,default:mn},[P]);var Md={exports:{}},za={},Id={exports:{}},Bd={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var Sx;function rS(){return Sx||(Sx=1,(function(e){function r(B,X){var Z=B.length;B.push(X);e:for(;0<Z;){var H=Z-1>>>1,L=B[H];if(0<c(L,X))B[H]=X,B[Z]=L,Z=H;else break e}}function s(B){return B.length===0?null:B[0]}function i(B){if(B.length===0)return null;var X=B[0],Z=B.pop();if(Z!==X){B[0]=Z;e:for(var H=0,L=B.length,R=L>>>1;H<R;){var F=2*(H+1)-1,U=B[F],ne=F+1,Q=B[ne];if(0>c(U,Z))ne<L&&0>c(Q,U)?(B[H]=Q,B[ne]=Z,H=ne):(B[H]=U,B[F]=Z,H=F);else if(ne<L&&0>c(Q,Z))B[H]=Q,B[ne]=Z,H=ne;else break e}}return X}function c(B,X){var Z=B.sortIndex-X.sortIndex;return Z!==0?Z:B.id-X.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var f=Date,l=f.now();e.unstable_now=function(){return f.now()-l}}var d=[],p=[],g=1,m=null,b=3,_=!1,E=!1,C=!1,y=!1,v=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;function j(B){for(var X=s(p);X!==null;){if(X.callback===null)i(p);else if(X.startTime<=B)i(p),X.sortIndex=X.expirationTime,r(d,X);else break;X=s(p)}}function T(B){if(C=!1,j(B),!E)if(s(d)!==null)E=!0,N||(N=!0,G());else{var X=s(p);X!==null&&$(T,X.startTime-B)}}var N=!1,D=-1,A=5,z=-1;function O(){return y?!0:!(e.unstable_now()-z<A)}function q(){if(y=!1,N){var B=e.unstable_now();z=B;var X=!0;try{e:{E=!1,C&&(C=!1,x(D),D=-1),_=!0;var Z=b;try{t:{for(j(B),m=s(d);m!==null&&!(m.expirationTime>B&&O());){var H=m.callback;if(typeof H=="function"){m.callback=null,b=m.priorityLevel;var L=H(m.expirationTime<=B);if(B=e.unstable_now(),typeof L=="function"){m.callback=L,j(B),X=!0;break t}m===s(d)&&i(d),j(B)}else i(d);m=s(d)}if(m!==null)X=!0;else{var R=s(p);R!==null&&$(T,R.startTime-B),X=!1}}break e}finally{m=null,b=Z,_=!1}X=void 0}}finally{X?G():N=!1}}}var G;if(typeof S=="function")G=function(){S(q)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,I=W.port2;W.port1.onmessage=q,G=function(){I.postMessage(null)}}else G=function(){v(q,0)};function $(B,X){D=v(function(){B(e.unstable_now())},X)}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(B){B.callback=null},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(B){switch(b){case 1:case 2:case 3:var X=3;break;default:X=b}var Z=b;b=X;try{return B()}finally{b=Z}},e.unstable_requestPaint=function(){y=!0},e.unstable_runWithPriority=function(B,X){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var Z=b;b=B;try{return X()}finally{b=Z}},e.unstable_scheduleCallback=function(B,X,Z){var H=e.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?H+Z:H):Z=H,B){case 1:var L=-1;break;case 2:L=250;break;case 5:L=1073741823;break;case 4:L=1e4;break;default:L=5e3}return L=Z+L,B={id:g++,callback:X,priorityLevel:B,startTime:Z,expirationTime:L,sortIndex:-1},Z>H?(B.sortIndex=Z,r(p,B),s(d)===null&&B===s(p)&&(C?(x(D),D=-1):C=!0,$(T,Z-H))):(B.sortIndex=L,r(d,B),E||_||(E=!0,N||(N=!0,G()))),B},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(B){var X=b;return function(){var Z=b;b=X;try{return B.apply(this,arguments)}finally{b=Z}}}})(Bd)),Bd}var wx;function sS(){return wx||(wx=1,Id.exports=rS()),Id.exports}var zd={exports:{}},fn={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var Cx;function iS(){if(Cx)return fn;Cx=1;var e=ic();function r(d){var p="https://react.dev/errors/"+d;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)p+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+d+"; visit "+p+" 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(r(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},c=Symbol.for("react.portal");function u(d,p,g){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:m==null?null:""+m,children:d,containerInfo:p,implementation:g}}var f=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(d,p){if(d==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return fn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,fn.createPortal=function(d,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(r(299));return u(d,p,null,g)},fn.flushSync=function(d){var p=f.T,g=i.p;try{if(f.T=null,i.p=2,d)return d()}finally{f.T=p,i.p=g,i.d.f()}},fn.preconnect=function(d,p){typeof d=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,i.d.C(d,p))},fn.prefetchDNS=function(d){typeof d=="string"&&i.d.D(d)},fn.preinit=function(d,p){if(typeof d=="string"&&p&&typeof p.as=="string"){var g=p.as,m=l(g,p.crossOrigin),b=typeof p.integrity=="string"?p.integrity:void 0,_=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;g==="style"?i.d.S(d,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:m,integrity:b,fetchPriority:_}):g==="script"&&i.d.X(d,{crossOrigin:m,integrity:b,fetchPriority:_,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},fn.preinitModule=function(d,p){if(typeof d=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var g=l(p.as,p.crossOrigin);i.d.M(d,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&i.d.M(d)},fn.preload=function(d,p){if(typeof d=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var g=p.as,m=l(g,p.crossOrigin);i.d.L(d,g,{crossOrigin:m,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},fn.preloadModule=function(d,p){if(typeof d=="string")if(p){var g=l(p.as,p.crossOrigin);i.d.m(d,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else i.d.m(d)},fn.requestFormReset=function(d){i.d.r(d)},fn.unstable_batchedUpdates=function(d,p){return d(p)},fn.useFormState=function(d,p,g){return f.H.useFormState(d,p,g)},fn.useFormStatus=function(){return f.H.useHostTransitionStatus()},fn.version="19.2.4",fn}var kx;function yb(){if(kx)return zd.exports;kx=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(r){console.error(r)}}return e(),zd.exports=iS(),zd.exports}/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var Ex;function aS(){if(Ex)return za;Ex=1;var e=sS(),r=ic(),s=yb();function i(t){var n="https://react.dev/errors/"+t;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function u(t){var n=t,a=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(a=n.return),t=n.return;while(t)}return n.tag===3?a:null}function f(t){if(t.tag===13){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function l(t){if(t.tag===31){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function d(t){if(u(t)!==t)throw Error(i(188))}function p(t){var n=t.alternate;if(!n){if(n=u(t),n===null)throw Error(i(188));return n!==t?null:t}for(var a=t,h=n;;){var w=a.return;if(w===null)break;var k=w.alternate;if(k===null){if(h=w.return,h!==null){a=h;continue}break}if(w.child===k.child){for(k=w.child;k;){if(k===a)return d(w),t;if(k===h)return d(w),n;k=k.sibling}throw Error(i(188))}if(a.return!==h.return)a=w,h=k;else{for(var M=!1,K=w.child;K;){if(K===a){M=!0,a=w,h=k;break}if(K===h){M=!0,h=w,a=k;break}K=K.sibling}if(!M){for(K=k.child;K;){if(K===a){M=!0,a=k,h=w;break}if(K===h){M=!0,h=k,a=w;break}K=K.sibling}if(!M)throw Error(i(189))}}if(a.alternate!==h)throw Error(i(190))}if(a.tag!==3)throw Error(i(188));return a.stateNode.current===a?t:n}function g(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=g(t),n!==null)return n;t=t.sibling}return null}var m=Object.assign,b=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),x=Symbol.for("react.consumer"),S=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),z=Symbol.for("react.activity"),O=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function G(t){return t===null||typeof t!="object"?null:(t=q&&t[q]||t["@@iterator"],typeof t=="function"?t:null)}var W=Symbol.for("react.client.reference");function I(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===W?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case C:return"Fragment";case v:return"Profiler";case y:return"StrictMode";case T:return"Suspense";case N:return"SuspenseList";case z:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case E:return"Portal";case S:return t.displayName||"Context";case x:return(t._context.displayName||"Context")+".Consumer";case j:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case D:return n=t.displayName||null,n!==null?n:I(t.type)||"Memo";case A:n=t._payload,t=t._init;try{return I(t(n))}catch{}}return null}var $=Array.isArray,B=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z={pending:!1,data:null,method:null,action:null},H=[],L=-1;function R(t){return{current:t}}function F(t){0>L||(t.current=H[L],H[L]=null,L--)}function U(t,n){L++,H[L]=t.current,t.current=n}var ne=R(null),Q=R(null),ee=R(null),Y=R(null);function V(t,n){switch(U(ee,n),U(Q,t),U(ne,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?Fg(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=Fg(n),t=Ug(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}F(ne),U(ne,t)}function oe(){F(ne),F(Q),F(ee)}function re(t){t.memoizedState!==null&&U(Y,t);var n=ne.current,a=Ug(n,t.type);n!==a&&(U(Q,t),U(ne,a))}function ve(t){Q.current===t&&(F(ne),F(Q)),Y.current===t&&(F(Y),Ra._currentValue=Z)}var be,Le;function Oe(t){if(be===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);be=n&&n[1]||"",Le=-1<a.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+be+t+Le}var ze=!1;function We(t,n){if(!t||ze)return"";ze=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(n){var xe=function(){throw Error()};if(Object.defineProperty(xe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(xe,[])}catch(de){var ce=de}Reflect.construct(t,[],xe)}else{try{xe.call()}catch(de){ce=de}t.call(xe.prototype)}}else{try{throw Error()}catch(de){ce=de}(xe=t())&&typeof xe.catch=="function"&&xe.catch(function(){})}}catch(de){if(de&&ce&&typeof de.stack=="string")return[de.stack,ce.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var w=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");w&&w.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var k=h.DetermineComponentFrameRoot(),M=k[0],K=k[1];if(M&&K){var J=M.split(`
44
+ `),le=K.split(`
45
+ `);for(w=h=0;h<J.length&&!J[h].includes("DetermineComponentFrameRoot");)h++;for(;w<le.length&&!le[w].includes("DetermineComponentFrameRoot");)w++;if(h===J.length||w===le.length)for(h=J.length-1,w=le.length-1;1<=h&&0<=w&&J[h]!==le[w];)w--;for(;1<=h&&0<=w;h--,w--)if(J[h]!==le[w]){if(h!==1||w!==1)do if(h--,w--,0>w||J[h]!==le[w]){var he=`
46
+ `+J[h].replace(" at new "," at ");return t.displayName&&he.includes("<anonymous>")&&(he=he.replace("<anonymous>",t.displayName)),he}while(1<=h&&0<=w);break}}}finally{ze=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?Oe(a):""}function Ee(t,n){switch(t.tag){case 26:case 27:case 5:return Oe(t.type);case 16:return Oe("Lazy");case 13:return t.child!==n&&n!==null?Oe("Suspense Fallback"):Oe("Suspense");case 19:return Oe("SuspenseList");case 0:case 15:return We(t.type,!1);case 11:return We(t.type.render,!1);case 1:return We(t.type,!0);case 31:return Oe("Activity");default:return""}}function fe(t){try{var n="",a=null;do n+=Ee(t,a),a=t,t=t.return;while(t);return n}catch(h){return`
47
+ Error generating stack: `+h.message+`
48
+ `+h.stack}}var je=Object.prototype.hasOwnProperty,Ue=e.unstable_scheduleCallback,It=e.unstable_cancelCallback,pe=e.unstable_shouldYield,Ne=e.unstable_requestPaint,Me=e.unstable_now,ot=e.unstable_getCurrentPriorityLevel,ue=e.unstable_ImmediatePriority,_e=e.unstable_UserBlockingPriority,Te=e.unstable_NormalPriority,Ie=e.unstable_LowPriority,$e=e.unstable_IdlePriority,St=e.log,Ye=e.unstable_setDisableYieldValue,Dt=null,mt=null;function Kt(t){if(typeof St=="function"&&Ye(t),mt&&typeof mt.setStrictMode=="function")try{mt.setStrictMode(Dt,t)}catch{}}var lt=Math.clz32?Math.clz32:Gi,$n=Math.log,sn=Math.LN2;function Gi(t){return t>>>=0,t===0?32:31-($n(t)/sn|0)|0}var me=256,ye=262144,we=4194304;function Ve(t){var n=t&42;if(n!==0)return n;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Qe(t,n,a){var h=t.pendingLanes;if(h===0)return 0;var w=0,k=t.suspendedLanes,M=t.pingedLanes;t=t.warmLanes;var K=h&134217727;return K!==0?(h=K&~k,h!==0?w=Ve(h):(M&=K,M!==0?w=Ve(M):a||(a=K&~t,a!==0&&(w=Ve(a))))):(K=h&~k,K!==0?w=Ve(K):M!==0?w=Ve(M):a||(a=h&~t,a!==0&&(w=Ve(a)))),w===0?0:n!==0&&n!==w&&(n&k)===0&&(k=w&-w,a=n&-n,k>=a||k===32&&(a&4194048)!==0)?n:w}function Pe(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function Yt(t,n){switch(t){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 Rt(){var t=we;return we<<=1,(we&62914560)===0&&(we=4194304),t}function Bt(t){for(var n=[],a=0;31>a;a++)n.push(t);return n}function Ur(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function ie(t,n,a,h,w,k){var M=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var K=t.entanglements,J=t.expirationTimes,le=t.hiddenUpdates;for(a=M&~a;0<a;){var he=31-lt(a),xe=1<<he;K[he]=0,J[he]=-1;var ce=le[he];if(ce!==null)for(le[he]=null,he=0;he<ce.length;he++){var de=ce[he];de!==null&&(de.lane&=-536870913)}a&=~xe}h!==0&&Ae(t,h,0),k!==0&&w===0&&t.tag!==0&&(t.suspendedLanes|=k&~(M&~n))}function Ae(t,n,a){t.pendingLanes|=n,t.suspendedLanes&=~n;var h=31-lt(n);t.entangledLanes|=n,t.entanglements[h]=t.entanglements[h]|1073741824|a&261930}function qe(t,n){var a=t.entangledLanes|=n;for(t=t.entanglements;a;){var h=31-lt(a),w=1<<h;w&n|t[h]&n&&(t[h]|=n),a&=~w}}function Ct(t,n){var a=n&-n;return a=(a&42)!==0?1:en(a),(a&(t.suspendedLanes|n))!==0?0:a}function en(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function yn(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function vr(){var t=X.p;return t!==0?t:(t=window.event,t===void 0?32:dx(t.type))}function Ks(t,n){var a=X.p;try{return X.p=t,n()}finally{X.p=a}}var _n=Math.random().toString(36).slice(2),an="__reactFiber$"+_n,Sn="__reactProps$"+_n,Ys="__reactContainer$"+_n,Cc="__reactEvents$"+_n,H0="__reactListeners$"+_n,P0="__reactHandles$"+_n,Nf="__reactResources$"+_n,Ki="__reactMarker$"+_n;function kc(t){delete t[an],delete t[Sn],delete t[Cc],delete t[H0],delete t[P0]}function Xs(t){var n=t[an];if(n)return n;for(var a=t.parentNode;a;){if(n=a[Ys]||a[an]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(t=Yg(t);t!==null;){if(a=t[an])return a;t=Yg(t)}return n}t=a,a=t.parentNode}return null}function Zs(t){if(t=t[an]||t[Ys]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function Yi(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(i(33))}function Qs(t){var n=t[Nf];return n||(n=t[Nf]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function tn(t){t[Ki]=!0}var Tf=new Set,Af={};function vs(t,n){Js(t,n),Js(t+"Capture",n)}function Js(t,n){for(Af[t]=n,t=0;t<n.length;t++)Tf.add(n[t])}var F0=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]*$"),Df={},Lf={};function U0(t){return je.call(Lf,t)?!0:je.call(Df,t)?!1:F0.test(t)?Lf[t]=!0:(Df[t]=!0,!1)}function _o(t,n,a){if(U0(n))if(a===null)t.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":t.removeAttribute(n);return;case"boolean":var h=n.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){t.removeAttribute(n);return}}t.setAttribute(n,""+a)}}function So(t,n,a){if(a===null)t.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttribute(n,""+a)}}function br(t,n,a,h){if(h===null)t.removeAttribute(a);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttributeNS(n,a,""+h)}}function qn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Rf(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function $0(t,n,a){var h=Object.getOwnPropertyDescriptor(t.constructor.prototype,n);if(!t.hasOwnProperty(n)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var w=h.get,k=h.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return w.call(this)},set:function(M){a=""+M,k.call(this,M)}}),Object.defineProperty(t,n,{enumerable:h.enumerable}),{getValue:function(){return a},setValue:function(M){a=""+M},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function Ec(t){if(!t._valueTracker){var n=Rf(t)?"checked":"value";t._valueTracker=$0(t,n,""+t[n])}}function Of(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var a=n.getValue(),h="";return t&&(h=Rf(t)?t.checked?"true":"false":t.value),t=h,t!==a?(n.setValue(t),!0):!1}function wo(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var q0=/[\n"\\]/g;function Wn(t){return t.replace(q0,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function jc(t,n,a,h,w,k,M,K){t.name="",M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?t.type=M:t.removeAttribute("type"),n!=null?M==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+qn(n)):t.value!==""+qn(n)&&(t.value=""+qn(n)):M!=="submit"&&M!=="reset"||t.removeAttribute("value"),n!=null?Nc(t,M,qn(n)):a!=null?Nc(t,M,qn(a)):h!=null&&t.removeAttribute("value"),w==null&&k!=null&&(t.defaultChecked=!!k),w!=null&&(t.checked=w&&typeof w!="function"&&typeof w!="symbol"),K!=null&&typeof K!="function"&&typeof K!="symbol"&&typeof K!="boolean"?t.name=""+qn(K):t.removeAttribute("name")}function Mf(t,n,a,h,w,k,M,K){if(k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(t.type=k),n!=null||a!=null){if(!(k!=="submit"&&k!=="reset"||n!=null)){Ec(t);return}a=a!=null?""+qn(a):"",n=n!=null?""+qn(n):a,K||n===t.value||(t.value=n),t.defaultValue=n}h=h??w,h=typeof h!="function"&&typeof h!="symbol"&&!!h,t.checked=K?t.checked:!!h,t.defaultChecked=!!h,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(t.name=M),Ec(t)}function Nc(t,n,a){n==="number"&&wo(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function ei(t,n,a,h){if(t=t.options,n){n={};for(var w=0;w<a.length;w++)n["$"+a[w]]=!0;for(a=0;a<t.length;a++)w=n.hasOwnProperty("$"+t[a].value),t[a].selected!==w&&(t[a].selected=w),w&&h&&(t[a].defaultSelected=!0)}else{for(a=""+qn(a),n=null,w=0;w<t.length;w++){if(t[w].value===a){t[w].selected=!0,h&&(t[w].defaultSelected=!0);return}n!==null||t[w].disabled||(n=t[w])}n!==null&&(n.selected=!0)}}function If(t,n,a){if(n!=null&&(n=""+qn(n),n!==t.value&&(t.value=n),a==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=a!=null?""+qn(a):""}function Bf(t,n,a,h){if(n==null){if(h!=null){if(a!=null)throw Error(i(92));if($(h)){if(1<h.length)throw Error(i(93));h=h[0]}a=h}a==null&&(a=""),n=a}a=qn(n),t.defaultValue=a,h=t.textContent,h===a&&h!==""&&h!==null&&(t.value=h),Ec(t)}function ti(t,n){if(n){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=n;return}}t.textContent=n}var W0=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 zf(t,n,a){var h=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?h?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="":h?t.setProperty(n,a):typeof a!="number"||a===0||W0.has(n)?n==="float"?t.cssFloat=a:t[n]=(""+a).trim():t[n]=a+"px"}function Hf(t,n,a){if(n!=null&&typeof n!="object")throw Error(i(62));if(t=t.style,a!=null){for(var h in a)!a.hasOwnProperty(h)||n!=null&&n.hasOwnProperty(h)||(h.indexOf("--")===0?t.setProperty(h,""):h==="float"?t.cssFloat="":t[h]="");for(var w in n)h=n[w],n.hasOwnProperty(w)&&a[w]!==h&&zf(t,w,h)}else for(var k in n)n.hasOwnProperty(k)&&zf(t,k,n[k])}function Tc(t){if(t.indexOf("-")===-1)return!1;switch(t){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 V0=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"]]),G0=/^[\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 Co(t){return G0.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function yr(){}var Ac=null;function Dc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var ni=null,ri=null;function Pf(t){var n=Zs(t);if(n&&(t=n.stateNode)){var a=t[Sn]||null;e:switch(t=n.stateNode,n.type){case"input":if(jc(t,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=t;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Wn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var h=a[n];if(h!==t&&h.form===t.form){var w=h[Sn]||null;if(!w)throw Error(i(90));jc(h,w.value,w.defaultValue,w.defaultValue,w.checked,w.defaultChecked,w.type,w.name)}}for(n=0;n<a.length;n++)h=a[n],h.form===t.form&&Of(h)}break e;case"textarea":If(t,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&ei(t,!!a.multiple,n,!1)}}}var Lc=!1;function Ff(t,n,a){if(Lc)return t(n,a);Lc=!0;try{var h=t(n);return h}finally{if(Lc=!1,(ni!==null||ri!==null)&&(dl(),ni&&(n=ni,t=ri,ri=ni=null,Pf(n),t)))for(n=0;n<t.length;n++)Pf(t[n])}}function Xi(t,n){var a=t.stateNode;if(a===null)return null;var h=a[Sn]||null;if(h===null)return null;a=h[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(t=t.type,h=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!h;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(i(231,n,typeof a));return a}var _r=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Rc=!1;if(_r)try{var Zi={};Object.defineProperty(Zi,"passive",{get:function(){Rc=!0}}),window.addEventListener("test",Zi,Zi),window.removeEventListener("test",Zi,Zi)}catch{Rc=!1}var $r=null,Oc=null,ko=null;function Uf(){if(ko)return ko;var t,n=Oc,a=n.length,h,w="value"in $r?$r.value:$r.textContent,k=w.length;for(t=0;t<a&&n[t]===w[t];t++);var M=a-t;for(h=1;h<=M&&n[a-h]===w[k-h];h++);return ko=w.slice(t,1<h?1-h:void 0)}function Eo(t){var n=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&n===13&&(t=13)):t=n,t===10&&(t=13),32<=t||t===13?t:0}function jo(){return!0}function $f(){return!1}function wn(t){function n(a,h,w,k,M){this._reactName=a,this._targetInst=w,this.type=h,this.nativeEvent=k,this.target=M,this.currentTarget=null;for(var K in t)t.hasOwnProperty(K)&&(a=t[K],this[K]=a?a(k):k[K]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?jo:$f,this.isPropagationStopped=$f,this}return m(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=jo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=jo)},persist:function(){},isPersistent:jo}),n}var bs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},No=wn(bs),Qi=m({},bs,{view:0,detail:0}),K0=wn(Qi),Mc,Ic,Ji,To=m({},Qi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zc,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Ji&&(Ji&&t.type==="mousemove"?(Mc=t.screenX-Ji.screenX,Ic=t.screenY-Ji.screenY):Ic=Mc=0,Ji=t),Mc)},movementY:function(t){return"movementY"in t?t.movementY:Ic}}),qf=wn(To),Y0=m({},To,{dataTransfer:0}),X0=wn(Y0),Z0=m({},Qi,{relatedTarget:0}),Bc=wn(Z0),Q0=m({},bs,{animationName:0,elapsedTime:0,pseudoElement:0}),J0=wn(Q0),e_=m({},bs,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),t_=wn(e_),n_=m({},bs,{data:0}),Wf=wn(n_),r_={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},s_={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"},i_={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function a_(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=i_[t])?!!n[t]:!1}function zc(){return a_}var o_=m({},Qi,{key:function(t){if(t.key){var n=r_[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=Eo(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?s_[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zc,charCode:function(t){return t.type==="keypress"?Eo(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Eo(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),l_=wn(o_),c_=m({},To,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Vf=wn(c_),u_=m({},Qi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zc}),d_=wn(u_),h_=m({},bs,{propertyName:0,elapsedTime:0,pseudoElement:0}),f_=wn(h_),p_=m({},To,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),m_=wn(p_),g_=m({},bs,{newState:0,oldState:0}),x_=wn(g_),v_=[9,13,27,32],Hc=_r&&"CompositionEvent"in window,ea=null;_r&&"documentMode"in document&&(ea=document.documentMode);var b_=_r&&"TextEvent"in window&&!ea,Gf=_r&&(!Hc||ea&&8<ea&&11>=ea),Kf=" ",Yf=!1;function Xf(t,n){switch(t){case"keyup":return v_.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Zf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var si=!1;function y_(t,n){switch(t){case"compositionend":return Zf(n);case"keypress":return n.which!==32?null:(Yf=!0,Kf);case"textInput":return t=n.data,t===Kf&&Yf?null:t;default:return null}}function __(t,n){if(si)return t==="compositionend"||!Hc&&Xf(t,n)?(t=Uf(),ko=Oc=$r=null,si=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Gf&&n.locale!=="ko"?null:n.data;default:return null}}var S_={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 Qf(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!S_[t.type]:n==="textarea"}function Jf(t,n,a,h){ni?ri?ri.push(h):ri=[h]:ni=h,n=vl(n,"onChange"),0<n.length&&(a=new No("onChange","change",null,a,h),t.push({event:a,listeners:n}))}var ta=null,na=null;function w_(t){Mg(t,0)}function Ao(t){var n=Yi(t);if(Of(n))return t}function ep(t,n){if(t==="change")return n}var tp=!1;if(_r){var Pc;if(_r){var Fc="oninput"in document;if(!Fc){var np=document.createElement("div");np.setAttribute("oninput","return;"),Fc=typeof np.oninput=="function"}Pc=Fc}else Pc=!1;tp=Pc&&(!document.documentMode||9<document.documentMode)}function rp(){ta&&(ta.detachEvent("onpropertychange",sp),na=ta=null)}function sp(t){if(t.propertyName==="value"&&Ao(na)){var n=[];Jf(n,na,t,Dc(t)),Ff(w_,n)}}function C_(t,n,a){t==="focusin"?(rp(),ta=n,na=a,ta.attachEvent("onpropertychange",sp)):t==="focusout"&&rp()}function k_(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Ao(na)}function E_(t,n){if(t==="click")return Ao(n)}function j_(t,n){if(t==="input"||t==="change")return Ao(n)}function N_(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var Dn=typeof Object.is=="function"?Object.is:N_;function ra(t,n){if(Dn(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var a=Object.keys(t),h=Object.keys(n);if(a.length!==h.length)return!1;for(h=0;h<a.length;h++){var w=a[h];if(!je.call(n,w)||!Dn(t[w],n[w]))return!1}return!0}function ip(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function ap(t,n){var a=ip(t);t=0;for(var h;a;){if(a.nodeType===3){if(h=t+a.textContent.length,t<=n&&h>=n)return{node:a,offset:n-t};t=h}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=ip(a)}}function op(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?op(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function lp(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=wo(t.document);n instanceof t.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)t=n.contentWindow;else break;n=wo(t.document)}return n}function Uc(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}var T_=_r&&"documentMode"in document&&11>=document.documentMode,ii=null,$c=null,sa=null,qc=!1;function cp(t,n,a){var h=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;qc||ii==null||ii!==wo(h)||(h=ii,"selectionStart"in h&&Uc(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),sa&&ra(sa,h)||(sa=h,h=vl($c,"onSelect"),0<h.length&&(n=new No("onSelect","select",null,n,a),t.push({event:n,listeners:h}),n.target=ii)))}function ys(t,n){var a={};return a[t.toLowerCase()]=n.toLowerCase(),a["Webkit"+t]="webkit"+n,a["Moz"+t]="moz"+n,a}var ai={animationend:ys("Animation","AnimationEnd"),animationiteration:ys("Animation","AnimationIteration"),animationstart:ys("Animation","AnimationStart"),transitionrun:ys("Transition","TransitionRun"),transitionstart:ys("Transition","TransitionStart"),transitioncancel:ys("Transition","TransitionCancel"),transitionend:ys("Transition","TransitionEnd")},Wc={},up={};_r&&(up=document.createElement("div").style,"AnimationEvent"in window||(delete ai.animationend.animation,delete ai.animationiteration.animation,delete ai.animationstart.animation),"TransitionEvent"in window||delete ai.transitionend.transition);function _s(t){if(Wc[t])return Wc[t];if(!ai[t])return t;var n=ai[t],a;for(a in n)if(n.hasOwnProperty(a)&&a in up)return Wc[t]=n[a];return t}var dp=_s("animationend"),hp=_s("animationiteration"),fp=_s("animationstart"),A_=_s("transitionrun"),D_=_s("transitionstart"),L_=_s("transitioncancel"),pp=_s("transitionend"),mp=new Map,Vc="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(" ");Vc.push("scrollEnd");function tr(t,n){mp.set(t,n),vs(n,[t])}var Do=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Vn=[],oi=0,Gc=0;function Lo(){for(var t=oi,n=Gc=oi=0;n<t;){var a=Vn[n];Vn[n++]=null;var h=Vn[n];Vn[n++]=null;var w=Vn[n];Vn[n++]=null;var k=Vn[n];if(Vn[n++]=null,h!==null&&w!==null){var M=h.pending;M===null?w.next=w:(w.next=M.next,M.next=w),h.pending=w}k!==0&&gp(a,w,k)}}function Ro(t,n,a,h){Vn[oi++]=t,Vn[oi++]=n,Vn[oi++]=a,Vn[oi++]=h,Gc|=h,t.lanes|=h,t=t.alternate,t!==null&&(t.lanes|=h)}function Kc(t,n,a,h){return Ro(t,n,a,h),Oo(t)}function Ss(t,n){return Ro(t,null,null,n),Oo(t)}function gp(t,n,a){t.lanes|=a;var h=t.alternate;h!==null&&(h.lanes|=a);for(var w=!1,k=t.return;k!==null;)k.childLanes|=a,h=k.alternate,h!==null&&(h.childLanes|=a),k.tag===22&&(t=k.stateNode,t===null||t._visibility&1||(w=!0)),t=k,k=k.return;return t.tag===3?(k=t.stateNode,w&&n!==null&&(w=31-lt(a),t=k.hiddenUpdates,h=t[w],h===null?t[w]=[n]:h.push(n),n.lane=a|536870912),k):null}function Oo(t){if(50<Ea)throw Ea=0,rd=null,Error(i(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var li={};function R_(t,n,a,h){this.tag=t,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ln(t,n,a,h){return new R_(t,n,a,h)}function Yc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Sr(t,n){var a=t.alternate;return a===null?(a=Ln(t.tag,n,t.key,t.mode),a.elementType=t.elementType,a.type=t.type,a.stateNode=t.stateNode,a.alternate=t,t.alternate=a):(a.pendingProps=n,a.type=t.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=t.flags&65011712,a.childLanes=t.childLanes,a.lanes=t.lanes,a.child=t.child,a.memoizedProps=t.memoizedProps,a.memoizedState=t.memoizedState,a.updateQueue=t.updateQueue,n=t.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=t.sibling,a.index=t.index,a.ref=t.ref,a.refCleanup=t.refCleanup,a}function xp(t,n){t.flags&=65011714;var a=t.alternate;return a===null?(t.childLanes=0,t.lanes=n,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=a.childLanes,t.lanes=a.lanes,t.child=a.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=a.memoizedProps,t.memoizedState=a.memoizedState,t.updateQueue=a.updateQueue,t.type=a.type,n=a.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t}function Mo(t,n,a,h,w,k){var M=0;if(h=t,typeof t=="function")Yc(t)&&(M=1);else if(typeof t=="string")M=z1(t,a,ne.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case z:return t=Ln(31,a,n,w),t.elementType=z,t.lanes=k,t;case C:return ws(a.children,w,k,n);case y:M=8,w|=24;break;case v:return t=Ln(12,a,n,w|2),t.elementType=v,t.lanes=k,t;case T:return t=Ln(13,a,n,w),t.elementType=T,t.lanes=k,t;case N:return t=Ln(19,a,n,w),t.elementType=N,t.lanes=k,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case S:M=10;break e;case x:M=9;break e;case j:M=11;break e;case D:M=14;break e;case A:M=16,h=null;break e}M=29,a=Error(i(130,t===null?"null":typeof t,"")),h=null}return n=Ln(M,a,n,w),n.elementType=t,n.type=h,n.lanes=k,n}function ws(t,n,a,h){return t=Ln(7,t,h,n),t.lanes=a,t}function Xc(t,n,a){return t=Ln(6,t,null,n),t.lanes=a,t}function vp(t){var n=Ln(18,null,null,0);return n.stateNode=t,n}function Zc(t,n,a){return n=Ln(4,t.children!==null?t.children:[],t.key,n),n.lanes=a,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var bp=new WeakMap;function Gn(t,n){if(typeof t=="object"&&t!==null){var a=bp.get(t);return a!==void 0?a:(n={value:t,source:n,stack:fe(n)},bp.set(t,n),n)}return{value:t,source:n,stack:fe(n)}}var ci=[],ui=0,Io=null,ia=0,Kn=[],Yn=0,qr=null,or=1,lr="";function wr(t,n){ci[ui++]=ia,ci[ui++]=Io,Io=t,ia=n}function yp(t,n,a){Kn[Yn++]=or,Kn[Yn++]=lr,Kn[Yn++]=qr,qr=t;var h=or;t=lr;var w=32-lt(h)-1;h&=~(1<<w),a+=1;var k=32-lt(n)+w;if(30<k){var M=w-w%5;k=(h&(1<<M)-1).toString(32),h>>=M,w-=M,or=1<<32-lt(n)+w|a<<w|h,lr=k+t}else or=1<<k|a<<w|h,lr=t}function Qc(t){t.return!==null&&(wr(t,1),yp(t,1,0))}function Jc(t){for(;t===Io;)Io=ci[--ui],ci[ui]=null,ia=ci[--ui],ci[ui]=null;for(;t===qr;)qr=Kn[--Yn],Kn[Yn]=null,lr=Kn[--Yn],Kn[Yn]=null,or=Kn[--Yn],Kn[Yn]=null}function _p(t,n){Kn[Yn++]=or,Kn[Yn++]=lr,Kn[Yn++]=qr,or=n.id,lr=n.overflow,qr=t}var on=null,kt=null,it=!1,Wr=null,Xn=!1,eu=Error(i(519));function Vr(t){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw aa(Gn(n,t)),eu}function Sp(t){var n=t.stateNode,a=t.type,h=t.memoizedProps;switch(n[an]=t,n[Sn]=h,a){case"dialog":et("cancel",n),et("close",n);break;case"iframe":case"object":case"embed":et("load",n);break;case"video":case"audio":for(a=0;a<Na.length;a++)et(Na[a],n);break;case"source":et("error",n);break;case"img":case"image":case"link":et("error",n),et("load",n);break;case"details":et("toggle",n);break;case"input":et("invalid",n),Mf(n,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":et("invalid",n);break;case"textarea":et("invalid",n),Bf(n,h.value,h.defaultValue,h.children)}a=h.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||h.suppressHydrationWarning===!0||Hg(n.textContent,a)?(h.popover!=null&&(et("beforetoggle",n),et("toggle",n)),h.onScroll!=null&&et("scroll",n),h.onScrollEnd!=null&&et("scrollend",n),h.onClick!=null&&(n.onclick=yr),n=!0):n=!1,n||Vr(t,!0)}function wp(t){for(on=t.return;on;)switch(on.tag){case 5:case 31:case 13:Xn=!1;return;case 27:case 3:Xn=!0;return;default:on=on.return}}function di(t){if(t!==on)return!1;if(!it)return wp(t),it=!0,!1;var n=t.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||vd(t.type,t.memoizedProps)),a=!a),a&&kt&&Vr(t),wp(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));kt=Kg(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));kt=Kg(t)}else n===27?(n=kt,as(t.type)?(t=wd,wd=null,kt=t):kt=n):kt=on?Qn(t.stateNode.nextSibling):null;return!0}function Cs(){kt=on=null,it=!1}function tu(){var t=Wr;return t!==null&&(jn===null?jn=t:jn.push.apply(jn,t),Wr=null),t}function aa(t){Wr===null?Wr=[t]:Wr.push(t)}var nu=R(null),ks=null,Cr=null;function Gr(t,n,a){U(nu,n._currentValue),n._currentValue=a}function kr(t){t._currentValue=nu.current,F(nu)}function ru(t,n,a){for(;t!==null;){var h=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,h!==null&&(h.childLanes|=n)):h!==null&&(h.childLanes&n)!==n&&(h.childLanes|=n),t===a)break;t=t.return}}function su(t,n,a,h){var w=t.child;for(w!==null&&(w.return=t);w!==null;){var k=w.dependencies;if(k!==null){var M=w.child;k=k.firstContext;e:for(;k!==null;){var K=k;k=w;for(var J=0;J<n.length;J++)if(K.context===n[J]){k.lanes|=a,K=k.alternate,K!==null&&(K.lanes|=a),ru(k.return,a,t),h||(M=null);break e}k=K.next}}else if(w.tag===18){if(M=w.return,M===null)throw Error(i(341));M.lanes|=a,k=M.alternate,k!==null&&(k.lanes|=a),ru(M,a,t),M=null}else M=w.child;if(M!==null)M.return=w;else for(M=w;M!==null;){if(M===t){M=null;break}if(w=M.sibling,w!==null){w.return=M.return,M=w;break}M=M.return}w=M}}function hi(t,n,a,h){t=null;for(var w=n,k=!1;w!==null;){if(!k){if((w.flags&524288)!==0)k=!0;else if((w.flags&262144)!==0)break}if(w.tag===10){var M=w.alternate;if(M===null)throw Error(i(387));if(M=M.memoizedProps,M!==null){var K=w.type;Dn(w.pendingProps.value,M.value)||(t!==null?t.push(K):t=[K])}}else if(w===Y.current){if(M=w.alternate,M===null)throw Error(i(387));M.memoizedState.memoizedState!==w.memoizedState.memoizedState&&(t!==null?t.push(Ra):t=[Ra])}w=w.return}t!==null&&su(n,t,a,h),n.flags|=262144}function Bo(t){for(t=t.firstContext;t!==null;){if(!Dn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Es(t){ks=t,Cr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function ln(t){return Cp(ks,t)}function zo(t,n){return ks===null&&Es(t),Cp(t,n)}function Cp(t,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Cr===null){if(t===null)throw Error(i(308));Cr=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else Cr=Cr.next=n;return a}var O_=typeof AbortController<"u"?AbortController:function(){var t=[],n=this.signal={aborted:!1,addEventListener:function(a,h){t.push(h)}};this.abort=function(){n.aborted=!0,t.forEach(function(a){return a()})}},M_=e.unstable_scheduleCallback,I_=e.unstable_NormalPriority,Ft={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function iu(){return{controller:new O_,data:new Map,refCount:0}}function oa(t){t.refCount--,t.refCount===0&&M_(I_,function(){t.controller.abort()})}var la=null,au=0,fi=0,pi=null;function B_(t,n){if(la===null){var a=la=[];au=0,fi=cd(),pi={status:"pending",value:void 0,then:function(h){a.push(h)}}}return au++,n.then(kp,kp),n}function kp(){if(--au===0&&la!==null){pi!==null&&(pi.status="fulfilled");var t=la;la=null,fi=0,pi=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function z_(t,n){var a=[],h={status:"pending",value:null,reason:null,then:function(w){a.push(w)}};return t.then(function(){h.status="fulfilled",h.value=n;for(var w=0;w<a.length;w++)(0,a[w])(n)},function(w){for(h.status="rejected",h.reason=w,w=0;w<a.length;w++)(0,a[w])(void 0)}),h}var Ep=B.S;B.S=function(t,n){cg=Me(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&B_(t,n),Ep!==null&&Ep(t,n)};var js=R(null);function ou(){var t=js.current;return t!==null?t:bt.pooledCache}function Ho(t,n){n===null?U(js,js.current):U(js,n.pool)}function jp(){var t=ou();return t===null?null:{parent:Ft._currentValue,pool:t}}var mi=Error(i(460)),lu=Error(i(474)),Po=Error(i(542)),Fo={then:function(){}};function Np(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Tp(t,n,a){switch(a=t[a],a===void 0?t.push(n):a!==n&&(n.then(yr,yr),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,Dp(t),t;default:if(typeof n.status=="string")n.then(yr,yr);else{if(t=bt,t!==null&&100<t.shellSuspendCounter)throw Error(i(482));t=n,t.status="pending",t.then(function(h){if(n.status==="pending"){var w=n;w.status="fulfilled",w.value=h}},function(h){if(n.status==="pending"){var w=n;w.status="rejected",w.reason=h}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,Dp(t),t}throw Ts=n,mi}}function Ns(t){try{var n=t._init;return n(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Ts=a,mi):a}}var Ts=null;function Ap(){if(Ts===null)throw Error(i(459));var t=Ts;return Ts=null,t}function Dp(t){if(t===mi||t===Po)throw Error(i(483))}var gi=null,ca=0;function Uo(t){var n=ca;return ca+=1,gi===null&&(gi=[]),Tp(gi,t,n)}function ua(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function $o(t,n){throw n.$$typeof===b?Error(i(525)):(t=Object.prototype.toString.call(n),Error(i(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function Lp(t){function n(se,te){if(t){var ae=se.deletions;ae===null?(se.deletions=[te],se.flags|=16):ae.push(te)}}function a(se,te){if(!t)return null;for(;te!==null;)n(se,te),te=te.sibling;return null}function h(se){for(var te=new Map;se!==null;)se.key!==null?te.set(se.key,se):te.set(se.index,se),se=se.sibling;return te}function w(se,te){return se=Sr(se,te),se.index=0,se.sibling=null,se}function k(se,te,ae){return se.index=ae,t?(ae=se.alternate,ae!==null?(ae=ae.index,ae<te?(se.flags|=67108866,te):ae):(se.flags|=67108866,te)):(se.flags|=1048576,te)}function M(se){return t&&se.alternate===null&&(se.flags|=67108866),se}function K(se,te,ae,ge){return te===null||te.tag!==6?(te=Xc(ae,se.mode,ge),te.return=se,te):(te=w(te,ae),te.return=se,te)}function J(se,te,ae,ge){var Be=ae.type;return Be===C?he(se,te,ae.props.children,ge,ae.key):te!==null&&(te.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===A&&Ns(Be)===te.type)?(te=w(te,ae.props),ua(te,ae),te.return=se,te):(te=Mo(ae.type,ae.key,ae.props,null,se.mode,ge),ua(te,ae),te.return=se,te)}function le(se,te,ae,ge){return te===null||te.tag!==4||te.stateNode.containerInfo!==ae.containerInfo||te.stateNode.implementation!==ae.implementation?(te=Zc(ae,se.mode,ge),te.return=se,te):(te=w(te,ae.children||[]),te.return=se,te)}function he(se,te,ae,ge,Be){return te===null||te.tag!==7?(te=ws(ae,se.mode,ge,Be),te.return=se,te):(te=w(te,ae),te.return=se,te)}function xe(se,te,ae){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return te=Xc(""+te,se.mode,ae),te.return=se,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case _:return ae=Mo(te.type,te.key,te.props,null,se.mode,ae),ua(ae,te),ae.return=se,ae;case E:return te=Zc(te,se.mode,ae),te.return=se,te;case A:return te=Ns(te),xe(se,te,ae)}if($(te)||G(te))return te=ws(te,se.mode,ae,null),te.return=se,te;if(typeof te.then=="function")return xe(se,Uo(te),ae);if(te.$$typeof===S)return xe(se,zo(se,te),ae);$o(se,te)}return null}function ce(se,te,ae,ge){var Be=te!==null?te.key:null;if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return Be!==null?null:K(se,te,""+ae,ge);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case _:return ae.key===Be?J(se,te,ae,ge):null;case E:return ae.key===Be?le(se,te,ae,ge):null;case A:return ae=Ns(ae),ce(se,te,ae,ge)}if($(ae)||G(ae))return Be!==null?null:he(se,te,ae,ge,null);if(typeof ae.then=="function")return ce(se,te,Uo(ae),ge);if(ae.$$typeof===S)return ce(se,te,zo(se,ae),ge);$o(se,ae)}return null}function de(se,te,ae,ge,Be){if(typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint")return se=se.get(ae)||null,K(te,se,""+ge,Be);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case _:return se=se.get(ge.key===null?ae:ge.key)||null,J(te,se,ge,Be);case E:return se=se.get(ge.key===null?ae:ge.key)||null,le(te,se,ge,Be);case A:return ge=Ns(ge),de(se,te,ae,ge,Be)}if($(ge)||G(ge))return se=se.get(ae)||null,he(te,se,ge,Be,null);if(typeof ge.then=="function")return de(se,te,ae,Uo(ge),Be);if(ge.$$typeof===S)return de(se,te,ae,zo(te,ge),Be);$o(te,ge)}return null}function De(se,te,ae,ge){for(var Be=null,ct=null,Re=te,Xe=te=0,rt=null;Re!==null&&Xe<ae.length;Xe++){Re.index>Xe?(rt=Re,Re=null):rt=Re.sibling;var ut=ce(se,Re,ae[Xe],ge);if(ut===null){Re===null&&(Re=rt);break}t&&Re&&ut.alternate===null&&n(se,Re),te=k(ut,te,Xe),ct===null?Be=ut:ct.sibling=ut,ct=ut,Re=rt}if(Xe===ae.length)return a(se,Re),it&&wr(se,Xe),Be;if(Re===null){for(;Xe<ae.length;Xe++)Re=xe(se,ae[Xe],ge),Re!==null&&(te=k(Re,te,Xe),ct===null?Be=Re:ct.sibling=Re,ct=Re);return it&&wr(se,Xe),Be}for(Re=h(Re);Xe<ae.length;Xe++)rt=de(Re,se,Xe,ae[Xe],ge),rt!==null&&(t&&rt.alternate!==null&&Re.delete(rt.key===null?Xe:rt.key),te=k(rt,te,Xe),ct===null?Be=rt:ct.sibling=rt,ct=rt);return t&&Re.forEach(function(ds){return n(se,ds)}),it&&wr(se,Xe),Be}function Fe(se,te,ae,ge){if(ae==null)throw Error(i(151));for(var Be=null,ct=null,Re=te,Xe=te=0,rt=null,ut=ae.next();Re!==null&&!ut.done;Xe++,ut=ae.next()){Re.index>Xe?(rt=Re,Re=null):rt=Re.sibling;var ds=ce(se,Re,ut.value,ge);if(ds===null){Re===null&&(Re=rt);break}t&&Re&&ds.alternate===null&&n(se,Re),te=k(ds,te,Xe),ct===null?Be=ds:ct.sibling=ds,ct=ds,Re=rt}if(ut.done)return a(se,Re),it&&wr(se,Xe),Be;if(Re===null){for(;!ut.done;Xe++,ut=ae.next())ut=xe(se,ut.value,ge),ut!==null&&(te=k(ut,te,Xe),ct===null?Be=ut:ct.sibling=ut,ct=ut);return it&&wr(se,Xe),Be}for(Re=h(Re);!ut.done;Xe++,ut=ae.next())ut=de(Re,se,Xe,ut.value,ge),ut!==null&&(t&&ut.alternate!==null&&Re.delete(ut.key===null?Xe:ut.key),te=k(ut,te,Xe),ct===null?Be=ut:ct.sibling=ut,ct=ut);return t&&Re.forEach(function(Y1){return n(se,Y1)}),it&&wr(se,Xe),Be}function vt(se,te,ae,ge){if(typeof ae=="object"&&ae!==null&&ae.type===C&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case _:e:{for(var Be=ae.key;te!==null;){if(te.key===Be){if(Be=ae.type,Be===C){if(te.tag===7){a(se,te.sibling),ge=w(te,ae.props.children),ge.return=se,se=ge;break e}}else if(te.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===A&&Ns(Be)===te.type){a(se,te.sibling),ge=w(te,ae.props),ua(ge,ae),ge.return=se,se=ge;break e}a(se,te);break}else n(se,te);te=te.sibling}ae.type===C?(ge=ws(ae.props.children,se.mode,ge,ae.key),ge.return=se,se=ge):(ge=Mo(ae.type,ae.key,ae.props,null,se.mode,ge),ua(ge,ae),ge.return=se,se=ge)}return M(se);case E:e:{for(Be=ae.key;te!==null;){if(te.key===Be)if(te.tag===4&&te.stateNode.containerInfo===ae.containerInfo&&te.stateNode.implementation===ae.implementation){a(se,te.sibling),ge=w(te,ae.children||[]),ge.return=se,se=ge;break e}else{a(se,te);break}else n(se,te);te=te.sibling}ge=Zc(ae,se.mode,ge),ge.return=se,se=ge}return M(se);case A:return ae=Ns(ae),vt(se,te,ae,ge)}if($(ae))return De(se,te,ae,ge);if(G(ae)){if(Be=G(ae),typeof Be!="function")throw Error(i(150));return ae=Be.call(ae),Fe(se,te,ae,ge)}if(typeof ae.then=="function")return vt(se,te,Uo(ae),ge);if(ae.$$typeof===S)return vt(se,te,zo(se,ae),ge);$o(se,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint"?(ae=""+ae,te!==null&&te.tag===6?(a(se,te.sibling),ge=w(te,ae),ge.return=se,se=ge):(a(se,te),ge=Xc(ae,se.mode,ge),ge.return=se,se=ge),M(se)):a(se,te)}return function(se,te,ae,ge){try{ca=0;var Be=vt(se,te,ae,ge);return gi=null,Be}catch(Re){if(Re===mi||Re===Po)throw Re;var ct=Ln(29,Re,null,se.mode);return ct.lanes=ge,ct.return=se,ct}finally{}}}var As=Lp(!0),Rp=Lp(!1),Kr=!1;function cu(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function uu(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Yr(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Xr(t,n,a){var h=t.updateQueue;if(h===null)return null;if(h=h.shared,(dt&2)!==0){var w=h.pending;return w===null?n.next=n:(n.next=w.next,w.next=n),h.pending=n,n=Oo(t),gp(t,null,a),n}return Ro(t,h,n,a),Oo(t)}function da(t,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var h=n.lanes;h&=t.pendingLanes,a|=h,n.lanes=a,qe(t,a)}}function du(t,n){var a=t.updateQueue,h=t.alternate;if(h!==null&&(h=h.updateQueue,a===h)){var w=null,k=null;if(a=a.firstBaseUpdate,a!==null){do{var M={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};k===null?w=k=M:k=k.next=M,a=a.next}while(a!==null);k===null?w=k=n:k=k.next=n}else w=k=n;a={baseState:h.baseState,firstBaseUpdate:w,lastBaseUpdate:k,shared:h.shared,callbacks:h.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=n:t.next=n,a.lastBaseUpdate=n}var hu=!1;function ha(){if(hu){var t=pi;if(t!==null)throw t}}function fa(t,n,a,h){hu=!1;var w=t.updateQueue;Kr=!1;var k=w.firstBaseUpdate,M=w.lastBaseUpdate,K=w.shared.pending;if(K!==null){w.shared.pending=null;var J=K,le=J.next;J.next=null,M===null?k=le:M.next=le,M=J;var he=t.alternate;he!==null&&(he=he.updateQueue,K=he.lastBaseUpdate,K!==M&&(K===null?he.firstBaseUpdate=le:K.next=le,he.lastBaseUpdate=J))}if(k!==null){var xe=w.baseState;M=0,he=le=J=null,K=k;do{var ce=K.lane&-536870913,de=ce!==K.lane;if(de?(nt&ce)===ce:(h&ce)===ce){ce!==0&&ce===fi&&(hu=!0),he!==null&&(he=he.next={lane:0,tag:K.tag,payload:K.payload,callback:null,next:null});e:{var De=t,Fe=K;ce=n;var vt=a;switch(Fe.tag){case 1:if(De=Fe.payload,typeof De=="function"){xe=De.call(vt,xe,ce);break e}xe=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=Fe.payload,ce=typeof De=="function"?De.call(vt,xe,ce):De,ce==null)break e;xe=m({},xe,ce);break e;case 2:Kr=!0}}ce=K.callback,ce!==null&&(t.flags|=64,de&&(t.flags|=8192),de=w.callbacks,de===null?w.callbacks=[ce]:de.push(ce))}else de={lane:ce,tag:K.tag,payload:K.payload,callback:K.callback,next:null},he===null?(le=he=de,J=xe):he=he.next=de,M|=ce;if(K=K.next,K===null){if(K=w.shared.pending,K===null)break;de=K,K=de.next,de.next=null,w.lastBaseUpdate=de,w.shared.pending=null}}while(!0);he===null&&(J=xe),w.baseState=J,w.firstBaseUpdate=le,w.lastBaseUpdate=he,k===null&&(w.shared.lanes=0),ts|=M,t.lanes=M,t.memoizedState=xe}}function Op(t,n){if(typeof t!="function")throw Error(i(191,t));t.call(n)}function Mp(t,n){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)Op(a[t],n)}var xi=R(null),qo=R(0);function Ip(t,n){t=Or,U(qo,t),U(xi,n),Or=t|n.baseLanes}function fu(){U(qo,Or),U(xi,xi.current)}function pu(){Or=qo.current,F(xi),F(qo)}var Rn=R(null),Zn=null;function Zr(t){var n=t.alternate;U(zt,zt.current&1),U(Rn,t),Zn===null&&(n===null||xi.current!==null||n.memoizedState!==null)&&(Zn=t)}function mu(t){U(zt,zt.current),U(Rn,t),Zn===null&&(Zn=t)}function Bp(t){t.tag===22?(U(zt,zt.current),U(Rn,t),Zn===null&&(Zn=t)):Qr()}function Qr(){U(zt,zt.current),U(Rn,Rn.current)}function On(t){F(Rn),Zn===t&&(Zn=null),F(zt)}var zt=R(0);function Wo(t){for(var n=t;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||_d(a)||Sd(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Er=0,Ke=null,gt=null,Ut=null,Vo=!1,vi=!1,Ds=!1,Go=0,pa=0,bi=null,H_=0;function Ot(){throw Error(i(321))}function gu(t,n){if(n===null)return!1;for(var a=0;a<n.length&&a<t.length;a++)if(!Dn(t[a],n[a]))return!1;return!0}function xu(t,n,a,h,w,k){return Er=k,Ke=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,B.H=t===null||t.memoizedState===null?ym:Lu,Ds=!1,k=a(h,w),Ds=!1,vi&&(k=Hp(n,a,h,w)),zp(t),k}function zp(t){B.H=xa;var n=gt!==null&&gt.next!==null;if(Er=0,Ut=gt=Ke=null,Vo=!1,pa=0,bi=null,n)throw Error(i(300));t===null||$t||(t=t.dependencies,t!==null&&Bo(t)&&($t=!0))}function Hp(t,n,a,h){Ke=t;var w=0;do{if(vi&&(bi=null),pa=0,vi=!1,25<=w)throw Error(i(301));if(w+=1,Ut=gt=null,t.updateQueue!=null){var k=t.updateQueue;k.lastEffect=null,k.events=null,k.stores=null,k.memoCache!=null&&(k.memoCache.index=0)}B.H=_m,k=n(a,h)}while(vi);return k}function P_(){var t=B.H,n=t.useState()[0];return n=typeof n.then=="function"?ma(n):n,t=t.useState()[0],(gt!==null?gt.memoizedState:null)!==t&&(Ke.flags|=1024),n}function vu(){var t=Go!==0;return Go=0,t}function bu(t,n,a){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~a}function yu(t){if(Vo){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}Vo=!1}Er=0,Ut=gt=Ke=null,vi=!1,pa=Go=0,bi=null}function vn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ut===null?Ke.memoizedState=Ut=t:Ut=Ut.next=t,Ut}function Ht(){if(gt===null){var t=Ke.alternate;t=t!==null?t.memoizedState:null}else t=gt.next;var n=Ut===null?Ke.memoizedState:Ut.next;if(n!==null)Ut=n,gt=t;else{if(t===null)throw Ke.alternate===null?Error(i(467)):Error(i(310));gt=t,t={memoizedState:gt.memoizedState,baseState:gt.baseState,baseQueue:gt.baseQueue,queue:gt.queue,next:null},Ut===null?Ke.memoizedState=Ut=t:Ut=Ut.next=t}return Ut}function Ko(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ma(t){var n=pa;return pa+=1,bi===null&&(bi=[]),t=Tp(bi,t,n),n=Ke,(Ut===null?n.memoizedState:Ut.next)===null&&(n=n.alternate,B.H=n===null||n.memoizedState===null?ym:Lu),t}function Yo(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return ma(t);if(t.$$typeof===S)return ln(t)}throw Error(i(438,String(t)))}function _u(t){var n=null,a=Ke.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var h=Ke.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(n={data:h.data.map(function(w){return w.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=Ko(),Ke.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(t),h=0;h<t;h++)a[h]=O;return n.index++,a}function jr(t,n){return typeof n=="function"?n(t):n}function Xo(t){var n=Ht();return Su(n,gt,t)}function Su(t,n,a){var h=t.queue;if(h===null)throw Error(i(311));h.lastRenderedReducer=a;var w=t.baseQueue,k=h.pending;if(k!==null){if(w!==null){var M=w.next;w.next=k.next,k.next=M}n.baseQueue=w=k,h.pending=null}if(k=t.baseState,w===null)t.memoizedState=k;else{n=w.next;var K=M=null,J=null,le=n,he=!1;do{var xe=le.lane&-536870913;if(xe!==le.lane?(nt&xe)===xe:(Er&xe)===xe){var ce=le.revertLane;if(ce===0)J!==null&&(J=J.next={lane:0,revertLane:0,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),xe===fi&&(he=!0);else if((Er&ce)===ce){le=le.next,ce===fi&&(he=!0);continue}else xe={lane:0,revertLane:le.revertLane,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},J===null?(K=J=xe,M=k):J=J.next=xe,Ke.lanes|=ce,ts|=ce;xe=le.action,Ds&&a(k,xe),k=le.hasEagerState?le.eagerState:a(k,xe)}else ce={lane:xe,revertLane:le.revertLane,gesture:le.gesture,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},J===null?(K=J=ce,M=k):J=J.next=ce,Ke.lanes|=xe,ts|=xe;le=le.next}while(le!==null&&le!==n);if(J===null?M=k:J.next=K,!Dn(k,t.memoizedState)&&($t=!0,he&&(a=pi,a!==null)))throw a;t.memoizedState=k,t.baseState=M,t.baseQueue=J,h.lastRenderedState=k}return w===null&&(h.lanes=0),[t.memoizedState,h.dispatch]}function wu(t){var n=Ht(),a=n.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=t;var h=a.dispatch,w=a.pending,k=n.memoizedState;if(w!==null){a.pending=null;var M=w=w.next;do k=t(k,M.action),M=M.next;while(M!==w);Dn(k,n.memoizedState)||($t=!0),n.memoizedState=k,n.baseQueue===null&&(n.baseState=k),a.lastRenderedState=k}return[k,h]}function Pp(t,n,a){var h=Ke,w=Ht(),k=it;if(k){if(a===void 0)throw Error(i(407));a=a()}else a=n();var M=!Dn((gt||w).memoizedState,a);if(M&&(w.memoizedState=a,$t=!0),w=w.queue,Eu($p.bind(null,h,w,t),[t]),w.getSnapshot!==n||M||Ut!==null&&Ut.memoizedState.tag&1){if(h.flags|=2048,yi(9,{destroy:void 0},Up.bind(null,h,w,a,n),null),bt===null)throw Error(i(349));k||(Er&127)!==0||Fp(h,n,a)}return a}function Fp(t,n,a){t.flags|=16384,t={getSnapshot:n,value:a},n=Ke.updateQueue,n===null?(n=Ko(),Ke.updateQueue=n,n.stores=[t]):(a=n.stores,a===null?n.stores=[t]:a.push(t))}function Up(t,n,a,h){n.value=a,n.getSnapshot=h,qp(n)&&Wp(t)}function $p(t,n,a){return a(function(){qp(n)&&Wp(t)})}function qp(t){var n=t.getSnapshot;t=t.value;try{var a=n();return!Dn(t,a)}catch{return!0}}function Wp(t){var n=Ss(t,2);n!==null&&Nn(n,t,2)}function Cu(t){var n=vn();if(typeof t=="function"){var a=t;if(t=a(),Ds){Kt(!0);try{a()}finally{Kt(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jr,lastRenderedState:t},n}function Vp(t,n,a,h){return t.baseState=a,Su(t,gt,typeof h=="function"?h:jr)}function F_(t,n,a,h,w){if(Jo(t))throw Error(i(485));if(t=n.action,t!==null){var k={payload:w,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(M){k.listeners.push(M)}};B.T!==null?a(!0):k.isTransition=!1,h(k),a=n.pending,a===null?(k.next=n.pending=k,Gp(n,k)):(k.next=a.next,n.pending=a.next=k)}}function Gp(t,n){var a=n.action,h=n.payload,w=t.state;if(n.isTransition){var k=B.T,M={};B.T=M;try{var K=a(w,h),J=B.S;J!==null&&J(M,K),Kp(t,n,K)}catch(le){ku(t,n,le)}finally{k!==null&&M.types!==null&&(k.types=M.types),B.T=k}}else try{k=a(w,h),Kp(t,n,k)}catch(le){ku(t,n,le)}}function Kp(t,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(h){Yp(t,n,h)},function(h){return ku(t,n,h)}):Yp(t,n,a)}function Yp(t,n,a){n.status="fulfilled",n.value=a,Xp(n),t.state=a,n=t.pending,n!==null&&(a=n.next,a===n?t.pending=null:(a=a.next,n.next=a,Gp(t,a)))}function ku(t,n,a){var h=t.pending;if(t.pending=null,h!==null){h=h.next;do n.status="rejected",n.reason=a,Xp(n),n=n.next;while(n!==h)}t.action=null}function Xp(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function Zp(t,n){return n}function Qp(t,n){if(it){var a=bt.formState;if(a!==null){e:{var h=Ke;if(it){if(kt){t:{for(var w=kt,k=Xn;w.nodeType!==8;){if(!k){w=null;break t}if(w=Qn(w.nextSibling),w===null){w=null;break t}}k=w.data,w=k==="F!"||k==="F"?w:null}if(w){kt=Qn(w.nextSibling),h=w.data==="F!";break e}}Vr(h)}h=!1}h&&(n=a[0])}}return a=vn(),a.memoizedState=a.baseState=n,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zp,lastRenderedState:n},a.queue=h,a=xm.bind(null,Ke,h),h.dispatch=a,h=Cu(!1),k=Du.bind(null,Ke,!1,h.queue),h=vn(),w={state:n,dispatch:null,action:t,pending:null},h.queue=w,a=F_.bind(null,Ke,w,k,a),w.dispatch=a,h.memoizedState=t,[n,a,!1]}function Jp(t){var n=Ht();return em(n,gt,t)}function em(t,n,a){if(n=Su(t,n,Zp)[0],t=Xo(jr)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var h=ma(n)}catch(M){throw M===mi?Po:M}else h=n;n=Ht();var w=n.queue,k=w.dispatch;return a!==n.memoizedState&&(Ke.flags|=2048,yi(9,{destroy:void 0},U_.bind(null,w,a),null)),[h,k,t]}function U_(t,n){t.action=n}function tm(t){var n=Ht(),a=gt;if(a!==null)return em(n,a,t);Ht(),n=n.memoizedState,a=Ht();var h=a.queue.dispatch;return a.memoizedState=t,[n,h,!1]}function yi(t,n,a,h){return t={tag:t,create:a,deps:h,inst:n,next:null},n=Ke.updateQueue,n===null&&(n=Ko(),Ke.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=t.next=t:(h=a.next,a.next=t,t.next=h,n.lastEffect=t),t}function nm(){return Ht().memoizedState}function Zo(t,n,a,h){var w=vn();Ke.flags|=t,w.memoizedState=yi(1|n,{destroy:void 0},a,h===void 0?null:h)}function Qo(t,n,a,h){var w=Ht();h=h===void 0?null:h;var k=w.memoizedState.inst;gt!==null&&h!==null&&gu(h,gt.memoizedState.deps)?w.memoizedState=yi(n,k,a,h):(Ke.flags|=t,w.memoizedState=yi(1|n,k,a,h))}function rm(t,n){Zo(8390656,8,t,n)}function Eu(t,n){Qo(2048,8,t,n)}function $_(t){Ke.flags|=4;var n=Ke.updateQueue;if(n===null)n=Ko(),Ke.updateQueue=n,n.events=[t];else{var a=n.events;a===null?n.events=[t]:a.push(t)}}function sm(t){var n=Ht().memoizedState;return $_({ref:n,nextImpl:t}),function(){if((dt&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function im(t,n){return Qo(4,2,t,n)}function am(t,n){return Qo(4,4,t,n)}function om(t,n){if(typeof n=="function"){t=t();var a=n(t);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return t=t(),n.current=t,function(){n.current=null}}function lm(t,n,a){a=a!=null?a.concat([t]):null,Qo(4,4,om.bind(null,n,t),a)}function ju(){}function cm(t,n){var a=Ht();n=n===void 0?null:n;var h=a.memoizedState;return n!==null&&gu(n,h[1])?h[0]:(a.memoizedState=[t,n],t)}function um(t,n){var a=Ht();n=n===void 0?null:n;var h=a.memoizedState;if(n!==null&&gu(n,h[1]))return h[0];if(h=t(),Ds){Kt(!0);try{t()}finally{Kt(!1)}}return a.memoizedState=[h,n],h}function Nu(t,n,a){return a===void 0||(Er&1073741824)!==0&&(nt&261930)===0?t.memoizedState=n:(t.memoizedState=a,t=dg(),Ke.lanes|=t,ts|=t,a)}function dm(t,n,a,h){return Dn(a,n)?a:xi.current!==null?(t=Nu(t,a,h),Dn(t,n)||($t=!0),t):(Er&42)===0||(Er&1073741824)!==0&&(nt&261930)===0?($t=!0,t.memoizedState=a):(t=dg(),Ke.lanes|=t,ts|=t,n)}function hm(t,n,a,h,w){var k=X.p;X.p=k!==0&&8>k?k:8;var M=B.T,K={};B.T=K,Du(t,!1,n,a);try{var J=w(),le=B.S;if(le!==null&&le(K,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var he=z_(J,h);ga(t,n,he,Bn(t))}else ga(t,n,h,Bn(t))}catch(xe){ga(t,n,{then:function(){},status:"rejected",reason:xe},Bn())}finally{X.p=k,M!==null&&K.types!==null&&(M.types=K.types),B.T=M}}function q_(){}function Tu(t,n,a,h){if(t.tag!==5)throw Error(i(476));var w=fm(t).queue;hm(t,w,n,Z,a===null?q_:function(){return pm(t),a(h)})}function fm(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:Z,baseState:Z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jr,lastRenderedState:Z},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jr,lastRenderedState:a},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function pm(t){var n=fm(t);n.next===null&&(n=t.alternate.memoizedState),ga(t,n.next.queue,{},Bn())}function Au(){return ln(Ra)}function mm(){return Ht().memoizedState}function gm(){return Ht().memoizedState}function W_(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var a=Bn();t=Yr(a);var h=Xr(n,t,a);h!==null&&(Nn(h,n,a),da(h,n,a)),n={cache:iu()},t.payload=n;return}n=n.return}}function V_(t,n,a){var h=Bn();a={lane:h,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Jo(t)?vm(n,a):(a=Kc(t,n,a,h),a!==null&&(Nn(a,t,h),bm(a,n,h)))}function xm(t,n,a){var h=Bn();ga(t,n,a,h)}function ga(t,n,a,h){var w={lane:h,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Jo(t))vm(n,w);else{var k=t.alternate;if(t.lanes===0&&(k===null||k.lanes===0)&&(k=n.lastRenderedReducer,k!==null))try{var M=n.lastRenderedState,K=k(M,a);if(w.hasEagerState=!0,w.eagerState=K,Dn(K,M))return Ro(t,n,w,0),bt===null&&Lo(),!1}catch{}finally{}if(a=Kc(t,n,w,h),a!==null)return Nn(a,t,h),bm(a,n,h),!0}return!1}function Du(t,n,a,h){if(h={lane:2,revertLane:cd(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Jo(t)){if(n)throw Error(i(479))}else n=Kc(t,a,h,2),n!==null&&Nn(n,t,2)}function Jo(t){var n=t.alternate;return t===Ke||n!==null&&n===Ke}function vm(t,n){vi=Vo=!0;var a=t.pending;a===null?n.next=n:(n.next=a.next,a.next=n),t.pending=n}function bm(t,n,a){if((a&4194048)!==0){var h=n.lanes;h&=t.pendingLanes,a|=h,n.lanes=a,qe(t,a)}}var xa={readContext:ln,use:Yo,useCallback:Ot,useContext:Ot,useEffect:Ot,useImperativeHandle:Ot,useLayoutEffect:Ot,useInsertionEffect:Ot,useMemo:Ot,useReducer:Ot,useRef:Ot,useState:Ot,useDebugValue:Ot,useDeferredValue:Ot,useTransition:Ot,useSyncExternalStore:Ot,useId:Ot,useHostTransitionStatus:Ot,useFormState:Ot,useActionState:Ot,useOptimistic:Ot,useMemoCache:Ot,useCacheRefresh:Ot};xa.useEffectEvent=Ot;var ym={readContext:ln,use:Yo,useCallback:function(t,n){return vn().memoizedState=[t,n===void 0?null:n],t},useContext:ln,useEffect:rm,useImperativeHandle:function(t,n,a){a=a!=null?a.concat([t]):null,Zo(4194308,4,om.bind(null,n,t),a)},useLayoutEffect:function(t,n){return Zo(4194308,4,t,n)},useInsertionEffect:function(t,n){Zo(4,2,t,n)},useMemo:function(t,n){var a=vn();n=n===void 0?null:n;var h=t();if(Ds){Kt(!0);try{t()}finally{Kt(!1)}}return a.memoizedState=[h,n],h},useReducer:function(t,n,a){var h=vn();if(a!==void 0){var w=a(n);if(Ds){Kt(!0);try{a(n)}finally{Kt(!1)}}}else w=n;return h.memoizedState=h.baseState=w,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:w},h.queue=t,t=t.dispatch=V_.bind(null,Ke,t),[h.memoizedState,t]},useRef:function(t){var n=vn();return t={current:t},n.memoizedState=t},useState:function(t){t=Cu(t);var n=t.queue,a=xm.bind(null,Ke,n);return n.dispatch=a,[t.memoizedState,a]},useDebugValue:ju,useDeferredValue:function(t,n){var a=vn();return Nu(a,t,n)},useTransition:function(){var t=Cu(!1);return t=hm.bind(null,Ke,t.queue,!0,!1),vn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,a){var h=Ke,w=vn();if(it){if(a===void 0)throw Error(i(407));a=a()}else{if(a=n(),bt===null)throw Error(i(349));(nt&127)!==0||Fp(h,n,a)}w.memoizedState=a;var k={value:a,getSnapshot:n};return w.queue=k,rm($p.bind(null,h,k,t),[t]),h.flags|=2048,yi(9,{destroy:void 0},Up.bind(null,h,k,a,n),null),a},useId:function(){var t=vn(),n=bt.identifierPrefix;if(it){var a=lr,h=or;a=(h&~(1<<32-lt(h)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Go++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=H_++,n="_"+n+"r_"+a.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:Au,useFormState:Qp,useActionState:Qp,useOptimistic:function(t){var n=vn();n.memoizedState=n.baseState=t;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Du.bind(null,Ke,!0,a),a.dispatch=n,[t,n]},useMemoCache:_u,useCacheRefresh:function(){return vn().memoizedState=W_.bind(null,Ke)},useEffectEvent:function(t){var n=vn(),a={impl:t};return n.memoizedState=a,function(){if((dt&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},Lu={readContext:ln,use:Yo,useCallback:cm,useContext:ln,useEffect:Eu,useImperativeHandle:lm,useInsertionEffect:im,useLayoutEffect:am,useMemo:um,useReducer:Xo,useRef:nm,useState:function(){return Xo(jr)},useDebugValue:ju,useDeferredValue:function(t,n){var a=Ht();return dm(a,gt.memoizedState,t,n)},useTransition:function(){var t=Xo(jr)[0],n=Ht().memoizedState;return[typeof t=="boolean"?t:ma(t),n]},useSyncExternalStore:Pp,useId:mm,useHostTransitionStatus:Au,useFormState:Jp,useActionState:Jp,useOptimistic:function(t,n){var a=Ht();return Vp(a,gt,t,n)},useMemoCache:_u,useCacheRefresh:gm};Lu.useEffectEvent=sm;var _m={readContext:ln,use:Yo,useCallback:cm,useContext:ln,useEffect:Eu,useImperativeHandle:lm,useInsertionEffect:im,useLayoutEffect:am,useMemo:um,useReducer:wu,useRef:nm,useState:function(){return wu(jr)},useDebugValue:ju,useDeferredValue:function(t,n){var a=Ht();return gt===null?Nu(a,t,n):dm(a,gt.memoizedState,t,n)},useTransition:function(){var t=wu(jr)[0],n=Ht().memoizedState;return[typeof t=="boolean"?t:ma(t),n]},useSyncExternalStore:Pp,useId:mm,useHostTransitionStatus:Au,useFormState:tm,useActionState:tm,useOptimistic:function(t,n){var a=Ht();return gt!==null?Vp(a,gt,t,n):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:_u,useCacheRefresh:gm};_m.useEffectEvent=sm;function Ru(t,n,a,h){n=t.memoizedState,a=a(h,n),a=a==null?n:m({},n,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var Ou={enqueueSetState:function(t,n,a){t=t._reactInternals;var h=Bn(),w=Yr(h);w.payload=n,a!=null&&(w.callback=a),n=Xr(t,w,h),n!==null&&(Nn(n,t,h),da(n,t,h))},enqueueReplaceState:function(t,n,a){t=t._reactInternals;var h=Bn(),w=Yr(h);w.tag=1,w.payload=n,a!=null&&(w.callback=a),n=Xr(t,w,h),n!==null&&(Nn(n,t,h),da(n,t,h))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var a=Bn(),h=Yr(a);h.tag=2,n!=null&&(h.callback=n),n=Xr(t,h,a),n!==null&&(Nn(n,t,a),da(n,t,a))}};function Sm(t,n,a,h,w,k,M){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(h,k,M):n.prototype&&n.prototype.isPureReactComponent?!ra(a,h)||!ra(w,k):!0}function wm(t,n,a,h){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,h),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,h),n.state!==t&&Ou.enqueueReplaceState(n,n.state,null)}function Ls(t,n){var a=n;if("ref"in n){a={};for(var h in n)h!=="ref"&&(a[h]=n[h])}if(t=t.defaultProps){a===n&&(a=m({},a));for(var w in t)a[w]===void 0&&(a[w]=t[w])}return a}function Cm(t){Do(t)}function km(t){console.error(t)}function Em(t){Do(t)}function el(t,n){try{var a=t.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(h){setTimeout(function(){throw h})}}function jm(t,n,a){try{var h=t.onCaughtError;h(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(w){setTimeout(function(){throw w})}}function Mu(t,n,a){return a=Yr(a),a.tag=3,a.payload={element:null},a.callback=function(){el(t,n)},a}function Nm(t){return t=Yr(t),t.tag=3,t}function Tm(t,n,a,h){var w=a.type.getDerivedStateFromError;if(typeof w=="function"){var k=h.value;t.payload=function(){return w(k)},t.callback=function(){jm(n,a,h)}}var M=a.stateNode;M!==null&&typeof M.componentDidCatch=="function"&&(t.callback=function(){jm(n,a,h),typeof w!="function"&&(ns===null?ns=new Set([this]):ns.add(this));var K=h.stack;this.componentDidCatch(h.value,{componentStack:K!==null?K:""})})}function G_(t,n,a,h,w){if(a.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(n=a.alternate,n!==null&&hi(n,a,w,!0),a=Rn.current,a!==null){switch(a.tag){case 31:case 13:return Zn===null?hl():a.alternate===null&&Mt===0&&(Mt=3),a.flags&=-257,a.flags|=65536,a.lanes=w,h===Fo?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([h]):n.add(h),ad(t,h,w)),!1;case 22:return a.flags|=65536,h===Fo?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([h])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([h]):a.add(h)),ad(t,h,w)),!1}throw Error(i(435,a.tag))}return ad(t,h,w),hl(),!1}if(it)return n=Rn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=w,h!==eu&&(t=Error(i(422),{cause:h}),aa(Gn(t,a)))):(h!==eu&&(n=Error(i(423),{cause:h}),aa(Gn(n,a))),t=t.current.alternate,t.flags|=65536,w&=-w,t.lanes|=w,h=Gn(h,a),w=Mu(t.stateNode,h,w),du(t,w),Mt!==4&&(Mt=2)),!1;var k=Error(i(520),{cause:h});if(k=Gn(k,a),ka===null?ka=[k]:ka.push(k),Mt!==4&&(Mt=2),n===null)return!0;h=Gn(h,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,t=w&-w,a.lanes|=t,t=Mu(a.stateNode,h,t),du(a,t),!1;case 1:if(n=a.type,k=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(ns===null||!ns.has(k))))return a.flags|=65536,w&=-w,a.lanes|=w,w=Nm(w),Tm(w,t,a,h),du(a,w),!1}a=a.return}while(a!==null);return!1}var Iu=Error(i(461)),$t=!1;function cn(t,n,a,h){n.child=t===null?Rp(n,null,a,h):As(n,t.child,a,h)}function Am(t,n,a,h,w){a=a.render;var k=n.ref;if("ref"in h){var M={};for(var K in h)K!=="ref"&&(M[K]=h[K])}else M=h;return Es(n),h=xu(t,n,a,M,k,w),K=vu(),t!==null&&!$t?(bu(t,n,w),Nr(t,n,w)):(it&&K&&Qc(n),n.flags|=1,cn(t,n,h,w),n.child)}function Dm(t,n,a,h,w){if(t===null){var k=a.type;return typeof k=="function"&&!Yc(k)&&k.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=k,Lm(t,n,k,h,w)):(t=Mo(a.type,null,h,n,n.mode,w),t.ref=n.ref,t.return=n,n.child=t)}if(k=t.child,!qu(t,w)){var M=k.memoizedProps;if(a=a.compare,a=a!==null?a:ra,a(M,h)&&t.ref===n.ref)return Nr(t,n,w)}return n.flags|=1,t=Sr(k,h),t.ref=n.ref,t.return=n,n.child=t}function Lm(t,n,a,h,w){if(t!==null){var k=t.memoizedProps;if(ra(k,h)&&t.ref===n.ref)if($t=!1,n.pendingProps=h=k,qu(t,w))(t.flags&131072)!==0&&($t=!0);else return n.lanes=t.lanes,Nr(t,n,w)}return Bu(t,n,a,h,w)}function Rm(t,n,a,h){var w=h.children,k=t!==null?t.memoizedState:null;if(t===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((n.flags&128)!==0){if(k=k!==null?k.baseLanes|a:a,t!==null){for(h=n.child=t.child,w=0;h!==null;)w=w|h.lanes|h.childLanes,h=h.sibling;h=w&~k}else h=0,n.child=null;return Om(t,n,k,a,h)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&Ho(n,k!==null?k.cachePool:null),k!==null?Ip(n,k):fu(),Bp(n);else return h=n.lanes=536870912,Om(t,n,k!==null?k.baseLanes|a:a,a,h)}else k!==null?(Ho(n,k.cachePool),Ip(n,k),Qr(),n.memoizedState=null):(t!==null&&Ho(n,null),fu(),Qr());return cn(t,n,w,a),n.child}function va(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Om(t,n,a,h,w){var k=ou();return k=k===null?null:{parent:Ft._currentValue,pool:k},n.memoizedState={baseLanes:a,cachePool:k},t!==null&&Ho(n,null),fu(),Bp(n),t!==null&&hi(t,n,h,!0),n.childLanes=w,null}function tl(t,n){return n=rl({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function Mm(t,n,a){return As(n,t.child,null,a),t=tl(n,n.pendingProps),t.flags|=2,On(n),n.memoizedState=null,t}function K_(t,n,a){var h=n.pendingProps,w=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(it){if(h.mode==="hidden")return t=tl(n,h),n.lanes=536870912,va(null,t);if(mu(n),(t=kt)?(t=Gg(t,Xn),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:qr!==null?{id:or,overflow:lr}:null,retryLane:536870912,hydrationErrors:null},a=vp(t),a.return=n,n.child=a,on=n,kt=null)):t=null,t===null)throw Vr(n);return n.lanes=536870912,null}return tl(n,h)}var k=t.memoizedState;if(k!==null){var M=k.dehydrated;if(mu(n),w)if(n.flags&256)n.flags&=-257,n=Mm(t,n,a);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(i(558));else if($t||hi(t,n,a,!1),w=(a&t.childLanes)!==0,$t||w){if(h=bt,h!==null&&(M=Ct(h,a),M!==0&&M!==k.retryLane))throw k.retryLane=M,Ss(t,M),Nn(h,t,M),Iu;hl(),n=Mm(t,n,a)}else t=k.treeContext,kt=Qn(M.nextSibling),on=n,it=!0,Wr=null,Xn=!1,t!==null&&_p(n,t),n=tl(n,h),n.flags|=4096;return n}return t=Sr(t.child,{mode:h.mode,children:h.children}),t.ref=n.ref,n.child=t,t.return=n,t}function nl(t,n){var a=n.ref;if(a===null)t!==null&&t.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(t===null||t.ref!==a)&&(n.flags|=4194816)}}function Bu(t,n,a,h,w){return Es(n),a=xu(t,n,a,h,void 0,w),h=vu(),t!==null&&!$t?(bu(t,n,w),Nr(t,n,w)):(it&&h&&Qc(n),n.flags|=1,cn(t,n,a,w),n.child)}function Im(t,n,a,h,w,k){return Es(n),n.updateQueue=null,a=Hp(n,h,a,w),zp(t),h=vu(),t!==null&&!$t?(bu(t,n,k),Nr(t,n,k)):(it&&h&&Qc(n),n.flags|=1,cn(t,n,a,k),n.child)}function Bm(t,n,a,h,w){if(Es(n),n.stateNode===null){var k=li,M=a.contextType;typeof M=="object"&&M!==null&&(k=ln(M)),k=new a(h,k),n.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,k.updater=Ou,n.stateNode=k,k._reactInternals=n,k=n.stateNode,k.props=h,k.state=n.memoizedState,k.refs={},cu(n),M=a.contextType,k.context=typeof M=="object"&&M!==null?ln(M):li,k.state=n.memoizedState,M=a.getDerivedStateFromProps,typeof M=="function"&&(Ru(n,a,M,h),k.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof k.getSnapshotBeforeUpdate=="function"||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(M=k.state,typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount(),M!==k.state&&Ou.enqueueReplaceState(k,k.state,null),fa(n,h,k,w),ha(),k.state=n.memoizedState),typeof k.componentDidMount=="function"&&(n.flags|=4194308),h=!0}else if(t===null){k=n.stateNode;var K=n.memoizedProps,J=Ls(a,K);k.props=J;var le=k.context,he=a.contextType;M=li,typeof he=="object"&&he!==null&&(M=ln(he));var xe=a.getDerivedStateFromProps;he=typeof xe=="function"||typeof k.getSnapshotBeforeUpdate=="function",K=n.pendingProps!==K,he||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(K||le!==M)&&wm(n,k,h,M),Kr=!1;var ce=n.memoizedState;k.state=ce,fa(n,h,k,w),ha(),le=n.memoizedState,K||ce!==le||Kr?(typeof xe=="function"&&(Ru(n,a,xe,h),le=n.memoizedState),(J=Kr||Sm(n,a,J,h,ce,le,M))?(he||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount()),typeof k.componentDidMount=="function"&&(n.flags|=4194308)):(typeof k.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=h,n.memoizedState=le),k.props=h,k.state=le,k.context=M,h=J):(typeof k.componentDidMount=="function"&&(n.flags|=4194308),h=!1)}else{k=n.stateNode,uu(t,n),M=n.memoizedProps,he=Ls(a,M),k.props=he,xe=n.pendingProps,ce=k.context,le=a.contextType,J=li,typeof le=="object"&&le!==null&&(J=ln(le)),K=a.getDerivedStateFromProps,(le=typeof K=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(M!==xe||ce!==J)&&wm(n,k,h,J),Kr=!1,ce=n.memoizedState,k.state=ce,fa(n,h,k,w),ha();var de=n.memoizedState;M!==xe||ce!==de||Kr||t!==null&&t.dependencies!==null&&Bo(t.dependencies)?(typeof K=="function"&&(Ru(n,a,K,h),de=n.memoizedState),(he=Kr||Sm(n,a,he,h,ce,de,J)||t!==null&&t.dependencies!==null&&Bo(t.dependencies))?(le||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(h,de,J),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(h,de,J)),typeof k.componentDidUpdate=="function"&&(n.flags|=4),typeof k.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof k.componentDidUpdate!="function"||M===t.memoizedProps&&ce===t.memoizedState||(n.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||M===t.memoizedProps&&ce===t.memoizedState||(n.flags|=1024),n.memoizedProps=h,n.memoizedState=de),k.props=h,k.state=de,k.context=J,h=he):(typeof k.componentDidUpdate!="function"||M===t.memoizedProps&&ce===t.memoizedState||(n.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||M===t.memoizedProps&&ce===t.memoizedState||(n.flags|=1024),h=!1)}return k=h,nl(t,n),h=(n.flags&128)!==0,k||h?(k=n.stateNode,a=h&&typeof a.getDerivedStateFromError!="function"?null:k.render(),n.flags|=1,t!==null&&h?(n.child=As(n,t.child,null,w),n.child=As(n,null,a,w)):cn(t,n,a,w),n.memoizedState=k.state,t=n.child):t=Nr(t,n,w),t}function zm(t,n,a,h){return Cs(),n.flags|=256,cn(t,n,a,h),n.child}var zu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Hu(t){return{baseLanes:t,cachePool:jp()}}function Pu(t,n,a){return t=t!==null?t.childLanes&~a:0,n&&(t|=In),t}function Hm(t,n,a){var h=n.pendingProps,w=!1,k=(n.flags&128)!==0,M;if((M=k)||(M=t!==null&&t.memoizedState===null?!1:(zt.current&2)!==0),M&&(w=!0,n.flags&=-129),M=(n.flags&32)!==0,n.flags&=-33,t===null){if(it){if(w?Zr(n):Qr(),(t=kt)?(t=Gg(t,Xn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:qr!==null?{id:or,overflow:lr}:null,retryLane:536870912,hydrationErrors:null},a=vp(t),a.return=n,n.child=a,on=n,kt=null)):t=null,t===null)throw Vr(n);return Sd(t)?n.lanes=32:n.lanes=536870912,null}var K=h.children;return h=h.fallback,w?(Qr(),w=n.mode,K=rl({mode:"hidden",children:K},w),h=ws(h,w,a,null),K.return=n,h.return=n,K.sibling=h,n.child=K,h=n.child,h.memoizedState=Hu(a),h.childLanes=Pu(t,M,a),n.memoizedState=zu,va(null,h)):(Zr(n),Fu(n,K))}var J=t.memoizedState;if(J!==null&&(K=J.dehydrated,K!==null)){if(k)n.flags&256?(Zr(n),n.flags&=-257,n=Uu(t,n,a)):n.memoizedState!==null?(Qr(),n.child=t.child,n.flags|=128,n=null):(Qr(),K=h.fallback,w=n.mode,h=rl({mode:"visible",children:h.children},w),K=ws(K,w,a,null),K.flags|=2,h.return=n,K.return=n,h.sibling=K,n.child=h,As(n,t.child,null,a),h=n.child,h.memoizedState=Hu(a),h.childLanes=Pu(t,M,a),n.memoizedState=zu,n=va(null,h));else if(Zr(n),Sd(K)){if(M=K.nextSibling&&K.nextSibling.dataset,M)var le=M.dgst;M=le,h=Error(i(419)),h.stack="",h.digest=M,aa({value:h,source:null,stack:null}),n=Uu(t,n,a)}else if($t||hi(t,n,a,!1),M=(a&t.childLanes)!==0,$t||M){if(M=bt,M!==null&&(h=Ct(M,a),h!==0&&h!==J.retryLane))throw J.retryLane=h,Ss(t,h),Nn(M,t,h),Iu;_d(K)||hl(),n=Uu(t,n,a)}else _d(K)?(n.flags|=192,n.child=t.child,n=null):(t=J.treeContext,kt=Qn(K.nextSibling),on=n,it=!0,Wr=null,Xn=!1,t!==null&&_p(n,t),n=Fu(n,h.children),n.flags|=4096);return n}return w?(Qr(),K=h.fallback,w=n.mode,J=t.child,le=J.sibling,h=Sr(J,{mode:"hidden",children:h.children}),h.subtreeFlags=J.subtreeFlags&65011712,le!==null?K=Sr(le,K):(K=ws(K,w,a,null),K.flags|=2),K.return=n,h.return=n,h.sibling=K,n.child=h,va(null,h),h=n.child,K=t.child.memoizedState,K===null?K=Hu(a):(w=K.cachePool,w!==null?(J=Ft._currentValue,w=w.parent!==J?{parent:J,pool:J}:w):w=jp(),K={baseLanes:K.baseLanes|a,cachePool:w}),h.memoizedState=K,h.childLanes=Pu(t,M,a),n.memoizedState=zu,va(t.child,h)):(Zr(n),a=t.child,t=a.sibling,a=Sr(a,{mode:"visible",children:h.children}),a.return=n,a.sibling=null,t!==null&&(M=n.deletions,M===null?(n.deletions=[t],n.flags|=16):M.push(t)),n.child=a,n.memoizedState=null,a)}function Fu(t,n){return n=rl({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function rl(t,n){return t=Ln(22,t,null,n),t.lanes=0,t}function Uu(t,n,a){return As(n,t.child,null,a),t=Fu(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function Pm(t,n,a){t.lanes|=n;var h=t.alternate;h!==null&&(h.lanes|=n),ru(t.return,n,a)}function $u(t,n,a,h,w,k){var M=t.memoizedState;M===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:h,tail:a,tailMode:w,treeForkCount:k}:(M.isBackwards=n,M.rendering=null,M.renderingStartTime=0,M.last=h,M.tail=a,M.tailMode=w,M.treeForkCount=k)}function Fm(t,n,a){var h=n.pendingProps,w=h.revealOrder,k=h.tail;h=h.children;var M=zt.current,K=(M&2)!==0;if(K?(M=M&1|2,n.flags|=128):M&=1,U(zt,M),cn(t,n,h,a),h=it?ia:0,!K&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Pm(t,a,n);else if(t.tag===19)Pm(t,a,n);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break e;for(;t.sibling===null;){if(t.return===null||t.return===n)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(w){case"forwards":for(a=n.child,w=null;a!==null;)t=a.alternate,t!==null&&Wo(t)===null&&(w=a),a=a.sibling;a=w,a===null?(w=n.child,n.child=null):(w=a.sibling,a.sibling=null),$u(n,!1,w,a,k,h);break;case"backwards":case"unstable_legacy-backwards":for(a=null,w=n.child,n.child=null;w!==null;){if(t=w.alternate,t!==null&&Wo(t)===null){n.child=w;break}t=w.sibling,w.sibling=a,a=w,w=t}$u(n,!0,a,null,k,h);break;case"together":$u(n,!1,null,null,void 0,h);break;default:n.memoizedState=null}return n.child}function Nr(t,n,a){if(t!==null&&(n.dependencies=t.dependencies),ts|=n.lanes,(a&n.childLanes)===0)if(t!==null){if(hi(t,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(t!==null&&n.child!==t.child)throw Error(i(153));if(n.child!==null){for(t=n.child,a=Sr(t,t.pendingProps),n.child=a,a.return=n;t.sibling!==null;)t=t.sibling,a=a.sibling=Sr(t,t.pendingProps),a.return=n;a.sibling=null}return n.child}function qu(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&Bo(t)))}function Y_(t,n,a){switch(n.tag){case 3:V(n,n.stateNode.containerInfo),Gr(n,Ft,t.memoizedState.cache),Cs();break;case 27:case 5:re(n);break;case 4:V(n,n.stateNode.containerInfo);break;case 10:Gr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,mu(n),null;break;case 13:var h=n.memoizedState;if(h!==null)return h.dehydrated!==null?(Zr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?Hm(t,n,a):(Zr(n),t=Nr(t,n,a),t!==null?t.sibling:null);Zr(n);break;case 19:var w=(t.flags&128)!==0;if(h=(a&n.childLanes)!==0,h||(hi(t,n,a,!1),h=(a&n.childLanes)!==0),w){if(h)return Fm(t,n,a);n.flags|=128}if(w=n.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),U(zt,zt.current),h)break;return null;case 22:return n.lanes=0,Rm(t,n,a,n.pendingProps);case 24:Gr(n,Ft,t.memoizedState.cache)}return Nr(t,n,a)}function Um(t,n,a){if(t!==null)if(t.memoizedProps!==n.pendingProps)$t=!0;else{if(!qu(t,a)&&(n.flags&128)===0)return $t=!1,Y_(t,n,a);$t=(t.flags&131072)!==0}else $t=!1,it&&(n.flags&1048576)!==0&&yp(n,ia,n.index);switch(n.lanes=0,n.tag){case 16:e:{var h=n.pendingProps;if(t=Ns(n.elementType),n.type=t,typeof t=="function")Yc(t)?(h=Ls(t,h),n.tag=1,n=Bm(null,n,t,h,a)):(n.tag=0,n=Bu(null,n,t,h,a));else{if(t!=null){var w=t.$$typeof;if(w===j){n.tag=11,n=Am(null,n,t,h,a);break e}else if(w===D){n.tag=14,n=Dm(null,n,t,h,a);break e}}throw n=I(t)||t,Error(i(306,n,""))}}return n;case 0:return Bu(t,n,n.type,n.pendingProps,a);case 1:return h=n.type,w=Ls(h,n.pendingProps),Bm(t,n,h,w,a);case 3:e:{if(V(n,n.stateNode.containerInfo),t===null)throw Error(i(387));h=n.pendingProps;var k=n.memoizedState;w=k.element,uu(t,n),fa(n,h,null,a);var M=n.memoizedState;if(h=M.cache,Gr(n,Ft,h),h!==k.cache&&su(n,[Ft],a,!0),ha(),h=M.element,k.isDehydrated)if(k={element:h,isDehydrated:!1,cache:M.cache},n.updateQueue.baseState=k,n.memoizedState=k,n.flags&256){n=zm(t,n,h,a);break e}else if(h!==w){w=Gn(Error(i(424)),n),aa(w),n=zm(t,n,h,a);break e}else{switch(t=n.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(kt=Qn(t.firstChild),on=n,it=!0,Wr=null,Xn=!0,a=Rp(n,null,h,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Cs(),h===w){n=Nr(t,n,a);break e}cn(t,n,h,a)}n=n.child}return n;case 26:return nl(t,n),t===null?(a=Jg(n.type,null,n.pendingProps,null))?n.memoizedState=a:it||(a=n.type,t=n.pendingProps,h=bl(ee.current).createElement(a),h[an]=n,h[Sn]=t,un(h,a,t),tn(h),n.stateNode=h):n.memoizedState=Jg(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return re(n),t===null&&it&&(h=n.stateNode=Xg(n.type,n.pendingProps,ee.current),on=n,Xn=!0,w=kt,as(n.type)?(wd=w,kt=Qn(h.firstChild)):kt=w),cn(t,n,n.pendingProps.children,a),nl(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&it&&((w=h=kt)&&(h=k1(h,n.type,n.pendingProps,Xn),h!==null?(n.stateNode=h,on=n,kt=Qn(h.firstChild),Xn=!1,w=!0):w=!1),w||Vr(n)),re(n),w=n.type,k=n.pendingProps,M=t!==null?t.memoizedProps:null,h=k.children,vd(w,k)?h=null:M!==null&&vd(w,M)&&(n.flags|=32),n.memoizedState!==null&&(w=xu(t,n,P_,null,null,a),Ra._currentValue=w),nl(t,n),cn(t,n,h,a),n.child;case 6:return t===null&&it&&((t=a=kt)&&(a=E1(a,n.pendingProps,Xn),a!==null?(n.stateNode=a,on=n,kt=null,t=!0):t=!1),t||Vr(n)),null;case 13:return Hm(t,n,a);case 4:return V(n,n.stateNode.containerInfo),h=n.pendingProps,t===null?n.child=As(n,null,h,a):cn(t,n,h,a),n.child;case 11:return Am(t,n,n.type,n.pendingProps,a);case 7:return cn(t,n,n.pendingProps,a),n.child;case 8:return cn(t,n,n.pendingProps.children,a),n.child;case 12:return cn(t,n,n.pendingProps.children,a),n.child;case 10:return h=n.pendingProps,Gr(n,n.type,h.value),cn(t,n,h.children,a),n.child;case 9:return w=n.type._context,h=n.pendingProps.children,Es(n),w=ln(w),h=h(w),n.flags|=1,cn(t,n,h,a),n.child;case 14:return Dm(t,n,n.type,n.pendingProps,a);case 15:return Lm(t,n,n.type,n.pendingProps,a);case 19:return Fm(t,n,a);case 31:return K_(t,n,a);case 22:return Rm(t,n,a,n.pendingProps);case 24:return Es(n),h=ln(Ft),t===null?(w=ou(),w===null&&(w=bt,k=iu(),w.pooledCache=k,k.refCount++,k!==null&&(w.pooledCacheLanes|=a),w=k),n.memoizedState={parent:h,cache:w},cu(n),Gr(n,Ft,w)):((t.lanes&a)!==0&&(uu(t,n),fa(n,null,null,a),ha()),w=t.memoizedState,k=n.memoizedState,w.parent!==h?(w={parent:h,cache:h},n.memoizedState=w,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=w),Gr(n,Ft,h)):(h=k.cache,Gr(n,Ft,h),h!==w.cache&&su(n,[Ft],a,!0))),cn(t,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function Tr(t){t.flags|=4}function Wu(t,n,a,h,w){if((n=(t.mode&32)!==0)&&(n=!1),n){if(t.flags|=16777216,(w&335544128)===w)if(t.stateNode.complete)t.flags|=8192;else if(mg())t.flags|=8192;else throw Ts=Fo,lu}else t.flags&=-16777217}function $m(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!sx(n))if(mg())t.flags|=8192;else throw Ts=Fo,lu}function sl(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?Rt():536870912,t.lanes|=n,Ci|=n)}function ba(t,n){if(!it)switch(t.tailMode){case"hidden":n=t.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var h=null;a!==null;)a.alternate!==null&&(h=a),a=a.sibling;h===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:h.sibling=null}}function Et(t){var n=t.alternate!==null&&t.alternate.child===t.child,a=0,h=0;if(n)for(var w=t.child;w!==null;)a|=w.lanes|w.childLanes,h|=w.subtreeFlags&65011712,h|=w.flags&65011712,w.return=t,w=w.sibling;else for(w=t.child;w!==null;)a|=w.lanes|w.childLanes,h|=w.subtreeFlags,h|=w.flags,w.return=t,w=w.sibling;return t.subtreeFlags|=h,t.childLanes=a,n}function X_(t,n,a){var h=n.pendingProps;switch(Jc(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Et(n),null;case 1:return Et(n),null;case 3:return a=n.stateNode,h=null,t!==null&&(h=t.memoizedState.cache),n.memoizedState.cache!==h&&(n.flags|=2048),kr(Ft),oe(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(di(n)?Tr(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,tu())),Et(n),null;case 26:var w=n.type,k=n.memoizedState;return t===null?(Tr(n),k!==null?(Et(n),$m(n,k)):(Et(n),Wu(n,w,null,h,a))):k?k!==t.memoizedState?(Tr(n),Et(n),$m(n,k)):(Et(n),n.flags&=-16777217):(t=t.memoizedProps,t!==h&&Tr(n),Et(n),Wu(n,w,t,h,a)),null;case 27:if(ve(n),a=ee.current,w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==h&&Tr(n);else{if(!h){if(n.stateNode===null)throw Error(i(166));return Et(n),null}t=ne.current,di(n)?Sp(n):(t=Xg(w,h,a),n.stateNode=t,Tr(n))}return Et(n),null;case 5:if(ve(n),w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==h&&Tr(n);else{if(!h){if(n.stateNode===null)throw Error(i(166));return Et(n),null}if(k=ne.current,di(n))Sp(n);else{var M=bl(ee.current);switch(k){case 1:k=M.createElementNS("http://www.w3.org/2000/svg",w);break;case 2:k=M.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;default:switch(w){case"svg":k=M.createElementNS("http://www.w3.org/2000/svg",w);break;case"math":k=M.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;case"script":k=M.createElement("div"),k.innerHTML="<script><\/script>",k=k.removeChild(k.firstChild);break;case"select":k=typeof h.is=="string"?M.createElement("select",{is:h.is}):M.createElement("select"),h.multiple?k.multiple=!0:h.size&&(k.size=h.size);break;default:k=typeof h.is=="string"?M.createElement(w,{is:h.is}):M.createElement(w)}}k[an]=n,k[Sn]=h;e:for(M=n.child;M!==null;){if(M.tag===5||M.tag===6)k.appendChild(M.stateNode);else if(M.tag!==4&&M.tag!==27&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===n)break e;for(;M.sibling===null;){if(M.return===null||M.return===n)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}n.stateNode=k;e:switch(un(k,w,h),w){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&Tr(n)}}return Et(n),Wu(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,a),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==h&&Tr(n);else{if(typeof h!="string"&&n.stateNode===null)throw Error(i(166));if(t=ee.current,di(n)){if(t=n.stateNode,a=n.memoizedProps,h=null,w=on,w!==null)switch(w.tag){case 27:case 5:h=w.memoizedProps}t[an]=n,t=!!(t.nodeValue===a||h!==null&&h.suppressHydrationWarning===!0||Hg(t.nodeValue,a)),t||Vr(n,!0)}else t=bl(t).createTextNode(h),t[an]=n,n.stateNode=t}return Et(n),null;case 31:if(a=n.memoizedState,t===null||t.memoizedState!==null){if(h=di(n),a!==null){if(t===null){if(!h)throw Error(i(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(557));t[an]=n}else Cs(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Et(n),t=!1}else a=tu(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return n.flags&256?(On(n),n):(On(n),null);if((n.flags&128)!==0)throw Error(i(558))}return Et(n),null;case 13:if(h=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(w=di(n),h!==null&&h.dehydrated!==null){if(t===null){if(!w)throw Error(i(318));if(w=n.memoizedState,w=w!==null?w.dehydrated:null,!w)throw Error(i(317));w[an]=n}else Cs(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Et(n),w=!1}else w=tu(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=w),w=!0;if(!w)return n.flags&256?(On(n),n):(On(n),null)}return On(n),(n.flags&128)!==0?(n.lanes=a,n):(a=h!==null,t=t!==null&&t.memoizedState!==null,a&&(h=n.child,w=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(w=h.alternate.memoizedState.cachePool.pool),k=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(k=h.memoizedState.cachePool.pool),k!==w&&(h.flags|=2048)),a!==t&&a&&(n.child.flags|=8192),sl(n,n.updateQueue),Et(n),null);case 4:return oe(),t===null&&fd(n.stateNode.containerInfo),Et(n),null;case 10:return kr(n.type),Et(n),null;case 19:if(F(zt),h=n.memoizedState,h===null)return Et(n),null;if(w=(n.flags&128)!==0,k=h.rendering,k===null)if(w)ba(h,!1);else{if(Mt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(k=Wo(t),k!==null){for(n.flags|=128,ba(h,!1),t=k.updateQueue,n.updateQueue=t,sl(n,t),n.subtreeFlags=0,t=a,a=n.child;a!==null;)xp(a,t),a=a.sibling;return U(zt,zt.current&1|2),it&&wr(n,h.treeForkCount),n.child}t=t.sibling}h.tail!==null&&Me()>cl&&(n.flags|=128,w=!0,ba(h,!1),n.lanes=4194304)}else{if(!w)if(t=Wo(k),t!==null){if(n.flags|=128,w=!0,t=t.updateQueue,n.updateQueue=t,sl(n,t),ba(h,!0),h.tail===null&&h.tailMode==="hidden"&&!k.alternate&&!it)return Et(n),null}else 2*Me()-h.renderingStartTime>cl&&a!==536870912&&(n.flags|=128,w=!0,ba(h,!1),n.lanes=4194304);h.isBackwards?(k.sibling=n.child,n.child=k):(t=h.last,t!==null?t.sibling=k:n.child=k,h.last=k)}return h.tail!==null?(t=h.tail,h.rendering=t,h.tail=t.sibling,h.renderingStartTime=Me(),t.sibling=null,a=zt.current,U(zt,w?a&1|2:a&1),it&&wr(n,h.treeForkCount),t):(Et(n),null);case 22:case 23:return On(n),pu(),h=n.memoizedState!==null,t!==null?t.memoizedState!==null!==h&&(n.flags|=8192):h&&(n.flags|=8192),h?(a&536870912)!==0&&(n.flags&128)===0&&(Et(n),n.subtreeFlags&6&&(n.flags|=8192)):Et(n),a=n.updateQueue,a!==null&&sl(n,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),h=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(h=n.memoizedState.cachePool.pool),h!==a&&(n.flags|=2048),t!==null&&F(js),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),kr(Ft),Et(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function Z_(t,n){switch(Jc(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return kr(Ft),oe(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return ve(n),null;case 31:if(n.memoizedState!==null){if(On(n),n.alternate===null)throw Error(i(340));Cs()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(On(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(i(340));Cs()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return F(zt),null;case 4:return oe(),null;case 10:return kr(n.type),null;case 22:case 23:return On(n),pu(),t!==null&&F(js),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return kr(Ft),null;case 25:return null;default:return null}}function qm(t,n){switch(Jc(n),n.tag){case 3:kr(Ft),oe();break;case 26:case 27:case 5:ve(n);break;case 4:oe();break;case 31:n.memoizedState!==null&&On(n);break;case 13:On(n);break;case 19:F(zt);break;case 10:kr(n.type);break;case 22:case 23:On(n),pu(),t!==null&&F(js);break;case 24:kr(Ft)}}function ya(t,n){try{var a=n.updateQueue,h=a!==null?a.lastEffect:null;if(h!==null){var w=h.next;a=w;do{if((a.tag&t)===t){h=void 0;var k=a.create,M=a.inst;h=k(),M.destroy=h}a=a.next}while(a!==w)}}catch(K){ft(n,n.return,K)}}function Jr(t,n,a){try{var h=n.updateQueue,w=h!==null?h.lastEffect:null;if(w!==null){var k=w.next;h=k;do{if((h.tag&t)===t){var M=h.inst,K=M.destroy;if(K!==void 0){M.destroy=void 0,w=n;var J=a,le=K;try{le()}catch(he){ft(w,J,he)}}}h=h.next}while(h!==k)}}catch(he){ft(n,n.return,he)}}function Wm(t){var n=t.updateQueue;if(n!==null){var a=t.stateNode;try{Mp(n,a)}catch(h){ft(t,t.return,h)}}}function Vm(t,n,a){a.props=Ls(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(h){ft(t,n,h)}}function _a(t,n){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var h=t.stateNode;break;case 30:h=t.stateNode;break;default:h=t.stateNode}typeof a=="function"?t.refCleanup=a(h):a.current=h}}catch(w){ft(t,n,w)}}function cr(t,n){var a=t.ref,h=t.refCleanup;if(a!==null)if(typeof h=="function")try{h()}catch(w){ft(t,n,w)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(w){ft(t,n,w)}else a.current=null}function Gm(t){var n=t.type,a=t.memoizedProps,h=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&h.focus();break e;case"img":a.src?h.src=a.src:a.srcSet&&(h.srcset=a.srcSet)}}catch(w){ft(t,t.return,w)}}function Vu(t,n,a){try{var h=t.stateNode;b1(h,t.type,a,n),h[Sn]=n}catch(w){ft(t,t.return,w)}}function Km(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&as(t.type)||t.tag===4}function Gu(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Km(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&as(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Ku(t,n,a){var h=t.tag;if(h===5||h===6)t=t.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(t,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(t),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=yr));else if(h!==4&&(h===27&&as(t.type)&&(a=t.stateNode,n=null),t=t.child,t!==null))for(Ku(t,n,a),t=t.sibling;t!==null;)Ku(t,n,a),t=t.sibling}function il(t,n,a){var h=t.tag;if(h===5||h===6)t=t.stateNode,n?a.insertBefore(t,n):a.appendChild(t);else if(h!==4&&(h===27&&as(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(il(t,n,a),t=t.sibling;t!==null;)il(t,n,a),t=t.sibling}function Ym(t){var n=t.stateNode,a=t.memoizedProps;try{for(var h=t.type,w=n.attributes;w.length;)n.removeAttributeNode(w[0]);un(n,h,a),n[an]=t,n[Sn]=a}catch(k){ft(t,t.return,k)}}var Ar=!1,qt=!1,Yu=!1,Xm=typeof WeakSet=="function"?WeakSet:Set,nn=null;function Q_(t,n){if(t=t.containerInfo,gd=El,t=lp(t),Uc(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var h=a.getSelection&&a.getSelection();if(h&&h.rangeCount!==0){a=h.anchorNode;var w=h.anchorOffset,k=h.focusNode;h=h.focusOffset;try{a.nodeType,k.nodeType}catch{a=null;break e}var M=0,K=-1,J=-1,le=0,he=0,xe=t,ce=null;t:for(;;){for(var de;xe!==a||w!==0&&xe.nodeType!==3||(K=M+w),xe!==k||h!==0&&xe.nodeType!==3||(J=M+h),xe.nodeType===3&&(M+=xe.nodeValue.length),(de=xe.firstChild)!==null;)ce=xe,xe=de;for(;;){if(xe===t)break t;if(ce===a&&++le===w&&(K=M),ce===k&&++he===h&&(J=M),(de=xe.nextSibling)!==null)break;xe=ce,ce=xe.parentNode}xe=de}a=K===-1||J===-1?null:{start:K,end:J}}else a=null}a=a||{start:0,end:0}}else a=null;for(xd={focusedElem:t,selectionRange:a},El=!1,nn=n;nn!==null;)if(n=nn,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,nn=t;else for(;nn!==null;){switch(n=nn,k=n.alternate,t=n.flags,n.tag){case 0:if((t&4)!==0&&(t=n.updateQueue,t=t!==null?t.events:null,t!==null))for(a=0;a<t.length;a++)w=t[a],w.ref.impl=w.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&k!==null){t=void 0,a=n,w=k.memoizedProps,k=k.memoizedState,h=a.stateNode;try{var De=Ls(a.type,w);t=h.getSnapshotBeforeUpdate(De,k),h.__reactInternalSnapshotBeforeUpdate=t}catch(Fe){ft(a,a.return,Fe)}}break;case 3:if((t&1024)!==0){if(t=n.stateNode.containerInfo,a=t.nodeType,a===9)yd(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":yd(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(i(163))}if(t=n.sibling,t!==null){t.return=n.return,nn=t;break}nn=n.return}}function Zm(t,n,a){var h=a.flags;switch(a.tag){case 0:case 11:case 15:Lr(t,a),h&4&&ya(5,a);break;case 1:if(Lr(t,a),h&4)if(t=a.stateNode,n===null)try{t.componentDidMount()}catch(M){ft(a,a.return,M)}else{var w=Ls(a.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(w,n,t.__reactInternalSnapshotBeforeUpdate)}catch(M){ft(a,a.return,M)}}h&64&&Wm(a),h&512&&_a(a,a.return);break;case 3:if(Lr(t,a),h&64&&(t=a.updateQueue,t!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{Mp(t,n)}catch(M){ft(a,a.return,M)}}break;case 27:n===null&&h&4&&Ym(a);case 26:case 5:Lr(t,a),n===null&&h&4&&Gm(a),h&512&&_a(a,a.return);break;case 12:Lr(t,a);break;case 31:Lr(t,a),h&4&&eg(t,a);break;case 13:Lr(t,a),h&4&&tg(t,a),h&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=o1.bind(null,a),j1(t,a))));break;case 22:if(h=a.memoizedState!==null||Ar,!h){n=n!==null&&n.memoizedState!==null||qt,w=Ar;var k=qt;Ar=h,(qt=n)&&!k?Rr(t,a,(a.subtreeFlags&8772)!==0):Lr(t,a),Ar=w,qt=k}break;case 30:break;default:Lr(t,a)}}function Qm(t){var n=t.alternate;n!==null&&(t.alternate=null,Qm(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&kc(n)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var jt=null,Cn=!1;function Dr(t,n,a){for(a=a.child;a!==null;)Jm(t,n,a),a=a.sibling}function Jm(t,n,a){if(mt&&typeof mt.onCommitFiberUnmount=="function")try{mt.onCommitFiberUnmount(Dt,a)}catch{}switch(a.tag){case 26:qt||cr(a,n),Dr(t,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:qt||cr(a,n);var h=jt,w=Cn;as(a.type)&&(jt=a.stateNode,Cn=!1),Dr(t,n,a),Aa(a.stateNode),jt=h,Cn=w;break;case 5:qt||cr(a,n);case 6:if(h=jt,w=Cn,jt=null,Dr(t,n,a),jt=h,Cn=w,jt!==null)if(Cn)try{(jt.nodeType===9?jt.body:jt.nodeName==="HTML"?jt.ownerDocument.body:jt).removeChild(a.stateNode)}catch(k){ft(a,n,k)}else try{jt.removeChild(a.stateNode)}catch(k){ft(a,n,k)}break;case 18:jt!==null&&(Cn?(t=jt,Wg(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),Li(t)):Wg(jt,a.stateNode));break;case 4:h=jt,w=Cn,jt=a.stateNode.containerInfo,Cn=!0,Dr(t,n,a),jt=h,Cn=w;break;case 0:case 11:case 14:case 15:Jr(2,a,n),qt||Jr(4,a,n),Dr(t,n,a);break;case 1:qt||(cr(a,n),h=a.stateNode,typeof h.componentWillUnmount=="function"&&Vm(a,n,h)),Dr(t,n,a);break;case 21:Dr(t,n,a);break;case 22:qt=(h=qt)||a.memoizedState!==null,Dr(t,n,a),qt=h;break;default:Dr(t,n,a)}}function eg(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Li(t)}catch(a){ft(n,n.return,a)}}}function tg(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Li(t)}catch(a){ft(n,n.return,a)}}function J_(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new Xm),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new Xm),n;default:throw Error(i(435,t.tag))}}function al(t,n){var a=J_(t);n.forEach(function(h){if(!a.has(h)){a.add(h);var w=l1.bind(null,t,h);h.then(w,w)}})}function kn(t,n){var a=n.deletions;if(a!==null)for(var h=0;h<a.length;h++){var w=a[h],k=t,M=n,K=M;e:for(;K!==null;){switch(K.tag){case 27:if(as(K.type)){jt=K.stateNode,Cn=!1;break e}break;case 5:jt=K.stateNode,Cn=!1;break e;case 3:case 4:jt=K.stateNode.containerInfo,Cn=!0;break e}K=K.return}if(jt===null)throw Error(i(160));Jm(k,M,w),jt=null,Cn=!1,k=w.alternate,k!==null&&(k.return=null),w.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)ng(n,t),n=n.sibling}var nr=null;function ng(t,n){var a=t.alternate,h=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:kn(n,t),En(t),h&4&&(Jr(3,t,t.return),ya(3,t),Jr(5,t,t.return));break;case 1:kn(n,t),En(t),h&512&&(qt||a===null||cr(a,a.return)),h&64&&Ar&&(t=t.updateQueue,t!==null&&(h=t.callbacks,h!==null&&(a=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=a===null?h:a.concat(h))));break;case 26:var w=nr;if(kn(n,t),En(t),h&512&&(qt||a===null||cr(a,a.return)),h&4){var k=a!==null?a.memoizedState:null;if(h=t.memoizedState,a===null)if(h===null)if(t.stateNode===null){e:{h=t.type,a=t.memoizedProps,w=w.ownerDocument||w;t:switch(h){case"title":k=w.getElementsByTagName("title")[0],(!k||k[Ki]||k[an]||k.namespaceURI==="http://www.w3.org/2000/svg"||k.hasAttribute("itemprop"))&&(k=w.createElement(h),w.head.insertBefore(k,w.querySelector("head > title"))),un(k,h,a),k[an]=t,tn(k),h=k;break e;case"link":var M=nx("link","href",w).get(h+(a.href||""));if(M){for(var K=0;K<M.length;K++)if(k=M[K],k.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&k.getAttribute("rel")===(a.rel==null?null:a.rel)&&k.getAttribute("title")===(a.title==null?null:a.title)&&k.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){M.splice(K,1);break t}}k=w.createElement(h),un(k,h,a),w.head.appendChild(k);break;case"meta":if(M=nx("meta","content",w).get(h+(a.content||""))){for(K=0;K<M.length;K++)if(k=M[K],k.getAttribute("content")===(a.content==null?null:""+a.content)&&k.getAttribute("name")===(a.name==null?null:a.name)&&k.getAttribute("property")===(a.property==null?null:a.property)&&k.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&k.getAttribute("charset")===(a.charSet==null?null:a.charSet)){M.splice(K,1);break t}}k=w.createElement(h),un(k,h,a),w.head.appendChild(k);break;default:throw Error(i(468,h))}k[an]=t,tn(k),h=k}t.stateNode=h}else rx(w,t.type,t.stateNode);else t.stateNode=tx(w,h,t.memoizedProps);else k!==h?(k===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):k.count--,h===null?rx(w,t.type,t.stateNode):tx(w,h,t.memoizedProps)):h===null&&t.stateNode!==null&&Vu(t,t.memoizedProps,a.memoizedProps)}break;case 27:kn(n,t),En(t),h&512&&(qt||a===null||cr(a,a.return)),a!==null&&h&4&&Vu(t,t.memoizedProps,a.memoizedProps);break;case 5:if(kn(n,t),En(t),h&512&&(qt||a===null||cr(a,a.return)),t.flags&32){w=t.stateNode;try{ti(w,"")}catch(De){ft(t,t.return,De)}}h&4&&t.stateNode!=null&&(w=t.memoizedProps,Vu(t,w,a!==null?a.memoizedProps:w)),h&1024&&(Yu=!0);break;case 6:if(kn(n,t),En(t),h&4){if(t.stateNode===null)throw Error(i(162));h=t.memoizedProps,a=t.stateNode;try{a.nodeValue=h}catch(De){ft(t,t.return,De)}}break;case 3:if(Sl=null,w=nr,nr=yl(n.containerInfo),kn(n,t),nr=w,En(t),h&4&&a!==null&&a.memoizedState.isDehydrated)try{Li(n.containerInfo)}catch(De){ft(t,t.return,De)}Yu&&(Yu=!1,rg(t));break;case 4:h=nr,nr=yl(t.stateNode.containerInfo),kn(n,t),En(t),nr=h;break;case 12:kn(n,t),En(t);break;case 31:kn(n,t),En(t),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,al(t,h)));break;case 13:kn(n,t),En(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(ll=Me()),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,al(t,h)));break;case 22:w=t.memoizedState!==null;var J=a!==null&&a.memoizedState!==null,le=Ar,he=qt;if(Ar=le||w,qt=he||J,kn(n,t),qt=he,Ar=le,En(t),h&8192)e:for(n=t.stateNode,n._visibility=w?n._visibility&-2:n._visibility|1,w&&(a===null||J||Ar||qt||Rs(t)),a=null,n=t;;){if(n.tag===5||n.tag===26){if(a===null){J=a=n;try{if(k=J.stateNode,w)M=k.style,typeof M.setProperty=="function"?M.setProperty("display","none","important"):M.display="none";else{K=J.stateNode;var xe=J.memoizedProps.style,ce=xe!=null&&xe.hasOwnProperty("display")?xe.display:null;K.style.display=ce==null||typeof ce=="boolean"?"":(""+ce).trim()}}catch(De){ft(J,J.return,De)}}}else if(n.tag===6){if(a===null){J=n;try{J.stateNode.nodeValue=w?"":J.memoizedProps}catch(De){ft(J,J.return,De)}}}else if(n.tag===18){if(a===null){J=n;try{var de=J.stateNode;w?Vg(de,!0):Vg(J.stateNode,!1)}catch(De){ft(J,J.return,De)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===t)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break e;for(;n.sibling===null;){if(n.return===null||n.return===t)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}h&4&&(h=t.updateQueue,h!==null&&(a=h.retryQueue,a!==null&&(h.retryQueue=null,al(t,a))));break;case 19:kn(n,t),En(t),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,al(t,h)));break;case 30:break;case 21:break;default:kn(n,t),En(t)}}function En(t){var n=t.flags;if(n&2){try{for(var a,h=t.return;h!==null;){if(Km(h)){a=h;break}h=h.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var w=a.stateNode,k=Gu(t);il(t,k,w);break;case 5:var M=a.stateNode;a.flags&32&&(ti(M,""),a.flags&=-33);var K=Gu(t);il(t,K,M);break;case 3:case 4:var J=a.stateNode.containerInfo,le=Gu(t);Ku(t,le,J);break;default:throw Error(i(161))}}catch(he){ft(t,t.return,he)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function rg(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;rg(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function Lr(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Zm(t,n.alternate,n),n=n.sibling}function Rs(t){for(t=t.child;t!==null;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:Jr(4,n,n.return),Rs(n);break;case 1:cr(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&Vm(n,n.return,a),Rs(n);break;case 27:Aa(n.stateNode);case 26:case 5:cr(n,n.return),Rs(n);break;case 22:n.memoizedState===null&&Rs(n);break;case 30:Rs(n);break;default:Rs(n)}t=t.sibling}}function Rr(t,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var h=n.alternate,w=t,k=n,M=k.flags;switch(k.tag){case 0:case 11:case 15:Rr(w,k,a),ya(4,k);break;case 1:if(Rr(w,k,a),h=k,w=h.stateNode,typeof w.componentDidMount=="function")try{w.componentDidMount()}catch(le){ft(h,h.return,le)}if(h=k,w=h.updateQueue,w!==null){var K=h.stateNode;try{var J=w.shared.hiddenCallbacks;if(J!==null)for(w.shared.hiddenCallbacks=null,w=0;w<J.length;w++)Op(J[w],K)}catch(le){ft(h,h.return,le)}}a&&M&64&&Wm(k),_a(k,k.return);break;case 27:Ym(k);case 26:case 5:Rr(w,k,a),a&&h===null&&M&4&&Gm(k),_a(k,k.return);break;case 12:Rr(w,k,a);break;case 31:Rr(w,k,a),a&&M&4&&eg(w,k);break;case 13:Rr(w,k,a),a&&M&4&&tg(w,k);break;case 22:k.memoizedState===null&&Rr(w,k,a),_a(k,k.return);break;case 30:break;default:Rr(w,k,a)}n=n.sibling}}function Xu(t,n){var a=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),t=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(t=n.memoizedState.cachePool.pool),t!==a&&(t!=null&&t.refCount++,a!=null&&oa(a))}function Zu(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&oa(t))}function rr(t,n,a,h){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)sg(t,n,a,h),n=n.sibling}function sg(t,n,a,h){var w=n.flags;switch(n.tag){case 0:case 11:case 15:rr(t,n,a,h),w&2048&&ya(9,n);break;case 1:rr(t,n,a,h);break;case 3:rr(t,n,a,h),w&2048&&(t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&oa(t)));break;case 12:if(w&2048){rr(t,n,a,h),t=n.stateNode;try{var k=n.memoizedProps,M=k.id,K=k.onPostCommit;typeof K=="function"&&K(M,n.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(J){ft(n,n.return,J)}}else rr(t,n,a,h);break;case 31:rr(t,n,a,h);break;case 13:rr(t,n,a,h);break;case 23:break;case 22:k=n.stateNode,M=n.alternate,n.memoizedState!==null?k._visibility&2?rr(t,n,a,h):Sa(t,n):k._visibility&2?rr(t,n,a,h):(k._visibility|=2,_i(t,n,a,h,(n.subtreeFlags&10256)!==0||!1)),w&2048&&Xu(M,n);break;case 24:rr(t,n,a,h),w&2048&&Zu(n.alternate,n);break;default:rr(t,n,a,h)}}function _i(t,n,a,h,w){for(w=w&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var k=t,M=n,K=a,J=h,le=M.flags;switch(M.tag){case 0:case 11:case 15:_i(k,M,K,J,w),ya(8,M);break;case 23:break;case 22:var he=M.stateNode;M.memoizedState!==null?he._visibility&2?_i(k,M,K,J,w):Sa(k,M):(he._visibility|=2,_i(k,M,K,J,w)),w&&le&2048&&Xu(M.alternate,M);break;case 24:_i(k,M,K,J,w),w&&le&2048&&Zu(M.alternate,M);break;default:_i(k,M,K,J,w)}n=n.sibling}}function Sa(t,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=t,h=n,w=h.flags;switch(h.tag){case 22:Sa(a,h),w&2048&&Xu(h.alternate,h);break;case 24:Sa(a,h),w&2048&&Zu(h.alternate,h);break;default:Sa(a,h)}n=n.sibling}}var wa=8192;function Si(t,n,a){if(t.subtreeFlags&wa)for(t=t.child;t!==null;)ig(t,n,a),t=t.sibling}function ig(t,n,a){switch(t.tag){case 26:Si(t,n,a),t.flags&wa&&t.memoizedState!==null&&H1(a,nr,t.memoizedState,t.memoizedProps);break;case 5:Si(t,n,a);break;case 3:case 4:var h=nr;nr=yl(t.stateNode.containerInfo),Si(t,n,a),nr=h;break;case 22:t.memoizedState===null&&(h=t.alternate,h!==null&&h.memoizedState!==null?(h=wa,wa=16777216,Si(t,n,a),wa=h):Si(t,n,a));break;default:Si(t,n,a)}}function ag(t){var n=t.alternate;if(n!==null&&(t=n.child,t!==null)){n.child=null;do n=t.sibling,t.sibling=null,t=n;while(t!==null)}}function Ca(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var h=n[a];nn=h,lg(h,t)}ag(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)og(t),t=t.sibling}function og(t){switch(t.tag){case 0:case 11:case 15:Ca(t),t.flags&2048&&Jr(9,t,t.return);break;case 3:Ca(t);break;case 12:Ca(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,ol(t)):Ca(t);break;default:Ca(t)}}function ol(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var h=n[a];nn=h,lg(h,t)}ag(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:Jr(8,n,n.return),ol(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,ol(n));break;default:ol(n)}t=t.sibling}}function lg(t,n){for(;nn!==null;){var a=nn;switch(a.tag){case 0:case 11:case 15:Jr(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var h=a.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:oa(a.memoizedState.cache)}if(h=a.child,h!==null)h.return=a,nn=h;else e:for(a=t;nn!==null;){h=nn;var w=h.sibling,k=h.return;if(Qm(h),h===a){nn=null;break e}if(w!==null){w.return=k,nn=w;break e}nn=k}}}var e1={getCacheForType:function(t){var n=ln(Ft),a=n.data.get(t);return a===void 0&&(a=t(),n.data.set(t,a)),a},cacheSignal:function(){return ln(Ft).controller.signal}},t1=typeof WeakMap=="function"?WeakMap:Map,dt=0,bt=null,Je=null,nt=0,ht=0,Mn=null,es=!1,wi=!1,Qu=!1,Or=0,Mt=0,ts=0,Os=0,Ju=0,In=0,Ci=0,ka=null,jn=null,ed=!1,ll=0,cg=0,cl=1/0,ul=null,ns=null,Xt=0,rs=null,ki=null,Mr=0,td=0,nd=null,ug=null,Ea=0,rd=null;function Bn(){return(dt&2)!==0&&nt!==0?nt&-nt:B.T!==null?cd():vr()}function dg(){if(In===0)if((nt&536870912)===0||it){var t=ye;ye<<=1,(ye&3932160)===0&&(ye=262144),In=t}else In=536870912;return t=Rn.current,t!==null&&(t.flags|=32),In}function Nn(t,n,a){(t===bt&&(ht===2||ht===9)||t.cancelPendingCommit!==null)&&(Ei(t,0),ss(t,nt,In,!1)),Ur(t,a),((dt&2)===0||t!==bt)&&(t===bt&&((dt&2)===0&&(Os|=a),Mt===4&&ss(t,nt,In,!1)),ur(t))}function hg(t,n,a){if((dt&6)!==0)throw Error(i(327));var h=!a&&(n&127)===0&&(n&t.expiredLanes)===0||Pe(t,n),w=h?s1(t,n):id(t,n,!0),k=h;do{if(w===0){wi&&!h&&ss(t,n,0,!1);break}else{if(a=t.current.alternate,k&&!n1(a)){w=id(t,n,!1),k=!1;continue}if(w===2){if(k=n,t.errorRecoveryDisabledLanes&k)var M=0;else M=t.pendingLanes&-536870913,M=M!==0?M:M&536870912?536870912:0;if(M!==0){n=M;e:{var K=t;w=ka;var J=K.current.memoizedState.isDehydrated;if(J&&(Ei(K,M).flags|=256),M=id(K,M,!1),M!==2){if(Qu&&!J){K.errorRecoveryDisabledLanes|=k,Os|=k,w=4;break e}k=jn,jn=w,k!==null&&(jn===null?jn=k:jn.push.apply(jn,k))}w=M}if(k=!1,w!==2)continue}}if(w===1){Ei(t,0),ss(t,n,0,!0);break}e:{switch(h=t,k=w,k){case 0:case 1:throw Error(i(345));case 4:if((n&4194048)!==n)break;case 6:ss(h,n,In,!es);break e;case 2:jn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(w=ll+300-Me(),10<w)){if(ss(h,n,In,!es),Qe(h,0,!0)!==0)break e;Mr=n,h.timeoutHandle=$g(fg.bind(null,h,a,jn,ul,ed,n,In,Os,Ci,es,k,"Throttled",-0,0),w);break e}fg(h,a,jn,ul,ed,n,In,Os,Ci,es,k,null,-0,0)}}break}while(!0);ur(t)}function fg(t,n,a,h,w,k,M,K,J,le,he,xe,ce,de){if(t.timeoutHandle=-1,xe=n.subtreeFlags,xe&8192||(xe&16785408)===16785408){xe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:yr},ig(n,k,xe);var De=(k&62914560)===k?ll-Me():(k&4194048)===k?cg-Me():0;if(De=P1(xe,De),De!==null){Mr=k,t.cancelPendingCommit=De(_g.bind(null,t,n,k,a,h,w,M,K,J,he,xe,null,ce,de)),ss(t,k,M,!le);return}}_g(t,n,k,a,h,w,M,K,J)}function n1(t){for(var n=t;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var h=0;h<a.length;h++){var w=a[h],k=w.getSnapshot;w=w.value;try{if(!Dn(k(),w))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function ss(t,n,a,h){n&=~Ju,n&=~Os,t.suspendedLanes|=n,t.pingedLanes&=~n,h&&(t.warmLanes|=n),h=t.expirationTimes;for(var w=n;0<w;){var k=31-lt(w),M=1<<k;h[k]=-1,w&=~M}a!==0&&Ae(t,a,n)}function dl(){return(dt&6)===0?(ja(0),!1):!0}function sd(){if(Je!==null){if(ht===0)var t=Je.return;else t=Je,Cr=ks=null,yu(t),gi=null,ca=0,t=Je;for(;t!==null;)qm(t.alternate,t),t=t.return;Je=null}}function Ei(t,n){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,S1(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),Mr=0,sd(),bt=t,Je=a=Sr(t.current,null),nt=n,ht=0,Mn=null,es=!1,wi=Pe(t,n),Qu=!1,Ci=In=Ju=Os=ts=Mt=0,jn=ka=null,ed=!1,(n&8)!==0&&(n|=n&32);var h=t.entangledLanes;if(h!==0)for(t=t.entanglements,h&=n;0<h;){var w=31-lt(h),k=1<<w;n|=t[w],h&=~k}return Or=n,Lo(),a}function pg(t,n){Ke=null,B.H=xa,n===mi||n===Po?(n=Ap(),ht=3):n===lu?(n=Ap(),ht=4):ht=n===Iu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Mn=n,Je===null&&(Mt=1,el(t,Gn(n,t.current)))}function mg(){var t=Rn.current;return t===null?!0:(nt&4194048)===nt?Zn===null:(nt&62914560)===nt||(nt&536870912)!==0?t===Zn:!1}function gg(){var t=B.H;return B.H=xa,t===null?xa:t}function xg(){var t=B.A;return B.A=e1,t}function hl(){Mt=4,es||(nt&4194048)!==nt&&Rn.current!==null||(wi=!0),(ts&134217727)===0&&(Os&134217727)===0||bt===null||ss(bt,nt,In,!1)}function id(t,n,a){var h=dt;dt|=2;var w=gg(),k=xg();(bt!==t||nt!==n)&&(ul=null,Ei(t,n)),n=!1;var M=Mt;e:do try{if(ht!==0&&Je!==null){var K=Je,J=Mn;switch(ht){case 8:sd(),M=6;break e;case 3:case 2:case 9:case 6:Rn.current===null&&(n=!0);var le=ht;if(ht=0,Mn=null,ji(t,K,J,le),a&&wi){M=0;break e}break;default:le=ht,ht=0,Mn=null,ji(t,K,J,le)}}r1(),M=Mt;break}catch(he){pg(t,he)}while(!0);return n&&t.shellSuspendCounter++,Cr=ks=null,dt=h,B.H=w,B.A=k,Je===null&&(bt=null,nt=0,Lo()),M}function r1(){for(;Je!==null;)vg(Je)}function s1(t,n){var a=dt;dt|=2;var h=gg(),w=xg();bt!==t||nt!==n?(ul=null,cl=Me()+500,Ei(t,n)):wi=Pe(t,n);e:do try{if(ht!==0&&Je!==null){n=Je;var k=Mn;t:switch(ht){case 1:ht=0,Mn=null,ji(t,n,k,1);break;case 2:case 9:if(Np(k)){ht=0,Mn=null,bg(n);break}n=function(){ht!==2&&ht!==9||bt!==t||(ht=7),ur(t)},k.then(n,n);break e;case 3:ht=7;break e;case 4:ht=5;break e;case 7:Np(k)?(ht=0,Mn=null,bg(n)):(ht=0,Mn=null,ji(t,n,k,7));break;case 5:var M=null;switch(Je.tag){case 26:M=Je.memoizedState;case 5:case 27:var K=Je;if(M?sx(M):K.stateNode.complete){ht=0,Mn=null;var J=K.sibling;if(J!==null)Je=J;else{var le=K.return;le!==null?(Je=le,fl(le)):Je=null}break t}}ht=0,Mn=null,ji(t,n,k,5);break;case 6:ht=0,Mn=null,ji(t,n,k,6);break;case 8:sd(),Mt=6;break e;default:throw Error(i(462))}}i1();break}catch(he){pg(t,he)}while(!0);return Cr=ks=null,B.H=h,B.A=w,dt=a,Je!==null?0:(bt=null,nt=0,Lo(),Mt)}function i1(){for(;Je!==null&&!pe();)vg(Je)}function vg(t){var n=Um(t.alternate,t,Or);t.memoizedProps=t.pendingProps,n===null?fl(t):Je=n}function bg(t){var n=t,a=n.alternate;switch(n.tag){case 15:case 0:n=Im(a,n,n.pendingProps,n.type,void 0,nt);break;case 11:n=Im(a,n,n.pendingProps,n.type.render,n.ref,nt);break;case 5:yu(n);default:qm(a,n),n=Je=xp(n,Or),n=Um(a,n,Or)}t.memoizedProps=t.pendingProps,n===null?fl(t):Je=n}function ji(t,n,a,h){Cr=ks=null,yu(n),gi=null,ca=0;var w=n.return;try{if(G_(t,w,n,a,nt)){Mt=1,el(t,Gn(a,t.current)),Je=null;return}}catch(k){if(w!==null)throw Je=w,k;Mt=1,el(t,Gn(a,t.current)),Je=null;return}n.flags&32768?(it||h===1?t=!0:wi||(nt&536870912)!==0?t=!1:(es=t=!0,(h===2||h===9||h===3||h===6)&&(h=Rn.current,h!==null&&h.tag===13&&(h.flags|=16384))),yg(n,t)):fl(n)}function fl(t){var n=t;do{if((n.flags&32768)!==0){yg(n,es);return}t=n.return;var a=X_(n.alternate,n,Or);if(a!==null){Je=a;return}if(n=n.sibling,n!==null){Je=n;return}Je=n=t}while(n!==null);Mt===0&&(Mt=5)}function yg(t,n){do{var a=Z_(t.alternate,t);if(a!==null){a.flags&=32767,Je=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(t=t.sibling,t!==null)){Je=t;return}Je=t=a}while(t!==null);Mt=6,Je=null}function _g(t,n,a,h,w,k,M,K,J){t.cancelPendingCommit=null;do pl();while(Xt!==0);if((dt&6)!==0)throw Error(i(327));if(n!==null){if(n===t.current)throw Error(i(177));if(k=n.lanes|n.childLanes,k|=Gc,ie(t,a,k,M,K,J),t===bt&&(Je=bt=null,nt=0),ki=n,rs=t,Mr=a,td=k,nd=w,ug=h,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,c1(Te,function(){return Eg(),null})):(t.callbackNode=null,t.callbackPriority=0),h=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||h){h=B.T,B.T=null,w=X.p,X.p=2,M=dt,dt|=4;try{Q_(t,n,a)}finally{dt=M,X.p=w,B.T=h}}Xt=1,Sg(),wg(),Cg()}}function Sg(){if(Xt===1){Xt=0;var t=rs,n=ki,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=B.T,B.T=null;var h=X.p;X.p=2;var w=dt;dt|=4;try{ng(n,t);var k=xd,M=lp(t.containerInfo),K=k.focusedElem,J=k.selectionRange;if(M!==K&&K&&K.ownerDocument&&op(K.ownerDocument.documentElement,K)){if(J!==null&&Uc(K)){var le=J.start,he=J.end;if(he===void 0&&(he=le),"selectionStart"in K)K.selectionStart=le,K.selectionEnd=Math.min(he,K.value.length);else{var xe=K.ownerDocument||document,ce=xe&&xe.defaultView||window;if(ce.getSelection){var de=ce.getSelection(),De=K.textContent.length,Fe=Math.min(J.start,De),vt=J.end===void 0?Fe:Math.min(J.end,De);!de.extend&&Fe>vt&&(M=vt,vt=Fe,Fe=M);var se=ap(K,Fe),te=ap(K,vt);if(se&&te&&(de.rangeCount!==1||de.anchorNode!==se.node||de.anchorOffset!==se.offset||de.focusNode!==te.node||de.focusOffset!==te.offset)){var ae=xe.createRange();ae.setStart(se.node,se.offset),de.removeAllRanges(),Fe>vt?(de.addRange(ae),de.extend(te.node,te.offset)):(ae.setEnd(te.node,te.offset),de.addRange(ae))}}}}for(xe=[],de=K;de=de.parentNode;)de.nodeType===1&&xe.push({element:de,left:de.scrollLeft,top:de.scrollTop});for(typeof K.focus=="function"&&K.focus(),K=0;K<xe.length;K++){var ge=xe[K];ge.element.scrollLeft=ge.left,ge.element.scrollTop=ge.top}}El=!!gd,xd=gd=null}finally{dt=w,X.p=h,B.T=a}}t.current=n,Xt=2}}function wg(){if(Xt===2){Xt=0;var t=rs,n=ki,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=B.T,B.T=null;var h=X.p;X.p=2;var w=dt;dt|=4;try{Zm(t,n.alternate,n)}finally{dt=w,X.p=h,B.T=a}}Xt=3}}function Cg(){if(Xt===4||Xt===3){Xt=0,Ne();var t=rs,n=ki,a=Mr,h=ug;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Xt=5:(Xt=0,ki=rs=null,kg(t,t.pendingLanes));var w=t.pendingLanes;if(w===0&&(ns=null),yn(a),n=n.stateNode,mt&&typeof mt.onCommitFiberRoot=="function")try{mt.onCommitFiberRoot(Dt,n,void 0,(n.current.flags&128)===128)}catch{}if(h!==null){n=B.T,w=X.p,X.p=2,B.T=null;try{for(var k=t.onRecoverableError,M=0;M<h.length;M++){var K=h[M];k(K.value,{componentStack:K.stack})}}finally{B.T=n,X.p=w}}(Mr&3)!==0&&pl(),ur(t),w=t.pendingLanes,(a&261930)!==0&&(w&42)!==0?t===rd?Ea++:(Ea=0,rd=t):Ea=0,ja(0)}}function kg(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,oa(n)))}function pl(){return Sg(),wg(),Cg(),Eg()}function Eg(){if(Xt!==5)return!1;var t=rs,n=td;td=0;var a=yn(Mr),h=B.T,w=X.p;try{X.p=32>a?32:a,B.T=null,a=nd,nd=null;var k=rs,M=Mr;if(Xt=0,ki=rs=null,Mr=0,(dt&6)!==0)throw Error(i(331));var K=dt;if(dt|=4,og(k.current),sg(k,k.current,M,a),dt=K,ja(0,!1),mt&&typeof mt.onPostCommitFiberRoot=="function")try{mt.onPostCommitFiberRoot(Dt,k)}catch{}return!0}finally{X.p=w,B.T=h,kg(t,n)}}function jg(t,n,a){n=Gn(a,n),n=Mu(t.stateNode,n,2),t=Xr(t,n,2),t!==null&&(Ur(t,2),ur(t))}function ft(t,n,a){if(t.tag===3)jg(t,t,a);else for(;n!==null;){if(n.tag===3){jg(n,t,a);break}else if(n.tag===1){var h=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(ns===null||!ns.has(h))){t=Gn(a,t),a=Nm(2),h=Xr(n,a,2),h!==null&&(Tm(a,h,n,t),Ur(h,2),ur(h));break}}n=n.return}}function ad(t,n,a){var h=t.pingCache;if(h===null){h=t.pingCache=new t1;var w=new Set;h.set(n,w)}else w=h.get(n),w===void 0&&(w=new Set,h.set(n,w));w.has(a)||(Qu=!0,w.add(a),t=a1.bind(null,t,n,a),n.then(t,t))}function a1(t,n,a){var h=t.pingCache;h!==null&&h.delete(n),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,bt===t&&(nt&a)===a&&(Mt===4||Mt===3&&(nt&62914560)===nt&&300>Me()-ll?(dt&2)===0&&Ei(t,0):Ju|=a,Ci===nt&&(Ci=0)),ur(t)}function Ng(t,n){n===0&&(n=Rt()),t=Ss(t,n),t!==null&&(Ur(t,n),ur(t))}function o1(t){var n=t.memoizedState,a=0;n!==null&&(a=n.retryLane),Ng(t,a)}function l1(t,n){var a=0;switch(t.tag){case 31:case 13:var h=t.stateNode,w=t.memoizedState;w!==null&&(a=w.retryLane);break;case 19:h=t.stateNode;break;case 22:h=t.stateNode._retryCache;break;default:throw Error(i(314))}h!==null&&h.delete(n),Ng(t,a)}function c1(t,n){return Ue(t,n)}var ml=null,Ni=null,od=!1,gl=!1,ld=!1,is=0;function ur(t){t!==Ni&&t.next===null&&(Ni===null?ml=Ni=t:Ni=Ni.next=t),gl=!0,od||(od=!0,d1())}function ja(t,n){if(!ld&&gl){ld=!0;do for(var a=!1,h=ml;h!==null;){if(t!==0){var w=h.pendingLanes;if(w===0)var k=0;else{var M=h.suspendedLanes,K=h.pingedLanes;k=(1<<31-lt(42|t)+1)-1,k&=w&~(M&~K),k=k&201326741?k&201326741|1:k?k|2:0}k!==0&&(a=!0,Lg(h,k))}else k=nt,k=Qe(h,h===bt?k:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(k&3)===0||Pe(h,k)||(a=!0,Lg(h,k));h=h.next}while(a);ld=!1}}function u1(){Tg()}function Tg(){gl=od=!1;var t=0;is!==0&&_1()&&(t=is);for(var n=Me(),a=null,h=ml;h!==null;){var w=h.next,k=Ag(h,n);k===0?(h.next=null,a===null?ml=w:a.next=w,w===null&&(Ni=a)):(a=h,(t!==0||(k&3)!==0)&&(gl=!0)),h=w}Xt!==0&&Xt!==5||ja(t),is!==0&&(is=0)}function Ag(t,n){for(var a=t.suspendedLanes,h=t.pingedLanes,w=t.expirationTimes,k=t.pendingLanes&-62914561;0<k;){var M=31-lt(k),K=1<<M,J=w[M];J===-1?((K&a)===0||(K&h)!==0)&&(w[M]=Yt(K,n)):J<=n&&(t.expiredLanes|=K),k&=~K}if(n=bt,a=nt,a=Qe(t,t===n?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),h=t.callbackNode,a===0||t===n&&(ht===2||ht===9)||t.cancelPendingCommit!==null)return h!==null&&h!==null&&It(h),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||Pe(t,a)){if(n=a&-a,n===t.callbackPriority)return n;switch(h!==null&&It(h),yn(a)){case 2:case 8:a=_e;break;case 32:a=Te;break;case 268435456:a=$e;break;default:a=Te}return h=Dg.bind(null,t),a=Ue(a,h),t.callbackPriority=n,t.callbackNode=a,n}return h!==null&&h!==null&&It(h),t.callbackPriority=2,t.callbackNode=null,2}function Dg(t,n){if(Xt!==0&&Xt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if(pl()&&t.callbackNode!==a)return null;var h=nt;return h=Qe(t,t===bt?h:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),h===0?null:(hg(t,h,n),Ag(t,Me()),t.callbackNode!=null&&t.callbackNode===a?Dg.bind(null,t):null)}function Lg(t,n){if(pl())return null;hg(t,n,!0)}function d1(){w1(function(){(dt&6)!==0?Ue(ue,u1):Tg()})}function cd(){if(is===0){var t=fi;t===0&&(t=me,me<<=1,(me&261888)===0&&(me=256)),is=t}return is}function Rg(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Co(""+t)}function Og(t,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,t.id&&a.setAttribute("form",t.id),n.parentNode.insertBefore(a,n),t=new FormData(t),a.parentNode.removeChild(a),t}function h1(t,n,a,h,w){if(n==="submit"&&a&&a.stateNode===w){var k=Rg((w[Sn]||null).action),M=h.submitter;M&&(n=(n=M[Sn]||null)?Rg(n.formAction):M.getAttribute("formAction"),n!==null&&(k=n,M=null));var K=new No("action","action",null,h,w);t.push({event:K,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(is!==0){var J=M?Og(w,M):new FormData(w);Tu(a,{pending:!0,data:J,method:w.method,action:k},null,J)}}else typeof k=="function"&&(K.preventDefault(),J=M?Og(w,M):new FormData(w),Tu(a,{pending:!0,data:J,method:w.method,action:k},k,J))},currentTarget:w}]})}}for(var ud=0;ud<Vc.length;ud++){var dd=Vc[ud],f1=dd.toLowerCase(),p1=dd[0].toUpperCase()+dd.slice(1);tr(f1,"on"+p1)}tr(dp,"onAnimationEnd"),tr(hp,"onAnimationIteration"),tr(fp,"onAnimationStart"),tr("dblclick","onDoubleClick"),tr("focusin","onFocus"),tr("focusout","onBlur"),tr(A_,"onTransitionRun"),tr(D_,"onTransitionStart"),tr(L_,"onTransitionCancel"),tr(pp,"onTransitionEnd"),Js("onMouseEnter",["mouseout","mouseover"]),Js("onMouseLeave",["mouseout","mouseover"]),Js("onPointerEnter",["pointerout","pointerover"]),Js("onPointerLeave",["pointerout","pointerover"]),vs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),vs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),vs("onBeforeInput",["compositionend","keypress","textInput","paste"]),vs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),vs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),vs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Na="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(" "),m1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Na));function Mg(t,n){n=(n&4)!==0;for(var a=0;a<t.length;a++){var h=t[a],w=h.event;h=h.listeners;e:{var k=void 0;if(n)for(var M=h.length-1;0<=M;M--){var K=h[M],J=K.instance,le=K.currentTarget;if(K=K.listener,J!==k&&w.isPropagationStopped())break e;k=K,w.currentTarget=le;try{k(w)}catch(he){Do(he)}w.currentTarget=null,k=J}else for(M=0;M<h.length;M++){if(K=h[M],J=K.instance,le=K.currentTarget,K=K.listener,J!==k&&w.isPropagationStopped())break e;k=K,w.currentTarget=le;try{k(w)}catch(he){Do(he)}w.currentTarget=null,k=J}}}}function et(t,n){var a=n[Cc];a===void 0&&(a=n[Cc]=new Set);var h=t+"__bubble";a.has(h)||(Ig(n,t,2,!1),a.add(h))}function hd(t,n,a){var h=0;n&&(h|=4),Ig(a,t,h,n)}var xl="_reactListening"+Math.random().toString(36).slice(2);function fd(t){if(!t[xl]){t[xl]=!0,Tf.forEach(function(a){a!=="selectionchange"&&(m1.has(a)||hd(a,!1,t),hd(a,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[xl]||(n[xl]=!0,hd("selectionchange",!1,n))}}function Ig(t,n,a,h){switch(dx(n)){case 2:var w=$1;break;case 8:w=q1;break;default:w=Nd}a=w.bind(null,n,a,t),w=void 0,!Rc||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(w=!0),h?w!==void 0?t.addEventListener(n,a,{capture:!0,passive:w}):t.addEventListener(n,a,!0):w!==void 0?t.addEventListener(n,a,{passive:w}):t.addEventListener(n,a,!1)}function pd(t,n,a,h,w){var k=h;if((n&1)===0&&(n&2)===0&&h!==null)e:for(;;){if(h===null)return;var M=h.tag;if(M===3||M===4){var K=h.stateNode.containerInfo;if(K===w)break;if(M===4)for(M=h.return;M!==null;){var J=M.tag;if((J===3||J===4)&&M.stateNode.containerInfo===w)return;M=M.return}for(;K!==null;){if(M=Xs(K),M===null)return;if(J=M.tag,J===5||J===6||J===26||J===27){h=k=M;continue e}K=K.parentNode}}h=h.return}Ff(function(){var le=k,he=Dc(a),xe=[];e:{var ce=mp.get(t);if(ce!==void 0){var de=No,De=t;switch(t){case"keypress":if(Eo(a)===0)break e;case"keydown":case"keyup":de=l_;break;case"focusin":De="focus",de=Bc;break;case"focusout":De="blur",de=Bc;break;case"beforeblur":case"afterblur":de=Bc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":de=qf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":de=X0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":de=d_;break;case dp:case hp:case fp:de=J0;break;case pp:de=f_;break;case"scroll":case"scrollend":de=K0;break;case"wheel":de=m_;break;case"copy":case"cut":case"paste":de=t_;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":de=Vf;break;case"toggle":case"beforetoggle":de=x_}var Fe=(n&4)!==0,vt=!Fe&&(t==="scroll"||t==="scrollend"),se=Fe?ce!==null?ce+"Capture":null:ce;Fe=[];for(var te=le,ae;te!==null;){var ge=te;if(ae=ge.stateNode,ge=ge.tag,ge!==5&&ge!==26&&ge!==27||ae===null||se===null||(ge=Xi(te,se),ge!=null&&Fe.push(Ta(te,ge,ae))),vt)break;te=te.return}0<Fe.length&&(ce=new de(ce,De,null,a,he),xe.push({event:ce,listeners:Fe}))}}if((n&7)===0){e:{if(ce=t==="mouseover"||t==="pointerover",de=t==="mouseout"||t==="pointerout",ce&&a!==Ac&&(De=a.relatedTarget||a.fromElement)&&(Xs(De)||De[Ys]))break e;if((de||ce)&&(ce=he.window===he?he:(ce=he.ownerDocument)?ce.defaultView||ce.parentWindow:window,de?(De=a.relatedTarget||a.toElement,de=le,De=De?Xs(De):null,De!==null&&(vt=u(De),Fe=De.tag,De!==vt||Fe!==5&&Fe!==27&&Fe!==6)&&(De=null)):(de=null,De=le),de!==De)){if(Fe=qf,ge="onMouseLeave",se="onMouseEnter",te="mouse",(t==="pointerout"||t==="pointerover")&&(Fe=Vf,ge="onPointerLeave",se="onPointerEnter",te="pointer"),vt=de==null?ce:Yi(de),ae=De==null?ce:Yi(De),ce=new Fe(ge,te+"leave",de,a,he),ce.target=vt,ce.relatedTarget=ae,ge=null,Xs(he)===le&&(Fe=new Fe(se,te+"enter",De,a,he),Fe.target=ae,Fe.relatedTarget=vt,ge=Fe),vt=ge,de&&De)t:{for(Fe=g1,se=de,te=De,ae=0,ge=se;ge;ge=Fe(ge))ae++;ge=0;for(var Be=te;Be;Be=Fe(Be))ge++;for(;0<ae-ge;)se=Fe(se),ae--;for(;0<ge-ae;)te=Fe(te),ge--;for(;ae--;){if(se===te||te!==null&&se===te.alternate){Fe=se;break t}se=Fe(se),te=Fe(te)}Fe=null}else Fe=null;de!==null&&Bg(xe,ce,de,Fe,!1),De!==null&&vt!==null&&Bg(xe,vt,De,Fe,!0)}}e:{if(ce=le?Yi(le):window,de=ce.nodeName&&ce.nodeName.toLowerCase(),de==="select"||de==="input"&&ce.type==="file")var ct=ep;else if(Qf(ce))if(tp)ct=j_;else{ct=k_;var Re=C_}else de=ce.nodeName,!de||de.toLowerCase()!=="input"||ce.type!=="checkbox"&&ce.type!=="radio"?le&&Tc(le.elementType)&&(ct=ep):ct=E_;if(ct&&(ct=ct(t,le))){Jf(xe,ct,a,he);break e}Re&&Re(t,ce,le),t==="focusout"&&le&&ce.type==="number"&&le.memoizedProps.value!=null&&Nc(ce,"number",ce.value)}switch(Re=le?Yi(le):window,t){case"focusin":(Qf(Re)||Re.contentEditable==="true")&&(ii=Re,$c=le,sa=null);break;case"focusout":sa=$c=ii=null;break;case"mousedown":qc=!0;break;case"contextmenu":case"mouseup":case"dragend":qc=!1,cp(xe,a,he);break;case"selectionchange":if(T_)break;case"keydown":case"keyup":cp(xe,a,he)}var Xe;if(Hc)e:{switch(t){case"compositionstart":var rt="onCompositionStart";break e;case"compositionend":rt="onCompositionEnd";break e;case"compositionupdate":rt="onCompositionUpdate";break e}rt=void 0}else si?Xf(t,a)&&(rt="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(rt="onCompositionStart");rt&&(Gf&&a.locale!=="ko"&&(si||rt!=="onCompositionStart"?rt==="onCompositionEnd"&&si&&(Xe=Uf()):($r=he,Oc="value"in $r?$r.value:$r.textContent,si=!0)),Re=vl(le,rt),0<Re.length&&(rt=new Wf(rt,t,null,a,he),xe.push({event:rt,listeners:Re}),Xe?rt.data=Xe:(Xe=Zf(a),Xe!==null&&(rt.data=Xe)))),(Xe=b_?y_(t,a):__(t,a))&&(rt=vl(le,"onBeforeInput"),0<rt.length&&(Re=new Wf("onBeforeInput","beforeinput",null,a,he),xe.push({event:Re,listeners:rt}),Re.data=Xe)),h1(xe,t,le,a,he)}Mg(xe,n)})}function Ta(t,n,a){return{instance:t,listener:n,currentTarget:a}}function vl(t,n){for(var a=n+"Capture",h=[];t!==null;){var w=t,k=w.stateNode;if(w=w.tag,w!==5&&w!==26&&w!==27||k===null||(w=Xi(t,a),w!=null&&h.unshift(Ta(t,w,k)),w=Xi(t,n),w!=null&&h.push(Ta(t,w,k))),t.tag===3)return h;t=t.return}return[]}function g1(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Bg(t,n,a,h,w){for(var k=n._reactName,M=[];a!==null&&a!==h;){var K=a,J=K.alternate,le=K.stateNode;if(K=K.tag,J!==null&&J===h)break;K!==5&&K!==26&&K!==27||le===null||(J=le,w?(le=Xi(a,k),le!=null&&M.unshift(Ta(a,le,J))):w||(le=Xi(a,k),le!=null&&M.push(Ta(a,le,J)))),a=a.return}M.length!==0&&t.push({event:n,listeners:M})}var x1=/\r\n?/g,v1=/\u0000|\uFFFD/g;function zg(t){return(typeof t=="string"?t:""+t).replace(x1,`
49
+ `).replace(v1,"")}function Hg(t,n){return n=zg(n),zg(t)===n}function xt(t,n,a,h,w,k){switch(a){case"children":typeof h=="string"?n==="body"||n==="textarea"&&h===""||ti(t,h):(typeof h=="number"||typeof h=="bigint")&&n!=="body"&&ti(t,""+h);break;case"className":So(t,"class",h);break;case"tabIndex":So(t,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":So(t,a,h);break;case"style":Hf(t,h,k);break;case"data":if(n!=="object"){So(t,"data",h);break}case"src":case"href":if(h===""&&(n!=="a"||a!=="href")){t.removeAttribute(a);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){t.removeAttribute(a);break}h=Co(""+h),t.setAttribute(a,h);break;case"action":case"formAction":if(typeof h=="function"){t.setAttribute(a,"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 k=="function"&&(a==="formAction"?(n!=="input"&&xt(t,n,"name",w.name,w,null),xt(t,n,"formEncType",w.formEncType,w,null),xt(t,n,"formMethod",w.formMethod,w,null),xt(t,n,"formTarget",w.formTarget,w,null)):(xt(t,n,"encType",w.encType,w,null),xt(t,n,"method",w.method,w,null),xt(t,n,"target",w.target,w,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){t.removeAttribute(a);break}h=Co(""+h),t.setAttribute(a,h);break;case"onClick":h!=null&&(t.onclick=yr);break;case"onScroll":h!=null&&et("scroll",t);break;case"onScrollEnd":h!=null&&et("scrollend",t);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(a=h.__html,a!=null){if(w.children!=null)throw Error(i(60));t.innerHTML=a}}break;case"multiple":t.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":t.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){t.removeAttribute("xlink:href");break}a=Co(""+h),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":h!=null&&typeof h!="function"&&typeof h!="symbol"?t.setAttribute(a,""+h):t.removeAttribute(a);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":h&&typeof h!="function"&&typeof h!="symbol"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":h===!0?t.setAttribute(a,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?t.setAttribute(a,h):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?t.setAttribute(a,h):t.removeAttribute(a);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?t.removeAttribute(a):t.setAttribute(a,h);break;case"popover":et("beforetoggle",t),et("toggle",t),_o(t,"popover",h);break;case"xlinkActuate":br(t,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":br(t,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":br(t,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":br(t,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":br(t,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":br(t,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":br(t,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":br(t,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":br(t,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":_o(t,"is",h);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=V0.get(a)||a,_o(t,a,h))}}function md(t,n,a,h,w,k){switch(a){case"style":Hf(t,h,k);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(a=h.__html,a!=null){if(w.children!=null)throw Error(i(60));t.innerHTML=a}}break;case"children":typeof h=="string"?ti(t,h):(typeof h=="number"||typeof h=="bigint")&&ti(t,""+h);break;case"onScroll":h!=null&&et("scroll",t);break;case"onScrollEnd":h!=null&&et("scrollend",t);break;case"onClick":h!=null&&(t.onclick=yr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Af.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(w=a.endsWith("Capture"),n=a.slice(2,w?a.length-7:void 0),k=t[Sn]||null,k=k!=null?k[a]:null,typeof k=="function"&&t.removeEventListener(n,k,w),typeof h=="function")){typeof k!="function"&&k!==null&&(a in t?t[a]=null:t.hasAttribute(a)&&t.removeAttribute(a)),t.addEventListener(n,h,w);break e}a in t?t[a]=h:h===!0?t.setAttribute(a,""):_o(t,a,h)}}}function un(t,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":et("error",t),et("load",t);var h=!1,w=!1,k;for(k in a)if(a.hasOwnProperty(k)){var M=a[k];if(M!=null)switch(k){case"src":h=!0;break;case"srcSet":w=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:xt(t,n,k,M,a,null)}}w&&xt(t,n,"srcSet",a.srcSet,a,null),h&&xt(t,n,"src",a.src,a,null);return;case"input":et("invalid",t);var K=k=M=w=null,J=null,le=null;for(h in a)if(a.hasOwnProperty(h)){var he=a[h];if(he!=null)switch(h){case"name":w=he;break;case"type":M=he;break;case"checked":J=he;break;case"defaultChecked":le=he;break;case"value":k=he;break;case"defaultValue":K=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(i(137,n));break;default:xt(t,n,h,he,a,null)}}Mf(t,k,K,J,le,M,w,!1);return;case"select":et("invalid",t),h=M=k=null;for(w in a)if(a.hasOwnProperty(w)&&(K=a[w],K!=null))switch(w){case"value":k=K;break;case"defaultValue":M=K;break;case"multiple":h=K;default:xt(t,n,w,K,a,null)}n=k,a=M,t.multiple=!!h,n!=null?ei(t,!!h,n,!1):a!=null&&ei(t,!!h,a,!0);return;case"textarea":et("invalid",t),k=w=h=null;for(M in a)if(a.hasOwnProperty(M)&&(K=a[M],K!=null))switch(M){case"value":h=K;break;case"defaultValue":w=K;break;case"children":k=K;break;case"dangerouslySetInnerHTML":if(K!=null)throw Error(i(91));break;default:xt(t,n,M,K,a,null)}Bf(t,h,w,k);return;case"option":for(J in a)if(a.hasOwnProperty(J)&&(h=a[J],h!=null))switch(J){case"selected":t.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:xt(t,n,J,h,a,null)}return;case"dialog":et("beforetoggle",t),et("toggle",t),et("cancel",t),et("close",t);break;case"iframe":case"object":et("load",t);break;case"video":case"audio":for(h=0;h<Na.length;h++)et(Na[h],t);break;case"image":et("error",t),et("load",t);break;case"details":et("toggle",t);break;case"embed":case"source":case"link":et("error",t),et("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(le in a)if(a.hasOwnProperty(le)&&(h=a[le],h!=null))switch(le){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:xt(t,n,le,h,a,null)}return;default:if(Tc(n)){for(he in a)a.hasOwnProperty(he)&&(h=a[he],h!==void 0&&md(t,n,he,h,a,void 0));return}}for(K in a)a.hasOwnProperty(K)&&(h=a[K],h!=null&&xt(t,n,K,h,a,null))}function b1(t,n,a,h){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var w=null,k=null,M=null,K=null,J=null,le=null,he=null;for(de in a){var xe=a[de];if(a.hasOwnProperty(de)&&xe!=null)switch(de){case"checked":break;case"value":break;case"defaultValue":J=xe;default:h.hasOwnProperty(de)||xt(t,n,de,null,h,xe)}}for(var ce in h){var de=h[ce];if(xe=a[ce],h.hasOwnProperty(ce)&&(de!=null||xe!=null))switch(ce){case"type":k=de;break;case"name":w=de;break;case"checked":le=de;break;case"defaultChecked":he=de;break;case"value":M=de;break;case"defaultValue":K=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(i(137,n));break;default:de!==xe&&xt(t,n,ce,de,h,xe)}}jc(t,M,K,J,le,he,k,w);return;case"select":de=M=K=ce=null;for(k in a)if(J=a[k],a.hasOwnProperty(k)&&J!=null)switch(k){case"value":break;case"multiple":de=J;default:h.hasOwnProperty(k)||xt(t,n,k,null,h,J)}for(w in h)if(k=h[w],J=a[w],h.hasOwnProperty(w)&&(k!=null||J!=null))switch(w){case"value":ce=k;break;case"defaultValue":K=k;break;case"multiple":M=k;default:k!==J&&xt(t,n,w,k,h,J)}n=K,a=M,h=de,ce!=null?ei(t,!!a,ce,!1):!!h!=!!a&&(n!=null?ei(t,!!a,n,!0):ei(t,!!a,a?[]:"",!1));return;case"textarea":de=ce=null;for(K in a)if(w=a[K],a.hasOwnProperty(K)&&w!=null&&!h.hasOwnProperty(K))switch(K){case"value":break;case"children":break;default:xt(t,n,K,null,h,w)}for(M in h)if(w=h[M],k=a[M],h.hasOwnProperty(M)&&(w!=null||k!=null))switch(M){case"value":ce=w;break;case"defaultValue":de=w;break;case"children":break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(i(91));break;default:w!==k&&xt(t,n,M,w,h,k)}If(t,ce,de);return;case"option":for(var De in a)if(ce=a[De],a.hasOwnProperty(De)&&ce!=null&&!h.hasOwnProperty(De))switch(De){case"selected":t.selected=!1;break;default:xt(t,n,De,null,h,ce)}for(J in h)if(ce=h[J],de=a[J],h.hasOwnProperty(J)&&ce!==de&&(ce!=null||de!=null))switch(J){case"selected":t.selected=ce&&typeof ce!="function"&&typeof ce!="symbol";break;default:xt(t,n,J,ce,h,de)}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 Fe in a)ce=a[Fe],a.hasOwnProperty(Fe)&&ce!=null&&!h.hasOwnProperty(Fe)&&xt(t,n,Fe,null,h,ce);for(le in h)if(ce=h[le],de=a[le],h.hasOwnProperty(le)&&ce!==de&&(ce!=null||de!=null))switch(le){case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(i(137,n));break;default:xt(t,n,le,ce,h,de)}return;default:if(Tc(n)){for(var vt in a)ce=a[vt],a.hasOwnProperty(vt)&&ce!==void 0&&!h.hasOwnProperty(vt)&&md(t,n,vt,void 0,h,ce);for(he in h)ce=h[he],de=a[he],!h.hasOwnProperty(he)||ce===de||ce===void 0&&de===void 0||md(t,n,he,ce,h,de);return}}for(var se in a)ce=a[se],a.hasOwnProperty(se)&&ce!=null&&!h.hasOwnProperty(se)&&xt(t,n,se,null,h,ce);for(xe in h)ce=h[xe],de=a[xe],!h.hasOwnProperty(xe)||ce===de||ce==null&&de==null||xt(t,n,xe,ce,h,de)}function Pg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function y1(){if(typeof performance.getEntriesByType=="function"){for(var t=0,n=0,a=performance.getEntriesByType("resource"),h=0;h<a.length;h++){var w=a[h],k=w.transferSize,M=w.initiatorType,K=w.duration;if(k&&K&&Pg(M)){for(M=0,K=w.responseEnd,h+=1;h<a.length;h++){var J=a[h],le=J.startTime;if(le>K)break;var he=J.transferSize,xe=J.initiatorType;he&&Pg(xe)&&(J=J.responseEnd,M+=he*(J<K?1:(K-le)/(J-le)))}if(--h,n+=8*(k+M)/(w.duration/1e3),t++,10<t)break}}if(0<t)return n/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var gd=null,xd=null;function bl(t){return t.nodeType===9?t:t.ownerDocument}function Fg(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Ug(t,n){if(t===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&n==="foreignObject"?0:t}function vd(t,n){return t==="textarea"||t==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var bd=null;function _1(){var t=window.event;return t&&t.type==="popstate"?t===bd?!1:(bd=t,!0):(bd=null,!1)}var $g=typeof setTimeout=="function"?setTimeout:void 0,S1=typeof clearTimeout=="function"?clearTimeout:void 0,qg=typeof Promise=="function"?Promise:void 0,w1=typeof queueMicrotask=="function"?queueMicrotask:typeof qg<"u"?function(t){return qg.resolve(null).then(t).catch(C1)}:$g;function C1(t){setTimeout(function(){throw t})}function as(t){return t==="head"}function Wg(t,n){var a=n,h=0;do{var w=a.nextSibling;if(t.removeChild(a),w&&w.nodeType===8)if(a=w.data,a==="/$"||a==="/&"){if(h===0){t.removeChild(w),Li(n);return}h--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")h++;else if(a==="html")Aa(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,Aa(a);for(var k=a.firstChild;k;){var M=k.nextSibling,K=k.nodeName;k[Ki]||K==="SCRIPT"||K==="STYLE"||K==="LINK"&&k.rel.toLowerCase()==="stylesheet"||a.removeChild(k),k=M}}else a==="body"&&Aa(t.ownerDocument.body);a=w}while(a);Li(n)}function Vg(t,n){var a=t;t=0;do{var h=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),h&&h.nodeType===8)if(a=h.data,a==="/$"){if(t===0)break;t--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||t++;a=h}while(a)}function yd(t){var n=t.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":yd(a),kc(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function k1(t,n,a,h){for(;t.nodeType===1;){var w=a;if(t.nodeName.toLowerCase()!==n.toLowerCase()){if(!h&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(h){if(!t[Ki])switch(n){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(k=t.getAttribute("rel"),k==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(k!==w.rel||t.getAttribute("href")!==(w.href==null||w.href===""?null:w.href)||t.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin)||t.getAttribute("title")!==(w.title==null?null:w.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(k=t.getAttribute("src"),(k!==(w.src==null?null:w.src)||t.getAttribute("type")!==(w.type==null?null:w.type)||t.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin))&&k&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(n==="input"&&t.type==="hidden"){var k=w.name==null?null:""+w.name;if(w.type==="hidden"&&t.getAttribute("name")===k)return t}else return t;if(t=Qn(t.nextSibling),t===null)break}return null}function E1(t,n,a){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Qn(t.nextSibling),t===null))return null;return t}function Gg(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=Qn(t.nextSibling),t===null))return null;return t}function _d(t){return t.data==="$?"||t.data==="$~"}function Sd(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function j1(t,n){var a=t.ownerDocument;if(t.data==="$~")t._reactRetry=n;else if(t.data!=="$?"||a.readyState!=="loading")n();else{var h=function(){n(),a.removeEventListener("DOMContentLoaded",h)};a.addEventListener("DOMContentLoaded",h),t._reactRetry=h}}function Qn(t){for(;t!=null;t=t.nextSibling){var n=t.nodeType;if(n===1||n===3)break;if(n===8){if(n=t.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return t}var wd=null;function Kg(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"||a==="/&"){if(n===0)return Qn(t.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}t=t.nextSibling}return null}function Yg(t){t=t.previousSibling;for(var n=0;t;){if(t.nodeType===8){var a=t.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return t;n--}else a!=="/$"&&a!=="/&"||n++}t=t.previousSibling}return null}function Xg(t,n,a){switch(n=bl(a),t){case"html":if(t=n.documentElement,!t)throw Error(i(452));return t;case"head":if(t=n.head,!t)throw Error(i(453));return t;case"body":if(t=n.body,!t)throw Error(i(454));return t;default:throw Error(i(451))}}function Aa(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);kc(t)}var Jn=new Map,Zg=new Set;function yl(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Ir=X.d;X.d={f:N1,r:T1,D:A1,C:D1,L:L1,m:R1,X:M1,S:O1,M:I1};function N1(){var t=Ir.f(),n=dl();return t||n}function T1(t){var n=Zs(t);n!==null&&n.tag===5&&n.type==="form"?pm(n):Ir.r(t)}var Ti=typeof document>"u"?null:document;function Qg(t,n,a){var h=Ti;if(h&&typeof n=="string"&&n){var w=Wn(n);w='link[rel="'+t+'"][href="'+w+'"]',typeof a=="string"&&(w+='[crossorigin="'+a+'"]'),Zg.has(w)||(Zg.add(w),t={rel:t,crossOrigin:a,href:n},h.querySelector(w)===null&&(n=h.createElement("link"),un(n,"link",t),tn(n),h.head.appendChild(n)))}}function A1(t){Ir.D(t),Qg("dns-prefetch",t,null)}function D1(t,n){Ir.C(t,n),Qg("preconnect",t,n)}function L1(t,n,a){Ir.L(t,n,a);var h=Ti;if(h&&t&&n){var w='link[rel="preload"][as="'+Wn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(w+='[imagesrcset="'+Wn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(w+='[imagesizes="'+Wn(a.imageSizes)+'"]')):w+='[href="'+Wn(t)+'"]';var k=w;switch(n){case"style":k=Ai(t);break;case"script":k=Di(t)}Jn.has(k)||(t=m({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:t,as:n},a),Jn.set(k,t),h.querySelector(w)!==null||n==="style"&&h.querySelector(Da(k))||n==="script"&&h.querySelector(La(k))||(n=h.createElement("link"),un(n,"link",t),tn(n),h.head.appendChild(n)))}}function R1(t,n){Ir.m(t,n);var a=Ti;if(a&&t){var h=n&&typeof n.as=="string"?n.as:"script",w='link[rel="modulepreload"][as="'+Wn(h)+'"][href="'+Wn(t)+'"]',k=w;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":k=Di(t)}if(!Jn.has(k)&&(t=m({rel:"modulepreload",href:t},n),Jn.set(k,t),a.querySelector(w)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(La(k)))return}h=a.createElement("link"),un(h,"link",t),tn(h),a.head.appendChild(h)}}}function O1(t,n,a){Ir.S(t,n,a);var h=Ti;if(h&&t){var w=Qs(h).hoistableStyles,k=Ai(t);n=n||"default";var M=w.get(k);if(!M){var K={loading:0,preload:null};if(M=h.querySelector(Da(k)))K.loading=5;else{t=m({rel:"stylesheet",href:t,"data-precedence":n},a),(a=Jn.get(k))&&Cd(t,a);var J=M=h.createElement("link");tn(J),un(J,"link",t),J._p=new Promise(function(le,he){J.onload=le,J.onerror=he}),J.addEventListener("load",function(){K.loading|=1}),J.addEventListener("error",function(){K.loading|=2}),K.loading|=4,_l(M,n,h)}M={type:"stylesheet",instance:M,count:1,state:K},w.set(k,M)}}}function M1(t,n){Ir.X(t,n);var a=Ti;if(a&&t){var h=Qs(a).hoistableScripts,w=Di(t),k=h.get(w);k||(k=a.querySelector(La(w)),k||(t=m({src:t,async:!0},n),(n=Jn.get(w))&&kd(t,n),k=a.createElement("script"),tn(k),un(k,"link",t),a.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},h.set(w,k))}}function I1(t,n){Ir.M(t,n);var a=Ti;if(a&&t){var h=Qs(a).hoistableScripts,w=Di(t),k=h.get(w);k||(k=a.querySelector(La(w)),k||(t=m({src:t,async:!0,type:"module"},n),(n=Jn.get(w))&&kd(t,n),k=a.createElement("script"),tn(k),un(k,"link",t),a.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},h.set(w,k))}}function Jg(t,n,a,h){var w=(w=ee.current)?yl(w):null;if(!w)throw Error(i(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=Ai(a.href),a=Qs(w).hoistableStyles,h=a.get(n),h||(h={type:"style",instance:null,count:0,state:null},a.set(n,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=Ai(a.href);var k=Qs(w).hoistableStyles,M=k.get(t);if(M||(w=w.ownerDocument||w,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},k.set(t,M),(k=w.querySelector(Da(t)))&&!k._p&&(M.instance=k,M.state.loading=5),Jn.has(t)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Jn.set(t,a),k||B1(w,t,a,M.state))),n&&h===null)throw Error(i(528,""));return M}if(n&&h!==null)throw Error(i(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Di(a),a=Qs(w).hoistableScripts,h=a.get(n),h||(h={type:"script",instance:null,count:0,state:null},a.set(n,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,t))}}function Ai(t){return'href="'+Wn(t)+'"'}function Da(t){return'link[rel="stylesheet"]['+t+"]"}function ex(t){return m({},t,{"data-precedence":t.precedence,precedence:null})}function B1(t,n,a,h){t.querySelector('link[rel="preload"][as="style"]['+n+"]")?h.loading=1:(n=t.createElement("link"),h.preload=n,n.addEventListener("load",function(){return h.loading|=1}),n.addEventListener("error",function(){return h.loading|=2}),un(n,"link",a),tn(n),t.head.appendChild(n))}function Di(t){return'[src="'+Wn(t)+'"]'}function La(t){return"script[async]"+t}function tx(t,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var h=t.querySelector('style[data-href~="'+Wn(a.href)+'"]');if(h)return n.instance=h,tn(h),h;var w=m({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return h=(t.ownerDocument||t).createElement("style"),tn(h),un(h,"style",w),_l(h,a.precedence,t),n.instance=h;case"stylesheet":w=Ai(a.href);var k=t.querySelector(Da(w));if(k)return n.state.loading|=4,n.instance=k,tn(k),k;h=ex(a),(w=Jn.get(w))&&Cd(h,w),k=(t.ownerDocument||t).createElement("link"),tn(k);var M=k;return M._p=new Promise(function(K,J){M.onload=K,M.onerror=J}),un(k,"link",h),n.state.loading|=4,_l(k,a.precedence,t),n.instance=k;case"script":return k=Di(a.src),(w=t.querySelector(La(k)))?(n.instance=w,tn(w),w):(h=a,(w=Jn.get(k))&&(h=m({},a),kd(h,w)),t=t.ownerDocument||t,w=t.createElement("script"),tn(w),un(w,"link",h),t.head.appendChild(w),n.instance=w);case"void":return null;default:throw Error(i(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(h=n.instance,n.state.loading|=4,_l(h,a.precedence,t));return n.instance}function _l(t,n,a){for(var h=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),w=h.length?h[h.length-1]:null,k=w,M=0;M<h.length;M++){var K=h[M];if(K.dataset.precedence===n)k=K;else if(k!==w)break}k?k.parentNode.insertBefore(t,k.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(t,n.firstChild))}function Cd(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function kd(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var Sl=null;function nx(t,n,a){if(Sl===null){var h=new Map,w=Sl=new Map;w.set(a,h)}else w=Sl,h=w.get(a),h||(h=new Map,w.set(a,h));if(h.has(t))return h;for(h.set(t,null),a=a.getElementsByTagName(t),w=0;w<a.length;w++){var k=a[w];if(!(k[Ki]||k[an]||t==="link"&&k.getAttribute("rel")==="stylesheet")&&k.namespaceURI!=="http://www.w3.org/2000/svg"){var M=k.getAttribute(n)||"";M=t+M;var K=h.get(M);K?K.push(k):h.set(M,[k])}}return h}function rx(t,n,a){t=t.ownerDocument||t,t.head.insertBefore(a,n==="title"?t.querySelector("head > title"):null)}function z1(t,n,a){if(a===1||n.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return t=n.disabled,typeof n.precedence=="string"&&t==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function sx(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function H1(t,n,a,h){if(a.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var w=Ai(h.href),k=n.querySelector(Da(w));if(k){n=k._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=wl.bind(t),n.then(t,t)),a.state.loading|=4,a.instance=k,tn(k);return}k=n.ownerDocument||n,h=ex(h),(w=Jn.get(w))&&Cd(h,w),k=k.createElement("link"),tn(k);var M=k;M._p=new Promise(function(K,J){M.onload=K,M.onerror=J}),un(k,"link",h),a.instance=k}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=wl.bind(t),n.addEventListener("load",a),n.addEventListener("error",a))}}var Ed=0;function P1(t,n){return t.stylesheets&&t.count===0&&kl(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var h=setTimeout(function(){if(t.stylesheets&&kl(t,t.stylesheets),t.unsuspend){var k=t.unsuspend;t.unsuspend=null,k()}},6e4+n);0<t.imgBytes&&Ed===0&&(Ed=62500*y1());var w=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&kl(t,t.stylesheets),t.unsuspend)){var k=t.unsuspend;t.unsuspend=null,k()}},(t.imgBytes>Ed?50:800)+n);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(h),clearTimeout(w)}}:null}function wl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)kl(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Cl=null;function kl(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Cl=new Map,n.forEach(F1,t),Cl=null,wl.call(t))}function F1(t,n){if(!(n.state.loading&4)){var a=Cl.get(t);if(a)var h=a.get(null);else{a=new Map,Cl.set(t,a);for(var w=t.querySelectorAll("link[data-precedence],style[data-precedence]"),k=0;k<w.length;k++){var M=w[k];(M.nodeName==="LINK"||M.getAttribute("media")!=="not all")&&(a.set(M.dataset.precedence,M),h=M)}h&&a.set(null,h)}w=n.instance,M=w.getAttribute("data-precedence"),k=a.get(M)||h,k===h&&a.set(null,w),a.set(M,w),this.count++,h=wl.bind(this),w.addEventListener("load",h),w.addEventListener("error",h),k?k.parentNode.insertBefore(w,k.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(w,t.firstChild)),n.state.loading|=4}}var Ra={$$typeof:S,Provider:null,Consumer:null,_currentValue:Z,_currentValue2:Z,_threadCount:0};function U1(t,n,a,h,w,k,M,K,J){this.tag=1,this.containerInfo=t,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=Bt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bt(0),this.hiddenUpdates=Bt(null),this.identifierPrefix=h,this.onUncaughtError=w,this.onCaughtError=k,this.onRecoverableError=M,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=J,this.incompleteTransitions=new Map}function ix(t,n,a,h,w,k,M,K,J,le,he,xe){return t=new U1(t,n,a,M,J,le,he,xe,K),n=1,k===!0&&(n|=24),k=Ln(3,null,null,n),t.current=k,k.stateNode=t,n=iu(),n.refCount++,t.pooledCache=n,n.refCount++,k.memoizedState={element:h,isDehydrated:a,cache:n},cu(k),t}function ax(t){return t?(t=li,t):li}function ox(t,n,a,h,w,k){w=ax(w),h.context===null?h.context=w:h.pendingContext=w,h=Yr(n),h.payload={element:a},k=k===void 0?null:k,k!==null&&(h.callback=k),a=Xr(t,h,n),a!==null&&(Nn(a,t,n),da(a,t,n))}function lx(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<n?a:n}}function jd(t,n){lx(t,n),(t=t.alternate)&&lx(t,n)}function cx(t){if(t.tag===13||t.tag===31){var n=Ss(t,67108864);n!==null&&Nn(n,t,67108864),jd(t,67108864)}}function ux(t){if(t.tag===13||t.tag===31){var n=Bn();n=en(n);var a=Ss(t,n);a!==null&&Nn(a,t,n),jd(t,n)}}var El=!0;function $1(t,n,a,h){var w=B.T;B.T=null;var k=X.p;try{X.p=2,Nd(t,n,a,h)}finally{X.p=k,B.T=w}}function q1(t,n,a,h){var w=B.T;B.T=null;var k=X.p;try{X.p=8,Nd(t,n,a,h)}finally{X.p=k,B.T=w}}function Nd(t,n,a,h){if(El){var w=Td(h);if(w===null)pd(t,n,h,jl,a),hx(t,h);else if(V1(w,t,n,a,h))h.stopPropagation();else if(hx(t,h),n&4&&-1<W1.indexOf(t)){for(;w!==null;){var k=Zs(w);if(k!==null)switch(k.tag){case 3:if(k=k.stateNode,k.current.memoizedState.isDehydrated){var M=Ve(k.pendingLanes);if(M!==0){var K=k;for(K.pendingLanes|=2,K.entangledLanes|=2;M;){var J=1<<31-lt(M);K.entanglements[1]|=J,M&=~J}ur(k),(dt&6)===0&&(cl=Me()+500,ja(0))}}break;case 31:case 13:K=Ss(k,2),K!==null&&Nn(K,k,2),dl(),jd(k,2)}if(k=Td(h),k===null&&pd(t,n,h,jl,a),k===w)break;w=k}w!==null&&h.stopPropagation()}else pd(t,n,h,null,a)}}function Td(t){return t=Dc(t),Ad(t)}var jl=null;function Ad(t){if(jl=null,t=Xs(t),t!==null){var n=u(t);if(n===null)t=null;else{var a=n.tag;if(a===13){if(t=f(n),t!==null)return t;t=null}else if(a===31){if(t=l(n),t!==null)return t;t=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;t=null}else n!==t&&(t=null)}}return jl=t,null}function dx(t){switch(t){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(ot()){case ue:return 2;case _e:return 8;case Te:case Ie:return 32;case $e:return 268435456;default:return 32}default:return 32}}var Dd=!1,os=null,ls=null,cs=null,Oa=new Map,Ma=new Map,us=[],W1="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 hx(t,n){switch(t){case"focusin":case"focusout":os=null;break;case"dragenter":case"dragleave":ls=null;break;case"mouseover":case"mouseout":cs=null;break;case"pointerover":case"pointerout":Oa.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ma.delete(n.pointerId)}}function Ia(t,n,a,h,w,k){return t===null||t.nativeEvent!==k?(t={blockedOn:n,domEventName:a,eventSystemFlags:h,nativeEvent:k,targetContainers:[w]},n!==null&&(n=Zs(n),n!==null&&cx(n)),t):(t.eventSystemFlags|=h,n=t.targetContainers,w!==null&&n.indexOf(w)===-1&&n.push(w),t)}function V1(t,n,a,h,w){switch(n){case"focusin":return os=Ia(os,t,n,a,h,w),!0;case"dragenter":return ls=Ia(ls,t,n,a,h,w),!0;case"mouseover":return cs=Ia(cs,t,n,a,h,w),!0;case"pointerover":var k=w.pointerId;return Oa.set(k,Ia(Oa.get(k)||null,t,n,a,h,w)),!0;case"gotpointercapture":return k=w.pointerId,Ma.set(k,Ia(Ma.get(k)||null,t,n,a,h,w)),!0}return!1}function fx(t){var n=Xs(t.target);if(n!==null){var a=u(n);if(a!==null){if(n=a.tag,n===13){if(n=f(a),n!==null){t.blockedOn=n,Ks(t.priority,function(){ux(a)});return}}else if(n===31){if(n=l(a),n!==null){t.blockedOn=n,Ks(t.priority,function(){ux(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){t.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Nl(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var a=Td(t.nativeEvent);if(a===null){a=t.nativeEvent;var h=new a.constructor(a.type,a);Ac=h,a.target.dispatchEvent(h),Ac=null}else return n=Zs(a),n!==null&&cx(n),t.blockedOn=a,!1;n.shift()}return!0}function px(t,n,a){Nl(t)&&a.delete(n)}function G1(){Dd=!1,os!==null&&Nl(os)&&(os=null),ls!==null&&Nl(ls)&&(ls=null),cs!==null&&Nl(cs)&&(cs=null),Oa.forEach(px),Ma.forEach(px)}function Tl(t,n){t.blockedOn===n&&(t.blockedOn=null,Dd||(Dd=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,G1)))}var Al=null;function mx(t){Al!==t&&(Al=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Al===t&&(Al=null);for(var n=0;n<t.length;n+=3){var a=t[n],h=t[n+1],w=t[n+2];if(typeof h!="function"){if(Ad(h||a)===null)continue;break}var k=Zs(a);k!==null&&(t.splice(n,3),n-=3,Tu(k,{pending:!0,data:w,method:a.method,action:h},h,w))}}))}function Li(t){function n(J){return Tl(J,t)}os!==null&&Tl(os,t),ls!==null&&Tl(ls,t),cs!==null&&Tl(cs,t),Oa.forEach(n),Ma.forEach(n);for(var a=0;a<us.length;a++){var h=us[a];h.blockedOn===t&&(h.blockedOn=null)}for(;0<us.length&&(a=us[0],a.blockedOn===null);)fx(a),a.blockedOn===null&&us.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(h=0;h<a.length;h+=3){var w=a[h],k=a[h+1],M=w[Sn]||null;if(typeof k=="function")M||mx(a);else if(M){var K=null;if(k&&k.hasAttribute("formAction")){if(w=k,M=k[Sn]||null)K=M.formAction;else if(Ad(w)!==null)continue}else K=M.action;typeof K=="function"?a[h+1]=K:(a.splice(h,3),h-=3),mx(a)}}}function gx(){function t(k){k.canIntercept&&k.info==="react-transition"&&k.intercept({handler:function(){return new Promise(function(M){return w=M})},focusReset:"manual",scroll:"manual"})}function n(){w!==null&&(w(),w=null),h||setTimeout(a,20)}function a(){if(!h&&!navigation.transition){var k=navigation.currentEntry;k&&k.url!=null&&navigation.navigate(k.url,{state:k.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var h=!1,w=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){h=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),w!==null&&(w(),w=null)}}}function Ld(t){this._internalRoot=t}Dl.prototype.render=Ld.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(i(409));var a=n.current,h=Bn();ox(a,h,t,n,null,null)},Dl.prototype.unmount=Ld.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;ox(t.current,2,null,t,null,null),dl(),n[Ys]=null}};function Dl(t){this._internalRoot=t}Dl.prototype.unstable_scheduleHydration=function(t){if(t){var n=vr();t={blockedOn:null,target:t,priority:n};for(var a=0;a<us.length&&n!==0&&n<us[a].priority;a++);us.splice(a,0,t),a===0&&fx(t)}};var xx=r.version;if(xx!=="19.2.4")throw Error(i(527,xx,"19.2.4"));X.findDOMNode=function(t){var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(i(188)):(t=Object.keys(t).join(","),Error(i(268,t)));return t=p(n),t=t!==null?g(t):null,t=t===null?null:t.stateNode,t};var K1={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ll=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ll.isDisabled&&Ll.supportsFiber)try{Dt=Ll.inject(K1),mt=Ll}catch{}}return za.createRoot=function(t,n){if(!c(t))throw Error(i(299));var a=!1,h="",w=Cm,k=km,M=Em;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(h=n.identifierPrefix),n.onUncaughtError!==void 0&&(w=n.onUncaughtError),n.onCaughtError!==void 0&&(k=n.onCaughtError),n.onRecoverableError!==void 0&&(M=n.onRecoverableError)),n=ix(t,1,!1,null,null,a,h,null,w,k,M,gx),t[Ys]=n.current,fd(t),new Ld(n)},za.hydrateRoot=function(t,n,a){if(!c(t))throw Error(i(299));var h=!1,w="",k=Cm,M=km,K=Em,J=null;return a!=null&&(a.unstable_strictMode===!0&&(h=!0),a.identifierPrefix!==void 0&&(w=a.identifierPrefix),a.onUncaughtError!==void 0&&(k=a.onUncaughtError),a.onCaughtError!==void 0&&(M=a.onCaughtError),a.onRecoverableError!==void 0&&(K=a.onRecoverableError),a.formState!==void 0&&(J=a.formState)),n=ix(t,1,!0,n,a??null,h,w,J,k,M,K,gx),n.context=ax(null),a=n.current,h=Bn(),h=en(h),w=Yr(h),w.callback=null,Xr(a,w,h),a=h,n.current.lanes=a,Ur(n,a),ur(n),t[Ys]=n.current,fd(t),new Dl(n)},za.version="19.2.4",za}var jx;function oS(){if(jx)return Md.exports;jx=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(r){console.error(r)}}return e(),Md.exports=aS(),Md.exports}var lS=oS();const cS=sc(lS),Nx=e=>{let r;const s=new Set,i=(p,g)=>{const m=typeof p=="function"?p(r):p;if(!Object.is(m,r)){const b=r;r=g??(typeof m!="object"||m===null)?m:Object.assign({},r,m),s.forEach(_=>_(r,b))}},c=()=>r,l={setState:i,getState:c,getInitialState:()=>d,subscribe:p=>(s.add(p),()=>s.delete(p))},d=r=e(i,c,l);return l},uS=(e=>e?Nx(e):Nx),dS=e=>e;function hS(e,r=dS){const s=mn.useSyncExternalStore(e.subscribe,mn.useCallback(()=>r(e.getState()),[e,r]),mn.useCallback(()=>r(e.getInitialState()),[e,r]));return mn.useDebugValue(s),s}const Tx=e=>{const r=uS(e),s=i=>hS(r,i);return Object.assign(s,r),s},Un=(e=>e?Tx(e):Tx);async function ke(e,r={}){const s=localStorage.getItem("openfox_token"),i={...r.headers instanceof Headers?Object.fromEntries(r.headers.entries()):r.headers,...s?{"x-session-token":s}:{}};return fetch(e,{...r,headers:i})}const yt={GLOBAL_INSTRUCTIONS:"global_instructions",NOTIFICATION_SETTINGS:"notification_settings",DISPLAY_SHOW_THINKING:"display.showThinking",DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT:"display.showVerboseToolOutput",DISPLAY_SHOW_STATS:"display.showStats",DISPLAY_SHOW_AGENT_DEFINITIONS:"display.showAgentDefinitions",DISPLAY_SHOW_WORKFLOW_BARS:"display.showWorkflowBars",DISPLAY_THEME:"display.theme"};function Rl(e,r){return s=>({loading:{...s.loading,[e]:r}})}function Ax(e,r){return s=>({settings:{...s.settings,[e]:r},loading:{...s.loading,[e]:!1}})}const fS=[yt.DISPLAY_SHOW_THINKING,yt.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT,yt.DISPLAY_SHOW_STATS,yt.DISPLAY_SHOW_AGENT_DEFINITIONS,yt.DISPLAY_SHOW_WORKFLOW_BARS];function _b(){return{showThinking:Zt(e=>e.settings[yt.DISPLAY_SHOW_THINKING]??"true")==="true",showVerboseToolOutput:Zt(e=>e.settings[yt.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT]??"true")==="true",showStats:Zt(e=>e.settings[yt.DISPLAY_SHOW_STATS]??"true")==="true",showAgentDefinitions:Zt(e=>e.settings[yt.DISPLAY_SHOW_AGENT_DEFINITIONS]??"true")==="true",showWorkflowBars:Zt(e=>e.settings[yt.DISPLAY_SHOW_WORKFLOW_BARS]??"true")==="true"}}const Zt=Un(e=>({settings:{},loading:{},getSetting:async r=>{e(Rl(r,!0));try{const i=await(await ke(`/api/settings/${r}`)).json();return e(Ax(r,i.value??"")),i.value}catch{return e(Rl(r,!1)),null}},setSetting:async(r,s)=>{e(Rl(r,!0));try{const c=await(await ke(`/api/settings/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:s})})).json();e(Ax(r,c.value??""))}catch{e(Rl(r,!1))}}}));function pS(){const[e,r]=P.useState({offsetTop:0,height:window.innerHeight,keyboardVisible:!1}),s=P.useRef(window.innerHeight);return P.useEffect(()=>{const i=window.visualViewport;if(!i)return;const c=()=>{const u=i.offsetTop,f=i.height,l=s.current-f>100;r({offsetTop:u,height:f,keyboardVisible:l})};return c(),i.addEventListener("resize",c),i.addEventListener("scroll",c),()=>{i.removeEventListener("resize",c),i.removeEventListener("scroll",c)}},[]),e}function mS(e,r){if(e instanceof RegExp)return{keys:!1,pattern:e};var s,i,c,u,f=[],l="",d=e.split("/");for(d[0]||d.shift();c=d.shift();)s=c[0],s==="*"?(f.push(s),l+=c[1]==="?"?"(?:/(.*))?":"/(.*)"):s===":"?(i=c.indexOf("?",1),u=c.indexOf(".",1),f.push(c.substring(1,~i?i:~u?u:c.length)),l+=~i&&!~u?"(?:/([^/]+?))?":"/([^/]+?)",~u&&(l+=(~i?"?":"")+"\\"+c.substring(u))):l+="/"+c;return{keys:f,pattern:new RegExp("^"+l+(r?"(?=$|/)":"/?$"),"i")}}var Hd={exports:{}},Pd={};/**
50
+ * @license React
51
+ * use-sync-external-store-shim.production.js
52
+ *
53
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
54
+ *
55
+ * This source code is licensed under the MIT license found in the
56
+ * LICENSE file in the root directory of this source tree.
57
+ */var Dx;function gS(){if(Dx)return Pd;Dx=1;var e=ic();function r(m,b){return m===b&&(m!==0||1/m===1/b)||m!==m&&b!==b}var s=typeof Object.is=="function"?Object.is:r,i=e.useState,c=e.useEffect,u=e.useLayoutEffect,f=e.useDebugValue;function l(m,b){var _=b(),E=i({inst:{value:_,getSnapshot:b}}),C=E[0].inst,y=E[1];return u(function(){C.value=_,C.getSnapshot=b,d(C)&&y({inst:C})},[m,_,b]),c(function(){return d(C)&&y({inst:C}),m(function(){d(C)&&y({inst:C})})},[m]),f(_),_}function d(m){var b=m.getSnapshot;m=m.value;try{var _=b();return!s(m,_)}catch{return!0}}function p(m,b){return b()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:l;return Pd.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,Pd}var Lx;function xS(){return Lx||(Lx=1,Hd.exports=gS()),Hd.exports}var vS=xS();const bS=nS.useInsertionEffect,yS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",_S=yS?P.useLayoutEffect:P.useEffect,SS=bS||_S,Sb=e=>{const r=P.useRef([e,(...s)=>r[0](...s)]).current;return SS(()=>{r[0]=e}),r[1]},wS="popstate",Lh="pushState",Rh="replaceState",CS="hashchange",Rx=[wS,Lh,Rh,CS],kS=e=>{for(const r of Rx)addEventListener(r,e);return()=>{for(const r of Rx)removeEventListener(r,e)}},wb=(e,r)=>vS.useSyncExternalStore(kS,e,r),Ox=()=>location.search,ES=({ssrSearch:e}={})=>wb(Ox,e!=null?()=>e:Ox),Mx=()=>location.pathname,jS=({ssrPath:e}={})=>wb(Mx,e!=null?()=>e:Mx),NS=(e,{replace:r=!1,state:s=null}={})=>history[r?Rh:Lh](s,"",e),TS=(e={})=>[jS(e),NS],Ix=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[Ix]>"u"){for(const e of[Lh,Rh]){const r=history[e];history[e]=function(){const s=r.apply(this,arguments),i=new Event(e);return i.arguments=arguments,dispatchEvent(i),s}}Object.defineProperty(window,Ix,{value:!0})}const AS=(e,r)=>r.toLowerCase().indexOf(e.toLowerCase())?"~"+r:r.slice(e.length)||"/",Cb=(e="")=>e==="/"?"":e,DS=(e,r)=>e[0]==="~"?e.slice(1):Cb(r)+e,LS=(e="",r)=>AS(Bx(Cb(e)),Bx(r)),Bx=e=>{try{return decodeURI(e)}catch{return e}},kb={hook:TS,searchHook:ES,parser:mS,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e,aroundNav:(e,r,s)=>e(r,s)},Eb=P.createContext(kb),qi=()=>P.useContext(Eb),jb={},Nb=P.createContext(jb),RS=()=>P.useContext(Nb),ac=e=>{const[r,s]=e.hook(e);return[LS(e.base,r),Sb((i,c)=>e.aroundNav(s,DS(i,e.base),c))]},gr=()=>ac(qi()),Oh=(e,r,s,i)=>{const{pattern:c,keys:u}=r instanceof RegExp?{keys:!1,pattern:r}:e(r||"*",i),f=c.exec(s)||[],[l,...d]=f;return l!==void 0?[!0,(()=>{const p=u!==!1?Object.fromEntries(u.map((m,b)=>[m,d[b]])):f.groups;let g={...d};return p&&Object.assign(g,p),g})(),...i?[l]:[]]:[!1,null]},Mh=e=>Oh(qi().parser,e,gr()[0]),OS=({children:e,...r})=>{var g,m,b;const s=qi(),i=r.hook?kb:s;let c=i;const[u,f=r.ssrSearch??""]=((g=r.ssrPath)==null?void 0:g.split("?"))??[];u&&(r.ssrSearch=f,r.ssrPath=u),r.hrefs=r.hrefs??((m=r.hook)==null?void 0:m.hrefs),r.searchHook=r.searchHook??((b=r.hook)==null?void 0:b.searchHook);let l=P.useRef({}),d=l.current,p=d;for(let _ in i){const E=_==="base"?i[_]+(r[_]??""):r[_]??i[_];d===p&&E!==p[_]&&(l.current=p={...p}),p[_]=E,(E!==i[_]||E!==c[_])&&(c=p)}return P.createElement(Eb.Provider,{value:c,children:e})},zx=({children:e,component:r},s)=>r?P.createElement(r,{params:s}):typeof e=="function"?e(s):e,MS=e=>{let r=P.useRef(jb);const s=r.current;return r.current=Object.keys(e).length!==Object.keys(s).length||Object.entries(e).some(([i,c])=>c!==s[i])?e:s},Ha=({path:e,nest:r,match:s,...i})=>{const c=qi(),[u]=ac(c),[f,l,d]=s??Oh(c.parser,e,u,r),p=MS({...RS(),...l});if(!f)return null;const g=d?P.createElement(OS,{base:d},zx(i,p)):zx(i,p);return P.createElement(Nb.Provider,{value:p,children:g})},Pn=P.forwardRef((e,r)=>{const s=qi(),[i,c]=ac(s),{to:u="",href:f=u,onClick:l,asChild:d,children:p,className:g,replace:m,state:b,transition:_,...E}=e,C=Sb(v=>{v.ctrlKey||v.metaKey||v.altKey||v.shiftKey||v.button!==0||(l==null||l(v),v.defaultPrevented||(v.preventDefault(),c(f,e)))}),y=s.hrefs(f[0]==="~"?f.slice(1):s.base+f,s);return d&&P.isValidElement(p)?P.cloneElement(p,{onClick:C,href:y}):P.createElement("a",{...E,onClick:C,href:y,className:g!=null&&g.call?g(i===f):g,children:p,ref:r})}),Tb=e=>Array.isArray(e)?e.flatMap(r=>Tb(r&&r.type===P.Fragment?r.props.children:r)):[e],IS=({children:e,location:r})=>{const s=qi(),[i]=ac(s);for(const c of Tb(e)){let u=0;if(P.isValidElement(c)&&(u=Oh(s.parser,c.props.path,r||i,c.props.nest))[0])return P.cloneElement(c,{match:u})}return null};function BS(e){return typeof e=="object"&&e!==null&&"type"in e&&"payload"in e}function Ab(){if(typeof crypto<"u"&&crypto.randomUUID)try{return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const r=Math.random()*16|0;return(e==="x"?r:r&3|8).toString(16)})}class zS{constructor(r){dr(this,"ws",null);dr(this,"handlers",new Set);dr(this,"statusHandler",null);dr(this,"baseUrl");dr(this,"isReconnecting",!1);dr(this,"connectingPromise",null);dr(this,"lastCloseCode",0);dr(this,"reconnectAttempts",0);dr(this,"manualReconnectScheduled",!1);this.baseUrl=r}getUrl(){const r=localStorage.getItem("openfox_token");if(r){const s=this.baseUrl.includes("?")?"&":"?";return`${this.baseUrl}${s}token=${encodeURIComponent(r)}`}return this.baseUrl}setToken(r){localStorage.setItem("openfox_token",r)}clearToken(){localStorage.removeItem("openfox_token")}hasToken(){return!!localStorage.getItem("openfox_token")}getLastCloseCode(){return this.lastCloseCode}onStatusChange(r){this.statusHandler=r}connect(){var r,s;return((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN?Promise.resolve():(this.lastCloseCode=0,this.isReconnecting=!1,this.connectingPromise&&((s=this.ws)==null?void 0:s.readyState)===WebSocket.CONNECTING?this.connectingPromise:(this.connectingPromise=new Promise((i,c)=>{try{const u=this.getUrl();this.ws=new WebSocket(u);const f=setTimeout(()=>{var l;((l=this.ws)==null?void 0:l.readyState)===WebSocket.CONNECTING&&(this.ws.close(),c(new Error("Connection timeout")))},5e3);this.ws.onopen=()=>{var l;clearTimeout(f),this.isReconnecting=!1,this.connectingPromise=null,(l=this.statusHandler)==null||l.call(this,"connected"),i()},this.ws.onclose=l=>{var d,p,g;clearTimeout(f),this.lastCloseCode=l.code,((d=this.ws)==null?void 0:d.readyState)===WebSocket.CONNECTING?(this.connectingPromise=null,(p=this.statusHandler)==null||p.call(this,"disconnected"),c(new Error(`Connection closed: ${l.code}`))):(this.connectingPromise=null,(g=this.statusHandler)==null||g.call(this,"disconnected"),this.attemptReconnect())},this.ws.onerror=l=>{clearTimeout(f),console.error("WebSocket error:",l),this.connectingPromise=null,c(l)},this.ws.onmessage=l=>{try{const d=JSON.parse(l.data);BS(d)&&this.handlers.forEach(p=>p(d))}catch(d){console.error("Failed to parse WebSocket message:",d)}}}catch(u){this.connectingPromise=null,c(u)}}),this.connectingPromise))}attemptReconnect(){var c;if(([1e3,1005,1006,4e3].includes(this.lastCloseCode)||this.lastCloseCode===0)&&this.hasToken()){console.log("[WS] Auth failure or initial failure with token - not auto-reconnecting, awaiting user action");return}if(this.isReconnecting||this.manualReconnectScheduled)return;this.isReconnecting=!0,(c=this.statusHandler)==null||c.call(this,"reconnecting");const i=Math.min(1e3*Math.pow(2,this.reconnectAttempts||0),3e4);this.reconnectAttempts=(this.reconnectAttempts||0)+1,setTimeout(()=>{this.isReconnecting=!1,this.manualReconnectScheduled=!1,this.connect().catch(()=>{})},i)}reconnect(){this.manualReconnectScheduled=!0,this.isReconnecting=!1,this.lastCloseCode=0,this.connectingPromise=null,this.connect().catch(()=>{})}disconnect(){this.isReconnecting=!1,this.reconnectAttempts=0,this.ws&&(this.ws.close(),this.ws=null)}resetReconnectAttempts(){this.reconnectAttempts=0}send(r,s){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");const i=Ab(),c={id:i,type:r,payload:s};return this.ws.send(JSON.stringify(c)),i}subscribe(r){return this.handlers.add(r),()=>this.handlers.delete(r)}get isConnected(){var r;return((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN}}const HS=`ws://${window.location.hostname}:${window.location.port||"10469"}/ws`,Vt=new zS(HS),gs=async(e,r,s)=>{try{const i=await ke(r,{method:e,headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return i.ok?{success:!0}:{success:!1,error:(await i.json()).error}}catch{return{success:!1,error:"Network error"}}};function Db(e){let r=null;function s(){r===null&&(r=requestAnimationFrame(()=>{r=null,e()}))}return s}let Ol=[];const pr=Un()((e,r)=>{function s(){if(Ol.length===0)return;const c=Ol;Ol=[],e(u=>({logs:[...u.logs,...c]}))}const i=Db(s);return{workdir:null,status:null,logs:[],config:null,loading:!1,setWorkdir:c=>{r().workdir!==c&&(e({workdir:c,status:null,logs:[],config:null,loading:!0}),c&&(r().fetchStatus(),r().fetchConfig()))},fetchStatus:async()=>{const c=r().workdir;if(c)try{const f=await(await ke(`/api/dev-server?workdir=${encodeURIComponent(c)}`)).json();e({status:f,loading:!1})}catch{e({loading:!1})}},fetchConfig:async()=>{const c=r().workdir;if(c)try{const f=await(await ke(`/api/dev-server/config?workdir=${encodeURIComponent(c)}`)).json();e({config:f.config??null})}catch{}},fetchLogs:async()=>{const c=r().workdir;if(c)try{const l=(await(await ke(`/api/dev-server/logs?workdir=${encodeURIComponent(c)}`)).json()).logs.map(d=>({stream:d.stream,content:d.content}));e({logs:l})}catch{}},start:async()=>{const c=r().workdir;if(c)try{const f=await(await ke(`/api/dev-server/start?workdir=${encodeURIComponent(c)}`,{method:"POST"})).json();e({status:f,logs:[]})}catch{}},stop:async()=>{const c=r().workdir;if(c)try{const f=await(await ke(`/api/dev-server/stop?workdir=${encodeURIComponent(c)}`,{method:"POST"})).json();e({status:f})}catch{}},restart:async()=>{const c=r().workdir;if(c)try{const f=await(await ke(`/api/dev-server/restart?workdir=${encodeURIComponent(c)}`,{method:"POST"})).json();e({status:f,logs:[]})}catch{}},saveConfig:async c=>{const u=r().workdir;if(u)try{const l=await(await ke(`/api/dev-server/config?workdir=${encodeURIComponent(u)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})).json();e({config:l.config??c}),r().fetchStatus()}catch{}},handleMessage:c=>{const u=r().workdir;if(u)switch(c.type){case"devServer.output":{const f=c.payload;if(f.workdir!==u)return;Ol.push({stream:f.stream,content:f.content}),i();break}case"devServer.state":{const f=c.payload;if(f.workdir!==u)return;e(l=>({status:l.status?{...l.status,state:f.state,errorMessage:f.errorMessage}:l.status}));break}}}}});function PS(e){return{...e.temperature!=null&&{temperature:e.temperature},...e.topP!=null&&{topP:e.topP},...e.topK!=null&&{topK:e.topK},...e.maxTokens!=null&&{maxTokens:e.maxTokens}}}async function Hx(e,r,s){const i=await ke(`/api/providers/${e}/models/${encodeURIComponent(r)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!i.ok){const c=await i.json();throw new Error(c.error??"Failed to update model")}return i.json()}function Px(e,r,s,i){return e.map(c=>c.id===r?{...c,models:c.models.map(u=>u.id===s?{...u,...i,source:"user"}:u)}:c)}const FS=3e4;function US(e){switch(e){case"vllm":return"vLLM";case"sglang":return"SGLang";case"ollama":return"Ollama";case"llamacpp":return"llama.cpp";case"openai":return"OpenAI";case"anthropic":return"Anthropic";case"opencode-go":return"OpenCode Go";case"auto":return"Auto";case"unknown":return""}}const Lt=Un((e,r)=>({version:null,model:null,maxContext:2e5,llmUrl:null,llmStatus:"unknown",backend:"unknown",providers:[],activeProviderId:null,defaultModelSelection:null,loading:!1,activating:!1,error:null,autoRefreshInterval:null,fetchConfig:async()=>{e({loading:!0,error:null});try{const s=await ke("/api/config");if(!s.ok)throw new Error("Failed to fetch config");const i=await s.json();e({version:i.version,model:i.model,maxContext:i.maxContext,llmUrl:i.llmUrl,llmStatus:i.llmStatus,backend:i.backend,providers:i.providers??[],activeProviderId:i.activeProviderId??null,defaultModelSelection:i.defaultModelSelection??null,loading:!1})}catch(s){e({error:s instanceof Error?s.message:"Unknown error",loading:!1})}},refreshModel:async()=>{try{const s=await ke("/api/model/refresh",{method:"POST"});if(!s.ok)throw new Error("Failed to refresh model");const i=await s.json(),u=Ce.getState().currentSession;if(u!=null&&u.providerId&&u.providerModel){e({llmStatus:i.llmStatus,backend:i.backend});return}e({model:i.model,llmStatus:i.llmStatus,backend:i.backend})}catch(s){console.error("Failed to refresh model:",s)}},activateProvider:async s=>{const{activeProviderId:i,providers:c}=r();if(s===i)return!0;e({activating:!0,error:null});try{const u=await ke(`/api/providers/${s}/activate`,{method:"POST"});if(!u.ok){const l=await u.json();throw new Error(l.error??"Failed to activate provider")}const f=await u.json();return e({activeProviderId:f.activeProviderId,model:f.model,backend:f.backend,providers:c.map(l=>({...l,isActive:l.id===f.activeProviderId})),activating:!1}),!0}catch(u){return e({error:u instanceof Error?u.message:"Failed to switch provider",activating:!1}),!1}},syncFromSession:(s,i)=>{const{providers:c}=r();e({activeProviderId:s,model:i,defaultModelSelection:`${s}/${i}`,providers:c.map(u=>({...u,isActive:u.id===s}))})},updateModelContext:async(s,i,c)=>{e({activating:!0,error:null});try{const u=await Hx(s,i,{contextWindow:c}),{providers:f}=r();return e({providers:Px(f,s,i,{contextWindow:c}),activating:!1}),u.contextState&&Ce.getState().updateContextState(u.contextState),!0}catch(u){return e({error:u instanceof Error?u.message:"Failed to update model context",activating:!1}),!1}},updateModelSettings:async(s,i,c)=>{e({activating:!0,error:null});try{const u=await Hx(s,i,c),{providers:f}=r(),l={...c.contextWindow!==void 0&&{contextWindow:c.contextWindow},...PS({temperature:c.temperature??void 0,topP:c.topP??void 0,topK:c.topK??void 0,maxTokens:c.maxTokens??void 0})};return e({providers:Px(f,s,i,l),activating:!1}),u.contextState&&Ce.getState().updateContextState(u.contextState),!0}catch(u){return e({error:u instanceof Error?u.message:"Failed to update model settings",activating:!1}),!1}},refreshProviderModels:async s=>{e({activating:!0,error:null});try{const i=await ke(`/api/providers/${s}/refresh`,{method:"POST"});if(!i.ok){const f=await i.json();throw new Error(f.error??"Failed to refresh models")}const c=await i.json(),{providers:u}=r();return e({providers:u.map(f=>f.id===s?{...f,models:c.models}:f),activating:!1}),!0}catch(i){return e({error:i instanceof Error?i.message:"Failed to refresh models",activating:!1}),!1}},startAutoRefresh:()=>{const{autoRefreshInterval:s,refreshModel:i}=r();if(s)return;const c=setInterval(()=>{i()},FS);e({autoRefreshInterval:c})},stopAutoRefresh:()=>{const{autoRefreshInterval:s}=r();s&&(clearInterval(s),e({autoRefreshInterval:null}))},getActiveProvider:()=>{const{providers:s,activeProviderId:i}=r();return s.find(c=>c.id===i)},getModelContext:s=>{const{providers:i,activeProviderId:c}=r(),u=i.find(l=>l.id===c);if(!u)return 2e5;const f=u.models.find(l=>l.id===s);return(f==null?void 0:f.contextWindow)??2e5}})),Qt=Un((e,r)=>({projects:[],currentProject:null,loading:!1,listProjects:async()=>{e({loading:!0});try{const i=await(await ke("/api/projects")).json();e({projects:i.projects??[],loading:!1})}catch{e({loading:!1})}},createProject:async(s,i)=>{try{const c=await ke("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,workdir:i})});if(!c.ok)return null;const u=await c.json();return await r().listProjects(),u.project}catch{return null}},loadProject:async s=>{try{const i=await ke(`/api/projects/${s}`);if(!i.ok)return null;const c=await i.json();return e({currentProject:c.project}),r().projects.length===0&&await r().listProjects(),c.project}catch{return null}},updateProject:async(s,i)=>{var c;try{const u=await ke(`/api/projects/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!u.ok)return null;const f=await u.json();return((c=r().currentProject)==null?void 0:c.id)===s&&e({currentProject:f.project}),await r().listProjects(),f.project}catch{return null}},deleteProject:async s=>{var i;try{return(await ke(`/api/projects/${s}`,{method:"DELETE"})).ok?(await r().listProjects(),((i=r().currentProject)==null?void 0:i.id)===s&&e({currentProject:null}),!0):!1}catch{return!1}},clearProject:()=>{e({currentProject:null})}}));let Ml=[];const Qa=Un()((e,r)=>{function s(){if(Ml.length===0)return;const c=Ml;Ml=[],e(u=>{const f={...u.logs};for(const l of c){const d=f[l.processId]??[];f[l.processId]=[...d,{offset:d.length,content:l.content,timestamp:Date.now(),stream:l.stream}]}return{logs:f}})}const i=Db(s);return{processes:[],logs:{},loading:!1,setProcesses:c=>e({processes:c}),addProcess:c=>e(u=>({processes:[...u.processes,c]})),updateProcess:(c,u)=>e(f=>({processes:f.processes.map(l=>l.id===c?{...l,...u}:l)})),removeProcess:c=>e(u=>({processes:u.processes.filter(f=>f.id!==c),logs:Object.fromEntries(Object.entries(u.logs).filter(([f])=>f!==c))})),stopProcess:async(c,u)=>{try{(await ke(`/api/sessions/${u}/background-process/${c}/stop`,{method:"POST"})).ok&&r().removeProcess(c)}catch{}},appendLog:(c,u,f)=>{Ml.push({processId:c,stream:u,content:f}),i()},setLogs:(c,u)=>e(f=>({logs:{...f.logs,[c]:u}})),clearLogs:c=>e(u=>({logs:{...u.logs,[c]:[]}})),handleMessage:(c,u)=>{switch(c){case"backgroundProcess.started":{const{processId:f,name:l,pid:d,status:p}=u;e(g=>({processes:[...g.processes,{id:f,sessionId:"",name:l,command:"",cwd:"",pid:d,status:p,exitCode:null,createdAt:Date.now(),startedAt:Date.now(),endedAt:null}]}));break}case"backgroundProcess.output":{const f=u.processId,l=u.stream,d=u.content;r().appendLog(f,l,d);break}case"backgroundProcess.exited":{const f=u.processId,l=u.exitCode;e(d=>({processes:d.processes.map(p=>p.id===f?{...p,status:"exited",exitCode:l}:p)}));break}case"backgroundProcess.removed":{const f=u.processId;r().removeProcess(f);break}}}}}),$S=[{key:"complete",label:"Task Complete",description:"When an agent finishes its work"},{key:"waiting_for_user",label:"Waiting for Input",description:"When the agent needs your input"},{key:"phase_done",label:"Phase Done",description:"When a build phase completes successfully"},{key:"phase_blocked",label:"Phase Blocked",description:"When a build phase is blocked and needs intervention"},{key:"new_message",label:"New Message",description:"When a new assistant message starts arriving"}],qS=[{url:"/sounds/notification.mp3",label:"Notification"},{url:"/sounds/waiting-for-user.mp3",label:"Waiting for User"},{url:"/sounds/achievement.mp3",label:"Achievement"},{url:"/sounds/intervention.mp3",label:"Intervention"},{url:"/sounds/typing.mp3",label:"Typing"}],Lb={complete:"/sounds/notification.mp3",waiting_for_user:"/sounds/waiting-for-user.mp3",phase_done:"/sounds/achievement.mp3",phase_blocked:"/sounds/intervention.mp3",new_message:"/sounds/typing.mp3"},ps={soundEnabled:!0,browserNotification:!1,customSoundUrl:null},Rb={soundEnabled:!1,browserNotification:!1,customSoundUrl:null},ph={soundEnabled:!0,browserNotificationEnabled:!1,events:{complete:{...ps},waiting_for_user:{...ps},phase_done:{...ps},phase_blocked:{...ps},new_message:{...Rb}},agentOverrides:{}};function Ob(e,r,s){var u;const i=e.events[r];if(!s)return i;const c=(u=e.agentOverrides[s])==null?void 0:u[r];return c?{soundEnabled:c.soundEnabled??i.soundEnabled,browserNotification:c.browserNotification??i.browserNotification,customSoundUrl:c.customSoundUrl!==void 0?c.customSoundUrl:i.customSoundUrl}:i}const Hs=Un((e,r)=>({settings:ph,loaded:!1,load:()=>{Zt.getState().getSetting(yt.NOTIFICATION_SETTINGS);const i=Zt.subscribe(u=>{const f=u.settings[yt.NOTIFICATION_SETTINGS];if(f!==void 0)try{const l=JSON.parse(f);e({settings:Fx(l),loaded:!0})}catch{e({loaded:!0})}}),c=Zt.getState().settings[yt.NOTIFICATION_SETTINGS];if(c)try{const u=JSON.parse(c);e({settings:Fx(u),loaded:!0})}catch{e({loaded:!0})}return i},update:s=>{e({settings:s}),Fd(s)},updateEvent:(s,i)=>{const c=r().settings,u={...c,events:{...c.events,[s]:{...c.events[s],...i}}};e({settings:u}),Fd(u)},updateAgentOverride:(s,i,c)=>{var d;const u=r().settings,f={...u.agentOverrides};if(c===null){if(f[s]){const p={...f[s]};delete p[i],Object.keys(p).length===0?delete f[s]:f[s]=p}}else f[s]={...f[s],[i]:{...((d=f[s])==null?void 0:d[i])??{},...c}};const l={...u,agentOverrides:f};e({settings:l}),Fd(l)}}));function Fd(e){Zt.getState().setSetting(yt.NOTIFICATION_SETTINGS,JSON.stringify(e))}function Fx(e){var r,s,i,c,u;return{soundEnabled:e.soundEnabled??ph.soundEnabled,browserNotificationEnabled:e.browserNotificationEnabled??ph.browserNotificationEnabled,events:{complete:{...ps,...(r=e.events)==null?void 0:r.complete},waiting_for_user:{...ps,...(s=e.events)==null?void 0:s.waiting_for_user},phase_done:{...ps,...(i=e.events)==null?void 0:i.phase_done},phase_blocked:{...ps,...(c=e.events)==null?void 0:c.phase_blocked},new_message:{...Rb,...(u=e.events)==null?void 0:u.new_message}},agentOverrides:e.agentOverrides??{}}}const Ux=new Map;function WS(e){let r=Ux.get(e);return r||(r=new Audio(e),r.volume=.5,Ux.set(e,r)),r}let Mb=typeof Notification<"u"?Notification.permission:"denied";function VS(){return typeof Notification>"u"?Promise.resolve("denied"):Notification.requestPermission().then(e=>(Mb=e,e))}const GS={complete:"Task Complete",waiting_for_user:"Waiting for Input",phase_done:"Phase Complete",phase_blocked:"Phase Blocked",new_message:"New Message"},KS={complete:"The agent has finished its work.",waiting_for_user:"The agent needs your input to continue.",phase_done:"The build phase completed successfully.",phase_blocked:"The build phase is blocked and needs intervention.",new_message:"A new assistant message is arriving."};function YS(e){typeof Notification>"u"||Mb==="granted"&&(document.hasFocus()||new Notification(GS[e],{body:KS[e],icon:"/fox.svg",tag:`openfox-${e}`}))}function po(e,r){const{settings:s}=Hs.getState(),i=Ob(s,e,r);if(s.soundEnabled&&i.soundEnabled){const c=i.customSoundUrl??Lb[e],u=WS(c);u.currentTime=0,u.play().catch(()=>{})}s.browserNotificationEnabled&&i.browserNotification&&YS(e)}const XS=e=>po("complete",e),ZS=e=>po("phase_done",e),QS=e=>po("phase_blocked",e),$x=e=>po("waiting_for_user",e),JS=e=>po("new_message",e);let Pa=!1,hr=null;const Ud=new Set,Wt={messageId:null,deltaContent:"",thinkingContent:"",toolOutput:[]};let Pi=null,pn=null;function $d(){Pi===null&&(Pi=requestAnimationFrame(()=>{Pi=null,pn==null||pn()}))}function Ms(){Pi!==null&&(cancelAnimationFrame(Pi),Pi=null)}function Pt(e,r){return r!==null&&e.sessionId===r}function ew(e,r,s){return e.id!==void 0||Pt(e,r)||s===!0&&e.sessionId!==void 0}function tw(e,r){return e.includes(r)?e:[...e,r]}function Fa(e,r){return e.filter(s=>s!==r)}function nw(e,r){const s=e.find(c=>c.id===r.id),i=s?{...s,projectId:r.projectId,workdir:r.workdir,mode:r.mode,phase:r.phase,isRunning:r.isRunning,messageCount:r.messages.length,criteriaCount:r.criteria.length,criteriaCompleted:r.criteria.filter(c=>c.status.type==="passed").length}:{id:r.id,projectId:r.projectId,workdir:r.workdir,mode:r.mode,phase:r.phase,isRunning:r.isRunning,createdAt:"",updatedAt:"",criteriaCount:r.criteria.length,criteriaCompleted:r.criteria.filter(c=>c.status.type==="passed").length,messageCount:r.messages.length};return s?e.map(c=>c.id===r.id?i:c):[i,...e]}function rw(e,r,s){return e.map(i=>{const c=(s==null?void 0:s.id)===i.id?s:null,u=r.find(f=>f.id===i.id);return{...i,title:i.title??(u==null?void 0:u.title),mode:(c==null?void 0:c.mode)??(u==null?void 0:u.mode)??i.mode,phase:(c==null?void 0:c.phase)??(u==null?void 0:u.phase)??i.phase,isRunning:(c==null?void 0:c.isRunning)??(u==null?void 0:u.isRunning)??i.isRunning,messageCount:i.messageCount,recentUserPrompts:i.recentUserPrompts}})}const qx=new Map;function Xa(e,r){var u;const s=r===((u=e.currentSession)==null?void 0:u.id)?e.currentSession:null,i=e.sessions.find(f=>f.id===r),c=(s==null?void 0:s.mode)??(i==null?void 0:i.mode);return c==="planner"?"planner":c==="builder"?"build":"planner"}function sw(e,r){if(e.type==="chat.done"){const s=e.payload,i=Xa(r,e.sessionId),c=s.agentType??i;s.reason==="complete"&&XS(c),s.reason==="waiting_for_user"&&$x(c);return}if(e.type==="chat.path_confirmation"){const s=Xa(r,e.sessionId);$x(s);return}if(e.type==="task.completed"){const s=Xa(r,e.sessionId);ZS(s);return}if(e.type==="phase.changed"&&e.sessionId){const s=e.payload,i=qx.get(e.sessionId)??null;if(qx.set(e.sessionId,s.phase),i===s.phase)return;const c=Xa(r,e.sessionId);s.phase==="blocked"&&QS(c)}}const Ce=Un((e,r)=>(pn=()=>{const s=Wt;if(!s.messageId)return;const i=s.deltaContent.length>0,c=s.thinkingContent.length>0,u=s.toolOutput.length>0;if(!i&&!c&&!u)return;const f=s.deltaContent,l=s.thinkingContent,d=s.toolOutput;s.deltaContent="",s.thinkingContent="",s.toolOutput=[],e(p=>{var m;const g=p.streamingMessage;if(g&&g.id===s.messageId){let b={...g};if(i&&(b.content=b.content+f),c&&(b.thinkingContent=(b.thinkingContent??"")+l),u){const _=new Set;b.toolCalls=(m=b.toolCalls)==null?void 0:m.map(C=>{const y=d.filter(v=>v.callId===C.id);return y.length===0?C:(_.add(C.id),{...C,streamingOutput:[...C.streamingOutput??[],...y.map(v=>({stream:v.stream,content:v.content,timestamp:Date.now()}))]})});const E=d.filter(C=>!_.has(C.callId));E.length>0&&Wt.toolOutput.push(...E)}return{streamingMessage:b}}if(u){const b=new Set,_=p.messages.map(C=>{var v;if(C.id!==s.messageId)return C;const y=(v=C.toolCalls)==null?void 0:v.map(x=>{const S=d.filter(j=>j.callId===x.id);return S.length===0?x:(b.add(x.id),{...x,streamingOutput:[...x.streamingOutput??[],...S.map(j=>({stream:j.stream,content:j.content,timestamp:Date.now()}))]})});return{...C,toolCalls:y}}),E=d.filter(C=>!b.has(C.callId));return E.length>0&&Wt.toolOutput.push(...E),{messages:_}}return p})},{connectionStatus:"disconnected",showPasswordModal:!1,passwordModalRetry:!1,sessions:[],currentSession:null,unreadSessionIds:[],messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,subAgentContextStates:{},pendingPathConfirmation:null,pendingQuestion:null,visionFallbackByMessage:{},queuedMessages:[],abortInProgress:!1,error:null,sessionsHasMore:!0,sessionsPaginationLoading:!1,pendingSessionCreate:!1,connect:async()=>{if(r().connectionStatus==="connected")return;e({connectionStatus:"reconnecting"});let i=!1;try{i=(await(await ke("/api/auth")).json()).requiresAuth}catch{}if(i&&!Vt.hasToken()){e({showPasswordModal:!0,passwordModalRetry:!1,connectionStatus:"reconnecting"});return}Vt.onStatusChange(c=>{var u;if(e({connectionStatus:c}),c==="connected"){r().listSessions(void 0);const f=(u=r().currentSession)==null?void 0:u.id;f&&r().loadSession(f)}});try{if(await Vt.connect(),!Pa){Pa=!0;const c=r().handleServerMessage;hr=Vt.subscribe(c)}}catch(c){console.error("Failed to connect:",c);const u=Vt.getLastCloseCode();if(!Vt.hasToken()&&(u===1006||u===4e3)){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}hr&&(hr(),hr=null),Pa=!1,e({connectionStatus:"disconnected"})}},reconnect:()=>{Vt.disconnect(),hr&&(hr(),hr=null),Pa=!1,e({connectionStatus:"disconnected"}),r().connect()},disconnect:()=>{Vt.disconnect(),hr&&(hr(),hr=null),Pa=!1,e({connectionStatus:"disconnected",showPasswordModal:!1})},submitPassword:async s=>{try{const i=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:s})});if(!i.ok){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}const{token:c}=await i.json();Vt.setToken(c),e({showPasswordModal:!1}),r().connect();const{listProjects:u}=Qt.getState(),{fetchConfig:f}=Lt.getState();u(),f(),r().connect()}catch{e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"})}},cancelPassword:()=>{Vt.clearToken(),e({showPasswordModal:!1,connectionStatus:"disconnected"})},createSession:async(s,i)=>{try{e({pendingSessionCreate:!0});const c=await ke("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:s,title:i})});if(!c.ok)return e({pendingSessionCreate:!1}),null;const u=await c.json();return Vt.send("session.load",{sessionId:u.session.id}),u.session}catch{return e({pendingSessionCreate:!1}),null}},loadSession:async s=>{try{const i=r().currentSession;!i||i.id!==s?(Ms(),e({currentSession:null,unreadSessionIds:Fa(r().unreadSessionIds,s),subAgentContextStates:{},messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,pendingPathConfirmation:null,queuedMessages:[],abortInProgress:!1,error:null})):e({unreadSessionIds:Fa(r().unreadSessionIds,s)});const c=await ke(`/api/sessions/${s}`);if(!c.ok)return;const u=await c.json();e({currentSession:u.session,messages:u.messages??[],contextState:u.contextState,queuedMessages:u.queueState??[]}),Vt.send("session.load",{sessionId:s});try{const f=await ke(`/api/sessions/${s}/background-processes`);if(f.ok){const l=await f.json();Qa.getState().setProcesses(l.processes??[])}}catch{}}catch{}},listSessions:async(s,i=20)=>{try{const c=new URLSearchParams;c.set("limit",String(i)),s&&c.set("projectId",s);const f=await(await ke(`/api/sessions?${c.toString()}`)).json();e({sessions:f.sessions??[],sessionsHasMore:s?f.hasMore??!1:!0})}catch{}},loadMoreSessions:async s=>{const i=r();if(!(i.sessionsPaginationLoading||!i.sessionsHasMore)){e({sessionsPaginationLoading:!0});try{const c=new URLSearchParams;c.set("limit","20"),c.set("offset",String(i.sessions.length)),c.set("projectId",s);const f=await(await ke(`/api/sessions?${c.toString()}`)).json();e(l=>({sessions:[...l.sessions,...f.sessions??[]],sessionsHasMore:f.hasMore??!1,sessionsPaginationLoading:!1}))}catch{e({sessionsPaginationLoading:!1})}}},deleteSession:async s=>{var i;try{return(await ke(`/api/sessions/${s}`,{method:"DELETE"})).ok?(await r().listSessions(),((i=r().currentSession)==null?void 0:i.id)===s&&r().clearSession(),!0):!1}catch{return!1}},deleteAllSessions:async s=>{try{return(await ke(`/api/projects/${s}/sessions`,{method:"DELETE"})).ok?(await r().listSessions(),!0):!1}catch{return!1}},clearSession:()=>{Ms(),e(s=>({currentSession:null,messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,unreadSessionIds:s.currentSession?Fa(s.unreadSessionIds,s.currentSession.id):s.unreadSessionIds}))},sendMessage:async(s,i,c)=>{var f;const u=(f=r().currentSession)==null?void 0:f.id;if(u){e({streamingMessageId:null});try{const d=await(await ke(`/api/sessions/${u}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:s,attachments:i,messageKind:c==null?void 0:c.messageKind})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(l){console.error("Error sending message:",l)}}},stopGeneration:async()=>{var i;const s=(i=r().currentSession)==null?void 0:i.id;if(s&&!r().abortInProgress){Ms(),pn==null||pn(),e({abortInProgress:!0});try{await ke(`/api/sessions/${s}/stop`,{method:"POST"})}catch(c){console.error("Error stopping generation:",c)}}},continueGeneration:async()=>{var i;const s=(i=r().currentSession)==null?void 0:i.id;if(s){e({streamingMessageId:null});try{await ke(`/api/sessions/${s}/continue`,{method:"POST"})}catch(c){console.error("Error continuing generation:",c)}}},launchRunner:(s,i,c)=>{e({streamingMessageId:null});const u={};s!=null&&s.trim()&&(u.content=s),i&&i.length>0&&(u.attachments=i),c&&(u.workflowId=c),Vt.send("runner.launch",u)},switchMode:async s=>{var c;const i=(c=r().currentSession)==null?void 0:c.id;if(i)try{const u=await ke(`/api/sessions/${i}/mode`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:s})});if(!u.ok){console.error("Failed to switch mode:",await u.json());return}const f=await u.json();f.session&&e({currentSession:f.session})}catch(u){console.error("Error switching mode:",u)}},switchDangerLevel:async s=>{var c;const i=(c=r().currentSession)==null?void 0:c.id;if(i)try{const u=await ke(`/api/sessions/${i}/danger-level`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({dangerLevel:s})});if(!u.ok){console.error("Failed to switch danger level:",await u.json());return}const f=await u.json();f.session&&e({currentSession:f.session})}catch(u){console.error("Error switching danger level:",u)}},acceptAndBuild:(s,i,c)=>{e({streamingMessageId:null});const u={};s&&(u.workflowId=s),i!=null&&i.trim()&&(u.content=i),c&&c.length>0&&(u.attachments=c),Vt.send("mode.accept",u)},editCriteria:async s=>{var c;const i=(c=r().currentSession)==null?void 0:c.id;if(i)try{const u=await ke(`/api/sessions/${i}/criteria`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({criteria:s})});u.ok||console.error("Failed to update criteria:",await u.json())}catch(u){console.error("Error updating criteria:",u)}},compactContext:()=>{Vt.send("context.compact",{})},setSessionProvider:async(s,i)=>{var c;try{const u=(c=r().currentSession)==null?void 0:c.id;if(!u)return null;const f=await ke(`/api/sessions/${u}/provider`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerId:s,...i?{model:i}:{}})});if(!f.ok)return null;const l=await f.json();return e({currentSession:l.session,messages:l.messages??[],contextState:l.contextState}),l.session}catch{return null}},updateContextState:s=>{e({contextState:s})},updateSubAgentContextState:(s,i)=>{e(c=>({subAgentContextStates:{...c.subAgentContextStates,[s]:i}}))},clearSubAgentContextState:s=>{e(i=>{const c={...i.subAgentContextStates};return delete c[s],{subAgentContextStates:c}})},confirmPath:async(s,i,c=!1)=>{var f;const u=(f=r().currentSession)==null?void 0:f.id;if(u)try{await ke(`/api/sessions/${u}/confirm-path`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callId:s,approved:i,alwaysAllow:c})})}catch(l){console.error("Error confirming path:",l)}},answerQuestion:async(s,i)=>{var u;const c=(u=r().currentSession)==null?void 0:u.id;if(c){try{await ke(`/api/sessions/${c}/answer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callId:s,answer:i})})}catch(f){console.error("Error answering question:",f)}e({pendingQuestion:null})}},queueAsap:async(s,i,c)=>{var f;const u=(f=r().currentSession)==null?void 0:f.id;if(u)try{const d=await(await ke(`/api/sessions/${u}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:s,attachments:i,messageKind:c})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(l){console.error("Error queueing ASAP message:",l)}},queueCompletion:async(s,i,c)=>{var f;const u=(f=r().currentSession)==null?void 0:f.id;if(u)try{const d=await(await ke(`/api/sessions/${u}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:s,attachments:i,messageKind:c})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(l){console.error("Error queueing completion message:",l)}},cancelQueued:async s=>{var c;const i=(c=r().currentSession)==null?void 0:c.id;if(i)try{const f=await(await ke(`/api/sessions/${i}/queue/${s}`,{method:"DELETE"})).json();f.queueState&&e({queuedMessages:f.queueState})}catch(u){console.error("Error canceling queued message:",u)}},clearError:()=>{e({error:null})},resetPendingSessionCreate:()=>{e({pendingSessionCreate:!1})},handleServerMessage:s=>{var f,l,d,p,g,m,b,_,E,C,y,v,x,S,j,T,N,D,A,z,O,q,G,W;const i=r();sw(s,i);const c=((f=i.currentSession)==null?void 0:f.id)??null,u=()=>{const I=s.sessionId;!I||I===c||e($=>({unreadSessionIds:tw($.unreadSessionIds,I)}))};switch(s.type){case"session.state":{const I=s.payload;if(!ew(s,c,i.pendingSessionCreate))break;Ms();const $=I.messages.find(L=>L.isStreaming)??null,B=r().pendingSessionCreate===!0,X=I.pendingConfirmations??[],H=i.pendingPathConfirmation??(X.length>0?X[0]??null:null);if(e({currentSession:I.session,sessions:nw(r().sessions,I.session),unreadSessionIds:Fa(r().unreadSessionIds,I.session.id),messages:I.messages,streamingMessageId:($==null?void 0:$.id)??null,streamingMessage:$,currentTodos:[],pendingPathConfirmation:H,error:null,...B?{pendingSessionCreate:I.session.id}:{}}),I.session.providerId&&I.session.providerModel){const L=Lt.getState();L.providers.find(F=>F.id===I.session.providerId)&&L.syncFromSession(I.session.providerId,I.session.providerModel)}break}case"session.list":{const I=s.payload;e($=>({sessions:rw(I.sessions,$.sessions,$.currentSession)}));break}case"session.deleted":{const I=s.payload;e($=>({unreadSessionIds:Fa($.unreadSessionIds,I.sessionId)})),r().listSessions();break}case"session.deletedAll":{r().listSessions();break}case"session.running":{const I=s.payload,$=s.sessionId,B=(l=r().currentSession)==null?void 0:l.id,X=$&&$!==B;e(Z=>({sessions:Z.sessions.map(H=>H.id===$?{...H,isRunning:I.isRunning}:H)})),X||e(Z=>({currentSession:Z.currentSession?{...Z.currentSession,isRunning:I.isRunning}:null,...I.isRunning?{}:{abortInProgress:!1,queuedMessages:[]}}));break}case"chat.message":{if(!Pt(s,((d=r().currentSession)==null?void 0:d.id)??null)){u();break}const I=s.payload;e($=>$.messages.some(B=>B.id===I.message.id)?$:{messages:[...$.messages,I.message],streamingMessageId:I.message.isStreaming?I.message.id:$.streamingMessageId,streamingMessage:I.message.isStreaming?I.message:$.streamingMessage});break}case"chat.message_updated":{if(!Pt(s,((p=r().currentSession)==null?void 0:p.id)??null)){u();break}const I=s.payload,$=I.updates.isStreaming===!1&&r().streamingMessageId===I.messageId;$&&(Ms(),pn==null||pn()),e(B=>{const X=B.streamingMessage,Z=$;if(X&&X.id===I.messageId){const H={...X,...I.updates};return{messages:B.messages.map(L=>L.id===I.messageId?H:L),streamingMessageId:Z?null:B.streamingMessageId,streamingMessage:Z?null:{...X,...I.updates}}}return{messages:B.messages.map(H=>H.id===I.messageId?{...H,...I.updates}:H),streamingMessageId:Z?null:B.streamingMessageId}});break}case"chat.delta":{if(!Pt(s,((g=r().currentSession)==null?void 0:g.id)??null)){u();break}const I=s.payload;if(!Ud.has(I.messageId)){Ud.add(I.messageId);const $=Xa(r(),s.sessionId);JS($)}Wt.messageId=I.messageId,Wt.deltaContent+=I.content,$d();break}case"chat.thinking":{if(!Pt(s,((m=r().currentSession)==null?void 0:m.id)??null)){u();break}const I=s.payload;Wt.messageId=I.messageId,Wt.thinkingContent+=I.content,$d();break}case"chat.tool_preparing":{if(!Pt(s,((b=r().currentSession)==null?void 0:b.id)??null)){u();break}const I=s.payload;e($=>{const B=$.streamingMessage;return B&&B.id===I.messageId?{streamingMessage:{...B,preparingToolCalls:[...B.preparingToolCalls??[],{index:I.index,name:I.name}]}}:{messages:$.messages.map(X=>X.id===I.messageId?{...X,preparingToolCalls:[...X.preparingToolCalls??[],{index:I.index,name:I.name}]}:X)}});break}case"chat.tool_call":{if(!Pt(s,((_=r().currentSession)==null?void 0:_.id)??null)){u();break}const I=s.payload,$=B=>{var H;const X=(H=B.preparingToolCalls)==null?void 0:H.filter((L,R)=>{var F;return L.name===I.tool?(F=B.preparingToolCalls)==null?void 0:F.slice(0,R).some(ne=>ne.name===I.tool):!0}),Z=Wt.toolOutput.filter(L=>L.callId===I.callId);return Z.length>0&&(Wt.toolOutput=Wt.toolOutput.filter(L=>L.callId!==I.callId)),{...B,toolCalls:[...B.toolCalls??[],{id:I.callId,name:I.tool,arguments:I.args,startedAt:Date.now(),...Z.length>0?{streamingOutput:Z.map(L=>({stream:L.stream,content:L.content,timestamp:Date.now()}))}:{}}],...X&&X.length>0?{preparingToolCalls:X}:{preparingToolCalls:void 0}}};e(B=>{const X=B.streamingMessage;return X&&X.id===I.messageId?{streamingMessage:$(X)}:{messages:B.messages.map(Z=>Z.id===I.messageId?$(Z):Z)}});break}case"chat.tool_output":{if(!Pt(s,((E=r().currentSession)==null?void 0:E.id)??null)){u();break}const I=s.payload;Wt.messageId=I.messageId,Wt.toolOutput.push({messageId:I.messageId,callId:I.callId,stream:I.stream,content:I.output}),$d();break}case"chat.tool_result":{if(!Pt(s,((C=r().currentSession)==null?void 0:C.id)??null)){u();break}const I=s.payload,$=B=>{var Z;const X=(Z=B.toolCalls)==null?void 0:Z.map(H=>H.id===I.callId?{...H,result:I.result}:H);return{...B,toolCalls:X}};e(B=>{const X=B.streamingMessage;return X&&X.id===I.messageId?{streamingMessage:$(X)}:{messages:B.messages.map(Z=>Z.id===I.messageId?$(Z):Z)}});break}case"chat.vision_fallback":{if(!Pt(s,((y=r().currentSession)==null?void 0:y.id)??null)){u();break}const I=s.payload;e($=>{const B=`${I.messageId}-${I.attachmentId}`,X={...$.visionFallbackByMessage};return X[B]={type:I.type,attachmentId:I.attachmentId,filename:I.filename,description:I.description},{visionFallbackByMessage:X}});break}case"chat.todo":{if(!Pt(s,((v=r().currentSession)==null?void 0:v.id)??null)){u();break}const I=s.payload;e({currentTodos:I.todos});break}case"chat.summary":{if(!Pt(s,((x=r().currentSession)==null?void 0:x.id)??null)){u();break}const I=s.payload;e($=>({currentSession:$.currentSession?{...$.currentSession,summary:I.summary}:null}));break}case"chat.progress":{if(!Pt(s,((S=r().currentSession)==null?void 0:S.id)??null)){u();break}const I=s.payload;console.log("Progress:",I.message,I.phase);break}case"chat.format_retry":{if(!Pt(s,((j=r().currentSession)==null?void 0:j.id)??null)){u();break}const I=s.payload;console.log("Format retry:",I.attempt,"/",I.maxAttempts);break}case"chat.done":{if(!Pt(s,((T=r().currentSession)==null?void 0:T.id)??null)){u();break}Ms(),pn==null||pn();const I=s.payload,$=I.stats;Wt.messageId=null,Wt.deltaContent="",Wt.thinkingContent="",Wt.toolOutput=[],Ud.delete(I.messageId),e(B=>{const X=B.streamingMessage,Z=X&&X.id===I.messageId?{...X,isStreaming:!1,stats:$??X.stats}:null;return{messages:B.messages.map(H=>H.id===I.messageId?Z??{...H,isStreaming:!1,stats:$??H.stats}:H),streamingMessageId:null,streamingMessage:null,visionFallbackByMessage:{}}});break}case"chat.error":{if(!Pt(s,((N=r().currentSession)==null?void 0:N.id)??null)){u();break}Ms(),pn==null||pn();const I=s.payload;console.error("Chat error:",I.error,"recoverable:",I.recoverable),I.recoverable||(Wt.messageId=null,Wt.deltaContent="",Wt.thinkingContent="",Wt.toolOutput=[]),e($=>({error:{code:"CHAT_ERROR",message:I.error},streamingMessageId:I.recoverable?$.streamingMessageId:null,...I.recoverable?{}:{messages:$.streamingMessage?$.messages.map(B=>B.id===$.streamingMessage.id?$.streamingMessage:B):$.messages,streamingMessage:null}}));break}case"chat.path_confirmation":{if(!Pt(s,((D=r().currentSession)==null?void 0:D.id)??null)){u();break}const I=s.payload;e({pendingPathConfirmation:{callId:I.callId,tool:I.tool,paths:I.paths,workdir:I.workdir,reason:I.reason}});break}case"chat.ask_user":{if(!Pt(s,((A=r().currentSession)==null?void 0:A.id)??null)){u();return}const I=s.payload;e({pendingQuestion:{callId:I.callId,question:I.question}});break}case"mode.changed":{if(!Pt(s,((z=r().currentSession)==null?void 0:z.id)??null)){u();break}const I=s.payload;e($=>({currentSession:$.currentSession?{...$.currentSession,mode:I.mode}:null}));break}case"phase.changed":{const I=s.payload,$=s.sessionId,B=(O=r().currentSession)==null?void 0:O.id,X=$&&$!==B;e(Z=>({sessions:Z.sessions.map(H=>H.id===$?{...H,phase:I.phase}:H)})),X||e(Z=>({currentSession:Z.currentSession?{...Z.currentSession,phase:I.phase}:null}));break}case"criteria.updated":{if(!Pt(s,((q=r().currentSession)==null?void 0:q.id)??null)){u();break}const I=s.payload;e($=>({currentSession:$.currentSession?{...$.currentSession,criteria:I.criteria}:null}));break}case"context.state":{const I=s.payload,$=Pt(s,((G=r().currentSession)==null?void 0:G.id)??null);I.subAgentId?$&&r().updateSubAgentContextState(I.subAgentId,I.context):$?e({contextState:I.context}):u();break}case"session.name_generated":{const I=s.payload,$=s.sessionId,B=(W=r().currentSession)==null?void 0:W.id;e(X=>{const Z=X.sessions.map(L=>L.id===$?{...L,title:I.name,updatedAt:new Date().toISOString()}:L),H=B===$?X.currentSession?{...X.currentSession,title:I.name,updatedAt:new Date().toISOString()}:null:X.currentSession;return{sessions:Z,currentSession:H}});break}case"queue.state":{const I=s.payload;e({queuedMessages:I.messages});break}case"devServer.output":case"devServer.state":{pr.getState().handleMessage(s);break}case"backgroundProcess.started":case"backgroundProcess.output":case"backgroundProcess.exited":case"backgroundProcess.removed":{Qa.getState().handleMessage(s.type,s.payload);break}case"error":{const I=s.payload;console.error("Server error:",I),e({error:{code:I.code,message:I.message},streamingMessageId:null});break}}}}));function Ib(){return Ce(e=>{var r;return((r=e.currentSession)==null?void 0:r.isRunning)??!1})}function iw(){return Ce(e=>e.queuedMessages)}function aw(){return Ce(e=>e.abortInProgress)}function ow(){const e=Ce(i=>i.connect),r=Ce(i=>i.connectionStatus),s=Hs(i=>i.load);return P.useEffect(()=>{e()},[e]),P.useEffect(()=>{r==="connected"&&s()},[r,s]),{connectionStatus:r}}const Bb=[{key:"color-bg-primary",category:"background",label:"Primary Background",defaultValue:"13 17 23"},{key:"color-bg-secondary",category:"background",label:"Secondary Background",defaultValue:"22 27 34"},{key:"color-bg-tertiary",category:"background",label:"Tertiary Background",defaultValue:"33 38 45"},{key:"color-primary",category:"surface",label:"Primary Surface",defaultValue:"10 10 10"},{key:"color-secondary",category:"surface",label:"Secondary Surface",defaultValue:"20 20 20"},{key:"color-text-primary",category:"text",label:"Primary Text",defaultValue:"139 148 158"},{key:"color-text-secondary",category:"text",label:"Secondary Text",defaultValue:"139 148 158"},{key:"color-text-muted",category:"text",label:"Muted Text",defaultValue:"72 79 88"},{key:"color-accent-primary",category:"accent",label:"Primary Accent",defaultValue:"88 166 255"},{key:"color-accent-success",category:"accent",label:"Success Accent",defaultValue:"63 185 80"},{key:"color-accent-warning",category:"accent",label:"Warning Accent",defaultValue:"210 153 34"},{key:"color-accent-error",category:"accent",label:"Error Accent",defaultValue:"248 81 73"},{key:"color-border",category:"border",label:"Border",defaultValue:"48 53 60"}],Ja=[{id:"dark",name:"Dark",tokens:{"color-bg-primary":"13 17 23","color-bg-secondary":"22 27 34","color-bg-tertiary":"33 38 45","color-primary":"10 10 10","color-secondary":"20 20 20","color-text-primary":"139 148 158","color-text-secondary":"139 148 158","color-text-muted":"72 79 88","color-accent-primary":"88 166 255","color-accent-success":"63 185 80","color-accent-warning":"210 153 34","color-accent-error":"248 81 73","color-border":"48 53 60"}},{id:"light",name:"Light",tokens:{"color-bg-primary":"255 255 255","color-bg-secondary":"250 251 252","color-bg-tertiary":"243 244 246","color-primary":"245 245 245","color-secondary":"229 229 229","color-text-primary":"15 23 42","color-text-secondary":"30 41 59","color-text-muted":"100 116 139","color-accent-primary":"37 99 235","color-accent-success":"22 163 74","color-accent-warning":"217 119 6","color-accent-error":"220 38 38","color-border":"203 213 225"}},{id:"monokai",name:"Monokai",tokens:{"color-bg-primary":"39 40 34","color-bg-secondary":"30 31 28","color-bg-tertiary":"62 61 50","color-primary":"30 31 28","color-secondary":"45 46 39","color-text-primary":"248 248 242","color-text-secondary":"207 207 194","color-text-muted":"117 113 94","color-accent-primary":"102 217 239","color-accent-success":"166 226 46","color-accent-warning":"230 219 116","color-accent-error":"249 38 114","color-border":"73 72 62"}},{id:"dracula",name:"Dracula",tokens:{"color-bg-primary":"40 42 54","color-bg-secondary":"33 34 44","color-bg-tertiary":"68 71 90","color-primary":"30 31 41","color-secondary":"44 46 61","color-text-primary":"248 248 242","color-text-secondary":"230 230 230","color-text-muted":"98 114 164","color-accent-primary":"189 147 249","color-accent-success":"80 250 123","color-accent-warning":"255 184 108","color-accent-error":"255 85 85","color-border":"68 71 90"}},{id:"nord",name:"Nord",tokens:{"color-bg-primary":"46 52 64","color-bg-secondary":"59 66 82","color-bg-tertiary":"67 76 94","color-primary":"46 52 64","color-secondary":"59 66 82","color-text-primary":"236 239 244","color-text-secondary":"229 233 240","color-text-muted":"76 86 106","color-accent-primary":"129 161 193","color-accent-success":"163 190 140","color-accent-warning":"235 203 139","color-accent-error":"191 97 106","color-border":"76 86 106"}}],fs=Un((e,r)=>({currentPreset:"dark",customTokens:{},isCustom:!1,applyPreset:s=>{Ja.find(c=>c.id===s)&&(e({currentPreset:s,customTokens:{},isCustom:!1}),r().applyTheme())},applyTokens:s=>{e({customTokens:s,isCustom:!0,currentPreset:""}),r().applyTheme()},getActiveTheme:()=>{var f;const{currentPreset:s,customTokens:i,isCustom:c}=r();if(c)return{...Bb.reduce((l,d)=>({...l,[d.key]:d.defaultValue}),{}),...i};const u=Ja.find(l=>l.id===s);return(u==null?void 0:u.tokens)??((f=Ja[0])==null?void 0:f.tokens)??{}},applyTheme:()=>{const s=r().getActiveTheme(),i=document.documentElement;Object.entries(s).forEach(([c,u])=>{i.style.setProperty(`--${c}`,u)})},getSavedTheme:()=>{try{const s=localStorage.getItem("openfox:theme");if(s){const i=JSON.parse(s);if(i.preset)return JSON.stringify({preset:i.preset});if(i.tokens)return JSON.stringify({tokens:i.tokens})}}catch{return null}return null},saveTheme:s=>{localStorage.setItem("openfox:theme",s)},clearCustomTheme:()=>{localStorage.removeItem("openfox:theme"),e({isCustom:!1})}}));function lw(e){return JSON.stringify(!e||e==="dark"||e==="light"?{preset:e??"dark"}:{preset:"dark"})}function cw({className:e="w-5 h-5"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}function zb({className:e="w-3.5 h-3.5"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14 5l7 7m0 0l-7 7m7-7H3"})})}function uw({className:e="w-5 h-5"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"})})}function dw({className:e="w-3 h-3 text-text-muted"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})})}function hw({className:e="w-4 h-4"}){return o.jsx("svg",{className:e,viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("path",{d:"M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"})})}function Pr({className:e="w-3.5 h-3.5 text-text-muted"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}function mr({className:e="w-3 h-3 text-text-muted",rotate:r}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,style:r!==void 0?{transform:`rotate(${r}deg)`}:void 0,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function fw({className:e="w-4 h-4"}){return o.jsxs("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",strokeWidth:"2"}),o.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1",strokeWidth:"2"})]})}function oc({className:e="w-3.5 h-3.5"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}function pw({className:e="w-3 h-3"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}function Ih({className:e="w-4 h-4"}){return o.jsxs("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("circle",{cx:"12",cy:"5",r:"2"}),o.jsx("circle",{cx:"12",cy:"12",r:"2"}),o.jsx("circle",{cx:"12",cy:"19",r:"2"})]})}function lc({className:e="w-3.5 h-3.5"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})})}function Yl({className:e="w-5 h-5 text-accent-primary"}){return o.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{d:"M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"})})}function mw({className:e="w-4 h-4"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25"})})}function gw({className:e="w-4 h-4"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})})}function xw({className:e="w-4 h-4"}){return o.jsx("svg",{className:e,viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("path",{d:"M8 0a8.2 8.2 0 0 1 .701.031C9.444.095 9.99.645 10.16 1.29l.288 1.107c.018.066.079.158.212.224.231.114.454.243.668.386.123.082.233.09.299.071l1.1-.303c.652-.18 1.37.008 1.755.653a8.043 8.043 0 0 1 .683 1.18c.227.568.096 1.26-.378 1.726l-.812.804a.312.312 0 0 0-.081.283c.024.166.04.335.04.507s-.016.341-.04.507a.312.312 0 0 0 .08.283l.813.804c.474.466.605 1.158.378 1.726a8.07 8.07 0 0 1-.683 1.18c-.385.645-1.103.833-1.755.653l-1.1-.303c-.066-.019-.176-.011-.299.071a5.1 5.1 0 0 1-.668.386c-.133.066-.194.158-.211.224l-.29 1.107c-.168.645-.714 1.196-1.458 1.26a8.094 8.094 0 0 1-1.402 0c-.744-.064-1.29-.615-1.458-1.26l-.29-1.107a.426.426 0 0 0-.211-.224 5.11 5.11 0 0 1-.668-.386c-.123-.082-.233-.09-.299-.071l-1.1.303c-.652.18-1.37-.008-1.755-.653a8.044 8.044 0 0 1-.683-1.18c-.227-.568-.096-1.26.378-1.726l.812-.804a.312.312 0 0 0 .081-.283A5.18 5.18 0 0 1 2.3 8c0-.172.016-.341.04-.507a.312.312 0 0 0-.08-.283l-.813-.804C.973 5.94.842 5.248 1.069 4.68c.181-.452.395-.882.683-1.18.385-.645 1.103-.833 1.755-.653l1.1.303c.066.019.176.011.299-.071.214-.143.437-.272.668-.386a.426.426 0 0 0 .211-.224l.29-1.107C6.009.645 6.556.095 7.299.03 7.53.01 7.764 0 8 0Zm0 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5Z"})})}function vw({className:e="w-3 h-3"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}function bw({className:e="w-4 h-4"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"})})}function Wx({className:e="w-4 h-4"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}function Hb({className:e="w-[18px] h-[18px]"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[o.jsx("circle",{cx:"12",cy:"5",r:"1.5",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"12",cy:"19",r:"1.5",fill:"currentColor",stroke:"none"})]})}function yw({className:e="w-4 h-4"}){return o.jsxs("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M6.5 3.5H3a1 1 0 0 0-1 1V13a1 1 0 0 0 1 1h8.5a1 1 0 0 0 1-1V9.5"}),o.jsx("path",{d:"M9.5 2h4.5v4.5"}),o.jsx("path",{d:"M14 2L7.5 8.5"})]})}function _w({className:e="w-3 h-3",color:r}){return o.jsx("svg",{className:e,fill:r??"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{d:"M8 5v14l11-7z"})})}function Pb({className:e="w-3 h-3 text-accent-primary"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}function Fb({className:e="",size:r="md"}){const s=r==="sm"?"w-4 h-4":"w-6 h-6";return o.jsxs("svg",{className:`animate-spin ${s} ${e}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}const Ub=Fb,$b=Fb;function Sw({className:e="w-5 h-5"}){return o.jsx("svg",{className:e,viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",clipRule:"evenodd"})})}function ww({className:e="w-4 h-4"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}function Cw({className:e="w-4 h-4"}){return o.jsxs("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}function kw({className:e="w-3 h-3 text-blue-400 animate-spin flex-shrink-0"}){return o.jsxs("svg",{"aria-label":"Session running",className:e,viewBox:"0 0 24 24",fill:"none",children:[o.jsx("title",{children:"Running"}),o.jsx("circle",{className:"opacity-30",cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"3"}),o.jsx("path",{d:"M21 12a9 9 0 00-9-9",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}function Ew({className:e="w-4 h-4"}){return o.jsx("svg",{className:e,viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})})}function jw({className:e="w-3.5 h-3.5 shrink-0",color:r}){return o.jsx("svg",{className:e,fill:"none",stroke:r,viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})}function Nw({className:e="w-4 h-4"}){return o.jsx("svg",{className:e,viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M2 5a2 2 0 012-2h12a2 2 0 012 2v10a2 2 0 01-2 2H4a2 2 0 01-2-2V5zm3 1h10v1H5V6zm10 7H5v1h10v-1zm-10 2H5v1h10v-1z",clipRule:"evenodd"})})}function qb({className:e="w-3.5 h-3.5"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})}function Wb(){return o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}function Tw({className:e="w-4 h-4"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}function Vb({className:e="w-2.5 h-2.5"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}function Gb({className:e="w-4 h-4"}){return o.jsx("svg",{className:e,viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})}function Aw({className:e="w-4 h-4"}){return o.jsx("svg",{className:e,viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("path",{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.55.55 0 0 1 0-.708z"})})}function mh(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const r=Math.random()*16|0;return(e==="x"?r:r&3|8).toString(16)})}function Vx(e,r){const s=Vt.ws;!s||s.readyState!==WebSocket.OPEN||s.send(JSON.stringify({id:mh(),type:e,payload:r}))}const sr=Un((e,r)=>({isOpen:!1,sessions:[],workdir:null,setOpen:s=>e({isOpen:s}),toggleOpen:()=>e(s=>({isOpen:!s.isOpen})),setWorkdir:s=>e({workdir:s}),fetchSessions:async()=>{try{const s=await ke("/api/terminals");if(s.ok){const i=await s.json();e({sessions:i});const c=Vt.ws;if(c&&c.readyState===WebSocket.OPEN)for(const u of i)c.send(JSON.stringify({id:mh(),type:"terminal.subscribe",payload:{sessionId:u.id}}))}}catch(s){console.error("Failed to fetch terminals:",s)}},createSession:async s=>{try{const i=await ke("/api/terminals",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:s??r().workdir??void 0})});if(i.ok){const c=await i.json();e(f=>({sessions:[...f.sessions,c]}));const u=Vt.ws;u&&u.readyState===WebSocket.OPEN&&u.send(JSON.stringify({id:mh(),type:"terminal.subscribe",payload:{sessionId:c.id}}))}}catch(i){console.error("Failed to create terminal:",i)}},writeSession:(s,i)=>{Vx("terminal.write",{sessionId:s,data:i})},resizeSession:(s,i,c)=>{Vx("terminal.resize",{sessionId:s,cols:i,rows:c})},killSession:async s=>{try{(await ke(`/api/terminals/${s}`,{method:"DELETE"})).ok&&e(c=>({sessions:c.sessions.filter(u=>u.id!==s)}))}catch(i){console.error("Failed to kill terminal:",i)}},handleMessage:s=>{switch(s.type){case"terminal.exit":{const{sessionId:i}=s.payload||{};i&&e(c=>{const u=c.sessions.filter(f=>f.id!==i);return u.length===0&&c.isOpen?{sessions:[],isOpen:!1}:{sessions:u}});break}}}}));Vt.subscribe(e=>{var r;(r=e.type)!=null&&r.startsWith("terminal.")&&sr.getState().handleMessage(e)});var mo=yb();const cc=P.forwardRef(({icon:e,iconSize:r="w-3.5 h-3.5",className:s="",...i},c)=>o.jsx("button",{ref:c,type:"button",className:`p-1 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors ${s}`,...i,children:o.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:e})})}));cc.displayName="IconButton";const Dw="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z",Ui=P.forwardRef((e,r)=>o.jsx(cc,{ref:r,icon:Dw,title:"Edit",...e}));Ui.displayName="EditButton";const Lw="M6 18L18 6M6 6l12 12",Bh=P.forwardRef((e,r)=>o.jsx(cc,{ref:r,icon:Lw,...e}));Bh.displayName="CloseButton";const Rw={sm:"max-w-sm",md:"max-w-md",lg:"max-w-2xl",xl:"max-w-4xl",full:"max-w-[95vw] h-[90vh] flex-1"};function At({label:e,title:r,size:s="md",minHeight:i,children:c,footer:u,className:f,onClose:l,isOpen:d,closeOnBackdropClick:p=!0,closeOnEscape:g=!0,showCloseButton:m=!0}){const[b,_]=P.useState(!1),E=d!==void 0,C=E?d:b,y=P.useCallback(()=>{E||_(!0)},[E]),v=P.useCallback(()=>{E||_(!1),l==null||l()},[E,l]);P.useEffect(()=>{if(!C||!g)return;const S=j=>{j.key==="Escape"&&v()};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[C,v,g]);const x=e&&(typeof e=="string"?o.jsx("button",{type:"button",onClick:y,className:f,children:e}):o.jsx("span",{onClick:y,className:f,style:{cursor:"pointer"},children:e}));return o.jsxs(o.Fragment,{children:[x,C&&(typeof document<"u"?mo.createPortal(o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:p?v:void 0}),o.jsxs("div",{className:`relative w-full ${Rw[s]} max-h-[90vh] bg-bg-secondary border border-border rounded shadow-xl flex flex-col`,children:[(r||m)&&o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[r&&o.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:r}),m&&o.jsx(Bh,{onClick:v,className:"ml-auto","aria-label":"Close"})]}),o.jsx("div",{className:"p-4 overflow-y-auto flex-1 min-h-0",style:i?{minHeight:i}:void 0,children:c}),u&&o.jsx("div",{className:"px-4 py-3 border-t border-border",children:u})]})]}),document.body):null)]})}const st=P.forwardRef(({variant:e="secondary",size:r="md",className:s="",children:i,...c},u)=>{const f="rounded font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",l={primary:"bg-accent-primary/25 text-text-primary hover:bg-accent-primary/40",secondary:"bg-bg-tertiary text-text-primary hover:bg-border",danger:"bg-accent-error text-white hover:bg-accent-error/80"},d={sm:"px-1.5 py-1 text-xs",md:"px-3 py-1.5 text-sm",lg:"px-4 py-2 text-base"};return o.jsx("button",{ref:u,className:`${f} ${l[e]} ${d[r]} ${s}`,...c,children:i})});st.displayName="Button";function Ow({value:e,defaultUrl:r,disabled:s,onChange:i}){const c=e??r;return o.jsxs("div",{className:"relative",children:[o.jsx("select",{value:c,disabled:s,onChange:u=>{const f=u.target.value;i(f===r?null:f)},className:"appearance-none bg-bg-tertiary border border-border rounded px-1.5 pr-5 text-xs focus:outline-none focus:ring-1 focus:ring-accent-primary disabled:opacity-40 cursor-pointer",style:{width:"60px"},children:qS.map(({url:u,label:f})=>o.jsx("option",{value:u,title:f,children:f.split(" ")[0]},u))}),o.jsx(mr,{className:"absolute right-0.5 top-1/2 -translate-y-1/2 w-3 h-3 pointer-events-none text-text-muted"})]})}const Gx=[{key:"general",label:"General"},{key:"build",label:"Agent"},{key:"sub-agent",label:"Sub-agent"}];function Mw(){const e=Hs(d=>d.settings),r=Hs(d=>d.update),s=Hs(d=>d.updateEvent),i=Hs(d=>d.updateAgentOverride),c=Hs(d=>d.load);P.useEffect(()=>{c()},[c]);const u=async()=>{await VS()==="granted"&&r({...e,browserNotificationEnabled:!0})},f=(d,p,g,m)=>{d==="general"?s(p,{[g]:m}):i(d,p,{[g]:m})},l=(d,p,g)=>{d==="general"?s(p,{customSoundUrl:g}):i(d,p,{customSoundUrl:g})};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Master Controls"}),o.jsx(Kx,{label:"Sound notifications",description:"Play sounds when events occur",checked:e.soundEnabled,onChange:d=>r({...e,soundEnabled:d})}),o.jsx(Kx,{label:"Browser notifications",description:"Show desktop notifications when the window is not focused",checked:e.browserNotificationEnabled,onChange:d=>{d&&typeof Notification<"u"&&Notification.permission!=="granted"?u():r({...e,browserNotificationEnabled:d})}}),typeof Notification<"u"&&Notification.permission==="denied"&&e.browserNotificationEnabled&&o.jsx("p",{className:"text-xs text-accent-error ml-6",children:"Browser notifications are blocked. Please enable them in your browser settings."})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Notification Settings"}),o.jsx("div",{className:"border border-border rounded overflow-hidden",children:o.jsxs("table",{className:"w-full text-sm",children:[o.jsx("thead",{className:"sticky top-0 bg-bg-tertiary",children:o.jsxs("tr",{className:"border-b border-border",children:[o.jsx("th",{className:"text-left px-3 py-2 text-text-primary font-medium w-40",children:"Event"}),Gx.map(d=>o.jsx("th",{className:"text-center px-2 py-2 text-text-primary font-medium",children:d.label},d.key))]})}),o.jsx("tbody",{children:$S.map(d=>o.jsxs("tr",{className:"border-b border-border last:border-b-0 hover:bg-bg-secondary/50",children:[o.jsx("td",{className:"px-3 py-2",children:o.jsx("div",{className:"text-text-primary text-xs",children:d.label})}),Gx.map(p=>{const g=Ob(e,d.key,p.key==="general"?void 0:p.key),m=Lb[d.key];return o.jsx("td",{className:"px-2 py-2 align-top",children:o.jsxs("div",{className:"flex flex-col items-center gap-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("label",{className:"flex items-center gap-1 text-text-secondary",children:o.jsx("input",{type:"checkbox",checked:g.soundEnabled,onChange:b=>f(p.key,d.key,"soundEnabled",b.target.checked),disabled:!e.soundEnabled,className:"rounded border-border",title:"Sound"})}),o.jsx("label",{className:"flex items-center gap-1 text-text-secondary",children:o.jsx("input",{type:"checkbox",checked:g.browserNotification,onChange:b=>f(p.key,d.key,"browserNotification",b.target.checked),disabled:!e.browserNotificationEnabled,className:"rounded border-border",title:"Browser"})})]}),g.soundEnabled&&e.soundEnabled&&o.jsx(Ow,{value:g.customSoundUrl,defaultUrl:m,disabled:!e.soundEnabled,onChange:b=>l(p.key,d.key,b)})]})},p.key)})]},d.key))})]})})]})]})}function Kx({label:e,description:r,checked:s,onChange:i}){return o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer group",children:[o.jsx("div",{className:"pt-0.5",children:o.jsx("div",{className:`relative w-9 h-5 rounded-full transition-colors ${s?"bg-accent-primary":"bg-bg-tertiary border border-border"}`,onClick:c=>{c.preventDefault(),i(!s)},children:o.jsx("div",{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white shadow transition-transform ${s?"translate-x-4":"translate-x-0.5"}`})})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm text-text-primary group-hover:text-accent-primary transition-colors",children:e}),o.jsx("div",{className:"text-xs text-text-muted",children:r})]})]})}async function zh(e,r){r({loading:!0});try{const i=await(await ke(e)).json();r({defaults:i.defaults??[],userItems:i.userItems??[],loading:!1})}catch{r({loading:!1})}}const Br=Un((e,r)=>({defaults:[],userItems:[],loading:!1,fetchSkills:async()=>{await zh("/api/skills",e)},toggleSkill:async s=>{try{const c=await(await ke(`/api/skills/${s}/toggle`,{method:"POST"})).json();e(u=>({defaults:u.defaults.map(f=>f.id===s?{...f,enabled:c.enabled}:f),userItems:u.userItems.map(f=>f.id===s?{...f,enabled:c.enabled}:f)}))}catch{}},fetchSkill:async s=>{try{const i=await ke(`/api/skills/${s}`);return i.ok?await i.json():null}catch{return null}},fetchDefaultContent:async s=>{try{const i=await ke(`/api/skills/defaults/${s}`);return i.ok?await i.json():null}catch{return null}},createSkill:async s=>{const i=await gs("POST","/api/skills",s);return i.success&&await r().fetchSkills(),i},updateSkill:async(s,i)=>{const c=await gs("PUT",`/api/skills/${s}`,i);return c.success&&await r().fetchSkills(),c},deleteSkill:async s=>{try{const i=await ke(`/api/skills/${s}`,{method:"DELETE"}),c=await i.json();return i.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==s)})),{success:!0}):{success:!1,error:c.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateSkill:async s=>{try{const i=await ke(`/api/skills/${s}/duplicate`,{method:"POST"}),c=await i.json();return i.ok?(await r().fetchSkills(),{success:!0}):{success:!1,error:c.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}));function Hh(){const[e,r]=P.useState({id:null,type:null}),s=P.useCallback(u=>r({id:u,type:"delete"}),[]),i=P.useCallback(()=>r({id:null,type:null}),[]),c=P.useCallback((u,f)=>e.id===u&&e.type===f,[e.id,e.type]);return{requestDelete:s,clearConfirm:i,isConfirming:c}}function Ph({onConfirm:e,onCancel:r}){return o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:e,className:"px-1.5 py-0.5 rounded text-xs hover:opacity-90 transition-colors bg-accent-error/20 text-accent-error hover:bg-accent-error/30",children:"Delete"}),o.jsx("button",{onClick:r,className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]})}function Fh({onClick:e}){return o.jsx("button",{onClick:e,className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-accent-error transition-colors",title:"Delete",children:o.jsx(qb,{})})}function so({onClick:e}){return o.jsx("button",{onClick:e,className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-text-primary transition-colors",title:"Duplicate",children:o.jsx(oc,{})})}function Ps({label:e,value:r,onChange:s,placeholder:i,readOnly:c,hint:u,mono:f}){return o.jsxs("div",{children:[o.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:[e,u&&o.jsx("span",{className:"text-text-muted ml-1",children:u})]}),o.jsx("input",{value:r,onChange:l=>s(l.target.value),readOnly:c,placeholder:i,className:`w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary ${f?"font-mono":""} ${c?"opacity-60":""}`})]})}function Iw({onCancel:e,onSave:r,saving:s,saveDisabled:i}){return o.jsxs("div",{className:"flex justify-end gap-2 pt-2 border-t border-border",children:[o.jsx(st,{variant:"secondary",onClick:e,children:"Cancel"}),o.jsx(st,{variant:"primary",onClick:r,disabled:s||i,children:s?"Saving...":"Save"})]})}function Uh({message:e}){return o.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded",children:e})}function Kb({description:e,onNew:r,newLabel:s="+ New"}){return o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:e}),o.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:o.jsx(st,{variant:"primary",size:"sm",onClick:r,children:s})})]})}function Yb({isBuiltIn:e,isConfirmingDelete:r,onView:s,onEdit:i,onDuplicate:c,onDelete:u,children:f}){return o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsx("div",{className:"min-w-0 flex-1 mr-3",children:f}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e&&s&&o.jsx("button",{onClick:s,className:"p-1.5 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors",title:"View",children:o.jsx(lc,{})}),o.jsx(so,{onClick:c}),!e&&i&&o.jsx(Ui,{onClick:i}),!e&&(r?o.jsx(Ph,{onConfirm:()=>{u==null||u()},onCancel:()=>{}}):o.jsx(Fh,{onClick:()=>u==null?void 0:u()}))]})]})}function Bw({id:e,name:r,description:s,isBuiltIn:i,isConfirmingDelete:c,onView:u,onEdit:f,onDuplicate:l,onDelete:d}){return o.jsxs(Yb,{isBuiltIn:i,isConfirmingDelete:c,onView:u,onEdit:f,onDuplicate:l,onDelete:d,children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-text-primary text-sm font-medium",children:r}),o.jsx("span",{className:"text-text-muted text-xs font-mono",children:e})]}),s&&o.jsx("p",{className:"text-text-muted text-xs truncate",children:s})]})}function Xb({loading:e,hasItems:r,loadingLabel:s,emptyLabel:i,children:c}){return e&&!r?o.jsx("div",{className:"text-text-muted text-sm",children:s}):r?o.jsx("div",{className:"space-y-4",children:c}):i?o.jsx("div",{className:"text-text-muted text-sm",children:i}):null}function Zb({name:e,id:r,nameLabel:s="Name",idLabel:i="ID",namePlaceholder:c="My Item",idPlaceholder:u="my-item",nameHint:f,readOnlyId:l=!1,readOnlyHint:d="(read-only)",onNameChange:p,onIdChange:g}){return o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ps,{label:s,value:e,onChange:p,placeholder:c,hint:f}),o.jsx(Ps,{label:i,value:r,onChange:g,readOnly:l,placeholder:u,hint:l?d:void 0,mono:!0})]})}function Qb(e={}){const{initialData:r={}}=e,[s,i]=P.useState("list"),[c,u]=P.useState(null),[f,l]=P.useState(""),[d,p]=P.useState(!1),[g,m]=P.useState(r),b=P.useCallback(()=>{m(r),l(""),u(null)},[r]),_=P.useCallback(v=>{i(v),v==="list"&&b()},[b]),E=P.useCallback(v=>{m(x=>typeof v=="function"?v(x):v)},[]),C=P.useCallback((v,x={})=>{u(v),i("edit"),m({...x}),l("")},[]),y=P.useCallback(()=>{u(null),i("edit"),m(r),l("")},[r]);return{view:s,editingId:c,formError:f,saving:d,formData:g,setView:_,setEditingId:u,setFormError:l,setFormData:E,setSaving:p,resetForm:b,startEditing:C,startNew:y}}function $h(){return o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 mt-3 bg-accent-warning/10 border border-accent-warning/30 rounded text-xs",children:[o.jsx("span",{children:"⚠️"}),o.jsx("p",{className:"text-text-secondary",children:"Editing this value now will have the side-effect of invalidating KV-cache, causing your next message in current sessions to take a long time to process. Consider doing this between sessions."})]})}function Yx({skill:e,isBuiltIn:r,isConfirmingDelete:s,onView:i,onEdit:c,onDuplicate:u,onDelete:f}){return o.jsx(Bw,{id:e.id,name:e.name,description:e.description,isBuiltIn:r,isConfirmingDelete:s,onView:i,onEdit:c,onDuplicate:u,onDelete:f})}function zw({isOpen:e}){const r=Br(I=>I.defaults),s=Br(I=>I.userItems),i=Br(I=>I.loading),c=Br(I=>I.fetchSkills),u=Br(I=>I.fetchSkill),f=Br(I=>I.fetchDefaultContent),l=Br(I=>I.createSkill),d=Br(I=>I.updateSkill),p=Br(I=>I.deleteSkill),{view:g,editingId:m,formError:b,saving:_,formData:E,setView:C,setEditingId:y,setFormError:v,setFormData:x,setSaving:S}=Qb(),{clearConfirm:j}=Hh();P.useEffect(()=>{e&&(c(),C("list"),y(null),j())},[e,c,j]);const T=(I,$,B,X)=>{x({name:X??I.metadata.name,id:B??I.metadata.id,description:I.metadata.description??"",version:I.metadata.version??"1.0.0",prompt:I.prompt,isReadOnly:$})},N=async I=>{if(r.some(B=>B.id===I)){const B=await f(I);if(!B)return;T(B,!0),y(I),v(""),C("edit")}else{const B=await u(I);if(!B)return;T(B,!0),y(I),v(""),C("edit")}},D=async I=>{const B=r.some(Z=>Z.id===I)?await f(I):await u(I);if(!B)return;const X=`${I}-copy-${Date.now()}`;T(B,!1,X,`${B.metadata.name} (copy)`),y(null),v(""),C("edit")},A=()=>{x({name:"",id:"",description:"",version:"1.0.0",prompt:"",isReadOnly:!1}),C("edit")},z=async I=>{const $=await u(I);$&&(T($,!1),y(I),v(""),C("edit"))},O=async I=>{await p(I),j()},q=async()=>{const I=m??E.id;if(!I||!E.name||!E.prompt){v("Name, ID, and prompt are required.");return}S(!0),v("");const $={metadata:{id:I,name:E.name,description:E.description,version:E.version},prompt:E.prompt},B=m?await d(m,$):await l($);if(S(!1),!B.success){v(B.error??"Failed to save skill.");return}C("list")},G=I=>{x($=>({...$,name:I})),m||x($=>({...$,id:I.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}))},W=E.isReadOnly;return g==="edit"?o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex justify-between items-center mb-3",children:[o.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:W?E.name:m?"Edit Skill":"New Skill"}),o.jsx("button",{onClick:()=>C("list"),className:"text-text-muted hover:text-text-primary",children:"Cancel"})]}),b&&o.jsx(Uh,{message:b}),o.jsxs("div",{className:"space-y-3 mb-3",children:[o.jsx(Zb,{name:E.name,id:E.id,nameLabel:"Name",idLabel:"ID",namePlaceholder:"My Skill",idPlaceholder:"my-skill",readOnlyId:!0,onNameChange:G,onIdChange:()=>{}}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ps,{label:"Description",value:E.description,onChange:I=>x($=>({...$,description:I})),placeholder:"What this skill does...",readOnly:W}),o.jsx(Ps,{label:"Version",value:E.version,onChange:I=>x($=>({...$,version:I})),placeholder:"1.0.0",readOnly:W})]})]}),o.jsxs("div",{className:"flex-1 min-h-[120px] border-t border-border pt-3 flex flex-col",children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Prompt"}),o.jsx("textarea",{value:E.prompt,onChange:I=>x($=>({...$,prompt:I.target.value})),readOnly:W,placeholder:"The system prompt for this skill...",className:"h-80 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-y focus:outline-none focus:ring-1 focus:ring-accent-primary"})]}),o.jsx($h,{}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-border flex-shrink-0",children:[o.jsx(st,{variant:"secondary",onClick:()=>C("list"),children:"Cancel"}),W?o.jsx(st,{variant:"primary",onClick:()=>{x(I=>({...I,name:I.name+" (copy)",id:`${m}-copy-${Date.now()}`,isReadOnly:!1})),y(null)},children:"Duplicate & Customize"}):o.jsx(st,{variant:"primary",onClick:q,disabled:_||!E.name||!E.id||!E.prompt,children:_?"Saving...":"Save"})]})]}):o.jsxs("div",{children:[o.jsx(Kb,{description:"Skills provide domain-specific knowledge that agents can load on demand.",onNew:A}),o.jsxs(Xb,{loading:i,hasItems:r.length>0||s.length>0,loadingLabel:"Loading skills...",emptyLabel:"No skills created yet.",children:[r.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Built-in"}),o.jsx("div",{className:"space-y-2",children:r.map(I=>o.jsx(Yx,{skill:I,isBuiltIn:!0,isConfirmingDelete:!1,onView:()=>N(I.id),onDuplicate:()=>D(I.id)},I.id))})]}),s.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Custom"}),o.jsx("div",{className:"space-y-2",children:s.map(I=>o.jsx(Yx,{skill:I,isBuiltIn:!1,isConfirmingDelete:!1,onView:()=>N(I.id),onEdit:()=>z(I.id),onDuplicate:()=>D(I.id),onDelete:()=>O(I.id)},I.id))})]})]})]})}function Hw(e){const r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r){const s=parseInt(r[1]??"0",16),i=parseInt(r[2]??"0",16),c=parseInt(r[3]??"0",16);return`${s} ${i} ${c}`}return e}function Il(e){const r=e.split(" ").map(s=>parseInt(s,10));return r.length===3&&r.every(s=>!isNaN(s))?`#${r.map(s=>(s??0).toString(16).padStart(2,"0")).join("")}`:e}function Pw(){var v;const[e,r]=P.useState(!1),[s,i]=P.useState({}),c=fs(x=>x.currentPreset),u=fs(x=>x.isCustom),f=fs(x=>x.applyPreset),l=fs(x=>x.applyTokens),d=fs(x=>x.saveTheme),p=fs(x=>x.getActiveTheme),g=x=>{f(x),d(JSON.stringify({preset:x}))},m=()=>{e||i(p()),r(!e)},b=(x,S)=>{const j=S.startsWith("#")?Hw(S):S,T={...s,[x]:j};i(T),l(T)},_=()=>{l(s),d(JSON.stringify({tokens:s})),r(!1)},E=()=>{r(!1),i({}),c&&f(c)},C=Bb.reduce((x,S)=>{const j=S.category;return x[j]||(x[j]=[]),x[j].push(S),x},{}),y={background:"Backgrounds",surface:"Surfaces",text:"Text",accent:"Accents",border:"Border"};return o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Theme"}),o.jsx("div",{className:"grid grid-cols-5 gap-2",children:Ja.map(x=>o.jsxs("button",{type:"button",onClick:()=>g(x.id),className:`flex flex-col items-center gap-2 px-3 py-3 rounded-lg border transition-colors ${c===x.id&&!u?"border-accent-primary bg-bg-tertiary text-text-primary":"border-border bg-bg-secondary text-text-muted hover:border-text-muted"}`,children:[o.jsx("div",{className:"w-8 h-8 rounded border flex items-center justify-center",style:{backgroundColor:Il(x.tokens["color-bg-primary"]??"#000"),borderColor:Il(x.tokens["color-border"]??"#000")},children:o.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Il(x.tokens["color-text-primary"]??"#fff")}})}),o.jsx("span",{className:"text-xs",children:x.name})]},x.id))}),o.jsx("button",{type:"button",onClick:m,className:"flex items-center gap-2 text-sm text-accent-primary hover:underline",children:e?"Hide":"Customize"}),e&&o.jsxs("div",{className:"space-y-4 p-4 bg-bg-secondary rounded-lg border border-border",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Custom Theme"}),u&&c&&o.jsxs("button",{type:"button",onClick:E,className:"text-xs text-accent-primary hover:underline",children:["Reset to ",(v=Ja.find(x=>x.id===c))==null?void 0:v.name]})]}),Object.entries(C).map(([x,S])=>o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-medium text-text-muted uppercase",children:y[x]??x}),o.jsx("div",{className:"grid grid-cols-2 gap-3",children:S.map(j=>o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("label",{htmlFor:j.key,className:"text-xs text-text-muted",children:j.label}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("input",{type:"color",id:j.key,value:Il(s[j.key]??j.defaultValue),onChange:T=>b(j.key,T.target.value),className:"w-8 h-8 rounded cursor-pointer border border-border bg-transparent"}),o.jsx("input",{type:"text",value:s[j.key]??j.defaultValue,onChange:T=>b(j.key,T.target.value),className:"flex-1 px-2 py-1 bg-bg-tertiary border border-border rounded text-xs text-text-primary font-mono focus:outline-none focus:ring-1 focus:ring-accent-primary"})]})]},j.key))})]},x)),o.jsx("button",{type:"button",onClick:_,className:"px-4 py-2 bg-accent-primary text-white rounded hover:bg-accent-primary/80 transition-colors text-sm",children:"Save Custom Theme"})]})]})}function Fw({isOpen:e,onClose:r}){const[s,i]=P.useState("instructions");return o.jsx(At,{isOpen:e,onClose:r,title:"Settings",size:"xl",minHeight:"500px",children:o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex border-b border-border mb-4 -mt-1",children:[o.jsx(Ua,{label:"Instructions",active:s==="instructions",onClick:()=>i("instructions")}),o.jsx(Ua,{label:"Skills",active:s==="skills",onClick:()=>i("skills")}),o.jsx(Ua,{label:"Notifications",active:s==="notifications",onClick:()=>i("notifications")}),o.jsx(Ua,{label:"Display",active:s==="display",onClick:()=>i("display")}),o.jsx(Ua,{label:"Advanced",active:s==="advanced",onClick:()=>i("advanced")})]}),s==="instructions"&&o.jsx(Ww,{isOpen:e}),s==="skills"&&o.jsx(zw,{isOpen:e}),s==="notifications"&&o.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:o.jsx(Mw,{})}),s==="display"&&o.jsx(qw,{}),s==="advanced"&&o.jsx(Uw,{onClose:r})]})})}function Uw({onClose:e}){const[,r]=gr();function s(){e(),r("/onboarding")}return o.jsx("div",{className:"space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary mb-1",children:"Onboarding"}),o.jsx("p",{className:"text-sm text-text-muted mb-4",children:"Reset your OpenFox setup and go through the initial configuration again."}),o.jsx(st,{variant:"secondary",onClick:s,children:"Launch Onboarding"})]})})}function $w(){return o.jsx(Pw,{})}function qw(){const e=Zt(g=>g.settings),r=Zt(g=>g.loading),s=Zt(g=>g.getSetting),i=Zt(g=>g.setSetting),c=r[yt.DISPLAY_SHOW_THINKING]??!1,u=[{key:yt.DISPLAY_SHOW_THINKING,label:"Show thinking blocks",description:"Display AI reasoning content in the feed"},{key:yt.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT,label:"Show expanded tool output",description:"Always show full tool call details instead of compact view"},{key:yt.DISPLAY_SHOW_STATS,label:"Show stats bar",description:"Display model, tokens, and timing information"},{key:yt.DISPLAY_SHOW_AGENT_DEFINITIONS,label:"Show agent definitions",description:"Display agent definition injections in the feed"},{key:yt.DISPLAY_SHOW_WORKFLOW_BARS,label:"Show workflow bars",description:"Display workflow start and end markers"}],f=Object.fromEntries(u.map(g=>[g.key,e[g.key]??"true"])),[l,d]=P.useState(()=>Object.fromEntries(u.map(g=>[g.key,f[g.key]==="true"])));P.useEffect(()=>{u.forEach(g=>s(g.key))},[s]),P.useEffect(()=>{d(Object.fromEntries(u.map(g=>[g.key,f[g.key]==="true"])))},[JSON.stringify(f)]);const p=async g=>{const m=String(!l[g]);d(b=>({...b,[g]:!b[g]})),await i(g,m)};return c?o.jsx("div",{className:"text-sm text-text-muted",children:"Loading..."}):o.jsxs("div",{className:"space-y-6",children:[o.jsx($w,{}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary mb-4",children:"Feed Display"}),o.jsx("div",{className:"space-y-4",children:u.map(({key:g,label:m,description:b})=>o.jsxs("label",{className:"flex items-center justify-between cursor-pointer",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-sm text-text-primary",children:m}),o.jsx("div",{className:"text-xs text-text-muted",children:b})]}),o.jsx("button",{type:"button",onClick:()=>p(g),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${l[g]?"bg-accent-primary":"bg-bg-tertiary"}`,children:o.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${l[g]?"translate-x-6":"translate-x-1"}`})})]},g))})]})]})}function Ua({label:e,active:r,onClick:s}){return o.jsx("button",{onClick:s,className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${r?"border-accent-primary text-accent-primary":"border-transparent text-text-muted hover:text-text-secondary hover:border-border"}`,children:e})}function Ww({isOpen:e}){const r=Zt(y=>y.settings),s=Zt(y=>y.loading),i=Zt(y=>y.getSetting),c=Zt(y=>y.setSetting),u=r[yt.GLOBAL_INSTRUCTIONS]??"",f=s[yt.GLOBAL_INSTRUCTIONS]??!1,[l,d]=P.useState(u),[p,g]=P.useState(!1),[m,b]=P.useState(!1);P.useEffect(()=>{e&&i(yt.GLOBAL_INSTRUCTIONS)},[e,i]),P.useEffect(()=>{d(u),g(!1)},[u]);const _=async()=>{b(!0),c(yt.GLOBAL_INSTRUCTIONS,l),b(!1),g(!1)},E=()=>{d(u),g(!1)},C=f||m;return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-primary mb-2",children:"Global Instructions"}),o.jsx("p",{className:"text-sm text-text-muted mb-2",children:"These instructions are injected into every prompt, regardless of project."}),o.jsx("textarea",{value:l,onChange:y=>{d(y.target.value),g(!0)},placeholder:"Enter global instructions that apply to all projects...",className:"w-full min-h-80 px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-y focus:outline-none focus:ring-1 focus:ring-accent-primary",disabled:C})]}),p&&o.jsx($h,{}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(st,{variant:"secondary",onClick:E,disabled:!p,children:"Discard"}),o.jsx(st,{variant:"primary",onClick:_,disabled:!p||C,children:m?"Saving...":"Save"})]})]})}var qd={exports:{}},Xx;function Vw(){return Xx||(Xx=1,(function(e,r){(function(s,i){e.exports=i()})(globalThis,(()=>(()=>{var s={4567:function(f,l,d){var p=this&&this.__decorate||function(x,S,j,T){var N,D=arguments.length,A=D<3?S:T===null?T=Object.getOwnPropertyDescriptor(S,j):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,S,j,T);else for(var z=x.length-1;z>=0;z--)(N=x[z])&&(A=(D<3?N(A):D>3?N(S,j,A):N(S,j))||A);return D>3&&A&&Object.defineProperty(S,j,A),A},g=this&&this.__param||function(x,S){return function(j,T){S(j,T,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.AccessibilityManager=void 0;const m=d(9042),b=d(9924),_=d(844),E=d(4725),C=d(2585),y=d(3656);let v=l.AccessibilityManager=class extends _.Disposable{constructor(x,S,j,T){super(),this._terminal=x,this._coreBrowserService=j,this._renderService=T,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let N=0;N<this._terminal.rows;N++)this._rowElements[N]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[N]);if(this._topBoundaryFocusListener=N=>this._handleBoundaryFocus(N,0),this._bottomBoundaryFocusListener=N=>this._handleBoundaryFocus(N,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new b.TimeBasedDebouncer(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((N=>this._handleResize(N.rows)))),this.register(this._terminal.onRender((N=>this._refreshRows(N.start,N.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((N=>this._handleChar(N)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
58
+ `)))),this.register(this._terminal.onA11yTab((N=>this._handleTab(N)))),this.register(this._terminal.onKey((N=>this._handleKey(N.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,y.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,_.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(x){for(let S=0;S<x;S++)this._handleChar(" ")}_handleChar(x){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==x&&(this._charsToAnnounce+=x):this._charsToAnnounce+=x,x===`
59
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=m.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(x){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(x)||this._charsToConsume.push(x)}_refreshRows(x,S){this._liveRegionDebouncer.refresh(x,S,this._terminal.rows)}_renderRows(x,S){const j=this._terminal.buffer,T=j.lines.length.toString();for(let N=x;N<=S;N++){const D=j.lines.get(j.ydisp+N),A=[],z=(D==null?void 0:D.translateToString(!0,void 0,void 0,A))||"",O=(j.ydisp+N+1).toString(),q=this._rowElements[N];q&&(z.length===0?(q.innerText=" ",this._rowColumns.set(q,[0,1])):(q.textContent=z,this._rowColumns.set(q,A)),q.setAttribute("aria-posinset",O),q.setAttribute("aria-setsize",T))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(x,S){const j=x.target,T=this._rowElements[S===0?1:this._rowElements.length-2];if(j.getAttribute("aria-posinset")===(S===0?"1":`${this._terminal.buffer.lines.length}`)||x.relatedTarget!==T)return;let N,D;if(S===0?(N=j,D=this._rowElements.pop(),this._rowContainer.removeChild(D)):(N=this._rowElements.shift(),D=j,this._rowContainer.removeChild(N)),N.removeEventListener("focus",this._topBoundaryFocusListener),D.removeEventListener("focus",this._bottomBoundaryFocusListener),S===0){const A=this._createAccessibilityTreeNode();this._rowElements.unshift(A),this._rowContainer.insertAdjacentElement("afterbegin",A)}else{const A=this._createAccessibilityTreeNode();this._rowElements.push(A),this._rowContainer.appendChild(A)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(S===0?-1:1),this._rowElements[S===0?1:this._rowElements.length-2].focus(),x.preventDefault(),x.stopImmediatePropagation()}_handleSelectionChange(){var z;if(this._rowElements.length===0)return;const x=document.getSelection();if(!x)return;if(x.isCollapsed)return void(this._rowContainer.contains(x.anchorNode)&&this._terminal.clearSelection());if(!x.anchorNode||!x.focusNode)return void console.error("anchorNode and/or focusNode are null");let S={node:x.anchorNode,offset:x.anchorOffset},j={node:x.focusNode,offset:x.focusOffset};if((S.node.compareDocumentPosition(j.node)&Node.DOCUMENT_POSITION_PRECEDING||S.node===j.node&&S.offset>j.offset)&&([S,j]=[j,S]),S.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(S={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(S.node))return;const T=this._rowElements.slice(-1)[0];if(j.node.compareDocumentPosition(T)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(j={node:T,offset:((z=T.textContent)==null?void 0:z.length)??0}),!this._rowContainer.contains(j.node))return;const N=({node:O,offset:q})=>{const G=O instanceof Text?O.parentNode:O;let W=parseInt(G==null?void 0:G.getAttribute("aria-posinset"),10)-1;if(isNaN(W))return console.warn("row is invalid. Race condition?"),null;const I=this._rowColumns.get(G);if(!I)return console.warn("columns is null. Race condition?"),null;let $=q<I.length?I[q]:I.slice(-1)[0]+1;return $>=this._terminal.cols&&(++W,$=0),{row:W,column:$}},D=N(S),A=N(j);if(D&&A){if(D.row>A.row||D.row===A.row&&D.column>=A.column)throw new Error("invalid range");this._terminal.select(D.column,D.row,(A.row-D.row)*this._terminal.cols-D.column+A.column)}}_handleResize(x){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let S=this._rowContainer.children.length;S<this._terminal.rows;S++)this._rowElements[S]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[S]);for(;this._rowElements.length>x;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const x=this._coreBrowserService.mainDocument.createElement("div");return x.setAttribute("role","listitem"),x.tabIndex=-1,this._refreshRowDimensions(x),x}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let x=0;x<this._terminal.rows;x++)this._refreshRowDimensions(this._rowElements[x])}}_refreshRowDimensions(x){x.style.height=`${this._renderService.dimensions.css.cell.height}px`}};l.AccessibilityManager=v=p([g(1,C.IInstantiationService),g(2,E.ICoreBrowserService),g(3,E.IRenderService)],v)},3614:(f,l)=>{function d(b){return b.replace(/\r?\n/g,"\r")}function p(b,_){return _?"\x1B[200~"+b+"\x1B[201~":b}function g(b,_,E,C){b=p(b=d(b),E.decPrivateModes.bracketedPasteMode&&C.rawOptions.ignoreBracketedPasteMode!==!0),E.triggerDataEvent(b,!0),_.value=""}function m(b,_,E){const C=E.getBoundingClientRect(),y=b.clientX-C.left-10,v=b.clientY-C.top-10;_.style.width="20px",_.style.height="20px",_.style.left=`${y}px`,_.style.top=`${v}px`,_.style.zIndex="1000",_.focus()}Object.defineProperty(l,"__esModule",{value:!0}),l.rightClickHandler=l.moveTextAreaUnderMouseCursor=l.paste=l.handlePasteEvent=l.copyHandler=l.bracketTextForPaste=l.prepareTextForTerminal=void 0,l.prepareTextForTerminal=d,l.bracketTextForPaste=p,l.copyHandler=function(b,_){b.clipboardData&&b.clipboardData.setData("text/plain",_.selectionText),b.preventDefault()},l.handlePasteEvent=function(b,_,E,C){b.stopPropagation(),b.clipboardData&&g(b.clipboardData.getData("text/plain"),_,E,C)},l.paste=g,l.moveTextAreaUnderMouseCursor=m,l.rightClickHandler=function(b,_,E,C,y){m(b,_,E),y&&C.rightClickSelect(b),_.value=C.selectionText,_.select()}},7239:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorContrastCache=void 0;const p=d(1505);l.ColorContrastCache=class{constructor(){this._color=new p.TwoKeyMap,this._css=new p.TwoKeyMap}setCss(g,m,b){this._css.set(g,m,b)}getCss(g,m){return this._css.get(g,m)}setColor(g,m,b){this._color.set(g,m,b)}getColor(g,m){return this._color.get(g,m)}clear(){this._color.clear(),this._css.clear()}}},3656:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.addDisposableDomListener=void 0,l.addDisposableDomListener=function(d,p,g,m){d.addEventListener(p,g,m);let b=!1;return{dispose:()=>{b||(b=!0,d.removeEventListener(p,g,m))}}}},3551:function(f,l,d){var p=this&&this.__decorate||function(v,x,S,j){var T,N=arguments.length,D=N<3?x:j===null?j=Object.getOwnPropertyDescriptor(x,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(v,x,S,j);else for(var A=v.length-1;A>=0;A--)(T=v[A])&&(D=(N<3?T(D):N>3?T(x,S,D):T(x,S))||D);return N>3&&D&&Object.defineProperty(x,S,D),D},g=this&&this.__param||function(v,x){return function(S,j){x(S,j,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Linkifier=void 0;const m=d(3656),b=d(8460),_=d(844),E=d(2585),C=d(4725);let y=l.Linkifier=class extends _.Disposable{get currentLink(){return this._currentLink}constructor(v,x,S,j,T){super(),this._element=v,this._mouseService=x,this._renderService=S,this._bufferService=j,this._linkProviderService=T,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new b.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new b.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,_.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,_.toDisposable)((()=>{var N;this._lastMouseEvent=void 0,(N=this._activeProviderReplies)==null||N.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,m.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,m.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(v){this._lastMouseEvent=v;const x=this._positionFromMouseEvent(v,this._element,this._mouseService);if(!x)return;this._isMouseOut=!1;const S=v.composedPath();for(let j=0;j<S.length;j++){const T=S[j];if(T.classList.contains("xterm"))break;if(T.classList.contains("xterm-hover"))return}this._lastBufferCell&&x.x===this._lastBufferCell.x&&x.y===this._lastBufferCell.y||(this._handleHover(x),this._lastBufferCell=x)}_handleHover(v){if(this._activeLine!==v.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(v,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,v)||(this._clearCurrentLink(),this._askForLink(v,!0))}_askForLink(v,x){var j,T;this._activeProviderReplies&&x||((j=this._activeProviderReplies)==null||j.forEach((N=>{N==null||N.forEach((D=>{D.link.dispose&&D.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=v.y);let S=!1;for(const[N,D]of this._linkProviderService.linkProviders.entries())x?(T=this._activeProviderReplies)!=null&&T.get(N)&&(S=this._checkLinkProviderResult(N,v,S)):D.provideLinks(v.y,(A=>{var O,q;if(this._isMouseOut)return;const z=A==null?void 0:A.map((G=>({link:G})));(O=this._activeProviderReplies)==null||O.set(N,z),S=this._checkLinkProviderResult(N,v,S),((q=this._activeProviderReplies)==null?void 0:q.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(v.y,this._activeProviderReplies)}))}_removeIntersectingLinks(v,x){const S=new Set;for(let j=0;j<x.size;j++){const T=x.get(j);if(T)for(let N=0;N<T.length;N++){const D=T[N],A=D.link.range.start.y<v?0:D.link.range.start.x,z=D.link.range.end.y>v?this._bufferService.cols:D.link.range.end.x;for(let O=A;O<=z;O++){if(S.has(O)){T.splice(N--,1);break}S.add(O)}}}}_checkLinkProviderResult(v,x,S){var N;if(!this._activeProviderReplies)return S;const j=this._activeProviderReplies.get(v);let T=!1;for(let D=0;D<v;D++)this._activeProviderReplies.has(D)&&!this._activeProviderReplies.get(D)||(T=!0);if(!T&&j){const D=j.find((A=>this._linkAtPosition(A.link,x)));D&&(S=!0,this._handleNewLink(D))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!S)for(let D=0;D<this._activeProviderReplies.size;D++){const A=(N=this._activeProviderReplies.get(D))==null?void 0:N.find((z=>this._linkAtPosition(z.link,x)));if(A){S=!0,this._handleNewLink(A);break}}return S}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(v){if(!this._currentLink)return;const x=this._positionFromMouseEvent(v,this._element,this._mouseService);x&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,x)&&this._currentLink.link.activate(v,this._currentLink.link.text)}_clearCurrentLink(v,x){this._currentLink&&this._lastMouseEvent&&(!v||!x||this._currentLink.link.range.start.y>=v&&this._currentLink.link.range.end.y<=x)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,_.disposeArray)(this._linkCacheDisposables))}_handleNewLink(v){if(!this._lastMouseEvent)return;const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._linkAtPosition(v.link,x)&&(this._currentLink=v,this._currentLink.state={decorations:{underline:v.link.decorations===void 0||v.link.decorations.underline,pointerCursor:v.link.decorations===void 0||v.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,v.link,this._lastMouseEvent),v.link.decorations={},Object.defineProperties(v.link.decorations,{pointerCursor:{get:()=>{var S,j;return(j=(S=this._currentLink)==null?void 0:S.state)==null?void 0:j.decorations.pointerCursor},set:S=>{var j;(j=this._currentLink)!=null&&j.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:()=>{var S,j;return(j=(S=this._currentLink)==null?void 0:S.state)==null?void 0:j.decorations.underline},set:S=>{var j,T,N;(j=this._currentLink)!=null&&j.state&&((N=(T=this._currentLink)==null?void 0:T.state)==null?void 0:N.decorations.underline)!==S&&(this._currentLink.state.decorations.underline=S,this._currentLink.state.isHovered&&this._fireUnderlineEvent(v.link,S))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((S=>{if(!this._currentLink)return;const j=S.start===0?0:S.start+1+this._bufferService.buffer.ydisp,T=this._bufferService.buffer.ydisp+1+S.end;if(this._currentLink.link.range.start.y>=j&&this._currentLink.link.range.end.y<=T&&(this._clearCurrentLink(j,T),this._lastMouseEvent)){const N=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);N&&this._askForLink(N,!1)}}))))}_linkHover(v,x,S){var j;(j=this._currentLink)!=null&&j.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!0),this._currentLink.state.decorations.pointerCursor&&v.classList.add("xterm-cursor-pointer")),x.hover&&x.hover(S,x.text)}_fireUnderlineEvent(v,x){const S=v.range,j=this._bufferService.buffer.ydisp,T=this._createLinkUnderlineEvent(S.start.x-1,S.start.y-j-1,S.end.x,S.end.y-j-1,void 0);(x?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(T)}_linkLeave(v,x,S){var j;(j=this._currentLink)!=null&&j.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!1),this._currentLink.state.decorations.pointerCursor&&v.classList.remove("xterm-cursor-pointer")),x.leave&&x.leave(S,x.text)}_linkAtPosition(v,x){const S=v.range.start.y*this._bufferService.cols+v.range.start.x,j=v.range.end.y*this._bufferService.cols+v.range.end.x,T=x.y*this._bufferService.cols+x.x;return S<=T&&T<=j}_positionFromMouseEvent(v,x,S){const j=S.getCoords(v,x,this._bufferService.cols,this._bufferService.rows);if(j)return{x:j[0],y:j[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(v,x,S,j,T){return{x1:v,y1:x,x2:S,y2:j,cols:this._bufferService.cols,fg:T}}};l.Linkifier=y=p([g(1,C.IMouseService),g(2,C.IRenderService),g(3,E.IBufferService),g(4,C.ILinkProviderService)],y)},9042:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.tooMuchOutput=l.promptLabel=void 0,l.promptLabel="Terminal input",l.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(f,l,d){var p=this&&this.__decorate||function(C,y,v,x){var S,j=arguments.length,T=j<3?y:x===null?x=Object.getOwnPropertyDescriptor(y,v):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(C,y,v,x);else for(var N=C.length-1;N>=0;N--)(S=C[N])&&(T=(j<3?S(T):j>3?S(y,v,T):S(y,v))||T);return j>3&&T&&Object.defineProperty(y,v,T),T},g=this&&this.__param||function(C,y){return function(v,x){y(v,x,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkProvider=void 0;const m=d(511),b=d(2585);let _=l.OscLinkProvider=class{constructor(C,y,v){this._bufferService=C,this._optionsService=y,this._oscLinkService=v}provideLinks(C,y){var z;const v=this._bufferService.buffer.lines.get(C-1);if(!v)return void y(void 0);const x=[],S=this._optionsService.rawOptions.linkHandler,j=new m.CellData,T=v.getTrimmedLength();let N=-1,D=-1,A=!1;for(let O=0;O<T;O++)if(D!==-1||v.hasContent(O)){if(v.loadCell(O,j),j.hasExtendedAttrs()&&j.extended.urlId){if(D===-1){D=O,N=j.extended.urlId;continue}A=j.extended.urlId!==N}else D!==-1&&(A=!0);if(A||D!==-1&&O===T-1){const q=(z=this._oscLinkService.getLinkData(N))==null?void 0:z.uri;if(q){const G={start:{x:D+1,y:C},end:{x:O+(A||O!==T-1?0:1),y:C}};let W=!1;if(!(S!=null&&S.allowNonHttpProtocols))try{const I=new URL(q);["http:","https:"].includes(I.protocol)||(W=!0)}catch{W=!0}W||x.push({text:q,range:G,activate:(I,$)=>S?S.activate(I,$,G):E(0,$),hover:(I,$)=>{var B;return(B=S==null?void 0:S.hover)==null?void 0:B.call(S,I,$,G)},leave:(I,$)=>{var B;return(B=S==null?void 0:S.leave)==null?void 0:B.call(S,I,$,G)}})}A=!1,j.hasExtendedAttrs()&&j.extended.urlId?(D=O,N=j.extended.urlId):(D=-1,N=-1)}}y(x)}};function E(C,y){if(confirm(`Do you want to navigate to ${y}?
60
+
61
+ WARNING: This link could potentially be dangerous`)){const v=window.open();if(v){try{v.opener=null}catch{}v.location.href=y}else console.warn("Opening link blocked as opener could not be cleared")}}l.OscLinkProvider=_=p([g(0,b.IBufferService),g(1,b.IOptionsService),g(2,b.IOscLinkService)],_)},6193:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.RenderDebouncer=void 0,l.RenderDebouncer=class{constructor(d,p){this._renderCallback=d,this._coreBrowserService=p,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(d){return this._refreshCallbacks.push(d),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(d,p,g){this._rowCount=g,d=d!==void 0?d:0,p=p!==void 0?p:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,d):d,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,p):p,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const d=Math.max(this._rowStart,0),p=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(d,p),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const d of this._refreshCallbacks)d(0);this._refreshCallbacks=[]}}},3236:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Terminal=void 0;const p=d(3614),g=d(3656),m=d(3551),b=d(9042),_=d(3730),E=d(1680),C=d(3107),y=d(5744),v=d(2950),x=d(1296),S=d(428),j=d(4269),T=d(5114),N=d(8934),D=d(3230),A=d(9312),z=d(4725),O=d(6731),q=d(8055),G=d(8969),W=d(8460),I=d(844),$=d(6114),B=d(8437),X=d(2584),Z=d(7399),H=d(5941),L=d(9074),R=d(2585),F=d(5435),U=d(4567),ne=d(779);class Q extends G.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(Y={}){super(Y),this.browser=$,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new I.MutableDisposable),this._onCursorMove=this.register(new W.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new W.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new W.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new W.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new W.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new W.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new W.EventEmitter),this._onBlur=this.register(new W.EventEmitter),this._onA11yCharEmitter=this.register(new W.EventEmitter),this._onA11yTabEmitter=this.register(new W.EventEmitter),this._onWillOpen=this.register(new W.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(L.DecorationService),this._instantiationService.setService(R.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ne.LinkProviderService),this._instantiationService.setService(z.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(_.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((V,oe)=>this.refresh(V,oe)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((V=>this._reportWindowsOptions(V)))),this.register(this._inputHandler.onColor((V=>this._handleColorEvent(V)))),this.register((0,W.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,W.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,W.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,W.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((V=>this._afterResize(V.cols,V.rows)))),this.register((0,I.toDisposable)((()=>{var V,oe;this._customKeyEventHandler=void 0,(oe=(V=this.element)==null?void 0:V.parentNode)==null||oe.removeChild(this.element)})))}_handleColorEvent(Y){if(this._themeService)for(const V of Y){let oe,re="";switch(V.index){case 256:oe="foreground",re="10";break;case 257:oe="background",re="11";break;case 258:oe="cursor",re="12";break;default:oe="ansi",re="4;"+V.index}switch(V.type){case 0:const ve=q.color.toColorRGB(oe==="ansi"?this._themeService.colors.ansi[V.index]:this._themeService.colors[oe]);this.coreService.triggerDataEvent(`${X.C0.ESC}]${re};${(0,H.toRgbString)(ve)}${X.C1_ESCAPED.ST}`);break;case 1:if(oe==="ansi")this._themeService.modifyColors((be=>be.ansi[V.index]=q.channels.toColor(...V.color)));else{const be=oe;this._themeService.modifyColors((Le=>Le[be]=q.channels.toColor(...V.color)))}break;case 2:this._themeService.restoreColor(V.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(Y){Y?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(Y){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var Y;return(Y=this.textarea)==null?void 0:Y.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const Y=this.buffer.ybase+this.buffer.y,V=this.buffer.lines.get(Y);if(!V)return;const oe=Math.min(this.buffer.x,this.cols-1),re=this._renderService.dimensions.css.cell.height,ve=V.getWidth(oe),be=this._renderService.dimensions.css.cell.width*ve,Le=this.buffer.y*this._renderService.dimensions.css.cell.height,Oe=oe*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Oe+"px",this.textarea.style.top=Le+"px",this.textarea.style.width=be+"px",this.textarea.style.height=re+"px",this.textarea.style.lineHeight=re+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,g.addDisposableDomListener)(this.element,"copy",(V=>{this.hasSelection()&&(0,p.copyHandler)(V,this._selectionService)})));const Y=V=>(0,p.handlePasteEvent)(V,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",Y)),this.register((0,g.addDisposableDomListener)(this.element,"paste",Y)),$.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(V=>{V.button===2&&(0,p.rightClickHandler)(V,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",(V=>{(0,p.rightClickHandler)(V,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),$.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",(V=>{V.button===1&&(0,p.moveTextAreaUnderMouseCursor)(V,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,g.addDisposableDomListener)(this.textarea,"keyup",(Y=>this._keyUp(Y)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keydown",(Y=>this._keyDown(Y)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keypress",(Y=>this._keyPress(Y)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionupdate",(Y=>this._compositionHelper.compositionupdate(Y)))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,g.addDisposableDomListener)(this.textarea,"input",(Y=>this._inputEvent(Y)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(Y){var oe;if(!Y)throw new Error("Terminal requires a parent element.");if(Y.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((oe=this.element)==null?void 0:oe.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=Y.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"),Y.appendChild(this.element);const V=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),V.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,g.addDisposableDomListener)(this.screenElement,"mousemove",(re=>this.updateCursorStyle(re)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),V.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",b.promptLabel),$.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(T.CoreBrowserService,this.textarea,Y.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(z.ICoreBrowserService,this._coreBrowserService),this.register((0,g.addDisposableDomListener)(this.textarea,"focus",(re=>this._handleTextAreaFocus(re)))),this.register((0,g.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(S.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(z.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(O.ThemeService),this._instantiationService.setService(z.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(j.CharacterJoinerService),this._instantiationService.setService(z.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(D.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(z.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((re=>this._onRender.fire(re)))),this.onResize((re=>this._renderService.resize(re.cols,re.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(v.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(N.MouseService),this._instantiationService.setService(z.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(m.Linkifier,this.screenElement)),this.element.appendChild(V);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(E.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((re=>this.scrollLines(re.amount,re.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(A.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(z.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((re=>this.scrollLines(re.amount,re.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((re=>this._renderService.handleSelectionChanged(re.start,re.end,re.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((re=>{this.textarea.value=re,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((re=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,g.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(C.BufferDecorationRenderer,this.screenElement)),this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(re=>this._selectionService.handleMouseDown(re)))),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(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(re=>this._handleScreenReaderModeOptionChange(re)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(y.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(re=>{!this._overviewRulerRenderer&&re&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(y.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(x.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const Y=this,V=this.element;function oe(be){const Le=Y._mouseService.getMouseReportCoords(be,Y.screenElement);if(!Le)return!1;let Oe,ze;switch(be.overrideType||be.type){case"mousemove":ze=32,be.buttons===void 0?(Oe=3,be.button!==void 0&&(Oe=be.button<3?be.button:3)):Oe=1&be.buttons?0:4&be.buttons?1:2&be.buttons?2:3;break;case"mouseup":ze=0,Oe=be.button<3?be.button:3;break;case"mousedown":ze=1,Oe=be.button<3?be.button:3;break;case"wheel":if(Y._customWheelEventHandler&&Y._customWheelEventHandler(be)===!1||Y.viewport.getLinesScrolled(be)===0)return!1;ze=be.deltaY<0?0:1,Oe=4;break;default:return!1}return!(ze===void 0||Oe===void 0||Oe>4)&&Y.coreMouseService.triggerMouseEvent({col:Le.col,row:Le.row,x:Le.x,y:Le.y,button:Oe,action:ze,ctrl:be.ctrlKey,alt:be.altKey,shift:be.shiftKey})}const re={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ve={mouseup:be=>(oe(be),be.buttons||(this._document.removeEventListener("mouseup",re.mouseup),re.mousedrag&&this._document.removeEventListener("mousemove",re.mousedrag)),this.cancel(be)),wheel:be=>(oe(be),this.cancel(be,!0)),mousedrag:be=>{be.buttons&&oe(be)},mousemove:be=>{be.buttons||oe(be)}};this.register(this.coreMouseService.onProtocolChange((be=>{be?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(be)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&be?re.mousemove||(V.addEventListener("mousemove",ve.mousemove),re.mousemove=ve.mousemove):(V.removeEventListener("mousemove",re.mousemove),re.mousemove=null),16&be?re.wheel||(V.addEventListener("wheel",ve.wheel,{passive:!1}),re.wheel=ve.wheel):(V.removeEventListener("wheel",re.wheel),re.wheel=null),2&be?re.mouseup||(re.mouseup=ve.mouseup):(this._document.removeEventListener("mouseup",re.mouseup),re.mouseup=null),4&be?re.mousedrag||(re.mousedrag=ve.mousedrag):(this._document.removeEventListener("mousemove",re.mousedrag),re.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,g.addDisposableDomListener)(V,"mousedown",(be=>{if(be.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(be))return oe(be),re.mouseup&&this._document.addEventListener("mouseup",re.mouseup),re.mousedrag&&this._document.addEventListener("mousemove",re.mousedrag),this.cancel(be)}))),this.register((0,g.addDisposableDomListener)(V,"wheel",(be=>{if(!re.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(be)===!1)return!1;if(!this.buffer.hasScrollback){const Le=this.viewport.getLinesScrolled(be);if(Le===0)return;const Oe=X.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(be.deltaY<0?"A":"B");let ze="";for(let We=0;We<Math.abs(Le);We++)ze+=Oe;return this.coreService.triggerDataEvent(ze,!0),this.cancel(be,!0)}return this.viewport.handleWheel(be)?this.cancel(be):void 0}}),{passive:!1})),this.register((0,g.addDisposableDomListener)(V,"touchstart",(be=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(be),this.cancel(be)}),{passive:!0})),this.register((0,g.addDisposableDomListener)(V,"touchmove",(be=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(be)?void 0:this.cancel(be)}),{passive:!1}))}refresh(Y,V){var oe;(oe=this._renderService)==null||oe.refreshRows(Y,V)}updateCursorStyle(Y){var V;(V=this._selectionService)!=null&&V.shouldColumnSelect(Y)?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(Y,V,oe=0){var re;oe===1?(super.scrollLines(Y,V,oe),this.refresh(0,this.rows-1)):(re=this.viewport)==null||re.scrollLines(Y)}paste(Y){(0,p.paste)(Y,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(Y){this._customKeyEventHandler=Y}attachCustomWheelEventHandler(Y){this._customWheelEventHandler=Y}registerLinkProvider(Y){return this._linkProviderService.registerLinkProvider(Y)}registerCharacterJoiner(Y){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const V=this._characterJoinerService.register(Y);return this.refresh(0,this.rows-1),V}deregisterCharacterJoiner(Y){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(Y)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(Y){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+Y)}registerDecoration(Y){return this._decorationService.registerDecoration(Y)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(Y,V,oe){this._selectionService.setSelection(Y,V,oe)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var Y;(Y=this._selectionService)==null||Y.clearSelection()}selectAll(){var Y;(Y=this._selectionService)==null||Y.selectAll()}selectLines(Y,V){var oe;(oe=this._selectionService)==null||oe.selectLines(Y,V)}_keyDown(Y){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(Y)===!1)return!1;const V=this.browser.isMac&&this.options.macOptionIsMeta&&Y.altKey;if(!V&&!this._compositionHelper.keydown(Y))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;V||Y.key!=="Dead"&&Y.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const oe=(0,Z.evaluateKeyboardEvent)(Y,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(Y),oe.type===3||oe.type===2){const re=this.rows-1;return this.scrollLines(oe.type===2?-re:re),this.cancel(Y,!0)}return oe.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,Y)||(oe.cancel&&this.cancel(Y,!0),!oe.key||!!(Y.key&&!Y.ctrlKey&&!Y.altKey&&!Y.metaKey&&Y.key.length===1&&Y.key.charCodeAt(0)>=65&&Y.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(oe.key!==X.C0.ETX&&oe.key!==X.C0.CR||(this.textarea.value=""),this._onKey.fire({key:oe.key,domEvent:Y}),this._showCursor(),this.coreService.triggerDataEvent(oe.key,!0),!this.optionsService.rawOptions.screenReaderMode||Y.altKey||Y.ctrlKey?this.cancel(Y,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(Y,V){const oe=Y.isMac&&!this.options.macOptionIsMeta&&V.altKey&&!V.ctrlKey&&!V.metaKey||Y.isWindows&&V.altKey&&V.ctrlKey&&!V.metaKey||Y.isWindows&&V.getModifierState("AltGraph");return V.type==="keypress"?oe:oe&&(!V.keyCode||V.keyCode>47)}_keyUp(Y){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(Y)===!1||((function(V){return V.keyCode===16||V.keyCode===17||V.keyCode===18})(Y)||this.focus(),this.updateCursorStyle(Y),this._keyPressHandled=!1)}_keyPress(Y){let V;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(Y)===!1)return!1;if(this.cancel(Y),Y.charCode)V=Y.charCode;else if(Y.which===null||Y.which===void 0)V=Y.keyCode;else{if(Y.which===0||Y.charCode===0)return!1;V=Y.which}return!(!V||(Y.altKey||Y.ctrlKey||Y.metaKey)&&!this._isThirdLevelShift(this.browser,Y)||(V=String.fromCharCode(V),this._onKey.fire({key:V,domEvent:Y}),this._showCursor(),this.coreService.triggerDataEvent(V,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(Y){if(Y.data&&Y.inputType==="insertText"&&(!Y.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const V=Y.data;return this.coreService.triggerDataEvent(V,!0),this.cancel(Y),!0}return!1}resize(Y,V){Y!==this.cols||V!==this.rows?super.resize(Y,V):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(Y,V){var oe,re;(oe=this._charSizeService)==null||oe.measure(),(re=this.viewport)==null||re.syncScrollArea(!0)}clear(){var Y;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 V=1;V<this.rows;V++)this.buffer.lines.push(this.buffer.getBlankLine(B.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(Y=this.viewport)==null||Y.reset(),this.refresh(0,this.rows-1)}}reset(){var V,oe;this.options.rows=this.rows,this.options.cols=this.cols;const Y=this._customKeyEventHandler;this._setup(),super.reset(),(V=this._selectionService)==null||V.reset(),this._decorationService.reset(),(oe=this.viewport)==null||oe.reset(),this._customKeyEventHandler=Y,this.refresh(0,this.rows-1)}clearTextureAtlas(){var Y;(Y=this._renderService)==null||Y.clearTextureAtlas()}_reportFocus(){var Y;(Y=this.element)!=null&&Y.classList.contains("focus")?this.coreService.triggerDataEvent(X.C0.ESC+"[I"):this.coreService.triggerDataEvent(X.C0.ESC+"[O")}_reportWindowsOptions(Y){if(this._renderService)switch(Y){case F.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const V=this._renderService.dimensions.css.canvas.width.toFixed(0),oe=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${X.C0.ESC}[4;${oe};${V}t`);break;case F.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const re=this._renderService.dimensions.css.cell.width.toFixed(0),ve=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${X.C0.ESC}[6;${ve};${re}t`)}}cancel(Y,V){if(this.options.cancelEvents||V)return Y.preventDefault(),Y.stopPropagation(),!1}}l.Terminal=Q},9924:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TimeBasedDebouncer=void 0,l.TimeBasedDebouncer=class{constructor(d,p=1e3){this._renderCallback=d,this._debounceThresholdMS=p,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(d,p,g){this._rowCount=g,d=d!==void 0?d:0,p=p!==void 0?p:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,d):d,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,p):p;const m=Date.now();if(m-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=m,this._innerRefresh();else if(!this._additionalRefreshRequested){const b=m-this._lastRefreshMs,_=this._debounceThresholdMS-b;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),_)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const d=Math.max(this._rowStart,0),p=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(d,p)}}},1680:function(f,l,d){var p=this&&this.__decorate||function(v,x,S,j){var T,N=arguments.length,D=N<3?x:j===null?j=Object.getOwnPropertyDescriptor(x,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(v,x,S,j);else for(var A=v.length-1;A>=0;A--)(T=v[A])&&(D=(N<3?T(D):N>3?T(x,S,D):T(x,S))||D);return N>3&&D&&Object.defineProperty(x,S,D),D},g=this&&this.__param||function(v,x){return function(S,j){x(S,j,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Viewport=void 0;const m=d(3656),b=d(4725),_=d(8460),E=d(844),C=d(2585);let y=l.Viewport=class extends E.Disposable{constructor(v,x,S,j,T,N,D,A){super(),this._viewportElement=v,this._scrollArea=x,this._bufferService=S,this._optionsService=j,this._charSizeService=T,this._renderService=N,this._coreBrowserService=D,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new _.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,m.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((z=>this._activeBuffer=z.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((z=>this._renderDimensions=z))),this._handleThemeChange(A.colors),this.register(A.onChangeColors((z=>this._handleThemeChange(z)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(v){this._viewportElement.style.backgroundColor=v.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(v){if(v)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const x=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==x&&(this._lastRecordedBufferHeight=x,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const v=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==v&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=v),this._refreshAnimationFrame=null}syncScrollArea(v=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(v);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(v)}_handleScroll(v){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const x=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:x,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const v=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(v*(this._smoothScrollState.target-this._smoothScrollState.origin)),v<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(v,x){const S=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(x<0&&this._viewportElement.scrollTop!==0||x>0&&S<this._lastRecordedBufferHeight)||(v.cancelable&&v.preventDefault(),!1)}handleWheel(v){const x=this._getPixelsScrolled(v);return x!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+x:this._smoothScrollState.target+=x,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=x,this._bubbleScroll(v,x))}scrollLines(v){if(v!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const x=v*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+x,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:v,suppressScrollEvent:!1})}_getPixelsScrolled(v){if(v.deltaY===0||v.shiftKey)return 0;let x=this._applyScrollModifier(v.deltaY,v);return v.deltaMode===WheelEvent.DOM_DELTA_LINE?x*=this._currentRowHeight:v.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._currentRowHeight*this._bufferService.rows),x}getBufferElements(v,x){var A;let S,j="";const T=[],N=x??this._bufferService.buffer.lines.length,D=this._bufferService.buffer.lines;for(let z=v;z<N;z++){const O=D.get(z);if(!O)continue;const q=(A=D.get(z+1))==null?void 0:A.isWrapped;if(j+=O.translateToString(!q),!q||z===D.length-1){const G=document.createElement("div");G.textContent=j,T.push(G),j.length>0&&(S=G),j=""}}return{bufferElements:T,cursorElement:S}}getLinesScrolled(v){if(v.deltaY===0||v.shiftKey)return 0;let x=this._applyScrollModifier(v.deltaY,v);return v.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(x/=this._currentRowHeight+0,this._wheelPartialScroll+=x,x=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):v.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._bufferService.rows),x}_applyScrollModifier(v,x){const S=this._optionsService.rawOptions.fastScrollModifier;return S==="alt"&&x.altKey||S==="ctrl"&&x.ctrlKey||S==="shift"&&x.shiftKey?v*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:v*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(v){this._lastTouchY=v.touches[0].pageY}handleTouchMove(v){const x=this._lastTouchY-v.touches[0].pageY;return this._lastTouchY=v.touches[0].pageY,x!==0&&(this._viewportElement.scrollTop+=x,this._bubbleScroll(v,x))}};l.Viewport=y=p([g(2,C.IBufferService),g(3,C.IOptionsService),g(4,b.ICharSizeService),g(5,b.IRenderService),g(6,b.ICoreBrowserService),g(7,b.IThemeService)],y)},3107:function(f,l,d){var p=this&&this.__decorate||function(C,y,v,x){var S,j=arguments.length,T=j<3?y:x===null?x=Object.getOwnPropertyDescriptor(y,v):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(C,y,v,x);else for(var N=C.length-1;N>=0;N--)(S=C[N])&&(T=(j<3?S(T):j>3?S(y,v,T):S(y,v))||T);return j>3&&T&&Object.defineProperty(y,v,T),T},g=this&&this.__param||function(C,y){return function(v,x){y(v,x,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferDecorationRenderer=void 0;const m=d(4725),b=d(844),_=d(2585);let E=l.BufferDecorationRenderer=class extends b.Disposable{constructor(C,y,v,x,S){super(),this._screenElement=C,this._bufferService=y,this._coreBrowserService=v,this._decorationService=x,this._renderService=S,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((j=>this._removeDecoration(j)))),this.register((0,b.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const C of this._decorationService.decorations)this._renderDecoration(C);this._dimensionsChanged=!1}_renderDecoration(C){this._refreshStyle(C),this._dimensionsChanged&&this._refreshXPosition(C)}_createElement(C){var x;const y=this._coreBrowserService.mainDocument.createElement("div");y.classList.add("xterm-decoration"),y.classList.toggle("xterm-decoration-top-layer",((x=C==null?void 0:C.options)==null?void 0:x.layer)==="top"),y.style.width=`${Math.round((C.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,y.style.height=(C.options.height||1)*this._renderService.dimensions.css.cell.height+"px",y.style.top=(C.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",y.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const v=C.options.x??0;return v&&v>this._bufferService.cols&&(y.style.display="none"),this._refreshXPosition(C,y),y}_refreshStyle(C){const y=C.marker.line-this._bufferService.buffers.active.ydisp;if(y<0||y>=this._bufferService.rows)C.element&&(C.element.style.display="none",C.onRenderEmitter.fire(C.element));else{let v=this._decorationElements.get(C);v||(v=this._createElement(C),C.element=v,this._decorationElements.set(C,v),this._container.appendChild(v),C.onDispose((()=>{this._decorationElements.delete(C),v.remove()}))),v.style.top=y*this._renderService.dimensions.css.cell.height+"px",v.style.display=this._altBufferIsActive?"none":"block",C.onRenderEmitter.fire(v)}}_refreshXPosition(C,y=C.element){if(!y)return;const v=C.options.x??0;(C.options.anchor||"left")==="right"?y.style.right=v?v*this._renderService.dimensions.css.cell.width+"px":"":y.style.left=v?v*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(C){var y;(y=this._decorationElements.get(C))==null||y.remove(),this._decorationElements.delete(C),C.dispose()}};l.BufferDecorationRenderer=E=p([g(1,_.IBufferService),g(2,m.ICoreBrowserService),g(3,_.IDecorationService),g(4,m.IRenderService)],E)},5871:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorZoneStore=void 0,l.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(d){if(d.options.overviewRulerOptions){for(const p of this._zones)if(p.color===d.options.overviewRulerOptions.color&&p.position===d.options.overviewRulerOptions.position){if(this._lineIntersectsZone(p,d.marker.line))return;if(this._lineAdjacentToZone(p,d.marker.line,d.options.overviewRulerOptions.position))return void this._addLineToZone(p,d.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=d.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=d.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=d.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=d.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:d.options.overviewRulerOptions.color,position:d.options.overviewRulerOptions.position,startBufferLine:d.marker.line,endBufferLine:d.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(d){this._linePadding=d}_lineIntersectsZone(d,p){return p>=d.startBufferLine&&p<=d.endBufferLine}_lineAdjacentToZone(d,p,g){return p>=d.startBufferLine-this._linePadding[g||"full"]&&p<=d.endBufferLine+this._linePadding[g||"full"]}_addLineToZone(d,p){d.startBufferLine=Math.min(d.startBufferLine,p),d.endBufferLine=Math.max(d.endBufferLine,p)}}},5744:function(f,l,d){var p=this&&this.__decorate||function(S,j,T,N){var D,A=arguments.length,z=A<3?j:N===null?N=Object.getOwnPropertyDescriptor(j,T):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(S,j,T,N);else for(var O=S.length-1;O>=0;O--)(D=S[O])&&(z=(A<3?D(z):A>3?D(j,T,z):D(j,T))||z);return A>3&&z&&Object.defineProperty(j,T,z),z},g=this&&this.__param||function(S,j){return function(T,N){j(T,N,S)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OverviewRulerRenderer=void 0;const m=d(5871),b=d(4725),_=d(844),E=d(2585),C={full:0,left:0,center:0,right:0},y={full:0,left:0,center:0,right:0},v={full:0,left:0,center:0,right:0};let x=l.OverviewRulerRenderer=class extends _.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(S,j,T,N,D,A,z){var q;super(),this._viewportElement=S,this._screenElement=j,this._bufferService=T,this._decorationService=N,this._renderService=D,this._optionsService=A,this._coreBrowserService=z,this._colorZoneStore=new m.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(q=this._viewportElement.parentElement)==null||q.insertBefore(this._canvas,this._viewportElement);const O=this._canvas.getContext("2d");if(!O)throw new Error("Ctx cannot be null");this._ctx=O,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,_.toDisposable)((()=>{var G;(G=this._canvas)==null||G.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const S=Math.floor(this._canvas.width/3),j=Math.ceil(this._canvas.width/3);y.full=this._canvas.width,y.left=S,y.center=j,y.right=S,this._refreshDrawHeightConstants(),v.full=0,v.left=0,v.center=y.left,v.right=y.left+y.center}_refreshDrawHeightConstants(){C.full=Math.round(2*this._coreBrowserService.dpr);const S=this._canvas.height/this._bufferService.buffer.lines.length,j=Math.round(Math.max(Math.min(S,12),6)*this._coreBrowserService.dpr);C.left=j,C.center=j,C.right=j}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const j of this._decorationService.decorations)this._colorZoneStore.addDecoration(j);this._ctx.lineWidth=1;const S=this._colorZoneStore.zones;for(const j of S)j.position!=="full"&&this._renderColorZone(j);for(const j of S)j.position==="full"&&this._renderColorZone(j);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(S){this._ctx.fillStyle=S.color,this._ctx.fillRect(v[S.position||"full"],Math.round((this._canvas.height-1)*(S.startBufferLine/this._bufferService.buffers.active.lines.length)-C[S.position||"full"]/2),y[S.position||"full"],Math.round((this._canvas.height-1)*((S.endBufferLine-S.startBufferLine)/this._bufferService.buffers.active.lines.length)+C[S.position||"full"]))}_queueRefresh(S,j){this._shouldUpdateDimensions=S||this._shouldUpdateDimensions,this._shouldUpdateAnchor=j||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};l.OverviewRulerRenderer=x=p([g(2,E.IBufferService),g(3,E.IDecorationService),g(4,b.IRenderService),g(5,E.IOptionsService),g(6,b.ICoreBrowserService)],x)},2950:function(f,l,d){var p=this&&this.__decorate||function(C,y,v,x){var S,j=arguments.length,T=j<3?y:x===null?x=Object.getOwnPropertyDescriptor(y,v):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(C,y,v,x);else for(var N=C.length-1;N>=0;N--)(S=C[N])&&(T=(j<3?S(T):j>3?S(y,v,T):S(y,v))||T);return j>3&&T&&Object.defineProperty(y,v,T),T},g=this&&this.__param||function(C,y){return function(v,x){y(v,x,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CompositionHelper=void 0;const m=d(4725),b=d(2585),_=d(2584);let E=l.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(C,y,v,x,S,j){this._textarea=C,this._compositionView=y,this._bufferService=v,this._optionsService=x,this._coreService=S,this._renderService=j,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(C){this._compositionView.textContent=C.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(C){if(this._isComposing||this._isSendingComposition){if(C.keyCode===229||C.keyCode===16||C.keyCode===17||C.keyCode===18)return!1;this._finalizeComposition(!1)}return C.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(C){if(this._compositionView.classList.remove("active"),this._isComposing=!1,C){const y={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let v;this._isSendingComposition=!1,y.start+=this._dataAlreadySent.length,v=this._isComposing?this._textarea.value.substring(y.start,y.end):this._textarea.value.substring(y.start),v.length>0&&this._coreService.triggerDataEvent(v,!0)}}),0)}else{this._isSendingComposition=!1;const y=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(y,!0)}}_handleAnyTextareaChanges(){const C=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const y=this._textarea.value,v=y.replace(C,"");this._dataAlreadySent=v,y.length>C.length?this._coreService.triggerDataEvent(v,!0):y.length<C.length?this._coreService.triggerDataEvent(`${_.C0.DEL}`,!0):y.length===C.length&&y!==C&&this._coreService.triggerDataEvent(y,!0)}}),0)}updateCompositionElements(C){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const y=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),v=this._renderService.dimensions.css.cell.height,x=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,S=y*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=S+"px",this._compositionView.style.top=x+"px",this._compositionView.style.height=v+"px",this._compositionView.style.lineHeight=v+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const j=this._compositionView.getBoundingClientRect();this._textarea.style.left=S+"px",this._textarea.style.top=x+"px",this._textarea.style.width=Math.max(j.width,1)+"px",this._textarea.style.height=Math.max(j.height,1)+"px",this._textarea.style.lineHeight=j.height+"px"}C||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};l.CompositionHelper=E=p([g(2,b.IBufferService),g(3,b.IOptionsService),g(4,b.ICoreService),g(5,m.IRenderService)],E)},9806:(f,l)=>{function d(p,g,m){const b=m.getBoundingClientRect(),_=p.getComputedStyle(m),E=parseInt(_.getPropertyValue("padding-left")),C=parseInt(_.getPropertyValue("padding-top"));return[g.clientX-b.left-E,g.clientY-b.top-C]}Object.defineProperty(l,"__esModule",{value:!0}),l.getCoords=l.getCoordsRelativeToElement=void 0,l.getCoordsRelativeToElement=d,l.getCoords=function(p,g,m,b,_,E,C,y,v){if(!E)return;const x=d(p,g,m);return x?(x[0]=Math.ceil((x[0]+(v?C/2:0))/C),x[1]=Math.ceil(x[1]/y),x[0]=Math.min(Math.max(x[0],1),b+(v?1:0)),x[1]=Math.min(Math.max(x[1],1),_),x):void 0}},9504:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.moveToCellSequence=void 0;const p=d(2584);function g(y,v,x,S){const j=y-m(y,x),T=v-m(v,x),N=Math.abs(j-T)-(function(D,A,z){let O=0;const q=D-m(D,z),G=A-m(A,z);for(let W=0;W<Math.abs(q-G);W++){const I=b(D,A)==="A"?-1:1,$=z.buffer.lines.get(q+I*W);$!=null&&$.isWrapped&&O++}return O})(y,v,x);return C(N,E(b(y,v),S))}function m(y,v){let x=0,S=v.buffer.lines.get(y),j=S==null?void 0:S.isWrapped;for(;j&&y>=0&&y<v.rows;)x++,S=v.buffer.lines.get(--y),j=S==null?void 0:S.isWrapped;return x}function b(y,v){return y>v?"A":"B"}function _(y,v,x,S,j,T){let N=y,D=v,A="";for(;N!==x||D!==S;)N+=j?1:-1,j&&N>T.cols-1?(A+=T.buffer.translateBufferLineToString(D,!1,y,N),N=0,y=0,D++):!j&&N<0&&(A+=T.buffer.translateBufferLineToString(D,!1,0,y+1),N=T.cols-1,y=N,D--);return A+T.buffer.translateBufferLineToString(D,!1,y,N)}function E(y,v){const x=v?"O":"[";return p.C0.ESC+x+y}function C(y,v){y=Math.floor(y);let x="";for(let S=0;S<y;S++)x+=v;return x}l.moveToCellSequence=function(y,v,x,S){const j=x.buffer.x,T=x.buffer.y;if(!x.buffer.hasScrollback)return(function(A,z,O,q,G,W){return g(z,q,G,W).length===0?"":C(_(A,z,A,z-m(z,G),!1,G).length,E("D",W))})(j,T,0,v,x,S)+g(T,v,x,S)+(function(A,z,O,q,G,W){let I;I=g(z,q,G,W).length>0?q-m(q,G):z;const $=q,B=(function(X,Z,H,L,R,F){let U;return U=g(H,L,R,F).length>0?L-m(L,R):Z,X<H&&U<=L||X>=H&&U<L?"C":"D"})(A,z,O,q,G,W);return C(_(A,I,O,$,B==="C",G).length,E(B,W))})(j,T,y,v,x,S);let N;if(T===v)return N=j>y?"D":"C",C(Math.abs(j-y),E(N,S));N=T>v?"D":"C";const D=Math.abs(T-v);return C((function(A,z){return z.cols-A})(T>v?y:j,x)+(D-1)*x.cols+1+((T>v?j:y)-1),E(N,S))}},1296:function(f,l,d){var p=this&&this.__decorate||function(W,I,$,B){var X,Z=arguments.length,H=Z<3?I:B===null?B=Object.getOwnPropertyDescriptor(I,$):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")H=Reflect.decorate(W,I,$,B);else for(var L=W.length-1;L>=0;L--)(X=W[L])&&(H=(Z<3?X(H):Z>3?X(I,$,H):X(I,$))||H);return Z>3&&H&&Object.defineProperty(I,$,H),H},g=this&&this.__param||function(W,I){return function($,B){I($,B,W)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRenderer=void 0;const m=d(3787),b=d(2550),_=d(2223),E=d(6171),C=d(6052),y=d(4725),v=d(8055),x=d(8460),S=d(844),j=d(2585),T="xterm-dom-renderer-owner-",N="xterm-rows",D="xterm-fg-",A="xterm-bg-",z="xterm-focus",O="xterm-selection";let q=1,G=l.DomRenderer=class extends S.Disposable{constructor(W,I,$,B,X,Z,H,L,R,F,U,ne,Q){super(),this._terminal=W,this._document=I,this._element=$,this._screenElement=B,this._viewportElement=X,this._helperContainer=Z,this._linkifier2=H,this._charSizeService=R,this._optionsService=F,this._bufferService=U,this._coreBrowserService=ne,this._themeService=Q,this._terminalClass=q++,this._rowElements=[],this._selectionRenderModel=(0,C.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new x.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(N),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(O),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,E.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((ee=>this._injectCss(ee)))),this._injectCss(this._themeService.colors),this._rowFactory=L.createInstance(m.DomRendererRowFactory,document),this._element.classList.add(T+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ee=>this._handleLinkHover(ee)))),this.register(this._linkifier2.onHideLinkUnderline((ee=>this._handleLinkLeave(ee)))),this.register((0,S.toDisposable)((()=>{this._element.classList.remove(T+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new b.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const W=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*W,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*W),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/W),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/W),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const $ of this._rowElements)$.style.width=`${this.dimensions.css.canvas.width}px`,$.style.height=`${this.dimensions.css.cell.height}px`,$.style.lineHeight=`${this.dimensions.css.cell.height}px`,$.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const I=`${this._terminalSelector} .${N} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=I,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(W){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let I=`${this._terminalSelector} .${N} { color: ${W.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;I+=`${this._terminalSelector} .${N} .xterm-dim { color: ${v.color.multiplyOpacity(W.foreground,.5).css};}`,I+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const $=`blink_underline_${this._terminalClass}`,B=`blink_bar_${this._terminalClass}`,X=`blink_block_${this._terminalClass}`;I+=`@keyframes ${$} { 50% { border-bottom-style: hidden; }}`,I+=`@keyframes ${B} { 50% { box-shadow: none; }}`,I+=`@keyframes ${X} { 0% { background-color: ${W.cursor.css}; color: ${W.cursorAccent.css}; } 50% { background-color: inherit; color: ${W.cursor.css}; }}`,I+=`${this._terminalSelector} .${N}.${z} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${$} 1s step-end infinite;}${this._terminalSelector} .${N}.${z} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${B} 1s step-end infinite;}${this._terminalSelector} .${N}.${z} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${X} 1s step-end infinite;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block { background-color: ${W.cursor.css}; color: ${W.cursorAccent.css};}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${W.cursor.css} !important; color: ${W.cursorAccent.css} !important;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${W.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${W.cursor.css} inset;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${W.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,I+=`${this._terminalSelector} .${O} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${O} div { position: absolute; background-color: ${W.selectionBackgroundOpaque.css};}${this._terminalSelector} .${O} div { position: absolute; background-color: ${W.selectionInactiveBackgroundOpaque.css};}`;for(const[Z,H]of W.ansi.entries())I+=`${this._terminalSelector} .${D}${Z} { color: ${H.css}; }${this._terminalSelector} .${D}${Z}.xterm-dim { color: ${v.color.multiplyOpacity(H,.5).css}; }${this._terminalSelector} .${A}${Z} { background-color: ${H.css}; }`;I+=`${this._terminalSelector} .${D}${_.INVERTED_DEFAULT_COLOR} { color: ${v.color.opaque(W.background).css}; }${this._terminalSelector} .${D}${_.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${v.color.multiplyOpacity(v.color.opaque(W.background),.5).css}; }${this._terminalSelector} .${A}${_.INVERTED_DEFAULT_COLOR} { background-color: ${W.foreground.css}; }`,this._themeStyleElement.textContent=I}_setDefaultSpacing(){const W=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${W}px`,this._rowFactory.defaultSpacing=W}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(W,I){for(let $=this._rowElements.length;$<=I;$++){const B=this._document.createElement("div");this._rowContainer.appendChild(B),this._rowElements.push(B)}for(;this._rowElements.length>I;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(W,I){this._refreshRowElements(W,I),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(z),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(z),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(W,I,$){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(W,I,$),this.renderRows(0,this._bufferService.rows-1),!W||!I)return;this._selectionRenderModel.update(this._terminal,W,I,$);const B=this._selectionRenderModel.viewportStartRow,X=this._selectionRenderModel.viewportEndRow,Z=this._selectionRenderModel.viewportCappedStartRow,H=this._selectionRenderModel.viewportCappedEndRow;if(Z>=this._bufferService.rows||H<0)return;const L=this._document.createDocumentFragment();if($){const R=W[0]>I[0];L.appendChild(this._createSelectionElement(Z,R?I[0]:W[0],R?W[0]:I[0],H-Z+1))}else{const R=B===Z?W[0]:0,F=Z===X?I[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(Z,R,F));const U=H-Z-1;if(L.appendChild(this._createSelectionElement(Z+1,0,this._bufferService.cols,U)),Z!==H){const ne=X===H?I[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(H,0,ne))}}this._selectionContainer.appendChild(L)}_createSelectionElement(W,I,$,B=1){const X=this._document.createElement("div"),Z=I*this.dimensions.css.cell.width;let H=this.dimensions.css.cell.width*($-I);return Z+H>this.dimensions.css.canvas.width&&(H=this.dimensions.css.canvas.width-Z),X.style.height=B*this.dimensions.css.cell.height+"px",X.style.top=W*this.dimensions.css.cell.height+"px",X.style.left=`${Z}px`,X.style.width=`${H}px`,X}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const W of this._rowElements)W.replaceChildren()}renderRows(W,I){const $=this._bufferService.buffer,B=$.ybase+$.y,X=Math.min($.x,this._bufferService.cols-1),Z=this._optionsService.rawOptions.cursorBlink,H=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let R=W;R<=I;R++){const F=R+$.ydisp,U=this._rowElements[R],ne=$.lines.get(F);if(!U||!ne)break;U.replaceChildren(...this._rowFactory.createRow(ne,F,F===B,H,L,X,Z,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${T}${this._terminalClass}`}_handleLinkHover(W){this._setCellUnderline(W.x1,W.x2,W.y1,W.y2,W.cols,!0)}_handleLinkLeave(W){this._setCellUnderline(W.x1,W.x2,W.y1,W.y2,W.cols,!1)}_setCellUnderline(W,I,$,B,X,Z){$<0&&(W=0),B<0&&(I=0);const H=this._bufferService.rows-1;$=Math.max(Math.min($,H),0),B=Math.max(Math.min(B,H),0),X=Math.min(X,this._bufferService.cols);const L=this._bufferService.buffer,R=L.ybase+L.y,F=Math.min(L.x,X-1),U=this._optionsService.rawOptions.cursorBlink,ne=this._optionsService.rawOptions.cursorStyle,Q=this._optionsService.rawOptions.cursorInactiveStyle;for(let ee=$;ee<=B;++ee){const Y=ee+L.ydisp,V=this._rowElements[ee],oe=L.lines.get(Y);if(!V||!oe)break;V.replaceChildren(...this._rowFactory.createRow(oe,Y,Y===R,ne,Q,F,U,this.dimensions.css.cell.width,this._widthCache,Z?ee===$?W:0:-1,Z?(ee===B?I:X)-1:-1))}}};l.DomRenderer=G=p([g(7,j.IInstantiationService),g(8,y.ICharSizeService),g(9,j.IOptionsService),g(10,j.IBufferService),g(11,y.ICoreBrowserService),g(12,y.IThemeService)],G)},3787:function(f,l,d){var p=this&&this.__decorate||function(N,D,A,z){var O,q=arguments.length,G=q<3?D:z===null?z=Object.getOwnPropertyDescriptor(D,A):z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")G=Reflect.decorate(N,D,A,z);else for(var W=N.length-1;W>=0;W--)(O=N[W])&&(G=(q<3?O(G):q>3?O(D,A,G):O(D,A))||G);return q>3&&G&&Object.defineProperty(D,A,G),G},g=this&&this.__param||function(N,D){return function(A,z){D(A,z,N)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRendererRowFactory=void 0;const m=d(2223),b=d(643),_=d(511),E=d(2585),C=d(8055),y=d(4725),v=d(4269),x=d(6171),S=d(3734);let j=l.DomRendererRowFactory=class{constructor(N,D,A,z,O,q,G){this._document=N,this._characterJoinerService=D,this._optionsService=A,this._coreBrowserService=z,this._coreService=O,this._decorationService=q,this._themeService=G,this._workCell=new _.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(N,D,A){this._selectionStart=N,this._selectionEnd=D,this._columnSelectMode=A}createRow(N,D,A,z,O,q,G,W,I,$,B){const X=[],Z=this._characterJoinerService.getJoinedCharacters(D),H=this._themeService.colors;let L,R=N.getNoBgTrimmedLength();A&&R<q+1&&(R=q+1);let F=0,U="",ne=0,Q=0,ee=0,Y=!1,V=0,oe=!1,re=0;const ve=[],be=$!==-1&&B!==-1;for(let Le=0;Le<R;Le++){N.loadCell(Le,this._workCell);let Oe=this._workCell.getWidth();if(Oe===0)continue;let ze=!1,We=Le,Ee=this._workCell;if(Z.length>0&&Le===Z[0][0]){ze=!0;const Ye=Z.shift();Ee=new v.JoinedCellData(this._workCell,N.translateToString(!0,Ye[0],Ye[1]),Ye[1]-Ye[0]),We=Ye[1]-1,Oe=Ee.getWidth()}const fe=this._isCellInSelection(Le,D),je=A&&Le===q,Ue=be&&Le>=$&&Le<=B;let It=!1;this._decorationService.forEachDecorationAtCell(Le,D,void 0,(Ye=>{It=!0}));let pe=Ee.getChars()||b.WHITESPACE_CELL_CHAR;if(pe===" "&&(Ee.isUnderline()||Ee.isOverline())&&(pe=" "),re=Oe*W-I.get(pe,Ee.isBold(),Ee.isItalic()),L){if(F&&(fe&&oe||!fe&&!oe&&Ee.bg===ne)&&(fe&&oe&&H.selectionForeground||Ee.fg===Q)&&Ee.extended.ext===ee&&Ue===Y&&re===V&&!je&&!ze&&!It){Ee.isInvisible()?U+=b.WHITESPACE_CELL_CHAR:U+=pe,F++;continue}F&&(L.textContent=U),L=this._document.createElement("span"),F=0,U=""}else L=this._document.createElement("span");if(ne=Ee.bg,Q=Ee.fg,ee=Ee.extended.ext,Y=Ue,V=re,oe=fe,ze&&q>=Le&&q<=We&&(q=Le),!this._coreService.isCursorHidden&&je&&this._coreService.isCursorInitialized){if(ve.push("xterm-cursor"),this._coreBrowserService.isFocused)G&&ve.push("xterm-cursor-blink"),ve.push(z==="bar"?"xterm-cursor-bar":z==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(O)switch(O){case"outline":ve.push("xterm-cursor-outline");break;case"block":ve.push("xterm-cursor-block");break;case"bar":ve.push("xterm-cursor-bar");break;case"underline":ve.push("xterm-cursor-underline")}}if(Ee.isBold()&&ve.push("xterm-bold"),Ee.isItalic()&&ve.push("xterm-italic"),Ee.isDim()&&ve.push("xterm-dim"),U=Ee.isInvisible()?b.WHITESPACE_CELL_CHAR:Ee.getChars()||b.WHITESPACE_CELL_CHAR,Ee.isUnderline()&&(ve.push(`xterm-underline-${Ee.extended.underlineStyle}`),U===" "&&(U=" "),!Ee.isUnderlineColorDefault()))if(Ee.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${S.AttributeData.toColorRGB(Ee.getUnderlineColor()).join(",")})`;else{let Ye=Ee.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Ee.isBold()&&Ye<8&&(Ye+=8),L.style.textDecorationColor=H.ansi[Ye].css}Ee.isOverline()&&(ve.push("xterm-overline"),U===" "&&(U=" ")),Ee.isStrikethrough()&&ve.push("xterm-strikethrough"),Ue&&(L.style.textDecoration="underline");let Ne=Ee.getFgColor(),Me=Ee.getFgColorMode(),ot=Ee.getBgColor(),ue=Ee.getBgColorMode();const _e=!!Ee.isInverse();if(_e){const Ye=Ne;Ne=ot,ot=Ye;const Dt=Me;Me=ue,ue=Dt}let Te,Ie,$e,St=!1;switch(this._decorationService.forEachDecorationAtCell(Le,D,void 0,(Ye=>{Ye.options.layer!=="top"&&St||(Ye.backgroundColorRGB&&(ue=50331648,ot=Ye.backgroundColorRGB.rgba>>8&16777215,Te=Ye.backgroundColorRGB),Ye.foregroundColorRGB&&(Me=50331648,Ne=Ye.foregroundColorRGB.rgba>>8&16777215,Ie=Ye.foregroundColorRGB),St=Ye.options.layer==="top")})),!St&&fe&&(Te=this._coreBrowserService.isFocused?H.selectionBackgroundOpaque:H.selectionInactiveBackgroundOpaque,ot=Te.rgba>>8&16777215,ue=50331648,St=!0,H.selectionForeground&&(Me=50331648,Ne=H.selectionForeground.rgba>>8&16777215,Ie=H.selectionForeground)),St&&ve.push("xterm-decoration-top"),ue){case 16777216:case 33554432:$e=H.ansi[ot],ve.push(`xterm-bg-${ot}`);break;case 50331648:$e=C.channels.toColor(ot>>16,ot>>8&255,255&ot),this._addStyle(L,`background-color:#${T((ot>>>0).toString(16),"0",6)}`);break;default:_e?($e=H.foreground,ve.push(`xterm-bg-${m.INVERTED_DEFAULT_COLOR}`)):$e=H.background}switch(Te||Ee.isDim()&&(Te=C.color.multiplyOpacity($e,.5)),Me){case 16777216:case 33554432:Ee.isBold()&&Ne<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Ne+=8),this._applyMinimumContrast(L,$e,H.ansi[Ne],Ee,Te,void 0)||ve.push(`xterm-fg-${Ne}`);break;case 50331648:const Ye=C.channels.toColor(Ne>>16&255,Ne>>8&255,255&Ne);this._applyMinimumContrast(L,$e,Ye,Ee,Te,Ie)||this._addStyle(L,`color:#${T(Ne.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,$e,H.foreground,Ee,Te,Ie)||_e&&ve.push(`xterm-fg-${m.INVERTED_DEFAULT_COLOR}`)}ve.length&&(L.className=ve.join(" "),ve.length=0),je||ze||It?L.textContent=U:F++,re!==this.defaultSpacing&&(L.style.letterSpacing=`${re}px`),X.push(L),Le=We}return L&&F&&(L.textContent=U),X}_applyMinimumContrast(N,D,A,z,O,q){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,x.treatGlyphAsBackgroundColor)(z.getCode()))return!1;const G=this._getContrastCache(z);let W;if(O||q||(W=G.getColor(D.rgba,A.rgba)),W===void 0){const I=this._optionsService.rawOptions.minimumContrastRatio/(z.isDim()?2:1);W=C.color.ensureContrastRatio(O||D,q||A,I),G.setColor((O||D).rgba,(q||A).rgba,W??null)}return!!W&&(this._addStyle(N,`color:${W.css}`),!0)}_getContrastCache(N){return N.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(N,D){N.setAttribute("style",`${N.getAttribute("style")||""}${D};`)}_isCellInSelection(N,D){const A=this._selectionStart,z=this._selectionEnd;return!(!A||!z)&&(this._columnSelectMode?A[0]<=z[0]?N>=A[0]&&D>=A[1]&&N<z[0]&&D<=z[1]:N<A[0]&&D>=A[1]&&N>=z[0]&&D<=z[1]:D>A[1]&&D<z[1]||A[1]===z[1]&&D===A[1]&&N>=A[0]&&N<z[0]||A[1]<z[1]&&D===z[1]&&N<z[0]||A[1]<z[1]&&D===A[1]&&N>=A[0])}};function T(N,D,A){for(;N.length<A;)N=D+N;return N}l.DomRendererRowFactory=j=p([g(1,y.ICharacterJoinerService),g(2,E.IOptionsService),g(3,y.ICoreBrowserService),g(4,E.ICoreService),g(5,E.IDecorationService),g(6,y.IThemeService)],j)},2550:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WidthCache=void 0,l.WidthCache=class{constructor(d,p){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=d.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const g=d.createElement("span");g.classList.add("xterm-char-measure-element");const m=d.createElement("span");m.classList.add("xterm-char-measure-element"),m.style.fontWeight="bold";const b=d.createElement("span");b.classList.add("xterm-char-measure-element"),b.style.fontStyle="italic";const _=d.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontWeight="bold",_.style.fontStyle="italic",this._measureElements=[g,m,b,_],this._container.appendChild(g),this._container.appendChild(m),this._container.appendChild(b),this._container.appendChild(_),p.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(d,p,g,m){d===this._font&&p===this._fontSize&&g===this._weight&&m===this._weightBold||(this._font=d,this._fontSize=p,this._weight=g,this._weightBold=m,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${g}`,this._measureElements[1].style.fontWeight=`${m}`,this._measureElements[2].style.fontWeight=`${g}`,this._measureElements[3].style.fontWeight=`${m}`,this.clear())}get(d,p,g){let m=0;if(!p&&!g&&d.length===1&&(m=d.charCodeAt(0))<256){if(this._flat[m]!==-9999)return this._flat[m];const E=this._measure(d,0);return E>0&&(this._flat[m]=E),E}let b=d;p&&(b+="B"),g&&(b+="I");let _=this._holey.get(b);if(_===void 0){let E=0;p&&(E|=1),g&&(E|=2),_=this._measure(d,E),_>0&&this._holey.set(b,_)}return _}_measure(d,p){const g=this._measureElements[p];return g.textContent=d.repeat(32),g.offsetWidth/32}}},2223:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TEXT_BASELINE=l.DIM_OPACITY=l.INVERTED_DEFAULT_COLOR=void 0;const p=d(6114);l.INVERTED_DEFAULT_COLOR=257,l.DIM_OPACITY=.5,l.TEXT_BASELINE=p.isFirefox||p.isLegacyEdge?"bottom":"ideographic"},6171:(f,l)=>{function d(g){return 57508<=g&&g<=57558}function p(g){return g>=128512&&g<=128591||g>=127744&&g<=128511||g>=128640&&g<=128767||g>=9728&&g<=9983||g>=9984&&g<=10175||g>=65024&&g<=65039||g>=129280&&g<=129535||g>=127462&&g<=127487}Object.defineProperty(l,"__esModule",{value:!0}),l.computeNextVariantOffset=l.createRenderDimensions=l.treatGlyphAsBackgroundColor=l.allowRescaling=l.isEmoji=l.isRestrictedPowerlineGlyph=l.isPowerlineGlyph=l.throwIfFalsy=void 0,l.throwIfFalsy=function(g){if(!g)throw new Error("value must not be falsy");return g},l.isPowerlineGlyph=d,l.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},l.isEmoji=p,l.allowRescaling=function(g,m,b,_){return m===1&&b>Math.ceil(1.5*_)&&g!==void 0&&g>255&&!p(g)&&!d(g)&&!(function(E){return 57344<=E&&E<=63743})(g)},l.treatGlyphAsBackgroundColor=function(g){return d(g)||(function(m){return 9472<=m&&m<=9631})(g)},l.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},l.computeNextVariantOffset=function(g,m,b=0){return(g-(2*Math.round(m)-b))%(2*Math.round(m))}},6052:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createSelectionRenderModel=void 0;class d{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(g,m,b,_=!1){if(this.selectionStart=m,this.selectionEnd=b,!m||!b||m[0]===b[0]&&m[1]===b[1])return void this.clear();const E=g.buffers.active.ydisp,C=m[1]-E,y=b[1]-E,v=Math.max(C,0),x=Math.min(y,g.rows-1);v>=g.rows||x<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=_,this.viewportStartRow=C,this.viewportEndRow=y,this.viewportCappedStartRow=v,this.viewportCappedEndRow=x,this.startCol=m[0],this.endCol=b[0])}isCellSelected(g,m,b){return!!this.hasSelection&&(b-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?m>=this.startCol&&b>=this.viewportCappedStartRow&&m<this.endCol&&b<=this.viewportCappedEndRow:m<this.startCol&&b>=this.viewportCappedStartRow&&m>=this.endCol&&b<=this.viewportCappedEndRow:b>this.viewportStartRow&&b<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&b===this.viewportStartRow&&m>=this.startCol&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&b===this.viewportEndRow&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&b===this.viewportStartRow&&m>=this.startCol)}}l.createSelectionRenderModel=function(){return new d}},456:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionModel=void 0,l.SelectionModel=class{constructor(d){this._bufferService=d,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const d=this.selectionStart[0]+this.selectionStartLength;return d>this._bufferService.cols?d%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)-1]:[d%this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)]:[d,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const d=this.selectionStart[0]+this.selectionStartLength;return d>this._bufferService.cols?[d%this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)]:[Math.max(d,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const d=this.selectionStart,p=this.selectionEnd;return!(!d||!p)&&(d[1]>p[1]||d[1]===p[1]&&d[0]>p[0])}handleTrim(d){return this.selectionStart&&(this.selectionStart[1]-=d),this.selectionEnd&&(this.selectionEnd[1]-=d),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(f,l,d){var p=this&&this.__decorate||function(x,S,j,T){var N,D=arguments.length,A=D<3?S:T===null?T=Object.getOwnPropertyDescriptor(S,j):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,S,j,T);else for(var z=x.length-1;z>=0;z--)(N=x[z])&&(A=(D<3?N(A):D>3?N(S,j,A):N(S,j))||A);return D>3&&A&&Object.defineProperty(S,j,A),A},g=this&&this.__param||function(x,S){return function(j,T){S(j,T,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharSizeService=void 0;const m=d(2585),b=d(8460),_=d(844);let E=l.CharSizeService=class extends _.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(x,S,j){super(),this._optionsService=j,this.width=0,this.height=0,this._onCharSizeChange=this.register(new b.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new v(this._optionsService))}catch{this._measureStrategy=this.register(new y(x,S,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const x=this._measureStrategy.measure();x.width===this.width&&x.height===this.height||(this.width=x.width,this.height=x.height,this._onCharSizeChange.fire())}};l.CharSizeService=E=p([g(2,m.IOptionsService)],E);class C extends _.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(S,j){S!==void 0&&S>0&&j!==void 0&&j>0&&(this._result.width=S,this._result.height=j)}}class y extends C{constructor(S,j,T){super(),this._document=S,this._parentElement=j,this._optionsService=T,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class v extends C{constructor(S){super(),this._optionsService=S,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const j=this._ctx.measureText("W");if(!("width"in j&&"fontBoundingBoxAscent"in j&&"fontBoundingBoxDescent"in j))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const S=this._ctx.measureText("W");return this._validateAndSet(S.width,S.fontBoundingBoxAscent+S.fontBoundingBoxDescent),this._result}}},4269:function(f,l,d){var p=this&&this.__decorate||function(v,x,S,j){var T,N=arguments.length,D=N<3?x:j===null?j=Object.getOwnPropertyDescriptor(x,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(v,x,S,j);else for(var A=v.length-1;A>=0;A--)(T=v[A])&&(D=(N<3?T(D):N>3?T(x,S,D):T(x,S))||D);return N>3&&D&&Object.defineProperty(x,S,D),D},g=this&&this.__param||function(v,x){return function(S,j){x(S,j,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharacterJoinerService=l.JoinedCellData=void 0;const m=d(3734),b=d(643),_=d(511),E=d(2585);class C extends m.AttributeData{constructor(x,S,j){super(),this.content=0,this.combinedData="",this.fg=x.fg,this.bg=x.bg,this.combinedData=S,this._width=j}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(x){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.JoinedCellData=C;let y=l.CharacterJoinerService=class Jb{constructor(x){this._bufferService=x,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _.CellData}register(x){const S={id:this._nextCharacterJoinerId++,handler:x};return this._characterJoiners.push(S),S.id}deregister(x){for(let S=0;S<this._characterJoiners.length;S++)if(this._characterJoiners[S].id===x)return this._characterJoiners.splice(S,1),!0;return!1}getJoinedCharacters(x){if(this._characterJoiners.length===0)return[];const S=this._bufferService.buffer.lines.get(x);if(!S||S.length===0)return[];const j=[],T=S.translateToString(!0);let N=0,D=0,A=0,z=S.getFg(0),O=S.getBg(0);for(let q=0;q<S.getTrimmedLength();q++)if(S.loadCell(q,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==z||this._workCell.bg!==O){if(q-N>1){const G=this._getJoinedRanges(T,A,D,S,N);for(let W=0;W<G.length;W++)j.push(G[W])}N=q,A=D,z=this._workCell.fg,O=this._workCell.bg}D+=this._workCell.getChars().length||b.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-N>1){const q=this._getJoinedRanges(T,A,D,S,N);for(let G=0;G<q.length;G++)j.push(q[G])}return j}_getJoinedRanges(x,S,j,T,N){const D=x.substring(S,j);let A=[];try{A=this._characterJoiners[0].handler(D)}catch(z){console.error(z)}for(let z=1;z<this._characterJoiners.length;z++)try{const O=this._characterJoiners[z].handler(D);for(let q=0;q<O.length;q++)Jb._mergeRanges(A,O[q])}catch(O){console.error(O)}return this._stringRangesToCellRanges(A,T,N),A}_stringRangesToCellRanges(x,S,j){let T=0,N=!1,D=0,A=x[T];if(A){for(let z=j;z<this._bufferService.cols;z++){const O=S.getWidth(z),q=S.getString(z).length||b.WHITESPACE_CELL_CHAR.length;if(O!==0){if(!N&&A[0]<=D&&(A[0]=z,N=!0),A[1]<=D){if(A[1]=z,A=x[++T],!A)break;A[0]<=D?(A[0]=z,N=!0):N=!1}D+=q}}A&&(A[1]=this._bufferService.cols)}}static _mergeRanges(x,S){let j=!1;for(let T=0;T<x.length;T++){const N=x[T];if(j){if(S[1]<=N[0])return x[T-1][1]=S[1],x;if(S[1]<=N[1])return x[T-1][1]=Math.max(S[1],N[1]),x.splice(T,1),x;x.splice(T,1),T--}else{if(S[1]<=N[0])return x.splice(T,0,S),x;if(S[1]<=N[1])return N[0]=Math.min(S[0],N[0]),x;S[0]<N[1]&&(N[0]=Math.min(S[0],N[0]),j=!0)}}return j?x[x.length-1][1]=S[1]:x.push(S),x}};l.CharacterJoinerService=y=p([g(0,E.IBufferService)],y)},5114:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreBrowserService=void 0;const p=d(844),g=d(8460),m=d(3656);class b extends p.Disposable{constructor(C,y,v){super(),this._textarea=C,this._window=y,this.mainDocument=v,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new _(this._window),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new g.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((x=>this._screenDprMonitor.setWindow(x)))),this.register((0,g.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(C){this._window!==C&&(this._window=C,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}l.CoreBrowserService=b;class _ extends p.Disposable{constructor(C){super(),this._parentWindow=C,this._windowResizeListener=this.register(new p.MutableDisposable),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,p.toDisposable)((()=>this.clearListener())))}setWindow(C){this._parentWindow=C,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,m.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var C;this._outerListener&&((C=this._resolutionMediaMatchList)==null||C.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.LinkProviderService=void 0;const p=d(844);class g extends p.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,p.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(b){return this.linkProviders.push(b),{dispose:()=>{const _=this.linkProviders.indexOf(b);_!==-1&&this.linkProviders.splice(_,1)}}}}l.LinkProviderService=g},8934:function(f,l,d){var p=this&&this.__decorate||function(E,C,y,v){var x,S=arguments.length,j=S<3?C:v===null?v=Object.getOwnPropertyDescriptor(C,y):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(E,C,y,v);else for(var T=E.length-1;T>=0;T--)(x=E[T])&&(j=(S<3?x(j):S>3?x(C,y,j):x(C,y))||j);return S>3&&j&&Object.defineProperty(C,y,j),j},g=this&&this.__param||function(E,C){return function(y,v){C(y,v,E)}};Object.defineProperty(l,"__esModule",{value:!0}),l.MouseService=void 0;const m=d(4725),b=d(9806);let _=l.MouseService=class{constructor(E,C){this._renderService=E,this._charSizeService=C}getCoords(E,C,y,v,x){return(0,b.getCoords)(window,E,C,y,v,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,x)}getMouseReportCoords(E,C){const y=(0,b.getCoordsRelativeToElement)(window,E,C);if(this._charSizeService.hasValidSize)return y[0]=Math.min(Math.max(y[0],0),this._renderService.dimensions.css.canvas.width-1),y[1]=Math.min(Math.max(y[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(y[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(y[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(y[0]),y:Math.floor(y[1])}}};l.MouseService=_=p([g(0,m.IRenderService),g(1,m.ICharSizeService)],_)},3230:function(f,l,d){var p=this&&this.__decorate||function(x,S,j,T){var N,D=arguments.length,A=D<3?S:T===null?T=Object.getOwnPropertyDescriptor(S,j):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,S,j,T);else for(var z=x.length-1;z>=0;z--)(N=x[z])&&(A=(D<3?N(A):D>3?N(S,j,A):N(S,j))||A);return D>3&&A&&Object.defineProperty(S,j,A),A},g=this&&this.__param||function(x,S){return function(j,T){S(j,T,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.RenderService=void 0;const m=d(6193),b=d(4725),_=d(8460),E=d(844),C=d(7226),y=d(2585);let v=l.RenderService=class extends E.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(x,S,j,T,N,D,A,z){super(),this._rowCount=x,this._charSizeService=T,this._renderer=this.register(new E.MutableDisposable),this._pausedResizeTask=new C.DebouncedIdleTask,this._observerDisposable=this.register(new E.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new _.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new _.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new _.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new _.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new m.RenderDebouncer(((O,q)=>this._renderRows(O,q)),A),this.register(this._renderDebouncer),this.register(A.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(D.onResize((()=>this._fullRefresh()))),this.register(D.buffers.onBufferActivate((()=>{var O;return(O=this._renderer.value)==null?void 0:O.clear()}))),this.register(j.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(N.onDecorationRegistered((()=>this._fullRefresh()))),this.register(N.onDecorationRemoved((()=>this._fullRefresh()))),this.register(j.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(D.cols,D.rows),this._fullRefresh()}))),this.register(j.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(D.buffer.y,D.buffer.y,!0)))),this.register(z.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(A.window,S),this.register(A.onWindowChange((O=>this._registerIntersectionObserver(O,S))))}_registerIntersectionObserver(x,S){if("IntersectionObserver"in x){const j=new x.IntersectionObserver((T=>this._handleIntersectionChange(T[T.length-1])),{threshold:0});j.observe(S),this._observerDisposable.value=(0,E.toDisposable)((()=>j.disconnect()))}}_handleIntersectionChange(x){this._isPaused=x.isIntersecting===void 0?x.intersectionRatio===0:!x.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(x,S,j=!1){this._isPaused?this._needsFullRefresh=!0:(j||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(x,S,this._rowCount))}_renderRows(x,S){this._renderer.value&&(x=Math.min(x,this._rowCount-1),S=Math.min(S,this._rowCount-1),this._renderer.value.renderRows(x,S),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:x,end:S}),this._onRender.fire({start:x,end:S}),this._isNextRenderRedrawOnly=!0)}resize(x,S){this._rowCount=S,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(x){this._renderer.value=x,this._renderer.value&&(this._renderer.value.onRequestRedraw((S=>this.refreshRows(S.start,S.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(x){return this._renderDebouncer.addRefreshCallback(x)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var x,S;this._renderer.value&&((S=(x=this._renderer.value).clearTextureAtlas)==null||S.call(x),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(x,S){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var j;return(j=this._renderer.value)==null?void 0:j.handleResize(x,S)})):this._renderer.value.handleResize(x,S),this._fullRefresh())}handleCharSizeChanged(){var x;(x=this._renderer.value)==null||x.handleCharSizeChanged()}handleBlur(){var x;(x=this._renderer.value)==null||x.handleBlur()}handleFocus(){var x;(x=this._renderer.value)==null||x.handleFocus()}handleSelectionChanged(x,S,j){var T;this._selectionState.start=x,this._selectionState.end=S,this._selectionState.columnSelectMode=j,(T=this._renderer.value)==null||T.handleSelectionChanged(x,S,j)}handleCursorMove(){var x;(x=this._renderer.value)==null||x.handleCursorMove()}clear(){var x;(x=this._renderer.value)==null||x.clear()}};l.RenderService=v=p([g(2,y.IOptionsService),g(3,b.ICharSizeService),g(4,y.IDecorationService),g(5,y.IBufferService),g(6,b.ICoreBrowserService),g(7,b.IThemeService)],v)},9312:function(f,l,d){var p=this&&this.__decorate||function(A,z,O,q){var G,W=arguments.length,I=W<3?z:q===null?q=Object.getOwnPropertyDescriptor(z,O):q;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(A,z,O,q);else for(var $=A.length-1;$>=0;$--)(G=A[$])&&(I=(W<3?G(I):W>3?G(z,O,I):G(z,O))||I);return W>3&&I&&Object.defineProperty(z,O,I),I},g=this&&this.__param||function(A,z){return function(O,q){z(O,q,A)}};Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionService=void 0;const m=d(9806),b=d(9504),_=d(456),E=d(4725),C=d(8460),y=d(844),v=d(6114),x=d(4841),S=d(511),j=d(2585),T=" ",N=new RegExp(T,"g");let D=l.SelectionService=class extends y.Disposable{constructor(A,z,O,q,G,W,I,$,B){super(),this._element=A,this._screenElement=z,this._linkifier=O,this._bufferService=q,this._coreService=G,this._mouseService=W,this._optionsService=I,this._renderService=$,this._coreBrowserService=B,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new S.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new C.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new C.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=X=>this._handleMouseMove(X),this._mouseUpListener=X=>this._handleMouseUp(X),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((X=>this._handleTrim(X))),this.register(this._bufferService.buffers.onBufferActivate((X=>this._handleBufferActivate(X)))),this.enable(),this._model=new _.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,y.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const A=this._model.finalSelectionStart,z=this._model.finalSelectionEnd;return!(!A||!z||A[0]===z[0]&&A[1]===z[1])}get selectionText(){const A=this._model.finalSelectionStart,z=this._model.finalSelectionEnd;if(!A||!z)return"";const O=this._bufferService.buffer,q=[];if(this._activeSelectionMode===3){if(A[0]===z[0])return"";const G=A[0]<z[0]?A[0]:z[0],W=A[0]<z[0]?z[0]:A[0];for(let I=A[1];I<=z[1];I++){const $=O.translateBufferLineToString(I,!0,G,W);q.push($)}}else{const G=A[1]===z[1]?z[0]:void 0;q.push(O.translateBufferLineToString(A[1],!0,A[0],G));for(let W=A[1]+1;W<=z[1]-1;W++){const I=O.lines.get(W),$=O.translateBufferLineToString(W,!0);I!=null&&I.isWrapped?q[q.length-1]+=$:q.push($)}if(A[1]!==z[1]){const W=O.lines.get(z[1]),I=O.translateBufferLineToString(z[1],!0,0,z[0]);W&&W.isWrapped?q[q.length-1]+=I:q.push(I)}}return q.map((G=>G.replace(N," "))).join(v.isWindows?`\r
62
+ `:`
63
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(A){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),v.isLinux&&A&&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(A){const z=this._getMouseBufferCoords(A),O=this._model.finalSelectionStart,q=this._model.finalSelectionEnd;return!!(O&&q&&z)&&this._areCoordsInSelection(z,O,q)}isCellInSelection(A,z){const O=this._model.finalSelectionStart,q=this._model.finalSelectionEnd;return!(!O||!q)&&this._areCoordsInSelection([A,z],O,q)}_areCoordsInSelection(A,z,O){return A[1]>z[1]&&A[1]<O[1]||z[1]===O[1]&&A[1]===z[1]&&A[0]>=z[0]&&A[0]<O[0]||z[1]<O[1]&&A[1]===O[1]&&A[0]<O[0]||z[1]<O[1]&&A[1]===z[1]&&A[0]>=z[0]}_selectWordAtCursor(A,z){var G,W;const O=(W=(G=this._linkifier.currentLink)==null?void 0:G.link)==null?void 0:W.range;if(O)return this._model.selectionStart=[O.start.x-1,O.start.y-1],this._model.selectionStartLength=(0,x.getRangeLength)(O,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const q=this._getMouseBufferCoords(A);return!!q&&(this._selectWordAt(q,z),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(A,z){this._model.clearSelection(),A=Math.max(A,0),z=Math.min(z,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,A],this._model.selectionEnd=[this._bufferService.cols,z],this.refresh(),this._onSelectionChange.fire()}_handleTrim(A){this._model.handleTrim(A)&&this.refresh()}_getMouseBufferCoords(A){const z=this._mouseService.getCoords(A,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(z)return z[0]--,z[1]--,z[1]+=this._bufferService.buffer.ydisp,z}_getMouseEventScrollAmount(A){let z=(0,m.getCoordsRelativeToElement)(this._coreBrowserService.window,A,this._screenElement)[1];const O=this._renderService.dimensions.css.canvas.height;return z>=0&&z<=O?0:(z>O&&(z-=O),z=Math.min(Math.max(z,-50),50),z/=50,z/Math.abs(z)+Math.round(14*z))}shouldForceSelection(A){return v.isMac?A.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:A.shiftKey}handleMouseDown(A){if(this._mouseDownTimeStamp=A.timeStamp,(A.button!==2||!this.hasSelection)&&A.button===0){if(!this._enabled){if(!this.shouldForceSelection(A))return;A.stopPropagation()}A.preventDefault(),this._dragScrollAmount=0,this._enabled&&A.shiftKey?this._handleIncrementalClick(A):A.detail===1?this._handleSingleClick(A):A.detail===2?this._handleDoubleClick(A):A.detail===3&&this._handleTripleClick(A),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(A){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(A))}_handleSingleClick(A){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(A)?3:0,this._model.selectionStart=this._getMouseBufferCoords(A),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const z=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);z&&z.length!==this._model.selectionStart[0]&&z.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(A){this._selectWordAtCursor(A,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(A){const z=this._getMouseBufferCoords(A);z&&(this._activeSelectionMode=2,this._selectLineAt(z[1]))}shouldColumnSelect(A){return A.altKey&&!(v.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(A){if(A.stopImmediatePropagation(),!this._model.selectionStart)return;const z=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(A),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(A),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const O=this._bufferService.buffer;if(this._model.selectionEnd[1]<O.lines.length){const q=O.lines.get(this._model.selectionEnd[1]);q&&q.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}z&&z[0]===this._model.selectionEnd[0]&&z[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const A=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(A.ydisp+this._bufferService.rows,A.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=A.ydisp),this.refresh()}}_handleMouseUp(A){const z=A.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&z<500&&A.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const O=this._mouseService.getCoords(A,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(O&&O[0]!==void 0&&O[1]!==void 0){const q=(0,b.moveToCellSequence)(O[0]-1,O[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(q,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const A=this._model.finalSelectionStart,z=this._model.finalSelectionEnd,O=!(!A||!z||A[0]===z[0]&&A[1]===z[1]);O?A&&z&&(this._oldSelectionStart&&this._oldSelectionEnd&&A[0]===this._oldSelectionStart[0]&&A[1]===this._oldSelectionStart[1]&&z[0]===this._oldSelectionEnd[0]&&z[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(A,z,O)):this._oldHasSelection&&this._fireOnSelectionChange(A,z,O)}_fireOnSelectionChange(A,z,O){this._oldSelectionStart=A,this._oldSelectionEnd=z,this._oldHasSelection=O,this._onSelectionChange.fire()}_handleBufferActivate(A){this.clearSelection(),this._trimListener.dispose(),this._trimListener=A.activeBuffer.lines.onTrim((z=>this._handleTrim(z)))}_convertViewportColToCharacterIndex(A,z){let O=z;for(let q=0;z>=q;q++){const G=A.loadCell(q,this._workCell).getChars().length;this._workCell.getWidth()===0?O--:G>1&&z!==q&&(O+=G-1)}return O}setSelection(A,z,O){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[A,z],this._model.selectionStartLength=O,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(A){this._isClickInSelection(A)||(this._selectWordAtCursor(A,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(A,z,O=!0,q=!0){if(A[0]>=this._bufferService.cols)return;const G=this._bufferService.buffer,W=G.lines.get(A[1]);if(!W)return;const I=G.translateBufferLineToString(A[1],!1);let $=this._convertViewportColToCharacterIndex(W,A[0]),B=$;const X=A[0]-$;let Z=0,H=0,L=0,R=0;if(I.charAt($)===" "){for(;$>0&&I.charAt($-1)===" ";)$--;for(;B<I.length&&I.charAt(B+1)===" ";)B++}else{let ne=A[0],Q=A[0];W.getWidth(ne)===0&&(Z++,ne--),W.getWidth(Q)===2&&(H++,Q++);const ee=W.getString(Q).length;for(ee>1&&(R+=ee-1,B+=ee-1);ne>0&&$>0&&!this._isCharWordSeparator(W.loadCell(ne-1,this._workCell));){W.loadCell(ne-1,this._workCell);const Y=this._workCell.getChars().length;this._workCell.getWidth()===0?(Z++,ne--):Y>1&&(L+=Y-1,$-=Y-1),$--,ne--}for(;Q<W.length&&B+1<I.length&&!this._isCharWordSeparator(W.loadCell(Q+1,this._workCell));){W.loadCell(Q+1,this._workCell);const Y=this._workCell.getChars().length;this._workCell.getWidth()===2?(H++,Q++):Y>1&&(R+=Y-1,B+=Y-1),B++,Q++}}B++;let F=$+X-Z+L,U=Math.min(this._bufferService.cols,B-$+Z+H-L-R);if(z||I.slice($,B).trim()!==""){if(O&&F===0&&W.getCodePoint(0)!==32){const ne=G.lines.get(A[1]-1);if(ne&&W.isWrapped&&ne.getCodePoint(this._bufferService.cols-1)!==32){const Q=this._getWordAt([this._bufferService.cols-1,A[1]-1],!1,!0,!1);if(Q){const ee=this._bufferService.cols-Q.start;F-=ee,U+=ee}}}if(q&&F+U===this._bufferService.cols&&W.getCodePoint(this._bufferService.cols-1)!==32){const ne=G.lines.get(A[1]+1);if(ne!=null&&ne.isWrapped&&ne.getCodePoint(0)!==32){const Q=this._getWordAt([0,A[1]+1],!1,!1,!0);Q&&(U+=Q.length)}}return{start:F,length:U}}}_selectWordAt(A,z){const O=this._getWordAt(A,z);if(O){for(;O.start<0;)O.start+=this._bufferService.cols,A[1]--;this._model.selectionStart=[O.start,A[1]],this._model.selectionStartLength=O.length}}_selectToWordAt(A){const z=this._getWordAt(A,!0);if(z){let O=A[1];for(;z.start<0;)z.start+=this._bufferService.cols,O--;if(!this._model.areSelectionValuesReversed())for(;z.start+z.length>this._bufferService.cols;)z.length-=this._bufferService.cols,O++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?z.start:z.start+z.length,O]}}_isCharWordSeparator(A){return A.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(A.getChars())>=0}_selectLineAt(A){const z=this._bufferService.buffer.getWrappedRangeForLine(A),O={start:{x:0,y:z.first},end:{x:this._bufferService.cols-1,y:z.last}};this._model.selectionStart=[0,z.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,x.getRangeLength)(O,this._bufferService.cols)}};l.SelectionService=D=p([g(3,j.IBufferService),g(4,j.ICoreService),g(5,E.IMouseService),g(6,j.IOptionsService),g(7,E.IRenderService),g(8,E.ICoreBrowserService)],D)},4725:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ILinkProviderService=l.IThemeService=l.ICharacterJoinerService=l.ISelectionService=l.IRenderService=l.IMouseService=l.ICoreBrowserService=l.ICharSizeService=void 0;const p=d(8343);l.ICharSizeService=(0,p.createDecorator)("CharSizeService"),l.ICoreBrowserService=(0,p.createDecorator)("CoreBrowserService"),l.IMouseService=(0,p.createDecorator)("MouseService"),l.IRenderService=(0,p.createDecorator)("RenderService"),l.ISelectionService=(0,p.createDecorator)("SelectionService"),l.ICharacterJoinerService=(0,p.createDecorator)("CharacterJoinerService"),l.IThemeService=(0,p.createDecorator)("ThemeService"),l.ILinkProviderService=(0,p.createDecorator)("LinkProviderService")},6731:function(f,l,d){var p=this&&this.__decorate||function(D,A,z,O){var q,G=arguments.length,W=G<3?A:O===null?O=Object.getOwnPropertyDescriptor(A,z):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(D,A,z,O);else for(var I=D.length-1;I>=0;I--)(q=D[I])&&(W=(G<3?q(W):G>3?q(A,z,W):q(A,z))||W);return G>3&&W&&Object.defineProperty(A,z,W),W},g=this&&this.__param||function(D,A){return function(z,O){A(z,O,D)}};Object.defineProperty(l,"__esModule",{value:!0}),l.ThemeService=l.DEFAULT_ANSI_COLORS=void 0;const m=d(7239),b=d(8055),_=d(8460),E=d(844),C=d(2585),y=b.css.toColor("#ffffff"),v=b.css.toColor("#000000"),x=b.css.toColor("#ffffff"),S=b.css.toColor("#000000"),j={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};l.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const D=[b.css.toColor("#2e3436"),b.css.toColor("#cc0000"),b.css.toColor("#4e9a06"),b.css.toColor("#c4a000"),b.css.toColor("#3465a4"),b.css.toColor("#75507b"),b.css.toColor("#06989a"),b.css.toColor("#d3d7cf"),b.css.toColor("#555753"),b.css.toColor("#ef2929"),b.css.toColor("#8ae234"),b.css.toColor("#fce94f"),b.css.toColor("#729fcf"),b.css.toColor("#ad7fa8"),b.css.toColor("#34e2e2"),b.css.toColor("#eeeeec")],A=[0,95,135,175,215,255];for(let z=0;z<216;z++){const O=A[z/36%6|0],q=A[z/6%6|0],G=A[z%6];D.push({css:b.channels.toCss(O,q,G),rgba:b.channels.toRgba(O,q,G)})}for(let z=0;z<24;z++){const O=8+10*z;D.push({css:b.channels.toCss(O,O,O),rgba:b.channels.toRgba(O,O,O)})}return D})());let T=l.ThemeService=class extends E.Disposable{get colors(){return this._colors}constructor(D){super(),this._optionsService=D,this._contrastCache=new m.ColorContrastCache,this._halfContrastCache=new m.ColorContrastCache,this._onChangeColors=this.register(new _.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:y,background:v,cursor:x,cursorAccent:S,selectionForeground:void 0,selectionBackgroundTransparent:j,selectionBackgroundOpaque:b.color.blend(v,j),selectionInactiveBackgroundTransparent:j,selectionInactiveBackgroundOpaque:b.color.blend(v,j),ansi:l.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(D={}){const A=this._colors;if(A.foreground=N(D.foreground,y),A.background=N(D.background,v),A.cursor=N(D.cursor,x),A.cursorAccent=N(D.cursorAccent,S),A.selectionBackgroundTransparent=N(D.selectionBackground,j),A.selectionBackgroundOpaque=b.color.blend(A.background,A.selectionBackgroundTransparent),A.selectionInactiveBackgroundTransparent=N(D.selectionInactiveBackground,A.selectionBackgroundTransparent),A.selectionInactiveBackgroundOpaque=b.color.blend(A.background,A.selectionInactiveBackgroundTransparent),A.selectionForeground=D.selectionForeground?N(D.selectionForeground,b.NULL_COLOR):void 0,A.selectionForeground===b.NULL_COLOR&&(A.selectionForeground=void 0),b.color.isOpaque(A.selectionBackgroundTransparent)&&(A.selectionBackgroundTransparent=b.color.opacity(A.selectionBackgroundTransparent,.3)),b.color.isOpaque(A.selectionInactiveBackgroundTransparent)&&(A.selectionInactiveBackgroundTransparent=b.color.opacity(A.selectionInactiveBackgroundTransparent,.3)),A.ansi=l.DEFAULT_ANSI_COLORS.slice(),A.ansi[0]=N(D.black,l.DEFAULT_ANSI_COLORS[0]),A.ansi[1]=N(D.red,l.DEFAULT_ANSI_COLORS[1]),A.ansi[2]=N(D.green,l.DEFAULT_ANSI_COLORS[2]),A.ansi[3]=N(D.yellow,l.DEFAULT_ANSI_COLORS[3]),A.ansi[4]=N(D.blue,l.DEFAULT_ANSI_COLORS[4]),A.ansi[5]=N(D.magenta,l.DEFAULT_ANSI_COLORS[5]),A.ansi[6]=N(D.cyan,l.DEFAULT_ANSI_COLORS[6]),A.ansi[7]=N(D.white,l.DEFAULT_ANSI_COLORS[7]),A.ansi[8]=N(D.brightBlack,l.DEFAULT_ANSI_COLORS[8]),A.ansi[9]=N(D.brightRed,l.DEFAULT_ANSI_COLORS[9]),A.ansi[10]=N(D.brightGreen,l.DEFAULT_ANSI_COLORS[10]),A.ansi[11]=N(D.brightYellow,l.DEFAULT_ANSI_COLORS[11]),A.ansi[12]=N(D.brightBlue,l.DEFAULT_ANSI_COLORS[12]),A.ansi[13]=N(D.brightMagenta,l.DEFAULT_ANSI_COLORS[13]),A.ansi[14]=N(D.brightCyan,l.DEFAULT_ANSI_COLORS[14]),A.ansi[15]=N(D.brightWhite,l.DEFAULT_ANSI_COLORS[15]),D.extendedAnsi){const z=Math.min(A.ansi.length-16,D.extendedAnsi.length);for(let O=0;O<z;O++)A.ansi[O+16]=N(D.extendedAnsi[O],l.DEFAULT_ANSI_COLORS[O+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(D){this._restoreColor(D),this._onChangeColors.fire(this.colors)}_restoreColor(D){if(D!==void 0)switch(D){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[D]=this._restoreColors.ansi[D]}else for(let A=0;A<this._restoreColors.ansi.length;++A)this._colors.ansi[A]=this._restoreColors.ansi[A]}modifyColors(D){D(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function N(D,A){if(D!==void 0)try{return b.css.toColor(D)}catch{}return A}l.ThemeService=T=p([g(0,C.IOptionsService)],T)},6349:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CircularList=void 0;const p=d(8460),g=d(844);class m extends g.Disposable{constructor(_){super(),this._maxLength=_,this.onDeleteEmitter=this.register(new p.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new p.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new p.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(_){if(this._maxLength===_)return;const E=new Array(_);for(let C=0;C<Math.min(_,this.length);C++)E[C]=this._array[this._getCyclicIndex(C)];this._array=E,this._maxLength=_,this._startIndex=0}get length(){return this._length}set length(_){if(_>this._length)for(let E=this._length;E<_;E++)this._array[E]=void 0;this._length=_}get(_){return this._array[this._getCyclicIndex(_)]}set(_,E){this._array[this._getCyclicIndex(_)]=E}push(_){this._array[this._getCyclicIndex(this._length)]=_,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,...C){if(E){for(let y=_;y<this._length-E;y++)this._array[this._getCyclicIndex(y)]=this._array[this._getCyclicIndex(y+E)];this._length-=E,this.onDeleteEmitter.fire({index:_,amount:E})}for(let y=this._length-1;y>=_;y--)this._array[this._getCyclicIndex(y+C.length)]=this._array[this._getCyclicIndex(y)];for(let y=0;y<C.length;y++)this._array[this._getCyclicIndex(_+y)]=C[y];if(C.length&&this.onInsertEmitter.fire({index:_,amount:C.length}),this._length+C.length>this._maxLength){const y=this._length+C.length-this._maxLength;this._startIndex+=y,this._length=this._maxLength,this.onTrimEmitter.fire(y)}else this._length+=C.length}trimStart(_){_>this._length&&(_=this._length),this._startIndex+=_,this._length-=_,this.onTrimEmitter.fire(_)}shiftElements(_,E,C){if(!(E<=0)){if(_<0||_>=this._length)throw new Error("start argument out of range");if(_+C<0)throw new Error("Cannot shift elements in list beyond index 0");if(C>0){for(let v=E-1;v>=0;v--)this.set(_+v+C,this.get(_+v));const y=_+E+C-this._length;if(y>0)for(this._length+=y;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let y=0;y<E;y++)this.set(_+y+C,this.get(_+y))}}_getCyclicIndex(_){return(this._startIndex+_)%this._maxLength}}l.CircularList=m},1439:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.clone=void 0,l.clone=function d(p,g=5){if(typeof p!="object")return p;const m=Array.isArray(p)?[]:{};for(const b in p)m[b]=g<=1?p[b]:p[b]&&d(p[b],g-1);return m}},8055:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.contrastRatio=l.toPaddedHex=l.rgba=l.rgb=l.css=l.color=l.channels=l.NULL_COLOR=void 0;let d=0,p=0,g=0,m=0;var b,_,E,C,y;function v(S){const j=S.toString(16);return j.length<2?"0"+j:j}function x(S,j){return S<j?(j+.05)/(S+.05):(S+.05)/(j+.05)}l.NULL_COLOR={css:"#00000000",rgba:0},(function(S){S.toCss=function(j,T,N,D){return D!==void 0?`#${v(j)}${v(T)}${v(N)}${v(D)}`:`#${v(j)}${v(T)}${v(N)}`},S.toRgba=function(j,T,N,D=255){return(j<<24|T<<16|N<<8|D)>>>0},S.toColor=function(j,T,N,D){return{css:S.toCss(j,T,N,D),rgba:S.toRgba(j,T,N,D)}}})(b||(l.channels=b={})),(function(S){function j(T,N){return m=Math.round(255*N),[d,p,g]=y.toChannels(T.rgba),{css:b.toCss(d,p,g,m),rgba:b.toRgba(d,p,g,m)}}S.blend=function(T,N){if(m=(255&N.rgba)/255,m===1)return{css:N.css,rgba:N.rgba};const D=N.rgba>>24&255,A=N.rgba>>16&255,z=N.rgba>>8&255,O=T.rgba>>24&255,q=T.rgba>>16&255,G=T.rgba>>8&255;return d=O+Math.round((D-O)*m),p=q+Math.round((A-q)*m),g=G+Math.round((z-G)*m),{css:b.toCss(d,p,g),rgba:b.toRgba(d,p,g)}},S.isOpaque=function(T){return(255&T.rgba)==255},S.ensureContrastRatio=function(T,N,D){const A=y.ensureContrastRatio(T.rgba,N.rgba,D);if(A)return b.toColor(A>>24&255,A>>16&255,A>>8&255)},S.opaque=function(T){const N=(255|T.rgba)>>>0;return[d,p,g]=y.toChannels(N),{css:b.toCss(d,p,g),rgba:N}},S.opacity=j,S.multiplyOpacity=function(T,N){return m=255&T.rgba,j(T,m*N/255)},S.toColorRGB=function(T){return[T.rgba>>24&255,T.rgba>>16&255,T.rgba>>8&255]}})(_||(l.color=_={})),(function(S){let j,T;try{const N=document.createElement("canvas");N.width=1,N.height=1;const D=N.getContext("2d",{willReadFrequently:!0});D&&(j=D,j.globalCompositeOperation="copy",T=j.createLinearGradient(0,0,1,1))}catch{}S.toColor=function(N){if(N.match(/#[\da-f]{3,8}/i))switch(N.length){case 4:return d=parseInt(N.slice(1,2).repeat(2),16),p=parseInt(N.slice(2,3).repeat(2),16),g=parseInt(N.slice(3,4).repeat(2),16),b.toColor(d,p,g);case 5:return d=parseInt(N.slice(1,2).repeat(2),16),p=parseInt(N.slice(2,3).repeat(2),16),g=parseInt(N.slice(3,4).repeat(2),16),m=parseInt(N.slice(4,5).repeat(2),16),b.toColor(d,p,g,m);case 7:return{css:N,rgba:(parseInt(N.slice(1),16)<<8|255)>>>0};case 9:return{css:N,rgba:parseInt(N.slice(1),16)>>>0}}const D=N.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(D)return d=parseInt(D[1]),p=parseInt(D[2]),g=parseInt(D[3]),m=Math.round(255*(D[5]===void 0?1:parseFloat(D[5]))),b.toColor(d,p,g,m);if(!j||!T)throw new Error("css.toColor: Unsupported css format");if(j.fillStyle=T,j.fillStyle=N,typeof j.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(j.fillRect(0,0,1,1),[d,p,g,m]=j.getImageData(0,0,1,1).data,m!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:b.toRgba(d,p,g,m),css:N}}})(E||(l.css=E={})),(function(S){function j(T,N,D){const A=T/255,z=N/255,O=D/255;return .2126*(A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4))+.7152*(z<=.03928?z/12.92:Math.pow((z+.055)/1.055,2.4))+.0722*(O<=.03928?O/12.92:Math.pow((O+.055)/1.055,2.4))}S.relativeLuminance=function(T){return j(T>>16&255,T>>8&255,255&T)},S.relativeLuminance2=j})(C||(l.rgb=C={})),(function(S){function j(N,D,A){const z=N>>24&255,O=N>>16&255,q=N>>8&255;let G=D>>24&255,W=D>>16&255,I=D>>8&255,$=x(C.relativeLuminance2(G,W,I),C.relativeLuminance2(z,O,q));for(;$<A&&(G>0||W>0||I>0);)G-=Math.max(0,Math.ceil(.1*G)),W-=Math.max(0,Math.ceil(.1*W)),I-=Math.max(0,Math.ceil(.1*I)),$=x(C.relativeLuminance2(G,W,I),C.relativeLuminance2(z,O,q));return(G<<24|W<<16|I<<8|255)>>>0}function T(N,D,A){const z=N>>24&255,O=N>>16&255,q=N>>8&255;let G=D>>24&255,W=D>>16&255,I=D>>8&255,$=x(C.relativeLuminance2(G,W,I),C.relativeLuminance2(z,O,q));for(;$<A&&(G<255||W<255||I<255);)G=Math.min(255,G+Math.ceil(.1*(255-G))),W=Math.min(255,W+Math.ceil(.1*(255-W))),I=Math.min(255,I+Math.ceil(.1*(255-I))),$=x(C.relativeLuminance2(G,W,I),C.relativeLuminance2(z,O,q));return(G<<24|W<<16|I<<8|255)>>>0}S.blend=function(N,D){if(m=(255&D)/255,m===1)return D;const A=D>>24&255,z=D>>16&255,O=D>>8&255,q=N>>24&255,G=N>>16&255,W=N>>8&255;return d=q+Math.round((A-q)*m),p=G+Math.round((z-G)*m),g=W+Math.round((O-W)*m),b.toRgba(d,p,g)},S.ensureContrastRatio=function(N,D,A){const z=C.relativeLuminance(N>>8),O=C.relativeLuminance(D>>8);if(x(z,O)<A){if(O<z){const W=j(N,D,A),I=x(z,C.relativeLuminance(W>>8));if(I<A){const $=T(N,D,A);return I>x(z,C.relativeLuminance($>>8))?W:$}return W}const q=T(N,D,A),G=x(z,C.relativeLuminance(q>>8));if(G<A){const W=j(N,D,A);return G>x(z,C.relativeLuminance(W>>8))?q:W}return q}},S.reduceLuminance=j,S.increaseLuminance=T,S.toChannels=function(N){return[N>>24&255,N>>16&255,N>>8&255,255&N]}})(y||(l.rgba=y={})),l.toPaddedHex=v,l.contrastRatio=x},8969:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreTerminal=void 0;const p=d(844),g=d(2585),m=d(4348),b=d(7866),_=d(744),E=d(7302),C=d(6975),y=d(8460),v=d(1753),x=d(1480),S=d(7994),j=d(9282),T=d(5435),N=d(5981),D=d(2660);let A=!1;class z extends p.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new y.EventEmitter),this._onScroll.event((q=>{var G;(G=this._onScrollApi)==null||G.fire(q.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(q){for(const G in q)this.optionsService.options[G]=q[G]}constructor(q){super(),this._windowsWrappingHeuristics=this.register(new p.MutableDisposable),this._onBinary=this.register(new y.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new y.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new y.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new y.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new y.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new y.EventEmitter),this._instantiationService=new m.InstantiationService,this.optionsService=this.register(new E.OptionsService(q)),this._instantiationService.setService(g.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(_.BufferService)),this._instantiationService.setService(g.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(b.LogService)),this._instantiationService.setService(g.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(C.CoreService)),this._instantiationService.setService(g.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(v.CoreMouseService)),this._instantiationService.setService(g.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(x.UnicodeService)),this._instantiationService.setService(g.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(S.CharsetService),this._instantiationService.setService(g.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(D.OscLinkService),this._instantiationService.setService(g.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new T.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,y.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,y.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,y.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,y.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((G=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((G=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new N.WriteBuffer(((G,W)=>this._inputHandler.parse(G,W)))),this.register((0,y.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(q,G){this._writeBuffer.write(q,G)}writeSync(q,G){this._logService.logLevel<=g.LogLevelEnum.WARN&&!A&&(this._logService.warn("writeSync is unreliable and will be removed soon."),A=!0),this._writeBuffer.writeSync(q,G)}input(q,G=!0){this.coreService.triggerDataEvent(q,G)}resize(q,G){isNaN(q)||isNaN(G)||(q=Math.max(q,_.MINIMUM_COLS),G=Math.max(G,_.MINIMUM_ROWS),this._bufferService.resize(q,G))}scroll(q,G=!1){this._bufferService.scroll(q,G)}scrollLines(q,G,W){this._bufferService.scrollLines(q,G,W)}scrollPages(q){this.scrollLines(q*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(q){const G=q-this._bufferService.buffer.ydisp;G!==0&&this.scrollLines(G)}registerEscHandler(q,G){return this._inputHandler.registerEscHandler(q,G)}registerDcsHandler(q,G){return this._inputHandler.registerDcsHandler(q,G)}registerCsiHandler(q,G){return this._inputHandler.registerCsiHandler(q,G)}registerOscHandler(q,G){return this._inputHandler.registerOscHandler(q,G)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let q=!1;const G=this.optionsService.rawOptions.windowsPty;G&&G.buildNumber!==void 0&&G.buildNumber!==void 0?q=G.backend==="conpty"&&G.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(q=!0),q?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const q=[];q.push(this.onLineFeed(j.updateWindowsModeWrappedState.bind(null,this._bufferService))),q.push(this.registerCsiHandler({final:"H"},(()=>((0,j.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,p.toDisposable)((()=>{for(const G of q)G.dispose()}))}}}l.CoreTerminal=z},8460:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.runAndSubscribe=l.forwardEvent=l.EventEmitter=void 0,l.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=d=>(this._listeners.push(d),{dispose:()=>{if(!this._disposed){for(let p=0;p<this._listeners.length;p++)if(this._listeners[p]===d)return void this._listeners.splice(p,1)}}})),this._event}fire(d,p){const g=[];for(let m=0;m<this._listeners.length;m++)g.push(this._listeners[m]);for(let m=0;m<g.length;m++)g[m].call(void 0,d,p)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},l.forwardEvent=function(d,p){return d((g=>p.fire(g)))},l.runAndSubscribe=function(d,p){return p(void 0),d((g=>p(g)))}},5435:function(f,l,d){var p=this&&this.__decorate||function(Z,H,L,R){var F,U=arguments.length,ne=U<3?H:R===null?R=Object.getOwnPropertyDescriptor(H,L):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ne=Reflect.decorate(Z,H,L,R);else for(var Q=Z.length-1;Q>=0;Q--)(F=Z[Q])&&(ne=(U<3?F(ne):U>3?F(H,L,ne):F(H,L))||ne);return U>3&&ne&&Object.defineProperty(H,L,ne),ne},g=this&&this.__param||function(Z,H){return function(L,R){H(L,R,Z)}};Object.defineProperty(l,"__esModule",{value:!0}),l.InputHandler=l.WindowsOptionsReportType=void 0;const m=d(2584),b=d(7116),_=d(2015),E=d(844),C=d(482),y=d(8437),v=d(8460),x=d(643),S=d(511),j=d(3734),T=d(2585),N=d(1480),D=d(6242),A=d(6351),z=d(5941),O={"(":0,")":1,"*":2,"+":3,"-":1,".":2},q=131072;function G(Z,H){if(Z>24)return H.setWinLines||!1;switch(Z){case 1:return!!H.restoreWin;case 2:return!!H.minimizeWin;case 3:return!!H.setWinPosition;case 4:return!!H.setWinSizePixels;case 5:return!!H.raiseWin;case 6:return!!H.lowerWin;case 7:return!!H.refreshWin;case 8:return!!H.setWinSizeChars;case 9:return!!H.maximizeWin;case 10:return!!H.fullscreenWin;case 11:return!!H.getWinState;case 13:return!!H.getWinPosition;case 14:return!!H.getWinSizePixels;case 15:return!!H.getScreenSizePixels;case 16:return!!H.getCellSizePixels;case 18:return!!H.getWinSizeChars;case 19:return!!H.getScreenSizeChars;case 20:return!!H.getIconTitle;case 21:return!!H.getWinTitle;case 22:return!!H.pushTitle;case 23:return!!H.popTitle;case 24:return!!H.setWinLines}return!1}var W;(function(Z){Z[Z.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",Z[Z.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(W||(l.WindowsOptionsReportType=W={}));let I=0;class $ extends E.Disposable{getAttrData(){return this._curAttrData}constructor(H,L,R,F,U,ne,Q,ee,Y=new _.EscapeSequenceParser){super(),this._bufferService=H,this._charsetService=L,this._coreService=R,this._logService=F,this._optionsService=U,this._oscLinkService=ne,this._coreMouseService=Q,this._unicodeService=ee,this._parser=Y,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new C.StringToUtf32,this._utf8Decoder=new C.Utf8ToUtf32,this._workCell=new S.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=y.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=y.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new v.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new v.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new v.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new v.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new v.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new v.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new v.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new v.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new v.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new v.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new v.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new v.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new v.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new B(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((V=>this._activeBuffer=V.activeBuffer))),this._parser.setCsiHandlerFallback(((V,oe)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(V),params:oe.toArray()})})),this._parser.setEscHandlerFallback((V=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(V)})})),this._parser.setExecuteHandlerFallback((V=>{this._logService.debug("Unknown EXECUTE code: ",{code:V})})),this._parser.setOscHandlerFallback(((V,oe,re)=>{this._logService.debug("Unknown OSC code: ",{identifier:V,action:oe,data:re})})),this._parser.setDcsHandlerFallback(((V,oe,re)=>{oe==="HOOK"&&(re=re.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(V),action:oe,payload:re})})),this._parser.setPrintHandler(((V,oe,re)=>this.print(V,oe,re))),this._parser.registerCsiHandler({final:"@"},(V=>this.insertChars(V))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(V=>this.scrollLeft(V))),this._parser.registerCsiHandler({final:"A"},(V=>this.cursorUp(V))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(V=>this.scrollRight(V))),this._parser.registerCsiHandler({final:"B"},(V=>this.cursorDown(V))),this._parser.registerCsiHandler({final:"C"},(V=>this.cursorForward(V))),this._parser.registerCsiHandler({final:"D"},(V=>this.cursorBackward(V))),this._parser.registerCsiHandler({final:"E"},(V=>this.cursorNextLine(V))),this._parser.registerCsiHandler({final:"F"},(V=>this.cursorPrecedingLine(V))),this._parser.registerCsiHandler({final:"G"},(V=>this.cursorCharAbsolute(V))),this._parser.registerCsiHandler({final:"H"},(V=>this.cursorPosition(V))),this._parser.registerCsiHandler({final:"I"},(V=>this.cursorForwardTab(V))),this._parser.registerCsiHandler({final:"J"},(V=>this.eraseInDisplay(V,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(V=>this.eraseInDisplay(V,!0))),this._parser.registerCsiHandler({final:"K"},(V=>this.eraseInLine(V,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(V=>this.eraseInLine(V,!0))),this._parser.registerCsiHandler({final:"L"},(V=>this.insertLines(V))),this._parser.registerCsiHandler({final:"M"},(V=>this.deleteLines(V))),this._parser.registerCsiHandler({final:"P"},(V=>this.deleteChars(V))),this._parser.registerCsiHandler({final:"S"},(V=>this.scrollUp(V))),this._parser.registerCsiHandler({final:"T"},(V=>this.scrollDown(V))),this._parser.registerCsiHandler({final:"X"},(V=>this.eraseChars(V))),this._parser.registerCsiHandler({final:"Z"},(V=>this.cursorBackwardTab(V))),this._parser.registerCsiHandler({final:"`"},(V=>this.charPosAbsolute(V))),this._parser.registerCsiHandler({final:"a"},(V=>this.hPositionRelative(V))),this._parser.registerCsiHandler({final:"b"},(V=>this.repeatPrecedingCharacter(V))),this._parser.registerCsiHandler({final:"c"},(V=>this.sendDeviceAttributesPrimary(V))),this._parser.registerCsiHandler({prefix:">",final:"c"},(V=>this.sendDeviceAttributesSecondary(V))),this._parser.registerCsiHandler({final:"d"},(V=>this.linePosAbsolute(V))),this._parser.registerCsiHandler({final:"e"},(V=>this.vPositionRelative(V))),this._parser.registerCsiHandler({final:"f"},(V=>this.hVPosition(V))),this._parser.registerCsiHandler({final:"g"},(V=>this.tabClear(V))),this._parser.registerCsiHandler({final:"h"},(V=>this.setMode(V))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(V=>this.setModePrivate(V))),this._parser.registerCsiHandler({final:"l"},(V=>this.resetMode(V))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(V=>this.resetModePrivate(V))),this._parser.registerCsiHandler({final:"m"},(V=>this.charAttributes(V))),this._parser.registerCsiHandler({final:"n"},(V=>this.deviceStatus(V))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(V=>this.deviceStatusPrivate(V))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(V=>this.softReset(V))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(V=>this.setCursorStyle(V))),this._parser.registerCsiHandler({final:"r"},(V=>this.setScrollRegion(V))),this._parser.registerCsiHandler({final:"s"},(V=>this.saveCursor(V))),this._parser.registerCsiHandler({final:"t"},(V=>this.windowOptions(V))),this._parser.registerCsiHandler({final:"u"},(V=>this.restoreCursor(V))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(V=>this.insertColumns(V))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(V=>this.deleteColumns(V))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(V=>this.selectProtected(V))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(V=>this.requestMode(V,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(V=>this.requestMode(V,!1))),this._parser.setExecuteHandler(m.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(m.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(m.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(m.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(m.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(m.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(m.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(m.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(m.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new D.OscHandler((V=>(this.setTitle(V),this.setIconName(V),!0)))),this._parser.registerOscHandler(1,new D.OscHandler((V=>this.setIconName(V)))),this._parser.registerOscHandler(2,new D.OscHandler((V=>this.setTitle(V)))),this._parser.registerOscHandler(4,new D.OscHandler((V=>this.setOrReportIndexedColor(V)))),this._parser.registerOscHandler(8,new D.OscHandler((V=>this.setHyperlink(V)))),this._parser.registerOscHandler(10,new D.OscHandler((V=>this.setOrReportFgColor(V)))),this._parser.registerOscHandler(11,new D.OscHandler((V=>this.setOrReportBgColor(V)))),this._parser.registerOscHandler(12,new D.OscHandler((V=>this.setOrReportCursorColor(V)))),this._parser.registerOscHandler(104,new D.OscHandler((V=>this.restoreIndexedColor(V)))),this._parser.registerOscHandler(110,new D.OscHandler((V=>this.restoreFgColor(V)))),this._parser.registerOscHandler(111,new D.OscHandler((V=>this.restoreBgColor(V)))),this._parser.registerOscHandler(112,new D.OscHandler((V=>this.restoreCursorColor(V)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const V in b.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:V},(()=>this.selectCharset("("+V))),this._parser.registerEscHandler({intermediates:")",final:V},(()=>this.selectCharset(")"+V))),this._parser.registerEscHandler({intermediates:"*",final:V},(()=>this.selectCharset("*"+V))),this._parser.registerEscHandler({intermediates:"+",final:V},(()=>this.selectCharset("+"+V))),this._parser.registerEscHandler({intermediates:"-",final:V},(()=>this.selectCharset("-"+V))),this._parser.registerEscHandler({intermediates:".",final:V},(()=>this.selectCharset("."+V))),this._parser.registerEscHandler({intermediates:"/",final:V},(()=>this.selectCharset("/"+V)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((V=>(this._logService.error("Parsing error: ",V),V))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new A.DcsHandler(((V,oe)=>this.requestStatusString(V,oe))))}_preserveStack(H,L,R,F){this._parseStack.paused=!0,this._parseStack.cursorStartX=H,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=R,this._parseStack.position=F}_logSlowResolvingAsync(H){this._logService.logLevel<=T.LogLevelEnum.WARN&&Promise.race([H,new Promise(((L,R)=>setTimeout((()=>R("#SLOW_TIMEOUT")),5e3)))]).catch((L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(H,L){let R,F=this._activeBuffer.x,U=this._activeBuffer.y,ne=0;const Q=this._parseStack.paused;if(Q){if(R=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(R),R;F=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,H.length>q&&(ne=this._parseStack.position+q)}if(this._logService.logLevel<=T.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof H=="string"?` "${H}"`:` "${Array.prototype.map.call(H,(V=>String.fromCharCode(V))).join("")}"`),typeof H=="string"?H.split("").map((V=>V.charCodeAt(0))):H),this._parseBuffer.length<H.length&&this._parseBuffer.length<q&&(this._parseBuffer=new Uint32Array(Math.min(H.length,q))),Q||this._dirtyRowTracker.clearRange(),H.length>q)for(let V=ne;V<H.length;V+=q){const oe=V+q<H.length?V+q:H.length,re=typeof H=="string"?this._stringDecoder.decode(H.substring(V,oe),this._parseBuffer):this._utf8Decoder.decode(H.subarray(V,oe),this._parseBuffer);if(R=this._parser.parse(this._parseBuffer,re))return this._preserveStack(F,U,re,V),this._logSlowResolvingAsync(R),R}else if(!Q){const V=typeof H=="string"?this._stringDecoder.decode(H,this._parseBuffer):this._utf8Decoder.decode(H,this._parseBuffer);if(R=this._parser.parse(this._parseBuffer,V))return this._preserveStack(F,U,V,0),this._logSlowResolvingAsync(R),R}this._activeBuffer.x===F&&this._activeBuffer.y===U||this._onCursorMove.fire();const ee=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),Y=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);Y<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(Y,this._bufferService.rows-1),Math.min(ee,this._bufferService.rows-1))}print(H,L,R){let F,U;const ne=this._charsetService.charset,Q=this._optionsService.rawOptions.screenReaderMode,ee=this._bufferService.cols,Y=this._coreService.decPrivateModes.wraparound,V=this._coreService.modes.insertMode,oe=this._curAttrData;let re=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&R-L>0&&re.getWidth(this._activeBuffer.x-1)===2&&re.setCellFromCodepoint(this._activeBuffer.x-1,0,1,oe);let ve=this._parser.precedingJoinState;for(let be=L;be<R;++be){if(F=H[be],F<127&&ne){const We=ne[String.fromCharCode(F)];We&&(F=We.charCodeAt(0))}const Le=this._unicodeService.charProperties(F,ve);U=N.UnicodeService.extractWidth(Le);const Oe=N.UnicodeService.extractShouldJoin(Le),ze=Oe?N.UnicodeService.extractWidth(ve):0;if(ve=Le,Q&&this._onA11yChar.fire((0,C.stringFromCodePoint)(F)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+U-ze>ee){if(Y){const We=re;let Ee=this._activeBuffer.x-ze;for(this._activeBuffer.x=ze,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),re=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),ze>0&&re instanceof y.BufferLine&&re.copyCellsFrom(We,Ee,0,ze,!1);Ee<ee;)We.setCellFromCodepoint(Ee++,0,1,oe)}else if(this._activeBuffer.x=ee-1,U===2)continue}if(Oe&&this._activeBuffer.x){const We=re.getWidth(this._activeBuffer.x-1)?1:2;re.addCodepointToCell(this._activeBuffer.x-We,F,U);for(let Ee=U-ze;--Ee>=0;)re.setCellFromCodepoint(this._activeBuffer.x++,0,0,oe)}else if(V&&(re.insertCells(this._activeBuffer.x,U-ze,this._activeBuffer.getNullCell(oe)),re.getWidth(ee-1)===2&&re.setCellFromCodepoint(ee-1,x.NULL_CELL_CODE,x.NULL_CELL_WIDTH,oe)),re.setCellFromCodepoint(this._activeBuffer.x++,F,U,oe),U>0)for(;--U;)re.setCellFromCodepoint(this._activeBuffer.x++,0,0,oe)}this._parser.precedingJoinState=ve,this._activeBuffer.x<ee&&R-L>0&&re.getWidth(this._activeBuffer.x)===0&&!re.hasContent(this._activeBuffer.x)&&re.setCellFromCodepoint(this._activeBuffer.x,0,1,oe),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(H,L){return H.final!=="t"||H.prefix||H.intermediates?this._parser.registerCsiHandler(H,L):this._parser.registerCsiHandler(H,(R=>!G(R.params[0],this._optionsService.rawOptions.windowOptions)||L(R)))}registerDcsHandler(H,L){return this._parser.registerDcsHandler(H,new A.DcsHandler(L))}registerEscHandler(H,L){return this._parser.registerEscHandler(H,L)}registerOscHandler(H,L){return this._parser.registerOscHandler(H,new D.OscHandler(L))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var H;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&&((H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&H.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);L.hasWidth(this._activeBuffer.x)&&!L.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const H=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-H),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(H=this._bufferService.cols-1){this._activeBuffer.x=Math.min(H,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(H,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=H,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=H,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(H,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+H,this._activeBuffer.y+L)}cursorUp(H){const L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,H.params[0]||1)):this._moveCursor(0,-(H.params[0]||1)),!0}cursorDown(H){const L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,H.params[0]||1)):this._moveCursor(0,H.params[0]||1),!0}cursorForward(H){return this._moveCursor(H.params[0]||1,0),!0}cursorBackward(H){return this._moveCursor(-(H.params[0]||1),0),!0}cursorNextLine(H){return this.cursorDown(H),this._activeBuffer.x=0,!0}cursorPrecedingLine(H){return this.cursorUp(H),this._activeBuffer.x=0,!0}cursorCharAbsolute(H){return this._setCursor((H.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(H){return this._setCursor(H.length>=2?(H.params[1]||1)-1:0,(H.params[0]||1)-1),!0}charPosAbsolute(H){return this._setCursor((H.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(H){return this._moveCursor(H.params[0]||1,0),!0}linePosAbsolute(H){return this._setCursor(this._activeBuffer.x,(H.params[0]||1)-1),!0}vPositionRelative(H){return this._moveCursor(0,H.params[0]||1),!0}hVPosition(H){return this.cursorPosition(H),!0}tabClear(H){const L=H.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(H){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=H.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(H){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=H.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(H){const L=H.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(H,L,R,F=!1,U=!1){const ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);ne.replaceCells(L,R,this._activeBuffer.getNullCell(this._eraseAttrData()),U),F&&(ne.isWrapped=!1)}_resetBufferLine(H,L=!1){const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);R&&(R.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+H),R.isWrapped=!1)}eraseInDisplay(H,L=!1){let R;switch(this._restrictCursor(this._bufferService.cols),H.params[0]){case 0:for(R=this._activeBuffer.y,this._dirtyRowTracker.markDirty(R),this._eraseInBufferLine(R++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);R<this._bufferService.rows;R++)this._resetBufferLine(R,L);this._dirtyRowTracker.markDirty(R);break;case 1:for(R=this._activeBuffer.y,this._dirtyRowTracker.markDirty(R),this._eraseInBufferLine(R,0,this._activeBuffer.x+1,!0,L),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(R+1).isWrapped=!1);R--;)this._resetBufferLine(R,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(R=this._bufferService.rows,this._dirtyRowTracker.markDirty(R-1);R--;)this._resetBufferLine(R,L);this._dirtyRowTracker.markDirty(0);break;case 3:const F=this._activeBuffer.lines.length-this._bufferService.rows;F>0&&(this._activeBuffer.lines.trimStart(F),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-F,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-F,0),this._onScroll.fire(0))}return!0}eraseInLine(H,L=!1){switch(this._restrictCursor(this._bufferService.cols),H.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(H){this._restrictCursor();let L=H.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=this._activeBuffer.ybase+this._activeBuffer.y,F=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-F+1;for(;L--;)this._activeBuffer.lines.splice(U-1,1),this._activeBuffer.lines.splice(R,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(H){this._restrictCursor();let L=H.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=this._activeBuffer.ybase+this._activeBuffer.y;let F;for(F=this._bufferService.rows-1-this._activeBuffer.scrollBottom,F=this._bufferService.rows-1+this._activeBuffer.ybase-F;L--;)this._activeBuffer.lines.splice(R,1),this._activeBuffer.lines.splice(F,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(H){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.insertCells(this._activeBuffer.x,H.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(H){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.deleteCells(this._activeBuffer.x,H.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(H){let L=H.params[0]||1;for(;L--;)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(H){let L=H.params[0]||1;for(;L--;)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(y.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(H){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=H.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);F.deleteCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),F.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(H){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=H.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);F.insertCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),F.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(H){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=H.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);F.insertCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),F.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(H){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=H.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);F.deleteCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),F.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(H){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(H.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(H){const L=this._parser.precedingJoinState;if(!L)return!0;const R=H.params[0]||1,F=N.UnicodeService.extractWidth(L),U=this._activeBuffer.x-F,ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(U),Q=new Uint32Array(ne.length*R);let ee=0;for(let V=0;V<ne.length;){const oe=ne.codePointAt(V)||0;Q[ee++]=oe,V+=oe>65535?2:1}let Y=ee;for(let V=1;V<R;++V)Q.copyWithin(Y,0,ee),Y+=ee;return this.print(Q,0,Y),!0}sendDeviceAttributesPrimary(H){return H.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(m.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(m.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(H){return H.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(m.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(m.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(H.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(m.C0.ESC+"[>83;40003;0c")),!0}_is(H){return(this._optionsService.rawOptions.termName+"").indexOf(H)===0}setMode(H){for(let L=0;L<H.length;L++)switch(H.params[L]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(H){for(let L=0;L<H.length;L++)switch(H.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,b.DEFAULT_CHARSET),this._charsetService.setgCharset(1,b.DEFAULT_CHARSET),this._charsetService.setgCharset(2,b.DEFAULT_CHARSET),this._charsetService.setgCharset(3,b.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(H){for(let L=0;L<H.length;L++)switch(H.params[L]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(H){for(let L=0;L<H.length;L++)switch(H.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),H.params[L]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(H,L){const R=this._coreService.decPrivateModes,{activeProtocol:F,activeEncoding:U}=this._coreMouseService,ne=this._coreService,{buffers:Q,cols:ee}=this._bufferService,{active:Y,alt:V}=Q,oe=this._optionsService.rawOptions,re=Oe=>Oe?1:2,ve=H.params[0];return be=ve,Le=L?ve===2?4:ve===4?re(ne.modes.insertMode):ve===12?3:ve===20?re(oe.convertEol):0:ve===1?re(R.applicationCursorKeys):ve===3?oe.windowOptions.setWinLines?ee===80?2:ee===132?1:0:0:ve===6?re(R.origin):ve===7?re(R.wraparound):ve===8?3:ve===9?re(F==="X10"):ve===12?re(oe.cursorBlink):ve===25?re(!ne.isCursorHidden):ve===45?re(R.reverseWraparound):ve===66?re(R.applicationKeypad):ve===67?4:ve===1e3?re(F==="VT200"):ve===1002?re(F==="DRAG"):ve===1003?re(F==="ANY"):ve===1004?re(R.sendFocus):ve===1005?4:ve===1006?re(U==="SGR"):ve===1015?4:ve===1016?re(U==="SGR_PIXELS"):ve===1048?1:ve===47||ve===1047||ve===1049?re(Y===V):ve===2004?re(R.bracketedPasteMode):0,ne.triggerDataEvent(`${m.C0.ESC}[${L?"":"?"}${be};${Le}$y`),!0;var be,Le}_updateAttrColor(H,L,R,F,U){return L===2?(H|=50331648,H&=-16777216,H|=j.AttributeData.fromColorRGB([R,F,U])):L===5&&(H&=-50331904,H|=33554432|255&R),H}_extractColor(H,L,R){const F=[0,0,-1,0,0,0];let U=0,ne=0;do{if(F[ne+U]=H.params[L+ne],H.hasSubParams(L+ne)){const Q=H.getSubParams(L+ne);let ee=0;do F[1]===5&&(U=1),F[ne+ee+1+U]=Q[ee];while(++ee<Q.length&&ee+ne+1+U<F.length);break}if(F[1]===5&&ne+U>=2||F[1]===2&&ne+U>=5)break;F[1]&&(U=1)}while(++ne+L<H.length&&ne+U<F.length);for(let Q=2;Q<F.length;++Q)F[Q]===-1&&(F[Q]=0);switch(F[0]){case 38:R.fg=this._updateAttrColor(R.fg,F[1],F[3],F[4],F[5]);break;case 48:R.bg=this._updateAttrColor(R.bg,F[1],F[3],F[4],F[5]);break;case 58:R.extended=R.extended.clone(),R.extended.underlineColor=this._updateAttrColor(R.extended.underlineColor,F[1],F[3],F[4],F[5])}return ne}_processUnderline(H,L){L.extended=L.extended.clone(),(!~H||H>5)&&(H=1),L.extended.underlineStyle=H,L.fg|=268435456,H===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(H){H.fg=y.DEFAULT_ATTR_DATA.fg,H.bg=y.DEFAULT_ATTR_DATA.bg,H.extended=H.extended.clone(),H.extended.underlineStyle=0,H.extended.underlineColor&=-67108864,H.updateExtended()}charAttributes(H){if(H.length===1&&H.params[0]===0)return this._processSGR0(this._curAttrData),!0;const L=H.length;let R;const F=this._curAttrData;for(let U=0;U<L;U++)R=H.params[U],R>=30&&R<=37?(F.fg&=-50331904,F.fg|=16777216|R-30):R>=40&&R<=47?(F.bg&=-50331904,F.bg|=16777216|R-40):R>=90&&R<=97?(F.fg&=-50331904,F.fg|=16777224|R-90):R>=100&&R<=107?(F.bg&=-50331904,F.bg|=16777224|R-100):R===0?this._processSGR0(F):R===1?F.fg|=134217728:R===3?F.bg|=67108864:R===4?(F.fg|=268435456,this._processUnderline(H.hasSubParams(U)?H.getSubParams(U)[0]:1,F)):R===5?F.fg|=536870912:R===7?F.fg|=67108864:R===8?F.fg|=1073741824:R===9?F.fg|=2147483648:R===2?F.bg|=134217728:R===21?this._processUnderline(2,F):R===22?(F.fg&=-134217729,F.bg&=-134217729):R===23?F.bg&=-67108865:R===24?(F.fg&=-268435457,this._processUnderline(0,F)):R===25?F.fg&=-536870913:R===27?F.fg&=-67108865:R===28?F.fg&=-1073741825:R===29?F.fg&=2147483647:R===39?(F.fg&=-67108864,F.fg|=16777215&y.DEFAULT_ATTR_DATA.fg):R===49?(F.bg&=-67108864,F.bg|=16777215&y.DEFAULT_ATTR_DATA.bg):R===38||R===48||R===58?U+=this._extractColor(H,U,F):R===53?F.bg|=1073741824:R===55?F.bg&=-1073741825:R===59?(F.extended=F.extended.clone(),F.extended.underlineColor=-1,F.updateExtended()):R===100?(F.fg&=-67108864,F.fg|=16777215&y.DEFAULT_ATTR_DATA.fg,F.bg&=-67108864,F.bg|=16777215&y.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",R);return!0}deviceStatus(H){switch(H.params[0]){case 5:this._coreService.triggerDataEvent(`${m.C0.ESC}[0n`);break;case 6:const L=this._activeBuffer.y+1,R=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[${L};${R}R`)}return!0}deviceStatusPrivate(H){if(H.params[0]===6){const L=this._activeBuffer.y+1,R=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[?${L};${R}R`)}return!0}softReset(H){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=y.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(H){const L=H.params[0]||1;switch(L){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const R=L%2==1;return this._optionsService.options.cursorBlink=R,!0}setScrollRegion(H){const L=H.params[0]||1;let R;return(H.length<2||(R=H.params[1])>this._bufferService.rows||R===0)&&(R=this._bufferService.rows),R>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=R-1,this._setCursor(0,0)),!0}windowOptions(H){if(!G(H.params[0],this._optionsService.rawOptions.windowOptions))return!0;const L=H.length>1?H.params[1]:0;switch(H.params[0]){case 14:L!==2&&this._onRequestWindowsOptionsReport.fire(W.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(W.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${m.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(H){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(H){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(H){return this._windowTitle=H,this._onTitleChange.fire(H),!0}setIconName(H){return this._iconName=H,!0}setOrReportIndexedColor(H){const L=[],R=H.split(";");for(;R.length>1;){const F=R.shift(),U=R.shift();if(/^\d+$/.exec(F)){const ne=parseInt(F);if(X(ne))if(U==="?")L.push({type:0,index:ne});else{const Q=(0,z.parseColor)(U);Q&&L.push({type:1,index:ne,color:Q})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(H){const L=H.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(H,L){this._getCurrentLinkId()&&this._finishHyperlink();const R=H.split(":");let F;const U=R.findIndex((ne=>ne.startsWith("id=")));return U!==-1&&(F=R[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:F,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(H,L){const R=H.split(";");for(let F=0;F<R.length&&!(L>=this._specialColors.length);++F,++L)if(R[F]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{const U=(0,z.parseColor)(R[F]);U&&this._onColor.fire([{type:1,index:this._specialColors[L],color:U}])}return!0}setOrReportFgColor(H){return this._setOrReportSpecialColor(H,0)}setOrReportBgColor(H){return this._setOrReportSpecialColor(H,1)}setOrReportCursorColor(H){return this._setOrReportSpecialColor(H,2)}restoreIndexedColor(H){if(!H)return this._onColor.fire([{type:2}]),!0;const L=[],R=H.split(";");for(let F=0;F<R.length;++F)if(/^\d+$/.exec(R[F])){const U=parseInt(R[F]);X(U)&&L.push({type:2,index:U})}return L.length&&this._onColor.fire(L),!0}restoreFgColor(H){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(H){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(H){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,b.DEFAULT_CHARSET),!0}selectCharset(H){return H.length!==2?(this.selectDefaultCharset(),!0):(H[0]==="/"||this._charsetService.setgCharset(O[H[0]],b.CHARSETS[H[1]]||b.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const H=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,H,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=y.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=y.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(H){return this._charsetService.setgLevel(H),!0}screenAlignmentPattern(){const H=new S.CellData;H.content=4194373,H.fg=this._curAttrData.fg,H.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L<this._bufferService.rows;++L){const R=this._activeBuffer.ybase+this._activeBuffer.y+L,F=this._activeBuffer.lines.get(R);F&&(F.fill(H),F.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(H,L){const R=this._bufferService.buffer,F=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${m.C0.ESC}${U}${m.C0.ESC}\\`),!0))(H==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:H==='"p'?'P1$r61;1"p':H==="r"?`P1$r${R.scrollTop+1};${R.scrollBottom+1}r`:H==="m"?"P1$r0m":H===" q"?`P1$r${{block:2,underline:4,bar:6}[F.cursorStyle]-(F.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(H,L){this._dirtyRowTracker.markRangeDirty(H,L)}}l.InputHandler=$;let B=class{constructor(Z){this._bufferService=Z,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(Z){Z<this.start?this.start=Z:Z>this.end&&(this.end=Z)}markRangeDirty(Z,H){Z>H&&(I=Z,Z=H,H=I),Z<this.start&&(this.start=Z),H>this.end&&(this.end=H)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function X(Z){return 0<=Z&&Z<256}B=p([g(0,T.IBufferService)],B)},844:(f,l)=>{function d(p){for(const g of p)g.dispose();p.length=0}Object.defineProperty(l,"__esModule",{value:!0}),l.getDisposeArrayDisposable=l.disposeArray=l.toDisposable=l.MutableDisposable=l.Disposable=void 0,l.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const p of this._disposables)p.dispose();this._disposables.length=0}register(p){return this._disposables.push(p),p}unregister(p){const g=this._disposables.indexOf(p);g!==-1&&this._disposables.splice(g,1)}},l.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(p){var g;this._isDisposed||p===this._value||((g=this._value)==null||g.dispose(),this._value=p)}clear(){this.value=void 0}dispose(){var p;this._isDisposed=!0,(p=this._value)==null||p.dispose(),this._value=void 0}},l.toDisposable=function(p){return{dispose:p}},l.disposeArray=d,l.getDisposeArrayDisposable=function(p){return{dispose:()=>d(p)}}},1505:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.FourKeyMap=l.TwoKeyMap=void 0;class d{constructor(){this._data={}}set(g,m,b){this._data[g]||(this._data[g]={}),this._data[g][m]=b}get(g,m){return this._data[g]?this._data[g][m]:void 0}clear(){this._data={}}}l.TwoKeyMap=d,l.FourKeyMap=class{constructor(){this._data=new d}set(p,g,m,b,_){this._data.get(p,g)||this._data.set(p,g,new d),this._data.get(p,g).set(m,b,_)}get(p,g,m,b){var _;return(_=this._data.get(p,g))==null?void 0:_.get(m,b)}clear(){this._data.clear()}}},6114:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.isChromeOS=l.isLinux=l.isWindows=l.isIphone=l.isIpad=l.isMac=l.getSafariVersion=l.isSafari=l.isLegacyEdge=l.isFirefox=l.isNode=void 0,l.isNode=typeof process<"u"&&"title"in process;const d=l.isNode?"node":navigator.userAgent,p=l.isNode?"node":navigator.platform;l.isFirefox=d.includes("Firefox"),l.isLegacyEdge=d.includes("Edge"),l.isSafari=/^((?!chrome|android).)*safari/i.test(d),l.getSafariVersion=function(){if(!l.isSafari)return 0;const g=d.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},l.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(p),l.isIpad=p==="iPad",l.isIphone=p==="iPhone",l.isWindows=["Windows","Win16","Win32","WinCE"].includes(p),l.isLinux=p.indexOf("Linux")>=0,l.isChromeOS=/\bCrOS\b/.test(d)},6106:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SortedList=void 0;let d=0;l.SortedList=class{constructor(p){this._getKey=p,this._array=[]}clear(){this._array.length=0}insert(p){this._array.length!==0?(d=this._search(this._getKey(p)),this._array.splice(d,0,p)):this._array.push(p)}delete(p){if(this._array.length===0)return!1;const g=this._getKey(p);if(g===void 0||(d=this._search(g),d===-1)||this._getKey(this._array[d])!==g)return!1;do if(this._array[d]===p)return this._array.splice(d,1),!0;while(++d<this._array.length&&this._getKey(this._array[d])===g);return!1}*getKeyIterator(p){if(this._array.length!==0&&(d=this._search(p),!(d<0||d>=this._array.length)&&this._getKey(this._array[d])===p))do yield this._array[d];while(++d<this._array.length&&this._getKey(this._array[d])===p)}forEachByKey(p,g){if(this._array.length!==0&&(d=this._search(p),!(d<0||d>=this._array.length)&&this._getKey(this._array[d])===p))do g(this._array[d]);while(++d<this._array.length&&this._getKey(this._array[d])===p)}values(){return[...this._array].values()}_search(p){let g=0,m=this._array.length-1;for(;m>=g;){let b=g+m>>1;const _=this._getKey(this._array[b]);if(_>p)m=b-1;else{if(!(_<p)){for(;b>0&&this._getKey(this._array[b-1])===p;)b--;return b}g=b+1}}return g}}},7226:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DebouncedIdleTask=l.IdleTaskQueue=l.PriorityTaskQueue=void 0;const p=d(6114);class g{constructor(){this._tasks=[],this._i=0}enqueue(_){this._tasks.push(_),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(_){this._idleCallback=void 0;let E=0,C=0,y=_.timeRemaining(),v=0;for(;this._i<this._tasks.length;){if(E=Date.now(),this._tasks[this._i]()||this._i++,E=Math.max(1,Date.now()-E),C=Math.max(E,C),v=_.timeRemaining(),1.5*C>v)return y-E<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(y-E))}ms`),void this._start();y=v}this.clear()}}class m extends g{_requestCallback(_){return setTimeout((()=>_(this._createDeadline(16))))}_cancelCallback(_){clearTimeout(_)}_createDeadline(_){const E=Date.now()+_;return{timeRemaining:()=>Math.max(0,E-Date.now())}}}l.PriorityTaskQueue=m,l.IdleTaskQueue=!p.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(b){return requestIdleCallback(b)}_cancelCallback(b){cancelIdleCallback(b)}}:m,l.DebouncedIdleTask=class{constructor(){this._queue=new l.IdleTaskQueue}set(b){this._queue.clear(),this._queue.enqueue(b)}flush(){this._queue.flush()}}},9282:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.updateWindowsModeWrappedState=void 0;const p=d(643);l.updateWindowsModeWrappedState=function(g){const m=g.buffer.lines.get(g.buffer.ybase+g.buffer.y-1),b=m==null?void 0:m.get(g.cols-1),_=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);_&&b&&(_.isWrapped=b[p.CHAR_DATA_CODE_INDEX]!==p.NULL_CELL_CODE&&b[p.CHAR_DATA_CODE_INDEX]!==p.WHITESPACE_CELL_CODE)}},3734:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ExtendedAttrs=l.AttributeData=void 0;class d{constructor(){this.fg=0,this.bg=0,this.extended=new p}static toColorRGB(m){return[m>>>16&255,m>>>8&255,255&m]}static fromColorRGB(m){return(255&m[0])<<16|(255&m[1])<<8|255&m[2]}clone(){const m=new d;return m.fg=this.fg,m.bg=this.bg,m.extended=this.extended.clone(),m}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}l.AttributeData=d;class p{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(m){this._ext=m}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(m){this._ext&=-469762049,this._ext|=m<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(m){this._ext&=-67108864,this._ext|=67108863&m}get urlId(){return this._urlId}set urlId(m){this._urlId=m}get underlineVariantOffset(){const m=(3758096384&this._ext)>>29;return m<0?4294967288^m:m}set underlineVariantOffset(m){this._ext&=536870911,this._ext|=m<<29&3758096384}constructor(m=0,b=0){this._ext=0,this._urlId=0,this._ext=m,this._urlId=b}clone(){return new p(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}l.ExtendedAttrs=p},9092:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Buffer=l.MAX_BUFFER_SIZE=void 0;const p=d(6349),g=d(7226),m=d(3734),b=d(8437),_=d(4634),E=d(511),C=d(643),y=d(4863),v=d(7116);l.MAX_BUFFER_SIZE=4294967295,l.Buffer=class{constructor(x,S,j){this._hasScrollback=x,this._optionsService=S,this._bufferService=j,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=b.DEFAULT_ATTR_DATA.clone(),this.savedCharset=v.DEFAULT_CHARSET,this.markers=[],this._nullCell=E.CellData.fromCharData([0,C.NULL_CELL_CHAR,C.NULL_CELL_WIDTH,C.NULL_CELL_CODE]),this._whitespaceCell=E.CellData.fromCharData([0,C.WHITESPACE_CELL_CHAR,C.WHITESPACE_CELL_WIDTH,C.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new g.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new p.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(x){return x?(this._nullCell.fg=x.fg,this._nullCell.bg=x.bg,this._nullCell.extended=x.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new m.ExtendedAttrs),this._nullCell}getWhitespaceCell(x){return x?(this._whitespaceCell.fg=x.fg,this._whitespaceCell.bg=x.bg,this._whitespaceCell.extended=x.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new m.ExtendedAttrs),this._whitespaceCell}getBlankLine(x,S){return new b.BufferLine(this._bufferService.cols,this.getNullCell(x),S)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const x=this.ybase+this.y-this.ydisp;return x>=0&&x<this._rows}_getCorrectBufferLength(x){if(!this._hasScrollback)return x;const S=x+this._optionsService.rawOptions.scrollback;return S>l.MAX_BUFFER_SIZE?l.MAX_BUFFER_SIZE:S}fillViewportRows(x){if(this.lines.length===0){x===void 0&&(x=b.DEFAULT_ATTR_DATA);let S=this._rows;for(;S--;)this.lines.push(this.getBlankLine(x))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new p.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(x,S){const j=this.getNullCell(b.DEFAULT_ATTR_DATA);let T=0;const N=this._getCorrectBufferLength(S);if(N>this.lines.maxLength&&(this.lines.maxLength=N),this.lines.length>0){if(this._cols<x)for(let A=0;A<this.lines.length;A++)T+=+this.lines.get(A).resize(x,j);let D=0;if(this._rows<S)for(let A=this._rows;A<S;A++)this.lines.length<S+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new b.BufferLine(x,j)):this.ybase>0&&this.lines.length<=this.ybase+this.y+D+1?(this.ybase--,D++,this.ydisp>0&&this.ydisp--):this.lines.push(new b.BufferLine(x,j)));else for(let A=this._rows;A>S;A--)this.lines.length>S+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(N<this.lines.maxLength){const A=this.lines.length-N;A>0&&(this.lines.trimStart(A),this.ybase=Math.max(this.ybase-A,0),this.ydisp=Math.max(this.ydisp-A,0),this.savedY=Math.max(this.savedY-A,0)),this.lines.maxLength=N}this.x=Math.min(this.x,x-1),this.y=Math.min(this.y,S-1),D&&(this.y+=D),this.savedX=Math.min(this.savedX,x-1),this.scrollTop=0}if(this.scrollBottom=S-1,this._isReflowEnabled&&(this._reflow(x,S),this._cols>x))for(let D=0;D<this.lines.length;D++)T+=+this.lines.get(D).resize(x,j);this._cols=x,this._rows=S,this._memoryCleanupQueue.clear(),T>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let x=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,x=!1);let S=0;for(;this._memoryCleanupPosition<this.lines.length;)if(S+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),S>100)return!0;return x}get _isReflowEnabled(){const x=this._optionsService.rawOptions.windowsPty;return x&&x.buildNumber?this._hasScrollback&&x.backend==="conpty"&&x.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(x,S){this._cols!==x&&(x>this._cols?this._reflowLarger(x,S):this._reflowSmaller(x,S))}_reflowLarger(x,S){const j=(0,_.reflowLargerGetLinesToRemove)(this.lines,this._cols,x,this.ybase+this.y,this.getNullCell(b.DEFAULT_ATTR_DATA));if(j.length>0){const T=(0,_.reflowLargerCreateNewLayout)(this.lines,j);(0,_.reflowLargerApplyNewLayout)(this.lines,T.layout),this._reflowLargerAdjustViewport(x,S,T.countRemoved)}}_reflowLargerAdjustViewport(x,S,j){const T=this.getNullCell(b.DEFAULT_ATTR_DATA);let N=j;for(;N-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<S&&this.lines.push(new b.BufferLine(x,T))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-j,0)}_reflowSmaller(x,S){const j=this.getNullCell(b.DEFAULT_ATTR_DATA),T=[];let N=0;for(let D=this.lines.length-1;D>=0;D--){let A=this.lines.get(D);if(!A||!A.isWrapped&&A.getTrimmedLength()<=x)continue;const z=[A];for(;A.isWrapped&&D>0;)A=this.lines.get(--D),z.unshift(A);const O=this.ybase+this.y;if(O>=D&&O<D+z.length)continue;const q=z[z.length-1].getTrimmedLength(),G=(0,_.reflowSmallerGetNewLineLengths)(z,this._cols,x),W=G.length-z.length;let I;I=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+W):Math.max(0,this.lines.length-this.lines.maxLength+W);const $=[];for(let R=0;R<W;R++){const F=this.getBlankLine(b.DEFAULT_ATTR_DATA,!0);$.push(F)}$.length>0&&(T.push({start:D+z.length+N,newLines:$}),N+=$.length),z.push(...$);let B=G.length-1,X=G[B];X===0&&(B--,X=G[B]);let Z=z.length-W-1,H=q;for(;Z>=0;){const R=Math.min(H,X);if(z[B]===void 0)break;if(z[B].copyCellsFrom(z[Z],H-R,X-R,R,!0),X-=R,X===0&&(B--,X=G[B]),H-=R,H===0){Z--;const F=Math.max(Z,0);H=(0,_.getWrappedLineTrimmedLength)(z,F,this._cols)}}for(let R=0;R<z.length;R++)G[R]<x&&z[R].setCell(G[R],j);let L=W-I;for(;L-- >0;)this.ybase===0?this.y<S-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+N)-S&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+W,this.ybase+S-1)}if(T.length>0){const D=[],A=[];for(let B=0;B<this.lines.length;B++)A.push(this.lines.get(B));const z=this.lines.length;let O=z-1,q=0,G=T[q];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+N);let W=0;for(let B=Math.min(this.lines.maxLength-1,z+N-1);B>=0;B--)if(G&&G.start>O+W){for(let X=G.newLines.length-1;X>=0;X--)this.lines.set(B--,G.newLines[X]);B++,D.push({index:O+1,amount:G.newLines.length}),W+=G.newLines.length,G=T[++q]}else this.lines.set(B,A[O--]);let I=0;for(let B=D.length-1;B>=0;B--)D[B].index+=I,this.lines.onInsertEmitter.fire(D[B]),I+=D[B].amount;const $=Math.max(0,z+N-this.lines.maxLength);$>0&&this.lines.onTrimEmitter.fire($)}}translateBufferLineToString(x,S,j=0,T){const N=this.lines.get(x);return N?N.translateToString(S,j,T):""}getWrappedRangeForLine(x){let S=x,j=x;for(;S>0&&this.lines.get(S).isWrapped;)S--;for(;j+1<this.lines.length&&this.lines.get(j+1).isWrapped;)j++;return{first:S,last:j}}setupTabStops(x){for(x!=null?this.tabs[x]||(x=this.prevStop(x)):(this.tabs={},x=0);x<this._cols;x+=this._optionsService.rawOptions.tabStopWidth)this.tabs[x]=!0}prevStop(x){for(x==null&&(x=this.x);!this.tabs[--x]&&x>0;);return x>=this._cols?this._cols-1:x<0?0:x}nextStop(x){for(x==null&&(x=this.x);!this.tabs[++x]&&x<this._cols;);return x>=this._cols?this._cols-1:x<0?0:x}clearMarkers(x){this._isClearing=!0;for(let S=0;S<this.markers.length;S++)this.markers[S].line===x&&(this.markers[S].dispose(),this.markers.splice(S--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let x=0;x<this.markers.length;x++)this.markers[x].dispose(),this.markers.splice(x--,1);this._isClearing=!1}addMarker(x){const S=new y.Marker(x);return this.markers.push(S),S.register(this.lines.onTrim((j=>{S.line-=j,S.line<0&&S.dispose()}))),S.register(this.lines.onInsert((j=>{S.line>=j.index&&(S.line+=j.amount)}))),S.register(this.lines.onDelete((j=>{S.line>=j.index&&S.line<j.index+j.amount&&S.dispose(),S.line>j.index&&(S.line-=j.amount)}))),S.register(S.onDispose((()=>this._removeMarker(S)))),S}_removeMarker(x){this._isClearing||this.markers.splice(this.markers.indexOf(x),1)}}},8437:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLine=l.DEFAULT_ATTR_DATA=void 0;const p=d(3734),g=d(511),m=d(643),b=d(482);l.DEFAULT_ATTR_DATA=Object.freeze(new p.AttributeData);let _=0;class E{constructor(y,v,x=!1){this.isWrapped=x,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*y);const S=v||g.CellData.fromCharData([0,m.NULL_CELL_CHAR,m.NULL_CELL_WIDTH,m.NULL_CELL_CODE]);for(let j=0;j<y;++j)this.setCell(j,S);this.length=y}get(y){const v=this._data[3*y+0],x=2097151&v;return[this._data[3*y+1],2097152&v?this._combined[y]:x?(0,b.stringFromCodePoint)(x):"",v>>22,2097152&v?this._combined[y].charCodeAt(this._combined[y].length-1):x]}set(y,v){this._data[3*y+1]=v[m.CHAR_DATA_ATTR_INDEX],v[m.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[y]=v[1],this._data[3*y+0]=2097152|y|v[m.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*y+0]=v[m.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|v[m.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(y){return this._data[3*y+0]>>22}hasWidth(y){return 12582912&this._data[3*y+0]}getFg(y){return this._data[3*y+1]}getBg(y){return this._data[3*y+2]}hasContent(y){return 4194303&this._data[3*y+0]}getCodePoint(y){const v=this._data[3*y+0];return 2097152&v?this._combined[y].charCodeAt(this._combined[y].length-1):2097151&v}isCombined(y){return 2097152&this._data[3*y+0]}getString(y){const v=this._data[3*y+0];return 2097152&v?this._combined[y]:2097151&v?(0,b.stringFromCodePoint)(2097151&v):""}isProtected(y){return 536870912&this._data[3*y+2]}loadCell(y,v){return _=3*y,v.content=this._data[_+0],v.fg=this._data[_+1],v.bg=this._data[_+2],2097152&v.content&&(v.combinedData=this._combined[y]),268435456&v.bg&&(v.extended=this._extendedAttrs[y]),v}setCell(y,v){2097152&v.content&&(this._combined[y]=v.combinedData),268435456&v.bg&&(this._extendedAttrs[y]=v.extended),this._data[3*y+0]=v.content,this._data[3*y+1]=v.fg,this._data[3*y+2]=v.bg}setCellFromCodepoint(y,v,x,S){268435456&S.bg&&(this._extendedAttrs[y]=S.extended),this._data[3*y+0]=v|x<<22,this._data[3*y+1]=S.fg,this._data[3*y+2]=S.bg}addCodepointToCell(y,v,x){let S=this._data[3*y+0];2097152&S?this._combined[y]+=(0,b.stringFromCodePoint)(v):2097151&S?(this._combined[y]=(0,b.stringFromCodePoint)(2097151&S)+(0,b.stringFromCodePoint)(v),S&=-2097152,S|=2097152):S=v|4194304,x&&(S&=-12582913,S|=x<<22),this._data[3*y+0]=S}insertCells(y,v,x){if((y%=this.length)&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y-1,0,1,x),v<this.length-y){const S=new g.CellData;for(let j=this.length-y-v-1;j>=0;--j)this.setCell(y+v+j,this.loadCell(y+j,S));for(let j=0;j<v;++j)this.setCell(y+j,x)}else for(let S=y;S<this.length;++S)this.setCell(S,x);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,x)}deleteCells(y,v,x){if(y%=this.length,v<this.length-y){const S=new g.CellData;for(let j=0;j<this.length-y-v;++j)this.setCell(y+j,this.loadCell(y+v+j,S));for(let j=this.length-v;j<this.length;++j)this.setCell(j,x)}else for(let S=y;S<this.length;++S)this.setCell(S,x);y&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y-1,0,1,x),this.getWidth(y)!==0||this.hasContent(y)||this.setCellFromCodepoint(y,0,1,x)}replaceCells(y,v,x,S=!1){if(S)for(y&&this.getWidth(y-1)===2&&!this.isProtected(y-1)&&this.setCellFromCodepoint(y-1,0,1,x),v<this.length&&this.getWidth(v-1)===2&&!this.isProtected(v)&&this.setCellFromCodepoint(v,0,1,x);y<v&&y<this.length;)this.isProtected(y)||this.setCell(y,x),y++;else for(y&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y-1,0,1,x),v<this.length&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v,0,1,x);y<v&&y<this.length;)this.setCell(y++,x)}resize(y,v){if(y===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const x=3*y;if(y>this.length){if(this._data.buffer.byteLength>=4*x)this._data=new Uint32Array(this._data.buffer,0,x);else{const S=new Uint32Array(x);S.set(this._data),this._data=S}for(let S=this.length;S<y;++S)this.setCell(S,v)}else{this._data=this._data.subarray(0,x);const S=Object.keys(this._combined);for(let T=0;T<S.length;T++){const N=parseInt(S[T],10);N>=y&&delete this._combined[N]}const j=Object.keys(this._extendedAttrs);for(let T=0;T<j.length;T++){const N=parseInt(j[T],10);N>=y&&delete this._extendedAttrs[N]}}return this.length=y,4*x*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const y=new Uint32Array(this._data.length);return y.set(this._data),this._data=y,1}return 0}fill(y,v=!1){if(v)for(let x=0;x<this.length;++x)this.isProtected(x)||this.setCell(x,y);else{this._combined={},this._extendedAttrs={};for(let x=0;x<this.length;++x)this.setCell(x,y)}}copyFrom(y){this.length!==y.length?this._data=new Uint32Array(y._data):this._data.set(y._data),this.length=y.length,this._combined={};for(const v in y._combined)this._combined[v]=y._combined[v];this._extendedAttrs={};for(const v in y._extendedAttrs)this._extendedAttrs[v]=y._extendedAttrs[v];this.isWrapped=y.isWrapped}clone(){const y=new E(0);y._data=new Uint32Array(this._data),y.length=this.length;for(const v in this._combined)y._combined[v]=this._combined[v];for(const v in this._extendedAttrs)y._extendedAttrs[v]=this._extendedAttrs[v];return y.isWrapped=this.isWrapped,y}getTrimmedLength(){for(let y=this.length-1;y>=0;--y)if(4194303&this._data[3*y+0])return y+(this._data[3*y+0]>>22);return 0}getNoBgTrimmedLength(){for(let y=this.length-1;y>=0;--y)if(4194303&this._data[3*y+0]||50331648&this._data[3*y+2])return y+(this._data[3*y+0]>>22);return 0}copyCellsFrom(y,v,x,S,j){const T=y._data;if(j)for(let D=S-1;D>=0;D--){for(let A=0;A<3;A++)this._data[3*(x+D)+A]=T[3*(v+D)+A];268435456&T[3*(v+D)+2]&&(this._extendedAttrs[x+D]=y._extendedAttrs[v+D])}else for(let D=0;D<S;D++){for(let A=0;A<3;A++)this._data[3*(x+D)+A]=T[3*(v+D)+A];268435456&T[3*(v+D)+2]&&(this._extendedAttrs[x+D]=y._extendedAttrs[v+D])}const N=Object.keys(y._combined);for(let D=0;D<N.length;D++){const A=parseInt(N[D],10);A>=v&&(this._combined[A-v+x]=y._combined[A])}}translateToString(y,v,x,S){v=v??0,x=x??this.length,y&&(x=Math.min(x,this.getTrimmedLength())),S&&(S.length=0);let j="";for(;v<x;){const T=this._data[3*v+0],N=2097151&T,D=2097152&T?this._combined[v]:N?(0,b.stringFromCodePoint)(N):m.WHITESPACE_CELL_CHAR;if(j+=D,S)for(let A=0;A<D.length;++A)S.push(v);v+=T>>22||1}return S&&S.push(v),j}}l.BufferLine=E},4841:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.getRangeLength=void 0,l.getRangeLength=function(d,p){if(d.start.y>d.end.y)throw new Error(`Buffer range end (${d.end.x}, ${d.end.y}) cannot be before start (${d.start.x}, ${d.start.y})`);return p*(d.end.y-d.start.y)+(d.end.x-d.start.x+1)}},4634:(f,l)=>{function d(p,g,m){if(g===p.length-1)return p[g].getTrimmedLength();const b=!p[g].hasContent(m-1)&&p[g].getWidth(m-1)===1,_=p[g+1].getWidth(0)===2;return b&&_?m-1:m}Object.defineProperty(l,"__esModule",{value:!0}),l.getWrappedLineTrimmedLength=l.reflowSmallerGetNewLineLengths=l.reflowLargerApplyNewLayout=l.reflowLargerCreateNewLayout=l.reflowLargerGetLinesToRemove=void 0,l.reflowLargerGetLinesToRemove=function(p,g,m,b,_){const E=[];for(let C=0;C<p.length-1;C++){let y=C,v=p.get(++y);if(!v.isWrapped)continue;const x=[p.get(C)];for(;y<p.length&&v.isWrapped;)x.push(v),v=p.get(++y);if(b>=C&&b<y){C+=x.length-1;continue}let S=0,j=d(x,S,g),T=1,N=0;for(;T<x.length;){const A=d(x,T,g),z=A-N,O=m-j,q=Math.min(z,O);x[S].copyCellsFrom(x[T],N,j,q,!1),j+=q,j===m&&(S++,j=0),N+=q,N===A&&(T++,N=0),j===0&&S!==0&&x[S-1].getWidth(m-1)===2&&(x[S].copyCellsFrom(x[S-1],m-1,j++,1,!1),x[S-1].setCell(m-1,_))}x[S].replaceCells(j,m,_);let D=0;for(let A=x.length-1;A>0&&(A>S||x[A].getTrimmedLength()===0);A--)D++;D>0&&(E.push(C+x.length-D),E.push(D)),C+=x.length-1}return E},l.reflowLargerCreateNewLayout=function(p,g){const m=[];let b=0,_=g[b],E=0;for(let C=0;C<p.length;C++)if(_===C){const y=g[++b];p.onDeleteEmitter.fire({index:C-E,amount:y}),C+=y-1,E+=y,_=g[++b]}else m.push(C);return{layout:m,countRemoved:E}},l.reflowLargerApplyNewLayout=function(p,g){const m=[];for(let b=0;b<g.length;b++)m.push(p.get(g[b]));for(let b=0;b<m.length;b++)p.set(b,m[b]);p.length=g.length},l.reflowSmallerGetNewLineLengths=function(p,g,m){const b=[],_=p.map(((v,x)=>d(p,x,g))).reduce(((v,x)=>v+x));let E=0,C=0,y=0;for(;y<_;){if(_-y<m){b.push(_-y);break}E+=m;const v=d(p,C,g);E>v&&(E-=v,C++);const x=p[C].getWidth(E-1)===2;x&&E--;const S=x?m-1:m;b.push(S),y+=S}return b},l.getWrappedLineTrimmedLength=d},5295:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferSet=void 0;const p=d(8460),g=d(844),m=d(9092);class b extends g.Disposable{constructor(E,C){super(),this._optionsService=E,this._bufferService=C,this._onBufferActivate=this.register(new p.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new m.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new m.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(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,C){this._normal.resize(E,C),this._alt.resize(E,C),this.setupTabStops(E)}setupTabStops(E){this._normal.setupTabStops(E),this._alt.setupTabStops(E)}}l.BufferSet=b},511:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CellData=void 0;const p=d(482),g=d(643),m=d(3734);class b extends m.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new m.ExtendedAttrs,this.combinedData=""}static fromCharData(E){const C=new b;return C.setFromCharData(E),C}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,p.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(E){this.fg=E[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let C=!1;if(E[g.CHAR_DATA_CHAR_INDEX].length>2)C=!0;else if(E[g.CHAR_DATA_CHAR_INDEX].length===2){const y=E[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=y&&y<=56319){const v=E[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=v&&v<=57343?this.content=1024*(y-55296)+v-56320+65536|E[g.CHAR_DATA_WIDTH_INDEX]<<22:C=!0}else C=!0}else this.content=E[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|E[g.CHAR_DATA_WIDTH_INDEX]<<22;C&&(this.combinedData=E[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|E[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.CellData=b},643:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WHITESPACE_CELL_CODE=l.WHITESPACE_CELL_WIDTH=l.WHITESPACE_CELL_CHAR=l.NULL_CELL_CODE=l.NULL_CELL_WIDTH=l.NULL_CELL_CHAR=l.CHAR_DATA_CODE_INDEX=l.CHAR_DATA_WIDTH_INDEX=l.CHAR_DATA_CHAR_INDEX=l.CHAR_DATA_ATTR_INDEX=l.DEFAULT_EXT=l.DEFAULT_ATTR=l.DEFAULT_COLOR=void 0,l.DEFAULT_COLOR=0,l.DEFAULT_ATTR=256|l.DEFAULT_COLOR<<9,l.DEFAULT_EXT=0,l.CHAR_DATA_ATTR_INDEX=0,l.CHAR_DATA_CHAR_INDEX=1,l.CHAR_DATA_WIDTH_INDEX=2,l.CHAR_DATA_CODE_INDEX=3,l.NULL_CELL_CHAR="",l.NULL_CELL_WIDTH=1,l.NULL_CELL_CODE=0,l.WHITESPACE_CELL_CHAR=" ",l.WHITESPACE_CELL_WIDTH=1,l.WHITESPACE_CELL_CODE=32},4863:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Marker=void 0;const p=d(8460),g=d(844);class m{get id(){return this._id}constructor(_){this.line=_,this.isDisposed=!1,this._disposables=[],this._id=m._nextId++,this._onDispose=this.register(new p.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,g.disposeArray)(this._disposables),this._disposables.length=0)}register(_){return this._disposables.push(_),_}}l.Marker=m,m._nextId=1},7116:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DEFAULT_CHARSET=l.CHARSETS=void 0,l.CHARSETS={},l.DEFAULT_CHARSET=l.CHARSETS.B,l.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},l.CHARSETS.A={"#":"£"},l.CHARSETS.B=void 0,l.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},l.CHARSETS.C=l.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},l.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},l.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},l.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},l.CHARSETS.E=l.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},l.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},l.CHARSETS.H=l.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(f,l)=>{var d,p,g;Object.defineProperty(l,"__esModule",{value:!0}),l.C1_ESCAPED=l.C1=l.C0=void 0,(function(m){m.NUL="\0",m.SOH="",m.STX="",m.ETX="",m.EOT="",m.ENQ="",m.ACK="",m.BEL="\x07",m.BS="\b",m.HT=" ",m.LF=`
64
+ `,m.VT="\v",m.FF="\f",m.CR="\r",m.SO="",m.SI="",m.DLE="",m.DC1="",m.DC2="",m.DC3="",m.DC4="",m.NAK="",m.SYN="",m.ETB="",m.CAN="",m.EM="",m.SUB="",m.ESC="\x1B",m.FS="",m.GS="",m.RS="",m.US="",m.SP=" ",m.DEL=""})(d||(l.C0=d={})),(function(m){m.PAD="€",m.HOP="",m.BPH="‚",m.NBH="ƒ",m.IND="„",m.NEL="…",m.SSA="†",m.ESA="‡",m.HTS="ˆ",m.HTJ="‰",m.VTS="Š",m.PLD="‹",m.PLU="Œ",m.RI="",m.SS2="Ž",m.SS3="",m.DCS="",m.PU1="‘",m.PU2="’",m.STS="“",m.CCH="”",m.MW="•",m.SPA="–",m.EPA="—",m.SOS="˜",m.SGCI="™",m.SCI="š",m.CSI="›",m.ST="œ",m.OSC="",m.PM="ž",m.APC="Ÿ"})(p||(l.C1=p={})),(function(m){m.ST=`${d.ESC}\\`})(g||(l.C1_ESCAPED=g={}))},7399:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.evaluateKeyboardEvent=void 0;const p=d(2584),g={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};l.evaluateKeyboardEvent=function(m,b,_,E){const C={type:0,cancel:!1,key:void 0},y=(m.shiftKey?1:0)|(m.altKey?2:0)|(m.ctrlKey?4:0)|(m.metaKey?8:0);switch(m.keyCode){case 0:m.key==="UIKeyInputUpArrow"?C.key=b?p.C0.ESC+"OA":p.C0.ESC+"[A":m.key==="UIKeyInputLeftArrow"?C.key=b?p.C0.ESC+"OD":p.C0.ESC+"[D":m.key==="UIKeyInputRightArrow"?C.key=b?p.C0.ESC+"OC":p.C0.ESC+"[C":m.key==="UIKeyInputDownArrow"&&(C.key=b?p.C0.ESC+"OB":p.C0.ESC+"[B");break;case 8:C.key=m.ctrlKey?"\b":p.C0.DEL,m.altKey&&(C.key=p.C0.ESC+C.key);break;case 9:if(m.shiftKey){C.key=p.C0.ESC+"[Z";break}C.key=p.C0.HT,C.cancel=!0;break;case 13:C.key=m.altKey?p.C0.ESC+p.C0.CR:p.C0.CR,C.cancel=!0;break;case 27:C.key=p.C0.ESC,m.altKey&&(C.key=p.C0.ESC+p.C0.ESC),C.cancel=!0;break;case 37:if(m.metaKey)break;y?(C.key=p.C0.ESC+"[1;"+(y+1)+"D",C.key===p.C0.ESC+"[1;3D"&&(C.key=p.C0.ESC+(_?"b":"[1;5D"))):C.key=b?p.C0.ESC+"OD":p.C0.ESC+"[D";break;case 39:if(m.metaKey)break;y?(C.key=p.C0.ESC+"[1;"+(y+1)+"C",C.key===p.C0.ESC+"[1;3C"&&(C.key=p.C0.ESC+(_?"f":"[1;5C"))):C.key=b?p.C0.ESC+"OC":p.C0.ESC+"[C";break;case 38:if(m.metaKey)break;y?(C.key=p.C0.ESC+"[1;"+(y+1)+"A",_||C.key!==p.C0.ESC+"[1;3A"||(C.key=p.C0.ESC+"[1;5A")):C.key=b?p.C0.ESC+"OA":p.C0.ESC+"[A";break;case 40:if(m.metaKey)break;y?(C.key=p.C0.ESC+"[1;"+(y+1)+"B",_||C.key!==p.C0.ESC+"[1;3B"||(C.key=p.C0.ESC+"[1;5B")):C.key=b?p.C0.ESC+"OB":p.C0.ESC+"[B";break;case 45:m.shiftKey||m.ctrlKey||(C.key=p.C0.ESC+"[2~");break;case 46:C.key=y?p.C0.ESC+"[3;"+(y+1)+"~":p.C0.ESC+"[3~";break;case 36:C.key=y?p.C0.ESC+"[1;"+(y+1)+"H":b?p.C0.ESC+"OH":p.C0.ESC+"[H";break;case 35:C.key=y?p.C0.ESC+"[1;"+(y+1)+"F":b?p.C0.ESC+"OF":p.C0.ESC+"[F";break;case 33:m.shiftKey?C.type=2:m.ctrlKey?C.key=p.C0.ESC+"[5;"+(y+1)+"~":C.key=p.C0.ESC+"[5~";break;case 34:m.shiftKey?C.type=3:m.ctrlKey?C.key=p.C0.ESC+"[6;"+(y+1)+"~":C.key=p.C0.ESC+"[6~";break;case 112:C.key=y?p.C0.ESC+"[1;"+(y+1)+"P":p.C0.ESC+"OP";break;case 113:C.key=y?p.C0.ESC+"[1;"+(y+1)+"Q":p.C0.ESC+"OQ";break;case 114:C.key=y?p.C0.ESC+"[1;"+(y+1)+"R":p.C0.ESC+"OR";break;case 115:C.key=y?p.C0.ESC+"[1;"+(y+1)+"S":p.C0.ESC+"OS";break;case 116:C.key=y?p.C0.ESC+"[15;"+(y+1)+"~":p.C0.ESC+"[15~";break;case 117:C.key=y?p.C0.ESC+"[17;"+(y+1)+"~":p.C0.ESC+"[17~";break;case 118:C.key=y?p.C0.ESC+"[18;"+(y+1)+"~":p.C0.ESC+"[18~";break;case 119:C.key=y?p.C0.ESC+"[19;"+(y+1)+"~":p.C0.ESC+"[19~";break;case 120:C.key=y?p.C0.ESC+"[20;"+(y+1)+"~":p.C0.ESC+"[20~";break;case 121:C.key=y?p.C0.ESC+"[21;"+(y+1)+"~":p.C0.ESC+"[21~";break;case 122:C.key=y?p.C0.ESC+"[23;"+(y+1)+"~":p.C0.ESC+"[23~";break;case 123:C.key=y?p.C0.ESC+"[24;"+(y+1)+"~":p.C0.ESC+"[24~";break;default:if(!m.ctrlKey||m.shiftKey||m.altKey||m.metaKey)if(_&&!E||!m.altKey||m.metaKey)!_||m.altKey||m.ctrlKey||m.shiftKey||!m.metaKey?m.key&&!m.ctrlKey&&!m.altKey&&!m.metaKey&&m.keyCode>=48&&m.key.length===1?C.key=m.key:m.key&&m.ctrlKey&&(m.key==="_"&&(C.key=p.C0.US),m.key==="@"&&(C.key=p.C0.NUL)):m.keyCode===65&&(C.type=1);else{const v=g[m.keyCode],x=v==null?void 0:v[m.shiftKey?1:0];if(x)C.key=p.C0.ESC+x;else if(m.keyCode>=65&&m.keyCode<=90){const S=m.ctrlKey?m.keyCode-64:m.keyCode+32;let j=String.fromCharCode(S);m.shiftKey&&(j=j.toUpperCase()),C.key=p.C0.ESC+j}else if(m.keyCode===32)C.key=p.C0.ESC+(m.ctrlKey?p.C0.NUL:" ");else if(m.key==="Dead"&&m.code.startsWith("Key")){let S=m.code.slice(3,4);m.shiftKey||(S=S.toLowerCase()),C.key=p.C0.ESC+S,C.cancel=!0}}else m.keyCode>=65&&m.keyCode<=90?C.key=String.fromCharCode(m.keyCode-64):m.keyCode===32?C.key=p.C0.NUL:m.keyCode>=51&&m.keyCode<=55?C.key=String.fromCharCode(m.keyCode-51+27):m.keyCode===56?C.key=p.C0.DEL:m.keyCode===219?C.key=p.C0.ESC:m.keyCode===220?C.key=p.C0.FS:m.keyCode===221&&(C.key=p.C0.GS)}return C}},482:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Utf8ToUtf32=l.StringToUtf32=l.utf32ToString=l.stringFromCodePoint=void 0,l.stringFromCodePoint=function(d){return d>65535?(d-=65536,String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):String.fromCharCode(d)},l.utf32ToString=function(d,p=0,g=d.length){let m="";for(let b=p;b<g;++b){let _=d[b];_>65535?(_-=65536,m+=String.fromCharCode(55296+(_>>10))+String.fromCharCode(_%1024+56320)):m+=String.fromCharCode(_)}return m},l.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(d,p){const g=d.length;if(!g)return 0;let m=0,b=0;if(this._interim){const _=d.charCodeAt(b++);56320<=_&&_<=57343?p[m++]=1024*(this._interim-55296)+_-56320+65536:(p[m++]=this._interim,p[m++]=_),this._interim=0}for(let _=b;_<g;++_){const E=d.charCodeAt(_);if(55296<=E&&E<=56319){if(++_>=g)return this._interim=E,m;const C=d.charCodeAt(_);56320<=C&&C<=57343?p[m++]=1024*(E-55296)+C-56320+65536:(p[m++]=E,p[m++]=C)}else E!==65279&&(p[m++]=E)}return m}},l.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(d,p){const g=d.length;if(!g)return 0;let m,b,_,E,C=0,y=0,v=0;if(this.interim[0]){let j=!1,T=this.interim[0];T&=(224&T)==192?31:(240&T)==224?15:7;let N,D=0;for(;(N=63&this.interim[++D])&&D<4;)T<<=6,T|=N;const A=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,z=A-D;for(;v<z;){if(v>=g)return 0;if(N=d[v++],(192&N)!=128){v--,j=!0;break}this.interim[D++]=N,T<<=6,T|=63&N}j||(A===2?T<128?v--:p[C++]=T:A===3?T<2048||T>=55296&&T<=57343||T===65279||(p[C++]=T):T<65536||T>1114111||(p[C++]=T)),this.interim.fill(0)}const x=g-4;let S=v;for(;S<g;){for(;!(!(S<x)||128&(m=d[S])||128&(b=d[S+1])||128&(_=d[S+2])||128&(E=d[S+3]));)p[C++]=m,p[C++]=b,p[C++]=_,p[C++]=E,S+=4;if(m=d[S++],m<128)p[C++]=m;else if((224&m)==192){if(S>=g)return this.interim[0]=m,C;if(b=d[S++],(192&b)!=128){S--;continue}if(y=(31&m)<<6|63&b,y<128){S--;continue}p[C++]=y}else if((240&m)==224){if(S>=g)return this.interim[0]=m,C;if(b=d[S++],(192&b)!=128){S--;continue}if(S>=g)return this.interim[0]=m,this.interim[1]=b,C;if(_=d[S++],(192&_)!=128){S--;continue}if(y=(15&m)<<12|(63&b)<<6|63&_,y<2048||y>=55296&&y<=57343||y===65279)continue;p[C++]=y}else if((248&m)==240){if(S>=g)return this.interim[0]=m,C;if(b=d[S++],(192&b)!=128){S--;continue}if(S>=g)return this.interim[0]=m,this.interim[1]=b,C;if(_=d[S++],(192&_)!=128){S--;continue}if(S>=g)return this.interim[0]=m,this.interim[1]=b,this.interim[2]=_,C;if(E=d[S++],(192&E)!=128){S--;continue}if(y=(7&m)<<18|(63&b)<<12|(63&_)<<6|63&E,y<65536||y>1114111)continue;p[C++]=y}}return C}}},225:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeV6=void 0;const p=d(1480),g=[[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]],m=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let b;l.UnicodeV6=class{constructor(){if(this.version="6",!b){b=new Uint8Array(65536),b.fill(1),b[0]=0,b.fill(0,1,32),b.fill(0,127,160),b.fill(2,4352,4448),b[9001]=2,b[9002]=2,b.fill(2,11904,42192),b[12351]=1,b.fill(2,44032,55204),b.fill(2,63744,64256),b.fill(2,65040,65050),b.fill(2,65072,65136),b.fill(2,65280,65377),b.fill(2,65504,65511);for(let _=0;_<g.length;++_)b.fill(0,g[_][0],g[_][1]+1)}}wcwidth(_){return _<32?0:_<127?1:_<65536?b[_]:(function(E,C){let y,v=0,x=C.length-1;if(E<C[0][0]||E>C[x][1])return!1;for(;x>=v;)if(y=v+x>>1,E>C[y][1])v=y+1;else{if(!(E<C[y][0]))return!0;x=y-1}return!1})(_,m)?0:_>=131072&&_<=196605||_>=196608&&_<=262141?2:1}charProperties(_,E){let C=this.wcwidth(_),y=C===0&&E!==0;if(y){const v=p.UnicodeService.extractWidth(E);v===0?y=!1:v>C&&(C=v)}return p.UnicodeService.createPropertyValue(0,C,y)}}},5981:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WriteBuffer=void 0;const p=d(8460),g=d(844);class m extends g.Disposable{constructor(_){super(),this._action=_,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new p.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(_,E){if(E!==void 0&&this._syncCalls>E)return void(this._syncCalls=0);if(this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let C;for(this._isSyncWriting=!0;C=this._writeBuffer.shift();){this._action(C);const y=this._callbacks.shift();y&&y()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(_,E){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(E),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(E)}_innerWrite(_=0,E=!0){const C=_||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const y=this._writeBuffer[this._bufferOffset],v=this._action(y,E);if(v){const S=j=>Date.now()-C>=12?setTimeout((()=>this._innerWrite(0,j))):this._innerWrite(C,j);return void v.catch((j=>(queueMicrotask((()=>{throw j})),Promise.resolve(!1)))).then(S)}const x=this._callbacks[this._bufferOffset];if(x&&x(),this._bufferOffset++,this._pendingData-=y.length,Date.now()-C>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}l.WriteBuffer=m},5941:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.toRgbString=l.parseColor=void 0;const d=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,p=/^[\da-f]+$/;function g(m,b){const _=m.toString(16),E=_.length<2?"0"+_:_;switch(b){case 4:return _[0];case 8:return E;case 12:return(E+E).slice(0,3);default:return E+E}}l.parseColor=function(m){if(!m)return;let b=m.toLowerCase();if(b.indexOf("rgb:")===0){b=b.slice(4);const _=d.exec(b);if(_){const E=_[1]?15:_[4]?255:_[7]?4095:65535;return[Math.round(parseInt(_[1]||_[4]||_[7]||_[10],16)/E*255),Math.round(parseInt(_[2]||_[5]||_[8]||_[11],16)/E*255),Math.round(parseInt(_[3]||_[6]||_[9]||_[12],16)/E*255)]}}else if(b.indexOf("#")===0&&(b=b.slice(1),p.exec(b)&&[3,6,9,12].includes(b.length))){const _=b.length/3,E=[0,0,0];for(let C=0;C<3;++C){const y=parseInt(b.slice(_*C,_*C+_),16);E[C]=_===1?y<<4:_===2?y:_===3?y>>4:y>>8}return E}},l.toRgbString=function(m,b=16){const[_,E,C]=m;return`rgb:${g(_,b)}/${g(E,b)}/${g(C,b)}`}},5770:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.PAYLOAD_LIMIT=void 0,l.PAYLOAD_LIMIT=1e7},6351:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DcsHandler=l.DcsParser=void 0;const p=d(482),g=d(8742),m=d(5770),b=[];l.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=b,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=b}registerHandler(E,C){this._handlers[E]===void 0&&(this._handlers[E]=[]);const y=this._handlers[E];return y.push(C),{dispose:()=>{const v=y.indexOf(C);v!==-1&&y.splice(v,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=b,this._ident=0}hook(E,C){if(this.reset(),this._ident=E,this._active=this._handlers[E]||b,this._active.length)for(let y=this._active.length-1;y>=0;y--)this._active[y].hook(C);else this._handlerFb(this._ident,"HOOK",C)}put(E,C,y){if(this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].put(E,C,y);else this._handlerFb(this._ident,"PUT",(0,p.utf32ToString)(E,C,y))}unhook(E,C=!0){if(this._active.length){let y=!1,v=this._active.length-1,x=!1;if(this._stack.paused&&(v=this._stack.loopPosition-1,y=C,x=this._stack.fallThrough,this._stack.paused=!1),!x&&y===!1){for(;v>=0&&(y=this._active[v].unhook(E),y!==!0);v--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=v,this._stack.fallThrough=!1,y;v--}for(;v>=0;v--)if(y=this._active[v].unhook(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=v,this._stack.fallThrough=!0,y}else this._handlerFb(this._ident,"UNHOOK",E);this._active=b,this._ident=0}};const _=new g.Params;_.addParam(0),l.DcsHandler=class{constructor(E){this._handler=E,this._data="",this._params=_,this._hitLimit=!1}hook(E){this._params=E.length>1||E.params[0]?E.clone():_,this._data="",this._hitLimit=!1}put(E,C,y){this._hitLimit||(this._data+=(0,p.utf32ToString)(E,C,y),this._data.length>m.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(E){let C=!1;if(this._hitLimit)C=!1;else if(E&&(C=this._handler(this._data,this._params),C instanceof Promise))return C.then((y=>(this._params=_,this._data="",this._hitLimit=!1,y)));return this._params=_,this._data="",this._hitLimit=!1,C}}},2015:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.EscapeSequenceParser=l.VT500_TRANSITION_TABLE=l.TransitionTable=void 0;const p=d(844),g=d(8742),m=d(6242),b=d(6351);class _{constructor(v){this.table=new Uint8Array(v)}setDefault(v,x){this.table.fill(v<<4|x)}add(v,x,S,j){this.table[x<<8|v]=S<<4|j}addMany(v,x,S,j){for(let T=0;T<v.length;T++)this.table[x<<8|v[T]]=S<<4|j}}l.TransitionTable=_;const E=160;l.VT500_TRANSITION_TABLE=(function(){const y=new _(4095),v=Array.apply(null,Array(256)).map(((D,A)=>A)),x=(D,A)=>v.slice(D,A),S=x(32,127),j=x(0,24);j.push(25),j.push.apply(j,x(28,32));const T=x(0,14);let N;for(N in y.setDefault(1,0),y.addMany(S,0,2,0),T)y.addMany([24,26,153,154],N,3,0),y.addMany(x(128,144),N,3,0),y.addMany(x(144,152),N,3,0),y.add(156,N,0,0),y.add(27,N,11,1),y.add(157,N,4,8),y.addMany([152,158,159],N,0,7),y.add(155,N,11,3),y.add(144,N,11,9);return y.addMany(j,0,3,0),y.addMany(j,1,3,1),y.add(127,1,0,1),y.addMany(j,8,0,8),y.addMany(j,3,3,3),y.add(127,3,0,3),y.addMany(j,4,3,4),y.add(127,4,0,4),y.addMany(j,6,3,6),y.addMany(j,5,3,5),y.add(127,5,0,5),y.addMany(j,2,3,2),y.add(127,2,0,2),y.add(93,1,4,8),y.addMany(S,8,5,8),y.add(127,8,5,8),y.addMany([156,27,24,26,7],8,6,0),y.addMany(x(28,32),8,0,8),y.addMany([88,94,95],1,0,7),y.addMany(S,7,0,7),y.addMany(j,7,0,7),y.add(156,7,0,0),y.add(127,7,0,7),y.add(91,1,11,3),y.addMany(x(64,127),3,7,0),y.addMany(x(48,60),3,8,4),y.addMany([60,61,62,63],3,9,4),y.addMany(x(48,60),4,8,4),y.addMany(x(64,127),4,7,0),y.addMany([60,61,62,63],4,0,6),y.addMany(x(32,64),6,0,6),y.add(127,6,0,6),y.addMany(x(64,127),6,0,0),y.addMany(x(32,48),3,9,5),y.addMany(x(32,48),5,9,5),y.addMany(x(48,64),5,0,6),y.addMany(x(64,127),5,7,0),y.addMany(x(32,48),4,9,5),y.addMany(x(32,48),1,9,2),y.addMany(x(32,48),2,9,2),y.addMany(x(48,127),2,10,0),y.addMany(x(48,80),1,10,0),y.addMany(x(81,88),1,10,0),y.addMany([89,90,92],1,10,0),y.addMany(x(96,127),1,10,0),y.add(80,1,11,9),y.addMany(j,9,0,9),y.add(127,9,0,9),y.addMany(x(28,32),9,0,9),y.addMany(x(32,48),9,9,12),y.addMany(x(48,60),9,8,10),y.addMany([60,61,62,63],9,9,10),y.addMany(j,11,0,11),y.addMany(x(32,128),11,0,11),y.addMany(x(28,32),11,0,11),y.addMany(j,10,0,10),y.add(127,10,0,10),y.addMany(x(28,32),10,0,10),y.addMany(x(48,60),10,8,10),y.addMany([60,61,62,63],10,0,11),y.addMany(x(32,48),10,9,12),y.addMany(j,12,0,12),y.add(127,12,0,12),y.addMany(x(28,32),12,0,12),y.addMany(x(32,48),12,9,12),y.addMany(x(48,64),12,0,11),y.addMany(x(64,127),12,12,13),y.addMany(x(64,127),10,12,13),y.addMany(x(64,127),9,12,13),y.addMany(j,13,13,13),y.addMany(S,13,13,13),y.add(127,13,0,13),y.addMany([27,156,24,26],13,14,0),y.add(E,0,2,0),y.add(E,8,5,8),y.add(E,6,0,6),y.add(E,11,0,11),y.add(E,13,13,13),y})();class C extends p.Disposable{constructor(v=l.VT500_TRANSITION_TABLE){super(),this._transitions=v,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new g.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(x,S,j)=>{},this._executeHandlerFb=x=>{},this._csiHandlerFb=(x,S)=>{},this._escHandlerFb=x=>{},this._errorHandlerFb=x=>x,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,p.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new m.OscParser),this._dcsParser=this.register(new b.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(v,x=[64,126]){let S=0;if(v.prefix){if(v.prefix.length>1)throw new Error("only one byte as prefix supported");if(S=v.prefix.charCodeAt(0),S&&60>S||S>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(v.intermediates){if(v.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let T=0;T<v.intermediates.length;++T){const N=v.intermediates.charCodeAt(T);if(32>N||N>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");S<<=8,S|=N}}if(v.final.length!==1)throw new Error("final must be a single byte");const j=v.final.charCodeAt(0);if(x[0]>j||j>x[1])throw new Error(`final must be in range ${x[0]} .. ${x[1]}`);return S<<=8,S|=j,S}identToString(v){const x=[];for(;v;)x.push(String.fromCharCode(255&v)),v>>=8;return x.reverse().join("")}setPrintHandler(v){this._printHandler=v}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(v,x){const S=this._identifier(v,[48,126]);this._escHandlers[S]===void 0&&(this._escHandlers[S]=[]);const j=this._escHandlers[S];return j.push(x),{dispose:()=>{const T=j.indexOf(x);T!==-1&&j.splice(T,1)}}}clearEscHandler(v){this._escHandlers[this._identifier(v,[48,126])]&&delete this._escHandlers[this._identifier(v,[48,126])]}setEscHandlerFallback(v){this._escHandlerFb=v}setExecuteHandler(v,x){this._executeHandlers[v.charCodeAt(0)]=x}clearExecuteHandler(v){this._executeHandlers[v.charCodeAt(0)]&&delete this._executeHandlers[v.charCodeAt(0)]}setExecuteHandlerFallback(v){this._executeHandlerFb=v}registerCsiHandler(v,x){const S=this._identifier(v);this._csiHandlers[S]===void 0&&(this._csiHandlers[S]=[]);const j=this._csiHandlers[S];return j.push(x),{dispose:()=>{const T=j.indexOf(x);T!==-1&&j.splice(T,1)}}}clearCsiHandler(v){this._csiHandlers[this._identifier(v)]&&delete this._csiHandlers[this._identifier(v)]}setCsiHandlerFallback(v){this._csiHandlerFb=v}registerDcsHandler(v,x){return this._dcsParser.registerHandler(this._identifier(v),x)}clearDcsHandler(v){this._dcsParser.clearHandler(this._identifier(v))}setDcsHandlerFallback(v){this._dcsParser.setHandlerFallback(v)}registerOscHandler(v,x){return this._oscParser.registerHandler(v,x)}clearOscHandler(v){this._oscParser.clearHandler(v)}setOscHandlerFallback(v){this._oscParser.setHandlerFallback(v)}setErrorHandler(v){this._errorHandler=v}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(v,x,S,j,T){this._parseStack.state=v,this._parseStack.handlers=x,this._parseStack.handlerPos=S,this._parseStack.transition=j,this._parseStack.chunkPos=T}parse(v,x,S){let j,T=0,N=0,D=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,D=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");const A=this._parseStack.handlers;let z=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(S===!1&&z>-1){for(;z>=0&&(j=A[z](this._params),j!==!0);z--)if(j instanceof Promise)return this._parseStack.handlerPos=z,j}this._parseStack.handlers=[];break;case 4:if(S===!1&&z>-1){for(;z>=0&&(j=A[z](),j!==!0);z--)if(j instanceof Promise)return this._parseStack.handlerPos=z,j}this._parseStack.handlers=[];break;case 6:if(T=v[this._parseStack.chunkPos],j=this._dcsParser.unhook(T!==24&&T!==26,S),j)return j;T===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(T=v[this._parseStack.chunkPos],j=this._oscParser.end(T!==24&&T!==26,S),j)return j;T===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,D=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let A=D;A<x;++A){switch(T=v[A],N=this._transitions.table[this.currentState<<8|(T<160?T:E)],N>>4){case 2:for(let W=A+1;;++W){if(W>=x||(T=v[W])<32||T>126&&T<E){this._printHandler(v,A,W),A=W-1;break}if(++W>=x||(T=v[W])<32||T>126&&T<E){this._printHandler(v,A,W),A=W-1;break}if(++W>=x||(T=v[W])<32||T>126&&T<E){this._printHandler(v,A,W),A=W-1;break}if(++W>=x||(T=v[W])<32||T>126&&T<E){this._printHandler(v,A,W),A=W-1;break}}break;case 3:this._executeHandlers[T]?this._executeHandlers[T]():this._executeHandlerFb(T),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:A,code:T,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const z=this._csiHandlers[this._collect<<8|T];let O=z?z.length-1:-1;for(;O>=0&&(j=z[O](this._params),j!==!0);O--)if(j instanceof Promise)return this._preserveStack(3,z,O,N,A),j;O<0&&this._csiHandlerFb(this._collect<<8|T,this._params),this.precedingJoinState=0;break;case 8:do switch(T){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(T-48)}while(++A<x&&(T=v[A])>47&&T<60);A--;break;case 9:this._collect<<=8,this._collect|=T;break;case 10:const q=this._escHandlers[this._collect<<8|T];let G=q?q.length-1:-1;for(;G>=0&&(j=q[G](),j!==!0);G--)if(j instanceof Promise)return this._preserveStack(4,q,G,N,A),j;G<0&&this._escHandlerFb(this._collect<<8|T),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|T,this._params);break;case 13:for(let W=A+1;;++W)if(W>=x||(T=v[W])===24||T===26||T===27||T>127&&T<E){this._dcsParser.put(v,A,W),A=W-1;break}break;case 14:if(j=this._dcsParser.unhook(T!==24&&T!==26),j)return this._preserveStack(6,[],0,N,A),j;T===27&&(N|=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 W=A+1;;W++)if(W>=x||(T=v[W])<32||T>127&&T<E){this._oscParser.put(v,A,W),A=W-1;break}break;case 6:if(j=this._oscParser.end(T!==24&&T!==26),j)return this._preserveStack(5,[],0,N,A),j;T===27&&(N|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&N}}}l.EscapeSequenceParser=C},6242:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OscHandler=l.OscParser=void 0;const p=d(5770),g=d(482),m=[];l.OscParser=class{constructor(){this._state=0,this._active=m,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(b,_){this._handlers[b]===void 0&&(this._handlers[b]=[]);const E=this._handlers[b];return E.push(_),{dispose:()=>{const C=E.indexOf(_);C!==-1&&E.splice(C,1)}}}clearHandler(b){this._handlers[b]&&delete this._handlers[b]}setHandlerFallback(b){this._handlerFb=b}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=m}reset(){if(this._state===2)for(let b=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;b>=0;--b)this._active[b].end(!1);this._stack.paused=!1,this._active=m,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||m,this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].start();else this._handlerFb(this._id,"START")}_put(b,_,E){if(this._active.length)for(let C=this._active.length-1;C>=0;C--)this._active[C].put(b,_,E);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(b,_,E))}start(){this.reset(),this._state=1}put(b,_,E){if(this._state!==3){if(this._state===1)for(;_<E;){const C=b[_++];if(C===59){this._state=2,this._start();break}if(C<48||57<C)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+C-48}this._state===2&&E-_>0&&this._put(b,_,E)}}end(b,_=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let E=!1,C=this._active.length-1,y=!1;if(this._stack.paused&&(C=this._stack.loopPosition-1,E=_,y=this._stack.fallThrough,this._stack.paused=!1),!y&&E===!1){for(;C>=0&&(E=this._active[C].end(b),E!==!0);C--)if(E instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!1,E;C--}for(;C>=0;C--)if(E=this._active[C].end(!1),E instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!0,E}else this._handlerFb(this._id,"END",b);this._active=m,this._id=-1,this._state=0}}},l.OscHandler=class{constructor(b){this._handler=b,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(b,_,E){this._hitLimit||(this._data+=(0,g.utf32ToString)(b,_,E),this._data.length>p.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(b){let _=!1;if(this._hitLimit)_=!1;else if(b&&(_=this._handler(this._data),_ instanceof Promise))return _.then((E=>(this._data="",this._hitLimit=!1,E)));return this._data="",this._hitLimit=!1,_}}},8742:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Params=void 0;const d=2147483647;class p{static fromArray(m){const b=new p;if(!m.length)return b;for(let _=Array.isArray(m[0])?1:0;_<m.length;++_){const E=m[_];if(Array.isArray(E))for(let C=0;C<E.length;++C)b.addSubParam(E[C]);else b.addParam(E)}return b}constructor(m=32,b=32){if(this.maxLength=m,this.maxSubParamsLength=b,b>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(m),this.length=0,this._subParams=new Int32Array(b),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(m),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const m=new p(this.maxLength,this.maxSubParamsLength);return m.params.set(this.params),m.length=this.length,m._subParams.set(this._subParams),m._subParamsLength=this._subParamsLength,m._subParamsIdx.set(this._subParamsIdx),m._rejectDigits=this._rejectDigits,m._rejectSubDigits=this._rejectSubDigits,m._digitIsSub=this._digitIsSub,m}toArray(){const m=[];for(let b=0;b<this.length;++b){m.push(this.params[b]);const _=this._subParamsIdx[b]>>8,E=255&this._subParamsIdx[b];E-_>0&&m.push(Array.prototype.slice.call(this._subParams,_,E))}return m}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(m){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(m<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=m>d?d:m}}addSubParam(m){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(m<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=m>d?d:m,this._subParamsIdx[this.length-1]++}}hasSubParams(m){return(255&this._subParamsIdx[m])-(this._subParamsIdx[m]>>8)>0}getSubParams(m){const b=this._subParamsIdx[m]>>8,_=255&this._subParamsIdx[m];return _-b>0?this._subParams.subarray(b,_):null}getSubParamsAll(){const m={};for(let b=0;b<this.length;++b){const _=this._subParamsIdx[b]>>8,E=255&this._subParamsIdx[b];E-_>0&&(m[b]=this._subParams.slice(_,E))}return m}addDigit(m){let b;if(this._rejectDigits||!(b=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const _=this._digitIsSub?this._subParams:this.params,E=_[b-1];_[b-1]=~E?Math.min(10*E+m,d):m}}l.Params=p},5741:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.AddonManager=void 0,l.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let d=this._addons.length-1;d>=0;d--)this._addons[d].instance.dispose()}loadAddon(d,p){const g={instance:p,dispose:p.dispose,isDisposed:!1};this._addons.push(g),p.dispose=()=>this._wrappedAddonDispose(g),p.activate(d)}_wrappedAddonDispose(d){if(d.isDisposed)return;let p=-1;for(let g=0;g<this._addons.length;g++)if(this._addons[g]===d){p=g;break}if(p===-1)throw new Error("Could not dispose an addon that has not been loaded");d.isDisposed=!0,d.dispose.apply(d.instance),this._addons.splice(p,1)}}},8771:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferApiView=void 0;const p=d(3785),g=d(511);l.BufferApiView=class{constructor(m,b){this._buffer=m,this.type=b}init(m){return this._buffer=m,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(m){const b=this._buffer.lines.get(m);if(b)return new p.BufferLineApiView(b)}getNullCell(){return new g.CellData}}},3785:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLineApiView=void 0;const p=d(511);l.BufferLineApiView=class{constructor(g){this._line=g}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(g,m){if(!(g<0||g>=this._line.length))return m?(this._line.loadCell(g,m),m):this._line.loadCell(g,new p.CellData)}translateToString(g,m,b){return this._line.translateToString(g,m,b)}}},8285:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferNamespaceApi=void 0;const p=d(8771),g=d(8460),m=d(844);class b extends m.Disposable{constructor(E){super(),this._core=E,this._onBufferChange=this.register(new g.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new p.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new p.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}l.BufferNamespaceApi=b},7975:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ParserApi=void 0,l.ParserApi=class{constructor(d){this._core=d}registerCsiHandler(d,p){return this._core.registerCsiHandler(d,(g=>p(g.toArray())))}addCsiHandler(d,p){return this.registerCsiHandler(d,p)}registerDcsHandler(d,p){return this._core.registerDcsHandler(d,((g,m)=>p(g,m.toArray())))}addDcsHandler(d,p){return this.registerDcsHandler(d,p)}registerEscHandler(d,p){return this._core.registerEscHandler(d,p)}addEscHandler(d,p){return this.registerEscHandler(d,p)}registerOscHandler(d,p){return this._core.registerOscHandler(d,p)}addOscHandler(d,p){return this.registerOscHandler(d,p)}}},7090:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeApi=void 0,l.UnicodeApi=class{constructor(d){this._core=d}register(d){this._core.unicodeService.register(d)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(d){this._core.unicodeService.activeVersion=d}}},744:function(f,l,d){var p=this&&this.__decorate||function(y,v,x,S){var j,T=arguments.length,N=T<3?v:S===null?S=Object.getOwnPropertyDescriptor(v,x):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(y,v,x,S);else for(var D=y.length-1;D>=0;D--)(j=y[D])&&(N=(T<3?j(N):T>3?j(v,x,N):j(v,x))||N);return T>3&&N&&Object.defineProperty(v,x,N),N},g=this&&this.__param||function(y,v){return function(x,S){v(x,S,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferService=l.MINIMUM_ROWS=l.MINIMUM_COLS=void 0;const m=d(8460),b=d(844),_=d(5295),E=d(2585);l.MINIMUM_COLS=2,l.MINIMUM_ROWS=1;let C=l.BufferService=class extends b.Disposable{get buffer(){return this.buffers.active}constructor(y){super(),this.isUserScrolling=!1,this._onResize=this.register(new m.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new m.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(y.rawOptions.cols||0,l.MINIMUM_COLS),this.rows=Math.max(y.rawOptions.rows||0,l.MINIMUM_ROWS),this.buffers=this.register(new _.BufferSet(y,this))}resize(y,v){this.cols=y,this.rows=v,this.buffers.resize(y,v),this._onResize.fire({cols:y,rows:v})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(y,v=!1){const x=this.buffer;let S;S=this._cachedBlankLine,S&&S.length===this.cols&&S.getFg(0)===y.fg&&S.getBg(0)===y.bg||(S=x.getBlankLine(y,v),this._cachedBlankLine=S),S.isWrapped=v;const j=x.ybase+x.scrollTop,T=x.ybase+x.scrollBottom;if(x.scrollTop===0){const N=x.lines.isFull;T===x.lines.length-1?N?x.lines.recycle().copyFrom(S):x.lines.push(S.clone()):x.lines.splice(T+1,0,S.clone()),N?this.isUserScrolling&&(x.ydisp=Math.max(x.ydisp-1,0)):(x.ybase++,this.isUserScrolling||x.ydisp++)}else{const N=T-j+1;x.lines.shiftElements(j+1,N-1,-1),x.lines.set(T,S.clone())}this.isUserScrolling||(x.ydisp=x.ybase),this._onScroll.fire(x.ydisp)}scrollLines(y,v,x){const S=this.buffer;if(y<0){if(S.ydisp===0)return;this.isUserScrolling=!0}else y+S.ydisp>=S.ybase&&(this.isUserScrolling=!1);const j=S.ydisp;S.ydisp=Math.max(Math.min(S.ydisp+y,S.ybase),0),j!==S.ydisp&&(v||this._onScroll.fire(S.ydisp))}};l.BufferService=C=p([g(0,E.IOptionsService)],C)},7994:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CharsetService=void 0,l.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(d){this.glevel=d,this.charset=this._charsets[d]}setgCharset(d,p){this._charsets[d]=p,this.glevel===d&&(this.charset=p)}}},1753:function(f,l,d){var p=this&&this.__decorate||function(S,j,T,N){var D,A=arguments.length,z=A<3?j:N===null?N=Object.getOwnPropertyDescriptor(j,T):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(S,j,T,N);else for(var O=S.length-1;O>=0;O--)(D=S[O])&&(z=(A<3?D(z):A>3?D(j,T,z):D(j,T))||z);return A>3&&z&&Object.defineProperty(j,T,z),z},g=this&&this.__param||function(S,j){return function(T,N){j(T,N,S)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreMouseService=void 0;const m=d(2585),b=d(8460),_=d(844),E={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:S=>S.button!==4&&S.action===1&&(S.ctrl=!1,S.alt=!1,S.shift=!1,!0)},VT200:{events:19,restrict:S=>S.action!==32},DRAG:{events:23,restrict:S=>S.action!==32||S.button!==3},ANY:{events:31,restrict:S=>!0}};function C(S,j){let T=(S.ctrl?16:0)|(S.shift?4:0)|(S.alt?8:0);return S.button===4?(T|=64,T|=S.action):(T|=3&S.button,4&S.button&&(T|=64),8&S.button&&(T|=128),S.action===32?T|=32:S.action!==0||j||(T|=3)),T}const y=String.fromCharCode,v={DEFAULT:S=>{const j=[C(S,!1)+32,S.col+32,S.row+32];return j[0]>255||j[1]>255||j[2]>255?"":`\x1B[M${y(j[0])}${y(j[1])}${y(j[2])}`},SGR:S=>{const j=S.action===0&&S.button!==4?"m":"M";return`\x1B[<${C(S,!0)};${S.col};${S.row}${j}`},SGR_PIXELS:S=>{const j=S.action===0&&S.button!==4?"m":"M";return`\x1B[<${C(S,!0)};${S.x};${S.y}${j}`}};let x=l.CoreMouseService=class extends _.Disposable{constructor(S,j){super(),this._bufferService=S,this._coreService=j,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new b.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const T of Object.keys(E))this.addProtocol(T,E[T]);for(const T of Object.keys(v))this.addEncoding(T,v[T]);this.reset()}addProtocol(S,j){this._protocols[S]=j}addEncoding(S,j){this._encodings[S]=j}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(S){if(!this._protocols[S])throw new Error(`unknown protocol "${S}"`);this._activeProtocol=S,this._onProtocolChange.fire(this._protocols[S].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(S){if(!this._encodings[S])throw new Error(`unknown encoding "${S}"`);this._activeEncoding=S}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(S){if(S.col<0||S.col>=this._bufferService.cols||S.row<0||S.row>=this._bufferService.rows||S.button===4&&S.action===32||S.button===3&&S.action!==32||S.button!==4&&(S.action===2||S.action===3)||(S.col++,S.row++,S.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,S,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(S))return!1;const j=this._encodings[this._activeEncoding](S);return j&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(j):this._coreService.triggerDataEvent(j,!0)),this._lastEvent=S,!0}explainEvents(S){return{down:!!(1&S),up:!!(2&S),drag:!!(4&S),move:!!(8&S),wheel:!!(16&S)}}_equalEvents(S,j,T){if(T){if(S.x!==j.x||S.y!==j.y)return!1}else if(S.col!==j.col||S.row!==j.row)return!1;return S.button===j.button&&S.action===j.action&&S.ctrl===j.ctrl&&S.alt===j.alt&&S.shift===j.shift}};l.CoreMouseService=x=p([g(0,m.IBufferService),g(1,m.ICoreService)],x)},6975:function(f,l,d){var p=this&&this.__decorate||function(x,S,j,T){var N,D=arguments.length,A=D<3?S:T===null?T=Object.getOwnPropertyDescriptor(S,j):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,S,j,T);else for(var z=x.length-1;z>=0;z--)(N=x[z])&&(A=(D<3?N(A):D>3?N(S,j,A):N(S,j))||A);return D>3&&A&&Object.defineProperty(S,j,A),A},g=this&&this.__param||function(x,S){return function(j,T){S(j,T,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreService=void 0;const m=d(1439),b=d(8460),_=d(844),E=d(2585),C=Object.freeze({insertMode:!1}),y=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let v=l.CoreService=class extends _.Disposable{constructor(x,S,j){super(),this._bufferService=x,this._logService=S,this._optionsService=j,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new b.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new b.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new b.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new b.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,m.clone)(C),this.decPrivateModes=(0,m.clone)(y)}reset(){this.modes=(0,m.clone)(C),this.decPrivateModes=(0,m.clone)(y)}triggerDataEvent(x,S=!1){if(this._optionsService.rawOptions.disableStdin)return;const j=this._bufferService.buffer;S&&this._optionsService.rawOptions.scrollOnUserInput&&j.ybase!==j.ydisp&&this._onRequestScrollToBottom.fire(),S&&this._onUserInput.fire(),this._logService.debug(`sending data "${x}"`,(()=>x.split("").map((T=>T.charCodeAt(0))))),this._onData.fire(x)}triggerBinaryEvent(x){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${x}"`,(()=>x.split("").map((S=>S.charCodeAt(0))))),this._onBinary.fire(x))}};l.CoreService=v=p([g(0,E.IBufferService),g(1,E.ILogService),g(2,E.IOptionsService)],v)},9074:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DecorationService=void 0;const p=d(8055),g=d(8460),m=d(844),b=d(6106);let _=0,E=0;class C extends m.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new b.SortedList((x=>x==null?void 0:x.marker.line)),this._onDecorationRegistered=this.register(new g.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new g.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,m.toDisposable)((()=>this.reset())))}registerDecoration(x){if(x.marker.isDisposed)return;const S=new y(x);if(S){const j=S.marker.onDispose((()=>S.dispose()));S.onDispose((()=>{S&&(this._decorations.delete(S)&&this._onDecorationRemoved.fire(S),j.dispose())})),this._decorations.insert(S),this._onDecorationRegistered.fire(S)}return S}reset(){for(const x of this._decorations.values())x.dispose();this._decorations.clear()}*getDecorationsAtCell(x,S,j){let T=0,N=0;for(const D of this._decorations.getKeyIterator(S))T=D.options.x??0,N=T+(D.options.width??1),x>=T&&x<N&&(!j||(D.options.layer??"bottom")===j)&&(yield D)}forEachDecorationAtCell(x,S,j,T){this._decorations.forEachByKey(S,(N=>{_=N.options.x??0,E=_+(N.options.width??1),x>=_&&x<E&&(!j||(N.options.layer??"bottom")===j)&&T(N)}))}}l.DecorationService=C;class y extends m.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=p.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=p.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(x){super(),this.options=x,this.onRenderEmitter=this.register(new g.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new g.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=x.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.InstantiationService=l.ServiceCollection=void 0;const p=d(2585),g=d(8343);class m{constructor(..._){this._entries=new Map;for(const[E,C]of _)this.set(E,C)}set(_,E){const C=this._entries.get(_);return this._entries.set(_,E),C}forEach(_){for(const[E,C]of this._entries.entries())_(E,C)}has(_){return this._entries.has(_)}get(_){return this._entries.get(_)}}l.ServiceCollection=m,l.InstantiationService=class{constructor(){this._services=new m,this._services.set(p.IInstantiationService,this)}setService(b,_){this._services.set(b,_)}getService(b){return this._services.get(b)}createInstance(b,..._){const E=(0,g.getServiceDependencies)(b).sort(((v,x)=>v.index-x.index)),C=[];for(const v of E){const x=this._services.get(v.id);if(!x)throw new Error(`[createInstance] ${b.name} depends on UNKNOWN service ${v.id}.`);C.push(x)}const y=E.length>0?E[0].index:_.length;if(_.length!==y)throw new Error(`[createInstance] First service dependency of ${b.name} at position ${y+1} conflicts with ${_.length} static arguments`);return new b(..._,...C)}}},7866:function(f,l,d){var p=this&&this.__decorate||function(y,v,x,S){var j,T=arguments.length,N=T<3?v:S===null?S=Object.getOwnPropertyDescriptor(v,x):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(y,v,x,S);else for(var D=y.length-1;D>=0;D--)(j=y[D])&&(N=(T<3?j(N):T>3?j(v,x,N):j(v,x))||N);return T>3&&N&&Object.defineProperty(v,x,N),N},g=this&&this.__param||function(y,v){return function(x,S){v(x,S,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.traceCall=l.setTraceLogger=l.LogService=void 0;const m=d(844),b=d(2585),_={trace:b.LogLevelEnum.TRACE,debug:b.LogLevelEnum.DEBUG,info:b.LogLevelEnum.INFO,warn:b.LogLevelEnum.WARN,error:b.LogLevelEnum.ERROR,off:b.LogLevelEnum.OFF};let E,C=l.LogService=class extends m.Disposable{get logLevel(){return this._logLevel}constructor(y){super(),this._optionsService=y,this._logLevel=b.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),E=this}_updateLogLevel(){this._logLevel=_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(y){for(let v=0;v<y.length;v++)typeof y[v]=="function"&&(y[v]=y[v]())}_log(y,v,x){this._evalLazyOptionalParams(x),y.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+v,...x)}trace(y,...v){var x;this._logLevel<=b.LogLevelEnum.TRACE&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.trace.bind(this._optionsService.options.logger))??console.log,y,v)}debug(y,...v){var x;this._logLevel<=b.LogLevelEnum.DEBUG&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.debug.bind(this._optionsService.options.logger))??console.log,y,v)}info(y,...v){var x;this._logLevel<=b.LogLevelEnum.INFO&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.info.bind(this._optionsService.options.logger))??console.info,y,v)}warn(y,...v){var x;this._logLevel<=b.LogLevelEnum.WARN&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.warn.bind(this._optionsService.options.logger))??console.warn,y,v)}error(y,...v){var x;this._logLevel<=b.LogLevelEnum.ERROR&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.error.bind(this._optionsService.options.logger))??console.error,y,v)}};l.LogService=C=p([g(0,b.IOptionsService)],C),l.setTraceLogger=function(y){E=y},l.traceCall=function(y,v,x){if(typeof x.value!="function")throw new Error("not supported");const S=x.value;x.value=function(...j){if(E.logLevel!==b.LogLevelEnum.TRACE)return S.apply(this,j);E.trace(`GlyphRenderer#${S.name}(${j.map((N=>JSON.stringify(N))).join(", ")})`);const T=S.apply(this,j);return E.trace(`GlyphRenderer#${S.name} return`,T),T}}},7302:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OptionsService=l.DEFAULT_OPTIONS=void 0;const p=d(8460),g=d(844),m=d(6114);l.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:m.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const b=["normal","bold","100","200","300","400","500","600","700","800","900"];class _ extends g.Disposable{constructor(C){super(),this._onOptionChange=this.register(new p.EventEmitter),this.onOptionChange=this._onOptionChange.event;const y={...l.DEFAULT_OPTIONS};for(const v in C)if(v in y)try{const x=C[v];y[v]=this._sanitizeAndValidateOption(v,x)}catch(x){console.error(x)}this.rawOptions=y,this.options={...y},this._setupOptions(),this.register((0,g.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(C,y){return this.onOptionChange((v=>{v===C&&y(this.rawOptions[C])}))}onMultipleOptionChange(C,y){return this.onOptionChange((v=>{C.indexOf(v)!==-1&&y()}))}_setupOptions(){const C=v=>{if(!(v in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${v}"`);return this.rawOptions[v]},y=(v,x)=>{if(!(v in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${v}"`);x=this._sanitizeAndValidateOption(v,x),this.rawOptions[v]!==x&&(this.rawOptions[v]=x,this._onOptionChange.fire(v))};for(const v in this.rawOptions){const x={get:C.bind(this,v),set:y.bind(this,v)};Object.defineProperty(this.options,v,x)}}_sanitizeAndValidateOption(C,y){switch(C){case"cursorStyle":if(y||(y=l.DEFAULT_OPTIONS[C]),!(function(v){return v==="block"||v==="underline"||v==="bar"})(y))throw new Error(`"${y}" is not a valid value for ${C}`);break;case"wordSeparator":y||(y=l.DEFAULT_OPTIONS[C]);break;case"fontWeight":case"fontWeightBold":if(typeof y=="number"&&1<=y&&y<=1e3)break;y=b.includes(y)?y:l.DEFAULT_OPTIONS[C];break;case"cursorWidth":y=Math.floor(y);case"lineHeight":case"tabStopWidth":if(y<1)throw new Error(`${C} cannot be less than 1, value: ${y}`);break;case"minimumContrastRatio":y=Math.max(1,Math.min(21,Math.round(10*y)/10));break;case"scrollback":if((y=Math.min(y,4294967295))<0)throw new Error(`${C} cannot be less than 0, value: ${y}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(y<=0)throw new Error(`${C} cannot be less than or equal to 0, value: ${y}`);break;case"rows":case"cols":if(!y&&y!==0)throw new Error(`${C} must be numeric, value: ${y}`);break;case"windowsPty":y=y??{}}return y}}l.OptionsService=_},2660:function(f,l,d){var p=this&&this.__decorate||function(_,E,C,y){var v,x=arguments.length,S=x<3?E:y===null?y=Object.getOwnPropertyDescriptor(E,C):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(_,E,C,y);else for(var j=_.length-1;j>=0;j--)(v=_[j])&&(S=(x<3?v(S):x>3?v(E,C,S):v(E,C))||S);return x>3&&S&&Object.defineProperty(E,C,S),S},g=this&&this.__param||function(_,E){return function(C,y){E(C,y,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkService=void 0;const m=d(2585);let b=l.OscLinkService=class{constructor(_){this._bufferService=_,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(_){const E=this._bufferService.buffer;if(_.id===void 0){const j=E.addMarker(E.ybase+E.y),T={data:_,id:this._nextId++,lines:[j]};return j.onDispose((()=>this._removeMarkerFromLink(T,j))),this._dataByLinkId.set(T.id,T),T.id}const C=_,y=this._getEntryIdKey(C),v=this._entriesWithId.get(y);if(v)return this.addLineToLink(v.id,E.ybase+E.y),v.id;const x=E.addMarker(E.ybase+E.y),S={id:this._nextId++,key:this._getEntryIdKey(C),data:C,lines:[x]};return x.onDispose((()=>this._removeMarkerFromLink(S,x))),this._entriesWithId.set(S.key,S),this._dataByLinkId.set(S.id,S),S.id}addLineToLink(_,E){const C=this._dataByLinkId.get(_);if(C&&C.lines.every((y=>y.line!==E))){const y=this._bufferService.buffer.addMarker(E);C.lines.push(y),y.onDispose((()=>this._removeMarkerFromLink(C,y)))}}getLinkData(_){var E;return(E=this._dataByLinkId.get(_))==null?void 0:E.data}_getEntryIdKey(_){return`${_.id};;${_.uri}`}_removeMarkerFromLink(_,E){const C=_.lines.indexOf(E);C!==-1&&(_.lines.splice(C,1),_.lines.length===0&&(_.data.id!==void 0&&this._entriesWithId.delete(_.key),this._dataByLinkId.delete(_.id)))}};l.OscLinkService=b=p([g(0,m.IBufferService)],b)},8343:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createDecorator=l.getServiceDependencies=l.serviceRegistry=void 0;const d="di$target",p="di$dependencies";l.serviceRegistry=new Map,l.getServiceDependencies=function(g){return g[p]||[]},l.createDecorator=function(g){if(l.serviceRegistry.has(g))return l.serviceRegistry.get(g);const m=function(b,_,E){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(C,y,v){y[d]===y?y[p].push({id:C,index:v}):(y[p]=[{id:C,index:v}],y[d]=y)})(m,b,E)};return m.toString=()=>g,l.serviceRegistry.set(g,m),m}},2585:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.IDecorationService=l.IUnicodeService=l.IOscLinkService=l.IOptionsService=l.ILogService=l.LogLevelEnum=l.IInstantiationService=l.ICharsetService=l.ICoreService=l.ICoreMouseService=l.IBufferService=void 0;const p=d(8343);var g;l.IBufferService=(0,p.createDecorator)("BufferService"),l.ICoreMouseService=(0,p.createDecorator)("CoreMouseService"),l.ICoreService=(0,p.createDecorator)("CoreService"),l.ICharsetService=(0,p.createDecorator)("CharsetService"),l.IInstantiationService=(0,p.createDecorator)("InstantiationService"),(function(m){m[m.TRACE=0]="TRACE",m[m.DEBUG=1]="DEBUG",m[m.INFO=2]="INFO",m[m.WARN=3]="WARN",m[m.ERROR=4]="ERROR",m[m.OFF=5]="OFF"})(g||(l.LogLevelEnum=g={})),l.ILogService=(0,p.createDecorator)("LogService"),l.IOptionsService=(0,p.createDecorator)("OptionsService"),l.IOscLinkService=(0,p.createDecorator)("OscLinkService"),l.IUnicodeService=(0,p.createDecorator)("UnicodeService"),l.IDecorationService=(0,p.createDecorator)("DecorationService")},1480:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeService=void 0;const p=d(8460),g=d(225);class m{static extractShouldJoin(_){return(1&_)!=0}static extractWidth(_){return _>>1&3}static extractCharKind(_){return _>>3}static createPropertyValue(_,E,C=!1){return(16777215&_)<<3|(3&E)<<1|(C?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new p.EventEmitter,this.onChange=this._onChange.event;const _=new g.UnicodeV6;this.register(_),this._active=_.version,this._activeProvider=_}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(_){if(!this._providers[_])throw new Error(`unknown Unicode version "${_}"`);this._active=_,this._activeProvider=this._providers[_],this._onChange.fire(_)}register(_){this._providers[_.version]=_}wcwidth(_){return this._activeProvider.wcwidth(_)}getStringCellWidth(_){let E=0,C=0;const y=_.length;for(let v=0;v<y;++v){let x=_.charCodeAt(v);if(55296<=x&&x<=56319){if(++v>=y)return E+this.wcwidth(x);const T=_.charCodeAt(v);56320<=T&&T<=57343?x=1024*(x-55296)+T-56320+65536:E+=this.wcwidth(T)}const S=this.charProperties(x,C);let j=m.extractWidth(S);m.extractShouldJoin(S)&&(j-=m.extractWidth(C)),E+=j,C=S}return E}charProperties(_,E){return this._activeProvider.charProperties(_,E)}}l.UnicodeService=m}},i={};function c(f){var l=i[f];if(l!==void 0)return l.exports;var d=i[f]={exports:{}};return s[f].call(d.exports,d,d.exports,c),d.exports}var u={};return(()=>{var f=u;Object.defineProperty(f,"__esModule",{value:!0}),f.Terminal=void 0;const l=c(9042),d=c(3236),p=c(844),g=c(5741),m=c(8285),b=c(7975),_=c(7090),E=["cols","rows"];class C extends p.Disposable{constructor(v){super(),this._core=this.register(new d.Terminal(v)),this._addonManager=this.register(new g.AddonManager),this._publicOptions={...this._core.options};const x=j=>this._core.options[j],S=(j,T)=>{this._checkReadonlyOptions(j),this._core.options[j]=T};for(const j in this._core.options){const T={get:x.bind(this,j),set:S.bind(this,j)};Object.defineProperty(this._publicOptions,j,T)}}_checkReadonlyOptions(v){if(E.includes(v))throw new Error(`Option "${v}" 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 b.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new _.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new m.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const v=this._core.coreService.decPrivateModes;let x="none";switch(this._core.coreMouseService.activeProtocol){case"X10":x="x10";break;case"VT200":x="vt200";break;case"DRAG":x="drag";break;case"ANY":x="any"}return{applicationCursorKeysMode:v.applicationCursorKeys,applicationKeypadMode:v.applicationKeypad,bracketedPasteMode:v.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:x,originMode:v.origin,reverseWraparoundMode:v.reverseWraparound,sendFocusMode:v.sendFocus,wraparoundMode:v.wraparound}}get options(){return this._publicOptions}set options(v){for(const x in v)this._publicOptions[x]=v[x]}blur(){this._core.blur()}focus(){this._core.focus()}input(v,x=!0){this._core.input(v,x)}resize(v,x){this._verifyIntegers(v,x),this._core.resize(v,x)}open(v){this._core.open(v)}attachCustomKeyEventHandler(v){this._core.attachCustomKeyEventHandler(v)}attachCustomWheelEventHandler(v){this._core.attachCustomWheelEventHandler(v)}registerLinkProvider(v){return this._core.registerLinkProvider(v)}registerCharacterJoiner(v){return this._checkProposedApi(),this._core.registerCharacterJoiner(v)}deregisterCharacterJoiner(v){this._checkProposedApi(),this._core.deregisterCharacterJoiner(v)}registerMarker(v=0){return this._verifyIntegers(v),this._core.registerMarker(v)}registerDecoration(v){return this._checkProposedApi(),this._verifyPositiveIntegers(v.x??0,v.width??0,v.height??0),this._core.registerDecoration(v)}hasSelection(){return this._core.hasSelection()}select(v,x,S){this._verifyIntegers(v,x,S),this._core.select(v,x,S)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(v,x){this._verifyIntegers(v,x),this._core.selectLines(v,x)}dispose(){super.dispose()}scrollLines(v){this._verifyIntegers(v),this._core.scrollLines(v)}scrollPages(v){this._verifyIntegers(v),this._core.scrollPages(v)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(v){this._verifyIntegers(v),this._core.scrollToLine(v)}clear(){this._core.clear()}write(v,x){this._core.write(v,x)}writeln(v,x){this._core.write(v),this._core.write(`\r
65
+ `,x)}paste(v){this._core.paste(v)}refresh(v,x){this._verifyIntegers(v,x),this._core.refresh(v,x)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(v){this._addonManager.loadAddon(this,v)}static get strings(){return l}_verifyIntegers(...v){for(const x of v)if(x===1/0||isNaN(x)||x%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...v){for(const x of v)if(x&&(x===1/0||isNaN(x)||x%1!=0||x<0))throw new Error("This API only accepts positive integers")}}f.Terminal=C})(),u})()))})(qd)),qd.exports}var Gw=Vw();/**
66
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
67
+ * @license MIT
68
+ *
69
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
70
+ * @license MIT
71
+ *
72
+ * Originally forked from (with the author's permission):
73
+ * Fabrice Bellard's javascript vt100 for jslinux:
74
+ * http://bellard.org/jslinux/
75
+ * Copyright (c) 2011 Fabrice Bellard
76
+ */var Kw=2,Yw=1,Xw=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let r=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(r._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var m;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 r=this._terminal.options.scrollback===0?0:((m=this._terminal.options.overviewRuler)==null?void 0:m.width)||14,s=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(s.getPropertyValue("height")),c=Math.max(0,parseInt(s.getPropertyValue("width"))),u=window.getComputedStyle(this._terminal.element),f={top:parseInt(u.getPropertyValue("padding-top")),bottom:parseInt(u.getPropertyValue("padding-bottom")),right:parseInt(u.getPropertyValue("padding-right")),left:parseInt(u.getPropertyValue("padding-left"))},l=f.top+f.bottom,d=f.right+f.left,p=i-l,g=c-d-r;return{cols:Math.max(Kw,Math.floor(g/e.css.cell.width)),rows:Math.max(Yw,Math.floor(p/e.css.cell.height))}}};function Zw({sessionId:e,onClose:r,onEscape:s,autoFocus:i}){const c=P.useRef(null),u=P.useRef(e),f=P.useRef(null),l=P.useRef(null),d=sr(g=>g.writeSession),p=sr(g=>g.resizeSession);return P.useEffect(()=>{u.current=e},[e]),P.useEffect(()=>{if(!s)return;const g=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),s())};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[s]),P.useEffect(()=>{if(!c.current)return;const g=new Gw.Terminal({fontFamily:'"JetBrains Mono", monospace',fontSize:13,theme:{background:"#1a1a1a",foreground:"#e0e0e0",cursor:"#ffffff",cursorAccent:"#1a1a1a"},cursorBlink:!0,cursorStyle:"bar",convertEol:!0}),m=new Xw;g.loadAddon(m),f.current={term:g,fitAddon:m},c.current.addEventListener("keydown",C=>{C.key==="Escape"&&s&&(C.preventDefault(),C.stopPropagation(),s())}),g.open(c.current);const b=c.current.querySelector(".xterm");b&&(b.style.padding="8px"),m.fit(),i&&setTimeout(()=>{g.focus()},150);const _=new ResizeObserver(()=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{requestAnimationFrame(()=>{var y;m.fit&&m.fit();const C=(y=f.current)==null?void 0:y.term;C&&C.cols>0&&C.rows>0&&p(u.current,C.cols,C.rows)})},100)});_.observe(c.current),g.onData(C=>{if(C==="\x1B"&&s){s();return}d(u.current,C)}),g.onKey(C=>{C.key==="\x1B"&&s&&(C.domEvent.stopPropagation(),s())});const E=Vt.subscribe(C=>{var y,v;if(C.type==="terminal.output"&&((y=C.payload)==null?void 0:y.sessionId)===u.current){const x=(v=C.payload)==null?void 0:v.data;x&&g.write(x)}});return()=>{E(),_.disconnect(),l.current&&clearTimeout(l.current),g.dispose(),f.current=null}},[e,d,p]),o.jsxs("div",{className:"flex flex-col h-full bg-[#1a1a1a]",children:[o.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-2 py-1 bg-[#252525] border-b border-[#333]",children:[o.jsx("div",{}),o.jsx("button",{onClick:r,className:"p-1 rounded hover:bg-[#333] text-[#888] hover:text-[#ccc] transition-colors",title:"Close terminal",children:o.jsx(Aw,{})})]}),o.jsx("div",{ref:c,className:"flex-1 relative overflow-hidden",tabIndex:0,onKeyDown:g=>{g.key==="Escape"&&s&&(g.preventDefault(),g.stopPropagation(),s())}})]})}function Qw(e){return e===1?"grid-cols-1":e===2?"grid-cols-1 lg:grid-cols-2":"grid-cols-1 lg:grid-cols-2 xl:grid-cols-3"}function Jw({isOpen:e,onClose:r,onFocusChat:s}){const i=sr(C=>C.createSession),c=sr(C=>C.killSession),u=sr(C=>C.sessions),f=sr(C=>C.setWorkdir),l=sr(C=>C.fetchSessions),d=Qt(C=>C.currentProject),[p,g]=P.useState(!0),m=P.useRef(null),b=P.useRef(!1),_=P.useRef(!1),E=P.useCallback(()=>{r(),s()},[r,s]);return P.useEffect(()=>{d!=null&&d.workdir&&f(d.workdir)},[d==null?void 0:d.workdir,f]),P.useEffect(()=>{e&&(g(!0),l().finally(()=>g(!1)))},[e,l]),P.useEffect(()=>{e&&u.length===0&&!p&&!_.current&&(_.current=!0,i())},[e,u.length,p,i]),P.useEffect(()=>{e?(b.current=!0,setTimeout(()=>{var C;(C=m.current)==null||C.focus(),setTimeout(()=>{b.current=!1},200)},100)):_.current=!1},[e]),P.useEffect(()=>{if(!e)return;const C=y=>{b.current||y.key==="Escape"&&(y.preventDefault(),r(),s())};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[e,r,s]),e?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-x-0 top-[50vh] bottom-0 z-[100] bg-black/40",style:{pointerEvents:"auto"},onClick:E}),o.jsxs("div",{ref:m,tabIndex:-1,className:"fixed inset-x-0 top-0 z-[100] h-[50vh] bg-bg-primary border-b border-border flex flex-col animate-slide-down outline-none",onClick:C=>C.stopPropagation(),onKeyDown:C=>{C.key==="Escape"&&(C.preventDefault(),E())},children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Terminal"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:()=>i(),className:"p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"New terminal",children:o.jsx(Sw,{})}),o.jsx("button",{onClick:()=>{r(),s()},className:"p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Close (Esc)",children:o.jsx(Gb,{})})]})]}),o.jsx("div",{className:"flex-1 min-h-0 p-2 overflow-auto",children:p?o.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:"Loading..."}):u.length===0?o.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:o.jsxs("div",{className:"text-center",children:[o.jsx("p",{className:"mb-4",children:"No terminal sessions"}),o.jsx("button",{onClick:()=>i(),className:"px-4 py-2 bg-accent-primary/25 text-text-primary rounded hover:bg-accent-primary/40 transition-colors",children:"Create Terminal"})]})}):o.jsx("div",{className:`grid ${Qw(u.length)} gap-2 h-full auto-rows-fr`,children:u.map(C=>o.jsx(Zw,{sessionId:C.id,onClose:()=>c(C.id),onEscape:E,autoFocus:u.length===1},C.id))})})]})]}):null}function go({items:e,trigger:r,minWidth:s="120px",isOpen:i,onOpenChange:c}){const[u,f]=P.useState(!1),l=i!==void 0,d=l?i:u,p=O=>{if(l){const q=typeof O=="function"?O(u):O;c==null||c(q)}else f(O)},[g,m]=P.useState(null),b=P.useRef(null),_=P.useRef(null),[E,C]=P.useState(0),y=P.useRef(0),v=P.useRef(e),x=P.useCallback(()=>{if(!b.current)return;const O=b.current.getBoundingClientRect(),q=200,W=window.innerHeight-O.bottom<q;m({top:W?O.top-q-4:O.bottom+4,left:O.left,alignToTop:W})},[]);P.useEffect(()=>{v.current=e},[e]),P.useEffect(()=>{function O(q){_.current&&!_.current.contains(q.target)&&p(!1)}return d&&document.addEventListener("mousedown",O),()=>{document.removeEventListener("mousedown",O)}},[d]),P.useEffect(()=>{d&&x()},[d,x]),P.useEffect(()=>{if(!d)return;setTimeout(()=>{var q;(q=_.current)==null||q.focus()},0);function O(q){const G=v.current,W=G.filter($=>!S($)),I=j(y.current,G);switch(q.key){case"ArrowDown":if(q.preventDefault(),q.stopPropagation(),I<W.length-1){const $=T(y.current+1,G);y.current=$,C($)}break;case"ArrowUp":if(q.preventDefault(),q.stopPropagation(),I>0){const $=N(y.current-1,G);y.current=$,C($)}break;case"Enter":q.preventDefault(),q.stopPropagation(),D(y.current,G);break;case"Escape":q.preventDefault(),q.stopPropagation(),p(!1);break}}return window.addEventListener("keydown",O,!0),()=>window.removeEventListener("keydown",O,!0)},[d,e]);function S(O){var W;const q=O.label;return q?String(((W=q.props)==null?void 0:W.className)??"").includes("cursor-default"):!1}function j(O,q){let G=0;for(let W=0;W<O;W++){const I=q[W];I&&!S(I)&&G++}return G}function T(O,q){for(let G=O;G<q.length;G++){const W=q[G];if(W&&!S(W))return G}return O}function N(O,q){for(let G=O;G>=0;G--){const W=q[G];if(W&&!S(W))return G}return O}function D(O,q){var W;const G=q[O];!G||S(G)||((W=G.onClick)==null||W.call(G),G.href&&(window.history.pushState(null,"",G.href),window.dispatchEvent(new PopStateEvent("popstate"))),p(!1))}P.useEffect(()=>{d&&(C(e.findIndex(O=>!S(O))),y.current=e.findIndex(O=>!S(O)))},[d,e]);const A=O=>{O.stopPropagation(),d||x(),p(!d)},z=g&&o.jsx("div",{ref:_,"data-testid":"session-dropdown-menu",className:`fixed bg-bg-secondary border border-border rounded shadow-lg z-50 ${g.alignToTop?"mb-1":"mt-1"}`,style:{top:g.top,left:g.left,minWidth:s},tabIndex:-1,children:e.map((O,q)=>{const W=!S(O)&&q===E,I=o.jsxs(o.Fragment,{children:[O.icon&&o.jsx("span",{className:"w-4 h-4 flex-shrink-0",children:O.icon}),O.label]});return O.href?o.jsx(Pn,{href:O.href,onClick:$=>{var B;(B=O.onClick)==null||B.call(O,$),p(!1)},className:`w-full px-3 py-2 text-left text-sm flex items-center gap-2 transition-colors ${O.danger?"text-accent-error hover:bg-accent-error/10":W?"bg-accent-primary/20 text-text-primary":"hover:bg-bg-tertiary text-text-primary"} ${q!==e.length-1?"border-b border-border":""}`,children:I},q):o.jsx("button",{onClick:$=>{var B;(B=O.onClick)==null||B.call(O,$),O.closeOnClick!==!1&&p(!1)},className:`w-full px-3 py-2 text-left text-sm flex items-center gap-2 transition-colors ${O.danger?"text-accent-error hover:bg-accent-error/10":W?"bg-accent-primary/20 text-text-primary":"hover:bg-bg-tertiary text-text-primary"} ${q!==e.length-1?"border-b border-border":""}`,children:I},q)})});return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"relative",children:o.jsx("div",{ref:b,onClick:A,children:r})}),d&&mo.createPortal(z,document.body)]})}function ey(e){const r=new Date(e),i=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][r.getDay()],c=r.getFullYear(),u=String(r.getMonth()+1).padStart(2,"0"),f=String(r.getDate()).padStart(2,"0");return`${i} ${c}/${u}/${f}`}function uc(e){const r=new Date(e),s=String(r.getHours()).padStart(2,"0"),i=String(r.getMinutes()).padStart(2,"0");return`${s}:${i}`}function eC(e){const r=new Date(e),s=new Date,i=new Date(s.getFullYear(),s.getMonth(),s.getDate()),c=new Date(r.getFullYear(),r.getMonth(),r.getDate()),u=Math.floor((i.getTime()-c.getTime())/(1e3*60*60*24)),f=uc(e);if(u===0)return`today ${f}`;if(u===1)return`yesterday ${f}`;if(u<7)return`${u} days ago ${f}`;{const l=r.getFullYear(),d=String(r.getMonth()+1).padStart(2,"0"),p=String(r.getDate()).padStart(2,"0");return`${l}/${d}/${p} ${f}`}}function ty(e){const r=new Date(e);return{year:r.getFullYear(),month:String(r.getMonth()+1).padStart(2,"0"),day:String(r.getDate()).padStart(2,"0")}}function tC(e){const{year:r,month:s,day:i}=ty(e);return`${r}-${s}-${i}`}function ny(e){const r=new Map;for(const c of e){const u=tC(c.updatedAt);r.has(u)||r.set(u,[]),r.get(u).push(c)}for(const[c,u]of r)u.sort((f,l)=>{const d=new Date(f.updatedAt).getTime();return new Date(l.updatedAt).getTime()-d});const s=Array.from(r.keys()).sort((c,u)=>u.localeCompare(c)),i=new Map;for(const c of s)i.set(c,r.get(c));return i}function nC({items:e,trigger:r,isActive:s=!1}){const[i,c]=P.useState(!1),u=P.useRef(null);return P.useEffect(()=>{function f(l){u.current&&!u.current.contains(l.target)&&c(!1)}if(i)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[i]),o.jsxs("div",{className:"relative",ref:u,children:[o.jsxs("button",{type:"button",onClick:()=>c(!i),className:`flex items-center gap-1 px-1.5 py-0.5 rounded transition-colors ${s?"bg-bg-tertiary":"hover:bg-bg-tertiary"}`,children:[typeof r=="string"?o.jsx("span",{className:"text-sm text-text-secondary font-medium",children:r}):r,o.jsx(mr,{className:"w-3 h-3 text-text-muted flex-shrink-0 transition-transform",rotate:i?180:0})]}),i&&e.length>0&&o.jsx("div",{className:"absolute top-full left-0 mt-1 w-56 bg-bg-secondary border border-border rounded-lg shadow-lg overflow-hidden z-50",children:e.map((f,l)=>{const d=f.label&&typeof f.label=="object"&&f.label.type===Pn?f.label:null;if(d){const p=d.props.href||"";return o.jsxs(Pn,{href:p,className:"flex items-center gap-2 px-3 py-2 text-sm border-b border-border hover:bg-bg-tertiary transition-colors",children:[f.icon,d.props.children]},l)}return f.href?o.jsxs("a",{href:f.href,className:"flex items-center gap-2 px-3 py-2 text-sm border-b border-border hover:bg-bg-tertiary transition-colors",children:[f.icon,f.label]},l):o.jsxs("button",{type:"button",onClick:()=>{var p;(p=f.onClick)==null||p.call(f),c(!1)},className:"flex items-center gap-2 px-3 py-2 text-sm w-full text-left border-b border-border hover:bg-bg-tertiary transition-colors",children:[f.icon,f.label]},l)})})]})}function rC({projects:e,currentProject:r}){const s=Qt(u=>u.loadProject),c=[...e].sort((u,f)=>u.name.localeCompare(f.name)).map(u=>({label:u.name,icon:u.id===r.id?o.jsx(Pr,{}):void 0,href:`/p/${u.id}`,onClick:()=>{s(u.id)}}));return o.jsx(go,{items:c,trigger:o.jsxs("button",{className:"text-text-secondary hover:text-text-primary hover:underline text-sm truncate flex items-center gap-1",title:r.name,children:[r.name,o.jsx(mr,{})]}),minWidth:"250px"})}function sC({currentProject:e,sessions:r,currentSession:s,projectIdFromUrl:i}){if(!(e!=null&&e.id)||e.id!==i)return null;const c=r.filter(f=>f.projectId===e.id).sort((f,l)=>new Date(l.updatedAt).getTime()-new Date(f.updatedAt).getTime()).slice(0,5),u=[{label:o.jsxs(Pn,{href:`/p/${e.id}/new`,className:"flex items-center gap-2",children:[o.jsx(Pb,{className:"w-3 h-3 text-accent-primary"}),o.jsx("span",{className:"text-sm",children:"New Session"})]})},...c.map(f=>({label:o.jsx(Pn,{href:`/p/${e.id}/s/${f.id}`,className:"flex items-center gap-2 truncate text-sm",children:o.jsx("span",{children:f.title??f.id.slice(0,8)})}),icon:f.id===(s==null?void 0:s.id)?o.jsx(Pr,{className:"w-3 h-3"}):void 0})),{label:o.jsxs(Pn,{href:"/",className:"flex items-center gap-2 text-text-muted hover:text-text-primary",children:[o.jsx(dw,{className:"w-3 h-3"}),o.jsx("span",{className:"text-sm",children:"Projects"})]})}];return o.jsx(nC,{items:u,trigger:o.jsx("span",{className:"text-sm text-text-secondary font-medium",children:e.name})})}function iC({sessions:e,currentProject:r,currentSession:s,isOpen:i,onOpenChange:c}){var g;const u=Ce(m=>m.loadSession),f=e.filter(m=>m.projectId===r.id).slice(0,15),l=ny(f),d=P.useMemo(()=>{const m=[];m.push({label:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pb,{className:"w-4 h-4 text-accent-primary"}),o.jsx("span",{className:"text-sm",children:"New session"})]}),href:`/p/${r.id}/new`,onClick:()=>{}});for(const[b,_]of l){const E=_[0];if(E){m.push({label:o.jsx("div",{className:"px-3 py-2 text-text-muted text-xs font-medium cursor-default",children:ey(E.updatedAt)}),onClick:()=>{}});for(const C of _)m.push({label:o.jsxs("div",{className:"min-w-[160px]",children:[o.jsx("div",{className:"truncate text-sm",children:C.title??C.id.slice(0,8)}),o.jsx("div",{className:"text-text-muted text-xs",children:uc(C.updatedAt)})]}),icon:C.id===(s==null?void 0:s.id)?o.jsx(Pr,{}):void 0,href:`/p/${r.id}/s/${C.id}`,onClick:()=>{u(C.id)}})}}return m},[r.id,l,s==null?void 0:s.id]),p=s?((g=s.metadata)==null?void 0:g.title)??s.id.slice(0,8):"No session selected";return o.jsx(go,{items:d,isOpen:i,onOpenChange:c,trigger:o.jsxs("button",{className:"text-text-secondary hover:text-text-primary hover:underline text-sm truncate flex items-center gap-1",title:p,"data-testid":"header-session-dropdown",children:[p,o.jsx(mr,{})]}),minWidth:"280px"})}function aC({onMenuClick:e,onCriteriaToggle:r}){const[s,i]=P.useState(!1),[c,u]=P.useState(!1),[f,l]=P.useState(!!document.fullscreenElement);P.useEffect(()=>{const T=()=>l(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",T),()=>document.removeEventListener("fullscreenchange",T)},[]);const[d]=gr(),p=d.startsWith("/p/"),g=/^\/p\/[^/]+\/s\/[^/]+$/.test(d),m=Ce(T=>T.currentSession),b=Ce(T=>T.sessions),_=Qt(T=>T.currentProject),E=Qt(T=>T.projects),C=Lt(T=>T.startAutoRefresh),y=Lt(T=>T.stopAutoRefresh),v=sr(T=>T.setOpen),x=sr(T=>T.isOpen);P.useEffect(()=>{const T=()=>u(!0);return window.addEventListener("open-session-dropdown",T),()=>window.removeEventListener("open-session-dropdown",T)},[]);const S=P.useCallback(()=>{const T=document.querySelector('textarea[placeholder*="What would you like to build"], textarea[placeholder*="Send a message"]');T&&T.focus()},[]),j=P.useRef(0);return P.useEffect(()=>{const T=N=>{if(N.key==="Control"&&!N.shiftKey&&!N.metaKey&&!N.altKey){const D=Date.now();D-j.current<300?(N.preventDefault(),N.stopPropagation(),sr.getState().toggleOpen(),j.current=0):j.current=D}};return window.addEventListener("keydown",T,!0),()=>window.removeEventListener("keydown",T,!0)},[]),P.useEffect(()=>(C(),()=>y()),[C,y]),o.jsxs("header",{className:"h-8 bg-secondary border-b border-border flex items-center justify-between px-2",children:[o.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e&&p&&o.jsx("button",{onClick:e,className:"flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Toggle session list",children:o.jsx(Wx,{})}),o.jsx(Pn,{href:"/",className:"text-accent-primary font-semibold text-base hover:underline flex-shrink-0 hidden md:inline",children:"OpenFox"}),_&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"hidden md:inline text-text-muted flex-shrink-0",children:"/"}),o.jsx("span",{className:"hidden md:inline",children:o.jsx(rC,{projects:E,currentProject:_})}),o.jsx("span",{className:"md:hidden",children:o.jsx(sC,{currentProject:_,sessions:b,currentSession:m,projectIdFromUrl:p&&d.split("/")[2]||null},_==null?void 0:_.id)}),o.jsx("span",{className:"hidden md:inline text-text-muted flex-shrink-0",children:"/"}),o.jsx("span",{className:"hidden md:inline",children:o.jsx(iC,{sessions:b,currentProject:_,currentSession:m,isOpen:c,onOpenChange:u})})]})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[g&&o.jsx("button",{onClick:()=>{var T,N,D;document.fullscreenElement?(T=document.exitFullscreen)==null||T.call(document):(D=(N=document.documentElement).requestFullscreen)==null||D.call(N)},className:"max-sm:block hidden p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:f?"Exit fullscreen":"Enter fullscreen",children:f?o.jsx(mw,{}):o.jsx(gw,{})}),p&&o.jsx("button",{onClick:()=>v(!x),className:`p-2.5 rounded hover:bg-bg-tertiary transition-colors ${x?"text-accent-primary":"text-text-muted hover:text-text-primary"}`,title:"Toggle terminal (double Ctrl)",children:o.jsx(Nw,{})}),o.jsx("button",{onClick:()=>i(!0),className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Settings",children:o.jsx(Cw,{})}),o.jsx("button",{onClick:()=>{localStorage.removeItem("openfox_token"),window.location.reload()},className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Logout",children:o.jsx(bw,{})}),r&&g&&o.jsx("button",{onClick:r,className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Toggle summary sidebar",children:o.jsx(Wx,{})})]}),o.jsx(Fw,{isOpen:s,onClose:()=>i(!1)}),o.jsx(Jw,{isOpen:x,onClose:()=>v(!1),onFocusChat:S})]})}function oC({isOpen:e,onClose:r,title:s,label:i,description:c,placeholder:u,value:f,isLoading:l=!1,onSave:d}){const[p,g]=P.useState(f),[m,b]=P.useState(!1),[_,E]=P.useState(!1);P.useEffect(()=>{g(f),b(!1)},[f]);const C=S=>{g(S.target.value),b(!0)},y=async()=>{E(!0),await d(p),E(!1),b(!1),r()},v=()=>{g(f),b(!1),r()},x=l||_;return o.jsx(At,{isOpen:e,onClose:v,title:s,size:"lg",children:o.jsxs("div",{className:"flex flex-col h-full -mt-1",children:[o.jsx("label",{className:"block text-sm font-medium text-text-primary mb-1 flex-shrink-0",children:i}),o.jsx("p",{className:"text-sm text-text-muted mb-3 flex-shrink-0",children:c}),o.jsx("div",{className:"flex-1 min-h-[150px]",children:o.jsx("textarea",{value:p,onChange:C,placeholder:u,className:"w-full h-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary",disabled:x})}),m&&o.jsx($h,{}),o.jsxs("div",{className:"flex justify-end gap-2 pt-2 border-t border-border flex-shrink-0",children:[o.jsx(st,{variant:"secondary",onClick:v,children:"Cancel"}),o.jsx(st,{variant:"primary",onClick:y,disabled:!m||x,children:_?"Saving...":"Save"})]})]})})}function lC({isOpen:e,onClose:r,project:s}){const i=Qt(u=>u.updateProject),c=async u=>{i(s.id,{customInstructions:u||null}),await new Promise(f=>setTimeout(f,100))};return o.jsx(oC,{isOpen:e,onClose:r,title:`${s.name} Settings`,label:"Project Instructions",description:"These instructions are injected into prompts when working in this project. They are applied after global instructions but before AGENTS.md files.",placeholder:"Enter project-specific instructions...",value:s.customInstructions??"",onSave:c})}const cC={sm:"w-3 h-3",md:"w-4 h-4",lg:"w-5 h-5",xl:"w-6 h-6"},uC="M6 18L18 6M6 6l12 12";function io({onClick:e,className:r="",size:s="md",variant:i="default"}){const c=i==="overlay"?"bg-accent-error text-white rounded-full flex items-center justify-center hover:bg-accent-error/80 transition-colors":i==="sidebar"?"flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors":i==="modal"?"text-text-muted hover:text-text-primary transition-colors":"hover:text-white transition-colors";return o.jsx(cc,{onClick:e,icon:uC,iconSize:cC[s],className:`${c} ${r}`,title:"Close"})}function ry({projectId:e,isOpen:r=!0,onClose:s}){const[,i]=gr(),[c,u]=P.useState(!1),f=Ce(j=>j.sessions),l=Ce(j=>j.currentSession),d=Ce(j=>j.unreadSessionIds),p=Ce(j=>j.deleteSession),g=Ce(j=>j.deleteAllSessions),m=Ce(j=>j.loadMoreSessions),b=Ce(j=>j.sessionsHasMore),_=Ce(j=>j.sessionsPaginationLoading),E=Qt(j=>j.currentProject),C=P.useRef(null),y=P.useCallback(()=>{b&&!_&&E&&m(E.id)},[b,_,E,m]);P.useEffect(()=>{if(!C.current||!b)return;const j=new IntersectionObserver(T=>{const N=T[0];N&&N.isIntersecting&&y()},{threshold:.1});return j.observe(C.current),()=>j.disconnect()},[b,y]);const v=f.filter(j=>j.projectId===(E==null?void 0:E.id)),x=(j,T)=>{T==null||T.stopPropagation(),confirm("Delete this session?")&&(p(j),(l==null?void 0:l.id)===j&&i(`/p/${e}`))},S=()=>{confirm("Delete all sessions in this project? This cannot be undone.")&&(g(e),i(`/p/${e}`))};return o.jsxs(o.Fragment,{children:[r&&s&&o.jsx("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:s}),o.jsxs("aside",{className:`
77
+ ${r?"md:w-[300px] md:shrink-0":"md:w-0 md:shrink-0 md:overflow-hidden"}
78
+ md:relative md:h-auto md:translate-x-0
79
+
80
+ fixed z-50 h-[calc(100vh-32px)]
81
+ w-[300px] bg-secondary border-r border-border flex flex-col
82
+ transition-all duration-300 ease-in-out
83
+ ${r?"translate-x-0":"-translate-x-full"}
84
+ `,children:[o.jsxs("div",{className:"p-4 border-b border-border flex gap-2",children:[o.jsx(Pn,{href:`/p/${e}/new`,className:"flex-1 block text-center rounded font-medium transition-colors bg-accent-primary/25 text-text-primary hover:bg-accent-primary/40 px-3 py-1.5 text-sm","data-testid":"sidebar-new-session-button",children:"+ New Session"}),o.jsx(go,{items:[{label:"Edit project settings",onClick:()=>u(!0)},{label:"Delete all sessions",onClick:S,danger:!0}],trigger:o.jsx("button",{className:"flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Options",children:o.jsx(Ih,{})})}),s&&o.jsx(io,{onClick:s,className:"md:hidden",variant:"sidebar",size:"md"})]}),E&&o.jsx(lC,{isOpen:c,onClose:()=>u(!1),project:E}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:v.length===0?o.jsx("div",{className:"p-4 text-center text-text-muted text-xs",children:"No sessions"}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"divide-y divide-border",children:dC(v,l,d,x,e)}),_&&o.jsx("div",{className:"p-4 text-center text-text-muted text-xs",children:"Loading more..."}),o.jsx("div",{ref:C,className:"h-px"})]})})]})]})}function dC(e,r,s,i,c){const u=ny(e);return Array.from(u).map(([f,l])=>{const d=l[0];return d?o.jsxs("div",{children:[o.jsx("div",{className:"px-4 py-2 bg-bg-tertiary/30 text-text-muted text-xs font-medium",children:ey(d.updatedAt)}),l.map(p=>{const g=(r==null?void 0:r.id)===p.id,m=s.includes(p.id),b=p.isRunning;return o.jsx("div",{className:`w-full px-4 py-3 text-left hover:bg-bg-tertiary/50 transition-colors group ${g?"bg-bg-tertiary":""}`,children:o.jsxs(Pn,{href:`/p/${c}/s/${p.id}`,className:`block ${g?"text-accent-primary":"text-text-primary"} hover:text-accent-primary`,children:[o.jsxs("div",{className:"flex justify-between items-center mb-1",children:[o.jsx("span",{className:`font-medium truncate text-sm ${g?"text-accent-primary":"text-text-primary"}`,children:p.title??p.id.slice(0,6)}),o.jsx(go,{items:[{label:"Delete session",onClick:_=>i(p.id,_),danger:!0}],trigger:o.jsx("button",{onClick:_=>_.preventDefault(),className:"p-1.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-all",title:"Options",children:o.jsx(Ih,{})})})]}),o.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[b?o.jsx(kw,{}):m&&!g?o.jsx("span",{"aria-label":"Unread activity",title:"Unread activity",className:"w-2 h-2 rounded-full bg-amber-400 flex-shrink-0"}):null,o.jsx("span",{className:"text-text-muted text-xs flex-shrink-0",children:uc(p.updatedAt)}),o.jsxs("span",{className:"text-text-muted text-xs flex-shrink-0",children:[p.messageCount," messages"]})]})]})},p.id)})]},f):null})}const Zx=["⠋","⠙","⠹","⠸","⠼","⠴"];function hC(){var l;const e=Qt(d=>d.currentProject),r=Ce(d=>d.currentSession),s=Ib(),i=!1,c=P.useRef(0),u=P.useRef(null);P.useEffect(()=>(s?(u.current=window.setInterval(()=>{c.current=(c.current+1)%Zx.length,f()},150),f()):(u.current&&(clearInterval(u.current),u.current=null),f()),()=>{u.current&&(clearInterval(u.current),u.current=null)}),[s,e,r,i]);const f=()=>{var m;const p=(m=r==null?void 0:r.metadata)==null?void 0:m.title,g=s?`${Zx[c.current]} `:"";e&&p?document.title=`${g}${e.name} - ${p} | OpenFox`:e?document.title=`${g}${e.name} | OpenFox`:document.title=`${g}OpenFox`};return typeof window<"u"&&((l=r==null?void 0:r.metadata)!=null&&l.title)&&window.document.documentElement.setAttribute("data-session-title",r.metadata.title),null}const dc=P.forwardRef(({className:e="",...r},s)=>o.jsx("input",{ref:s,className:`bg-bg-tertiary border border-border rounded px-3 py-2 text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-accent-primary/50 focus:border-accent-primary ${e}`,...r}));dc.displayName="Input";function fC({isOpen:e,onClose:r,projectName:s,onConfirm:i}){const c=()=>{i(),r()};return o.jsx(At,{isOpen:e,onClose:r,title:"Delete Project",size:"sm",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("p",{className:"text-text-secondary",children:["This will permanently delete the project ",o.jsx("span",{className:"font-semibold text-text-primary",children:s})," and all its sessions from OpenFox. The project files on disk will remain untouched."]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(st,{variant:"secondary",onClick:r,children:"Cancel"}),o.jsx(st,{variant:"danger",onClick:c,children:"Delete"})]})]})})}function pC(e){return!e||e.trim()===""?{valid:!1,error:"Project name cannot be empty"}:/^[a-zA-Z0-9._-]+$/.test(e)?{valid:!0}:{valid:!1,error:"Project name can only contain letters, numbers, hyphens, underscores, and dots"}}function mC({isOpen:e,onClose:r}){const[,s]=gr(),[i,c]=P.useState(""),[u,f]=P.useState(null),[l,d]=P.useState(!1),[p,g]=P.useState(""),m=P.useRef(null);P.useEffect(()=>{e&&(ke("/api/config").then(C=>C.json()).then(C=>{C.workdir&&g(C.workdir)}),c(""),f(null),d(!1),setTimeout(()=>{var C;(C=m.current)==null||C.focus()},100))},[e]);const b=P.useCallback(async C=>{C.preventDefault();const y=pC(i);if(!y.valid){f(y.error);return}d(!0),f(null);const v=`${p}/${i}`;try{const x=await ke("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,workdir:v})});if(!x.ok){const T=await x.json().catch(()=>({}));throw new Error(T.error||"Failed to create project")}const j=(await x.json()).project;r(),s(`/p/${j.id}`)}catch(x){f(x instanceof Error?x.message:"Failed to create project"),d(!1)}},[i,s,r,p]),_=P.useCallback(()=>{c(""),f(null),r()},[r]),E=i?`${p}/${i}`:"";return o.jsx(At,{isOpen:e,onClose:_,title:"Create New Project",size:"sm",children:o.jsxs("form",{onSubmit:b,className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{htmlFor:"project-name",className:"block text-sm font-medium text-text-secondary mb-2",children:"Project Name"}),o.jsx(dc,{ref:m,id:"project-name",value:i,onChange:C=>{c(C.target.value),f(null)},placeholder:"my-project",disabled:l,className:"w-full"}),i&&o.jsxs("div",{className:"mt-2 text-xs text-text-muted",children:["Full path: ",o.jsx("span",{className:"font-mono",children:E})]}),u&&o.jsx("div",{className:"mt-3 p-3 bg-accent-error/10 border border-accent-error/30 rounded text-sm text-accent-error",children:u})]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(st,{type:"button",variant:"secondary",onClick:_,disabled:l,children:"Cancel"}),o.jsx(st,{type:"submit",variant:"primary",disabled:l||!i.trim(),className:"min-w-[100px]",children:l?o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx($b,{className:"h-4 w-4"}),"Creating..."]}):"Create"})]})]})})}const gC={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};function hc({size:e="md",className:r=""}){return o.jsx("div",{className:`animate-spin border-2 border-accent-primary border-t-transparent rounded-full ${gC[e]} ${r}`})}function xC({text:e,...r}){return o.jsxs("div",{className:"text-center",children:[o.jsx(hc,{...r,className:"mx-auto mb-4"}),e&&o.jsx("div",{className:"text-text-secondary",children:e})]})}function sy({onSelect:e,onClose:r,initialPath:s}){const[i,c]=P.useState(null),[u,f]=P.useState(!0),l=P.useCallback(async p=>{f(!0);try{const g=p?`/api/directories?path=${encodeURIComponent(p)}`:"/api/directories",b=await(await ke(g)).json();c(b)}catch(g){console.error("Failed to load directories:",g)}finally{f(!1)}},[]);P.useEffect(()=>{l(s)},[s,l]);const d=((i==null?void 0:i.current)??"").split("/").filter(Boolean).map((p,g,m)=>({name:p,path:"/"+m.slice(0,g+1).join("/")}));return o.jsxs(At,{isOpen:!0,onClose:r,title:"Select Folder",size:"lg",children:[i&&o.jsx("div",{className:"px-3 py-2 bg-bg-tertiary/30 -mx-4 -mt-4 mb-4 border-b border-border",children:o.jsxs("div",{className:"flex items-center text-xs overflow-x-auto",children:[d.map((p,g)=>o.jsxs("span",{className:"flex items-center shrink-0",children:[o.jsx("span",{className:"text-text-muted",children:"/"}),o.jsx("button",{onClick:()=>l(p.path),className:`px-1 ${g===d.length-1?"text-accent-primary font-medium":"text-text-secondary hover:text-accent-primary"}`,children:p.name})]},p.path)),d.length===0&&o.jsx("button",{onClick:()=>l("/"),className:"text-text-muted hover:text-accent-primary",children:"/"})]})}),o.jsx("div",{className:"flex-1 overflow-y-auto -mx-4",children:u?o.jsx("div",{className:"p-8 text-center",children:o.jsx(hc,{size:"sm"})}):o.jsxs("div",{className:"divide-y divide-border",children:[(i==null?void 0:i.parent)&&o.jsxs("button",{onClick:()=>l(i.parent),className:"w-full p-3 flex items-center gap-3 hover:bg-bg-tertiary/50 text-text-muted",children:[o.jsx(cw,{className:"w-5 h-5"}),o.jsx("span",{children:".."})]}),i==null?void 0:i.directories.map(p=>o.jsxs("div",{className:"group flex items-center gap-2 hover:bg-bg-tertiary/50",children:[o.jsxs("button",{onClick:()=>l(p.path),className:"flex-1 p-3 flex items-center gap-3 text-left",children:[o.jsx(Yl,{}),o.jsx("span",{children:p.name})]}),o.jsx("button",{onClick:()=>e(p.path),className:"px-3 py-1 text-xs bg-accent-primary/10 text-accent-primary rounded opacity-0 group-hover:opacity-100 transition-opacity mr-3",children:"Select"})]},p.path)),(i==null?void 0:i.directories.length)===0&&o.jsx("div",{className:"p-8 text-center text-text-muted text-sm",children:"No subdirectories"})]})}),o.jsxs("div",{className:"flex flex-col gap-2 pt-4 border-t border-border mt-4 -mx-4 -mb-4 p-4",children:[(i==null?void 0:i.current)&&o.jsx("button",{onClick:()=>e(i.current),className:"w-full px-4 py-2 bg-accent-primary text-text-primary rounded-lg font-medium hover:bg-accent-primary/90 transition-colors",children:"Select this folder"}),o.jsx("button",{onClick:r,className:"w-full text-center text-text-muted hover:text-text-secondary text-sm",children:"Cancel"})]})]})}async function Wd(e,r){let s="/api/directories";return e?s=`/api/directories?path=${encodeURIComponent(e)}`:r&&(s=`/api/directories?path=${encodeURIComponent(r)}`),(await ke(s)).json()}function vC({isOpen:e,onClose:r}){const[,s]=gr(),[i,c]=P.useState(!1),[u,f]=P.useState(""),[l,d]=P.useState(null),[p,g]=P.useState(!1),[m,b]=P.useState(null),_=Qt(Z=>Z.projects),E=Qt(Z=>Z.createProject),C=Qt(Z=>Z.listProjects),y=Qt(Z=>Z.deleteProject),[v,x]=P.useState(null),[S,j]=P.useState(-1),[T,N]=P.useState(null),[D,A]=P.useState(!1),z=P.useRef([]);P.useEffect(()=>{ke("/api/config").then(Z=>Z.json()).then(Z=>{Z.workdir&&b(Z.workdir)})},[]);const O=P.useCallback(async Z=>{g(!0);try{const H=await Wd(Z,m??void 0);d(H)}catch(H){console.error("Failed to load directories:",H)}finally{g(!1)}},[m]);P.useEffect(()=>{e&&m&&(Wd(m),C())},[e,m,O,C]);const q=(l==null?void 0:l.directories.filter(Z=>u===""||Z.name.toLowerCase().includes(u.toLowerCase())))??[],G=[...l!=null&&l.parent&&!u?[{type:"parent",path:l.parent,name:".."}]:[],...q.map(Z=>({type:"directory",path:Z.path,name:Z.name}))],W=Z=>{s(`/p/${Z}`),r()},I=(Z,H)=>{H.stopPropagation(),N(Z)},$=()=>{T&&(y(T.id),N(null))},B=Z=>{const H=Z.split("/").filter(Boolean).pop()??"";E(H,Z),C(),x(Z)};P.useEffect(()=>{if(v){const Z=_.find(H=>H.workdir===v);Z&&(s(`/p/${Z.id}`),r(),x(null))}},[_,v,s,r]),P.useEffect(()=>{j(G.length>0?0:-1)},[u,G.length]);const X=Z=>{f(""),Wd(Z)};return P.useEffect(()=>{S>=0&&z.current[S]&&z.current[S].scrollIntoView({behavior:"smooth",block:"nearest"})},[S]),e?o.jsxs(At,{isOpen:e,onClose:r,title:"Open Project",size:"xl",footer:o.jsxs("div",{className:"flex justify-between gap-2",children:[o.jsx(st,{variant:"secondary",onClick:()=>c(!0),children:"Create Project"}),o.jsx(st,{variant:"secondary",onClick:r,children:"Cancel"})]}),children:[o.jsxs("div",{className:"flex flex-1 -m-4",children:[o.jsxs("div",{className:"w-1/2 border-r border-border flex flex-col",children:[o.jsx("div",{className:"p-3 border-b border-border bg-bg-tertiary/30",children:o.jsx("h3",{className:"font-medium text-sm text-text-secondary",children:"Recent Projects"})}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:_.length===0?o.jsx("div",{className:"p-4 text-center text-text-muted text-sm",children:"No recent projects"}):o.jsx("div",{className:"divide-y divide-border",children:_.map(Z=>o.jsxs("div",{className:"group flex items-center gap-3 p-3 hover:bg-bg-tertiary/50 transition-colors",children:[o.jsxs("button",{onClick:()=>W(Z.id),className:"flex-1 flex items-center gap-3 text-left",children:[o.jsx(Yl,{className:"w-5 h-5 text-accent-primary"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"font-medium truncate",children:Z.name}),o.jsx("div",{className:"text-xs text-text-muted truncate",children:Z.workdir})]})]}),o.jsx("button",{onClick:H=>I(Z,H),className:"opacity-0 group-hover:opacity-100 text-accent-error/70 hover:text-accent-error p-1 transition-opacity",title:"Delete project",children:o.jsx(oc,{className:"w-4 h-4"})})]},Z.id))})})]}),o.jsxs("div",{className:"w-1/2 flex flex-col",children:[o.jsxs("div",{className:"p-3 border-b border-border bg-bg-tertiary/30 flex items-center justify-between",children:[o.jsx("h3",{className:"font-medium text-sm text-text-secondary",children:"Browse Projects"}),o.jsx("button",{onClick:()=>A(!0),className:"text-xs text-accent-primary hover:underline",children:"Open in dialog"})]}),o.jsx("div",{className:"p-3 border-b border-border",children:o.jsx(dc,{value:u,onChange:Z=>f(Z.target.value),placeholder:"Filter directories...",className:"w-full"})}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:p?o.jsx("div",{className:"p-8 text-center text-text-muted",children:o.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-accent-primary border-t-transparent rounded-full mx-auto"})}):G.length===0?o.jsx("div",{className:"p-8 text-center text-text-muted text-sm",children:u?"No matching directories":"No subdirectories"}):o.jsx("div",{className:"divide-y divide-border",children:G.map((Z,H)=>o.jsxs("button",{ref:L=>{L&&(z.current[H]=L)},onClick:()=>Z.type==="parent"?X(Z.path):B(Z.path),className:`w-full p-3 flex items-center gap-3 text-left transition-colors ${H===S?"bg-accent-primary/20 text-accent-primary":"hover:bg-bg-tertiary/50"}`,children:[o.jsx(Yl,{className:"w-5 h-5"}),o.jsx("span",{className:"flex-1",children:Z.name})]},Z.path))})})]})]}),i&&o.jsx(mC,{isOpen:i,onClose:()=>c(!1)}),T&&o.jsx(fC,{isOpen:!0,onClose:()=>N(null),projectName:T.name,onConfirm:$}),D&&o.jsx(sy,{initialPath:m??void 0,onSelect:Z=>{B(Z),A(!1)},onClose:()=>A(!1)})]}):null}function bC(){const[e,r]=P.useState(!1),s=Ce(g=>g.sessions),i=Qt(g=>g.projects),c=Qt(g=>g.listProjects),u=Ce(g=>g.listSessions),f=Ce(g=>g.connectionStatus);P.useEffect(()=>{f==="connected"&&(c(),u())},[f,c,u]);const l=[...i].sort((g,m)=>{const b=s.filter(y=>y.workdir.startsWith(g.workdir)),_=s.filter(y=>y.workdir.startsWith(m.workdir)),E=b.length>0?new Date(b.reduce((y,v)=>new Date(v.updatedAt)>new Date(y.updatedAt)?v:y).updatedAt).getTime():new Date(g.updatedAt).getTime();return(_.length>0?new Date(_.reduce((y,v)=>new Date(v.updatedAt)>new Date(y.updatedAt)?v:y).updatedAt).getTime():new Date(m.updatedAt).getTime())-E}),d=g=>{const m=i.find(b=>b.id===g);return m?s.filter(b=>b.workdir.startsWith(m.workdir)).sort((b,_)=>new Date(_.updatedAt).getTime()-new Date(b.updatedAt).getTime()).slice(0,5):[]},p=()=>{r(!0)};return o.jsxs("div",{className:"flex-1 flex flex-col overflow-y-auto bg-primary",children:[o.jsxs("div",{className:"max-w-5xl mx-auto w-full p-4 md:p-8",children:[o.jsxs("div",{className:"mb-6 md:mb-8 flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-3xl font-bold text-accent-primary",children:"OpenFox"}),o.jsx("p",{className:"text-text-secondary",children:"Local LLM-powered coding assistant with contract-driven execution"})]}),o.jsx(st,{variant:"primary",onClick:p,children:"Open Project"})]}),l.map(g=>{const m=d(g.id);return o.jsx("div",{className:"mb-6 md:mb-8",children:o.jsxs("div",{className:"bg-bg-secondary border border-border rounded-lg overflow-hidden",children:[o.jsxs("div",{className:"p-3 md:p-4 border-b border-border flex items-center justify-between gap-2",children:[o.jsxs(Pn,{href:`/p/${g.id}`,className:"flex items-center gap-2 cursor-pointer hover:opacity-80 transition-opacity flex-1",children:[o.jsx(Yl,{className:"w-5 h-5 text-accent-primary flex-shrink-0"}),o.jsx("span",{className:"text-text-primary font-semibold",children:g.name})]}),o.jsx(Pn,{href:`/p/${g.id}/new`,className:"rounded font-medium transition-colors bg-accent-primary/25 text-text-primary hover:bg-accent-primary/40 px-1.5 py-1 text-xs",children:"+ New Session"})]}),o.jsx("div",{className:"divide-y divide-border",children:m.length>0?m.map(b=>{const _=i.find(C=>b.workdir.startsWith(C.workdir)),E=_?`/p/${_.id}/s/${b.id}`:"#";return o.jsx(Pn,{href:E,className:"block p-3 md:p-4 hover:bg-bg-tertiary/50 cursor-pointer transition-colors",children:o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx("div",{className:"text-sm text-text-muted truncate",children:b.title??b.id.slice(0,8)})})}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[o.jsx("span",{className:"text-text-muted text-xs",children:eC(b.updatedAt)}),o.jsxs("span",{className:"text-text-muted text-xs",children:[b.messageCount," msgs"]})]})]})},b.id)}):o.jsx("div",{className:"p-3 md:p-4 text-text-muted text-sm",children:"No sessions yet"})})]})},g.id)}),l.length===0&&o.jsx("div",{className:"text-center py-12 text-text-muted",children:"No projects yet. Open a project to get started."})]}),e&&o.jsx(vC,{isOpen:e,onClose:()=>r(!1)})]})}function yC(){const[,e]=Mh("/p/:projectId/new"),[,r]=gr(),s=e==null?void 0:e.projectId,i=Ce(c=>c.createSession);return P.useEffect(()=>{s&&(async()=>{const u=await i(s);r(u?`/p/${s}/s/${u.id}`:`/p/${s}`)})()},[s,i,r]),o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(hc,{})})}function _C(){const e=Qt(r=>r.currentProject);return o.jsx("div",{className:"h-full flex flex-col items-center justify-center p-8 text-center",children:o.jsxs("div",{className:"max-w-md",children:[o.jsx("h2",{className:"text-xl font-semibold text-text-primary mb-2",children:(e==null?void 0:e.name)??"Project"}),o.jsx("p",{className:"text-text-secondary mb-6",children:"No session selected"}),o.jsxs("div",{className:"flex flex-col gap-3",children:[e&&o.jsx(Pn,{href:`/p/${e.id}/new`,className:"block w-full rounded font-medium transition-colors bg-accent-primary/25 text-text-primary hover:bg-accent-primary/40 px-3 py-2 text-center",children:"Create New Session"}),o.jsx("p",{className:"text-sm text-text-muted",children:"Or select an existing session from the sidebar"})]})]})})}const $a=e=>Math.round(e*10)/10;function gh(e){return{providerId:e.providerId,providerName:e.providerName,backend:e.backend,model:e.model}}function SC(e){return`${e.providerId}::${e.model}`}function wC(e){return`${e.providerName} > ${e.model}`}function Qx(e){let r=0,s=0,i=0,c=0,u=0,f=0;const l=[],d=[];let p=0;for(const[b,_]of e.entries()){const E=_.stats,C=gh(E);r+=E.totalTime,s+=E.toolTime,i+=E.prefillTokens,c+=E.generationTokens;const y=E.prefillSpeed>0?E.prefillTokens/E.prefillSpeed:0,v=E.generationSpeed>0?E.generationTokens/E.generationSpeed:0;u+=y,f+=v,l.push({messageId:_.id,timestamp:_.timestamp,...C,mode:E.mode,responseIndex:b+1,prefillTokens:E.prefillTokens,generationTokens:E.generationTokens,prefillSpeed:E.prefillSpeed,generationSpeed:E.generationSpeed,totalTime:E.totalTime,aiTime:E.totalTime-E.toolTime,toolTime:E.toolTime});const x=E.llmCalls??[];for(const S of x)p+=1,d.push({messageId:_.id,timestamp:S.timestamp??_.timestamp,providerId:S.providerId,providerName:S.providerName,backend:S.backend,model:S.model,mode:E.mode,responseIndex:b+1,sessionCallIndex:p,callIndex:S.callIndex,promptTokens:S.promptTokens,completionTokens:S.completionTokens,ttft:S.ttft,completionTime:S.completionTime,prefillSpeed:S.prefillSpeed,generationSpeed:S.generationSpeed,totalTime:S.totalTime,...S.temperature!==void 0&&{temperature:S.temperature},...S.topP!==void 0&&{topP:S.topP},...S.topK!==void 0&&{topK:S.topK},...S.maxTokens!==void 0&&{maxTokens:S.maxTokens}})}const g=u>0?$a(i/u):0,m=f>0?$a(c/f):0;return{totalTime:$a(r),aiTime:$a(r-s),toolTime:$a(s),prefillTokens:i,generationTokens:c,avgPrefillSpeed:g,avgGenerationSpeed:m,responseCount:e.length,llmCallCount:d.length,dataPoints:l,callDataPoints:d}}function CC(e){const r=e.filter(c=>c.stats!==void 0&&c.stats!==null).sort((c,u)=>new Date(c.timestamp).getTime()-new Date(u.timestamp).getTime());if(r.length===0)return null;const s=new Map;for(const c of r){const u=SC(gh(c.stats)),f=s.get(u)??[];s.set(u,[...f,c])}const i=Array.from(s.entries()).map(([c,u])=>{const f=gh(u[0].stats),l=Qx(u);return{...f,key:c,label:wC(f),...l}});return{...Qx(r),modelGroups:i}}function kC(e){return P.useMemo(()=>CC(e),[e])}function EC(e){const[r,s]=P.useState(null),[i,c]=P.useState(!0),[u,f]=P.useState(null),l=e||"";return P.useEffect(()=>{if(!l){c(!1);return}let d=!0,p=null;const g=async()=>{try{const b=await(await ke(`/api/branch?workdir=${encodeURIComponent(l)}`)).json();d&&(s(b.branch),f(b.error||null),c(!1))}catch(m){d&&(f(m instanceof Error?m.message:"Failed to fetch branch"),c(!1))}};return g(),p=setInterval(g,3e3),()=>{d=!1,p&&clearInterval(p)}},[l]),{branch:r,loading:i,error:u}}function Xl(e){return e.toLocaleString("en-US").replace(/,/g," ")}function Jx(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function jC(e){if(e<60)return`${e.toFixed(1)}s`;const r=Math.floor(e/60),s=Math.round(e%60);return`${r}m${s}s`}const NC="modulepreload",TC=function(e){return"/"+e},ev={},AC=function(r,s,i){let c=Promise.resolve();if(s&&s.length>0){let f=function(p){return Promise.all(p.map(g=>Promise.resolve(g).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),d=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));c=f(s.map(p=>{if(p=TC(p),p in ev)return;ev[p]=!0;const g=p.endsWith(".css"),m=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${m}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":NC,g||(b.as="script"),b.crossOrigin="",b.href=p,d&&b.setAttribute("nonce",d),document.head.appendChild(b),g)return new Promise((_,E)=>{b.addEventListener("load",_),b.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${p}`)))})}))}function u(f){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=f,window.dispatchEvent(l),!l.defaultPrevented)throw f}return c.then(f=>{for(const l of f||[])l.status==="rejected"&&u(l.reason);return r().catch(u)})},tv=["▁","▂","▃","▄","▅","▆","▇","█"];function DC(e,r,s){if(s===r)return 4;const i=(e-r)/(s-r);return Math.min(7,Math.max(0,Math.round(i*7)))}function LC(e,r){if(e===r){const c=Math.max(Math.abs(e)*.05,1);return{minY:e-c,maxY:r+c}}const s=r-e,i=Math.max(s*.1,.1);return{minY:e-i,maxY:r+i}}function RC(e,r){if(e.length===0||r<=0)return{blocks:"",minX:0,maxX:0,minY:0,maxY:0};const s=[...e].sort((m,b)=>m.x-b.x),i=s[0].x,c=s[s.length-1].x,u=Math.min(...s.map(m=>m.y)),f=Math.max(...s.map(m=>m.y)),{minY:l,maxY:d}=LC(u,f),p=Array.from({length:r},()=>" "),g=new Map;for(const m of s){const b=c===i?0:Math.round((m.x-i)/(c-i)*(r-1)),_=g.get(b)??[];g.set(b,[..._,m.y])}for(const[m,b]of g){const _=Math.max(...b);p[m]=tv[DC(_,l,d)]??tv[0]}return{blocks:p.join(""),minX:i,maxX:c,minY:l,maxY:d}}function nv(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function rv({data:e,width:r=60,height:s=78,label:i,xLabel:c,yLabel:u,showAxes:f=!0,formatY:l=nv,formatX:d=nv}){const p=P.useMemo(()=>{const g=RC(e,r),m=Math.max(r*6,240),b=10,_=8,C=[...e].sort((S,j)=>S.x-j.x).map(S=>{const j=g.maxX===g.minX?m/2:b+(S.x-g.minX)/(g.maxX-g.minX)*(m-b*2),T=g.maxY===g.minY?s/2:_+(g.maxY-S.y)/(g.maxY-g.minY)*(s-_*2);return{...S,cx:j,cy:T,leftPercent:j/m*100,topPercent:T/s*100}}),y=C.map((S,j)=>`${j===0?"M":"L"} ${S.cx.toFixed(1)} ${S.cy.toFixed(1)}`).join(" "),x=[g.maxY,(g.maxY+g.minY)/2,g.minY].map(S=>({value:S,y:g.maxY===g.minY?s/2:_+(g.maxY-S)/(g.maxY-g.minY)*(s-_*2)}));return{...g,chartWidth:m,points:C,path:y,gridLines:x}},[e,s,r]);return e.length===0?o.jsxs("div",{className:"font-mono text-text-muted text-xs",children:[i&&o.jsx("div",{className:"mb-1",children:i}),o.jsx("div",{children:"No data"})]}):o.jsxs("div",{className:"font-mono text-xs",children:[i&&o.jsx("div",{className:"text-text-secondary mb-2",children:i}),o.jsxs("div",{className:"flex gap-3",children:[f&&o.jsx("div",{className:"w-12 h-[78px] flex flex-col justify-between text-right text-text-muted",children:p.gridLines.map(g=>o.jsx("span",{children:l(g.value)},`${g.value}-${g.y}`))}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsxs("div",{className:"relative h-[78px]",children:[o.jsxs("svg",{viewBox:`0 0 ${p.chartWidth} ${s}`,className:"w-full h-[78px] overflow-visible",preserveAspectRatio:"none","aria-hidden":"true",children:[p.gridLines.map(g=>o.jsx("line",{x1:"0",x2:p.chartWidth,y1:g.y,y2:g.y,stroke:"currentColor",strokeDasharray:"3 4",className:"text-border/60"},`grid-${g.y}`)),p.points.map(g=>o.jsx("line",{x1:g.cx,x2:g.cx,y1:s-4,y2:g.cy,stroke:"currentColor",className:"text-border/40"},`guide-${g.cx}-${g.cy}`)),p.points.length>1&&o.jsx("path",{d:p.path,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-accent-primary/45"})]}),p.points.map(g=>o.jsx("div",{className:"absolute -translate-x-1/2 -translate-y-1/2",style:{left:`${g.leftPercent}%`,top:`${g.topPercent}%`},title:`${d(g.x)} -> ${l(g.y)}`,children:o.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-accent-primary/20 flex items-center justify-center",children:o.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-accent-primary"})})},`point-${g.x}-${g.y}`))]})})]}),f&&o.jsxs("div",{className:"flex items-start gap-3 text-text-muted mt-1",children:[o.jsx("span",{className:"w-12"}),o.jsxs("span",{className:"flex-1 flex justify-between",children:[o.jsx("span",{children:d(p.minX)}),o.jsx("span",{children:c}),o.jsx("span",{children:d(p.maxX)})]})]}),u&&f&&o.jsx("div",{className:"text-text-muted mt-1 text-center",children:u})]})}function OC({data:e,prefillLabel:r="Prefill Speed (tok/s) by Response",generationLabel:s="Generation Speed (tok/s) by Response",xLabel:i="response",width:c=60}){const u=e.map(l=>({x:l.x,y:l.ppSpeed})),f=e.map(l=>({x:l.x,y:l.tgSpeed}));return o.jsxs("div",{className:"space-y-5",children:[o.jsx(rv,{data:u,width:c,label:r,xLabel:i}),o.jsx(rv,{data:f,width:c,label:s,xLabel:i})]})}function MC(e){const r=new Map;for(const s of e.callDataPoints){const i=r.get(s.messageId)??[];r.set(s.messageId,[...i,s])}return e.dataPoints.map(s=>{const i=[...r.get(s.messageId)??[]].sort((c,u)=>c.callIndex-u.callIndex);return{...s,callCount:i.length,calls:i,isExpandable:i.length>1}})}function IC(e){return{mode:"responses",xLabel:"response",prefillLabel:"Prefill Speed (tok/s) by Response",generationLabel:"Generation Speed (tok/s) by Response",points:e.dataPoints.map(r=>({x:r.responseIndex,ppSpeed:r.prefillSpeed,tgSpeed:r.generationSpeed}))}}function BC(e){return{mode:"calls",xLabel:"context",prefillLabel:"Prefill Speed (tok/s) vs Context",generationLabel:"Generation Speed (tok/s) vs Context",points:e.callDataPoints.map(r=>({x:r.promptTokens,ppSpeed:r.prefillSpeed,tgSpeed:r.generationSpeed}))}}function zC(e){return e.callDataPoints.length>0?BC(e):IC(e)}function Vd(e){if(e<60)return`${e.toFixed(1)}s`;const r=Math.floor(e/60),s=e%60;return`${r}m ${s.toFixed(0)}s`}function Fs(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toString()}function Za(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function HC(e){if(e.length===0)return"0 ctx";const r=Math.min(...e),s=Math.max(...e);return r===s?`${Fs(r)} ctx`:`${Fs(r)}-${Fs(s)} ctx`}function Zl(e){return`${Za(e)} t/s`}function iy(e){try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}catch{return e}}function PC(e){return{exportedAt:new Date().toISOString(),providerId:e.providerId,providerName:e.providerName,backend:e.backend,model:e.model,label:e.label,summary:{totalTime:e.totalTime,aiTime:e.aiTime,toolTime:e.toolTime,prefillTokens:e.prefillTokens,generationTokens:e.generationTokens,avgPrefillSpeed:e.avgPrefillSpeed,avgGenerationSpeed:e.avgGenerationSpeed,responseCount:e.responseCount,llmCallCount:e.llmCallCount},responses:e.dataPoints.map(r=>({responseIndex:r.responseIndex,timestamp:r.timestamp,mode:r.mode,prefillTokens:r.prefillTokens,generationTokens:r.generationTokens,prefillSpeed:r.prefillSpeed,generationSpeed:r.generationSpeed,totalTime:r.totalTime,aiTime:r.aiTime,toolTime:r.toolTime})),llmCalls:e.callDataPoints.map(r=>({sessionCallIndex:r.sessionCallIndex,responseIndex:r.responseIndex,callIndex:r.callIndex,timestamp:r.timestamp,mode:r.mode,promptTokens:r.promptTokens,completionTokens:r.completionTokens,ttft:r.ttft,completionTime:r.completionTime,prefillSpeed:r.prefillSpeed,generationSpeed:r.generationSpeed,totalTime:r.totalTime}))}}function FC({isOpen:e,onClose:r,stats:s}){const i=P.useRef(null),[c,u]=P.useState({}),[f,l]=P.useState(()=>{var E;return((E=s.modelGroups[0])==null?void 0:E.key)??""});P.useEffect(()=>{var E;s.modelGroups.some(C=>C.key===f)||l(((E=s.modelGroups[0])==null?void 0:E.key)??"")},[f,s.modelGroups]);const d=P.useMemo(()=>s.modelGroups.find(E=>E.key===f)??s.modelGroups[0],[f,s.modelGroups]),p=P.useMemo(()=>d?MC(d):[],[d]),g=P.useMemo(()=>d?zC(d):{mode:"responses",xLabel:"response",prefillLabel:"",generationLabel:"",points:[]},[d]),m=P.useCallback(E=>{u(C=>({...C,[E]:!C[E]}))},[]),b=P.useCallback(()=>{if(!d)return;const E=PC(d);navigator.clipboard.writeText(JSON.stringify(E,null,2)).catch(C=>console.error("Failed to copy:",C))},[d]),_=P.useCallback(async()=>{if(i.current)try{const E=(await AC(async()=>{const{default:v}=await import("./html2canvas.esm-QH1iLAAe.js");return{default:v}},[])).default,C=await E(i.current,{backgroundColor:"#1a1a1a",scale:2}),y=document.createElement("a");y.download=`openfox-stats-${new Date().toISOString().slice(0,10)}.png`,y.href=C.toDataURL("image/png"),y.click()}catch(E){console.error("Failed to export PNG:",E),b()}},[b]);return o.jsx(At,{isOpen:e,onClose:r,title:"Session Stats",size:"lg",children:o.jsxs("div",{ref:i,className:"space-y-6",children:[o.jsx("section",{children:o.jsx("div",{className:"flex flex-wrap gap-2",children:s.modelGroups.map(E=>o.jsx("button",{onClick:()=>l(E.key),className:`px-3 py-1.5 rounded border text-xs transition-colors ${E.key===(d==null?void 0:d.key)?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border text-text-muted hover:text-text-primary hover:bg-bg-tertiary/40"}`,title:E.label,children:E.label},E.key))})}),d&&o.jsxs("section",{children:[o.jsx("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:"Summary"}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[o.jsx(zr,{label:"AI Time",value:Vd(d.aiTime)}),o.jsx(zr,{label:"Total Time",value:Vd(d.totalTime)}),o.jsx(zr,{label:"Tool Time",value:Vd(d.toolTime)}),o.jsx(zr,{label:"Responses",value:d.responseCount.toString()}),o.jsx(zr,{label:"LLM Calls",value:d.llmCallCount.toString()})]}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-3",children:[o.jsx(zr,{label:"Prefill Tokens",value:Fs(d.prefillTokens),subValue:`@ ${Za(d.avgPrefillSpeed)} tok/s`}),o.jsx(zr,{label:"Gen Tokens",value:Fs(d.generationTokens),subValue:`@ ${Za(d.avgGenerationSpeed)} tok/s`}),o.jsx(zr,{label:"Avg PP Speed",value:`${Za(d.avgPrefillSpeed)}`,subValue:"tok/s"}),o.jsx(zr,{label:"Avg TG Speed",value:`${Za(d.avgGenerationSpeed)}`,subValue:"tok/s"})]})]}),d&&g.points.length>1&&o.jsxs("section",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-secondary uppercase tracking-wide",children:"Performance Progression"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:b,className:"px-2 py-1 text-xs text-text-muted hover:text-text-primary hover:bg-bg-tertiary rounded transition-colors",children:"Copy JSON"}),o.jsx("button",{onClick:_,className:"px-2 py-1 text-xs text-text-muted hover:text-text-primary hover:bg-bg-tertiary rounded transition-colors",children:"Save PNG"})]})]}),o.jsx("div",{className:"bg-bg-tertiary/50 rounded p-4",children:o.jsx(OC,{data:g.points,width:50,prefillLabel:g.prefillLabel,generationLabel:g.generationLabel,xLabel:g.xLabel})})]}),d&&o.jsxs("section",{children:[o.jsxs("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:["Response Log (",d.responseCount," responses)"]}),o.jsx("div",{className:"overflow-y-auto bg-bg-tertiary/30 rounded",children:o.jsxs("table",{className:"w-full table-fixed border-separate border-spacing-0 text-xs",children:[o.jsxs("colgroup",{children:[o.jsx("col",{className:"w-[7%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[10%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[11%]"}),o.jsx("col",{className:"w-[2%]"})]}),o.jsx("thead",{children:o.jsxs("tr",{className:"text-[10px] uppercase tracking-wide text-text-muted/80",children:[o.jsx("th",{className:"px-3 py-2 text-center font-medium",children:"#"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"At"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Time"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Context"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"PP t/s"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"TG t/s"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Calls"}),o.jsx("th",{className:"px-2 py-2"})]})}),o.jsx("tbody",{children:p.map((E,C)=>o.jsxs(P.Fragment,{children:[o.jsx(UC,{row:E,index:C,isExpanded:c[E.messageId]??!1,onToggle:E.isExpandable?()=>m(E.messageId):void 0}),(c[E.messageId]??!1)&&E.calls.map((y,v)=>o.jsx($C,{dataPoint:y,index:v},`${y.messageId}-${y.callIndex}`))]},E.messageId))})]})})]})]})})}function zr({label:e,value:r,subValue:s}){return o.jsxs("div",{className:"bg-bg-tertiary/50 rounded p-3",children:[o.jsx("div",{className:"text-text-muted text-xs mb-1",children:e}),o.jsx("div",{className:"text-text-primary text-lg font-semibold",children:r}),s&&o.jsx("div",{className:"text-text-muted text-xs",children:s})]})}function UC({row:e,index:r,isExpanded:s,onToggle:i}){const c=e.calls.length>0?HC(e.calls.map(u=>u.promptTokens)):`${Fs(e.prefillTokens)} ctx`;return o.jsxs("tr",{onClick:i,className:`${r%2===0?"bg-bg-tertiary/20":""} ${i?"cursor-pointer hover:bg-bg-tertiary/35 transition-colors":""}`,children:[o.jsx("td",{className:"px-3 py-2 text-center text-text-muted align-middle",children:e.responseIndex}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:iy(e.timestamp)}),o.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:c.replace(/ ctx$/,"")}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Zl(e.prefillSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Zl(e.generationSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:e.callCount}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:e.isExpandable?s?"v":">":""})]})}function $C({dataPoint:e,index:r}){const s=e.temperature!==void 0||e.topP!==void 0||e.topK!==void 0||e.maxTokens!==void 0;return o.jsxs(o.Fragment,{children:[o.jsxs("tr",{className:`${r%2===0?"bg-bg-tertiary/10":"bg-bg-tertiary/5"}`,children:[o.jsxs("td",{className:"px-3 py-2 pl-6 text-center text-text-muted align-middle border-l border-border/60",children:["c",e.callIndex]}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:iy(e.timestamp)}),o.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Fs(e.promptTokens)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Zl(e.prefillSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Zl(e.generationSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:e.callIndex}),o.jsx("td",{className:"px-2 py-2"})]}),s&&o.jsx("tr",{className:`${r%2===0?"bg-bg-tertiary/5":"bg-bg-tertiary/[2.5%]"}`,children:o.jsx("td",{colSpan:8,className:"px-6 py-1.5 border-l border-border/60",children:o.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-[10px] text-text-muted",children:[e.temperature!==void 0&&o.jsxs("span",{children:["temp: ",e.temperature.toFixed(2)]}),e.topP!==void 0&&o.jsxs("span",{children:["topP: ",e.topP.toFixed(2)]}),e.topK!==void 0&&o.jsxs("span",{children:["topK: ",e.topK]}),e.maxTokens!==void 0&&o.jsxs("span",{children:["maxTok: ",e.maxTokens]})]})})})]})}const qC={pending:{icon:"○",color:"text-text-muted",label:"Pending"},in_progress:{icon:"●",color:"text-accent-warning",label:"In Progress",animate:!0},completed:{icon:"◉",color:"text-purple-400",label:"Completed"},passed:{icon:"✓",color:"text-accent-success",label:"Passed"},failed:{icon:"✗",color:"text-accent-error",label:"Failed"}},WC=P.memo(function({criteria:r}){if(r.length===0)return o.jsx("div",{className:"text-text-muted text-sm text-center py-2",children:"No criteria yet"});const s={pending:0,in_progress:0,completed:0,passed:0,failed:0};for(const c of r){const u=c.status.type;u in s&&s[u]++}const i=Object.keys(s).filter(c=>s[c]>0);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:"font-semibold text-text-primary",children:"Total:"}),o.jsx("span",{className:"text-text-secondary",children:r.length})]}),o.jsx("div",{className:"space-y-1",children:i.map(c=>{const u=qC[c];return o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:`${u.color} ${u.animate?"animate-pulse":""} text-sm leading-tight`,children:u.icon}),o.jsxs("span",{className:"text-text-muted",children:[u.label,":"]}),o.jsx("span",{className:"text-text-primary font-medium",children:s[c]})]},c)})})]})});function VC({isOpen:e,onClose:r}){const s=pr(_=>_.config),i=pr(_=>_.saveConfig),[c,u]=P.useState(""),[f,l]=P.useState(""),[d,p]=P.useState(!1),[g,m]=P.useState(!1);P.useEffect(()=>{e&&(u((s==null?void 0:s.command)??""),l((s==null?void 0:s.url)??""),p((s==null?void 0:s.hotReload)??!1))},[e,s]);const b=async()=>{!c.trim()||!f.trim()||(m(!0),await i({command:c.trim(),url:f.trim(),hotReload:d}),m(!1),r())};return o.jsx(At,{isOpen:e,onClose:r,title:"Dev Server Config",size:"sm",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Command"}),o.jsx("input",{className:"input w-full",type:"text",value:c,onChange:_=>u(_.target.value),placeholder:"npm run dev"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Dev URL"}),o.jsx("input",{className:"input w-full",type:"text",value:f,onChange:_=>l(_.target.value),placeholder:"http://localhost:3000"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("input",{type:"checkbox",id:"hotReload",checked:d,onChange:_=>p(_.target.checked),className:"rounded border-border bg-bg-tertiary"}),o.jsx("label",{htmlFor:"hotReload",className:"text-xs text-text-secondary",children:"Hot Reload"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[o.jsx("button",{className:"btn btn-secondary",onClick:r,children:"Cancel"}),o.jsx("button",{className:"btn btn-primary",onClick:b,disabled:g||!c.trim()||!f.trim(),children:g?"Saving...":"Save"})]})]})})}const sv={30:"text-black",31:"text-red-400",32:"text-accent-success",33:"text-accent-warning",34:"text-blue-400",35:"text-purple-400",36:"text-cyan-400",37:"text-gray-300",90:"text-gray-500",91:"text-red-500",92:"text-green-500",93:"text-yellow-400",94:"text-blue-500",95:"text-pink-400",96:"text-cyan-500",97:"text-white"},GC={40:"bg-black",41:"bg-red-900",42:"bg-green-900",43:"bg-yellow-900",44:"bg-blue-900",45:"bg-purple-900",46:"bg-cyan-900",47:"bg-gray-700"},iv={1:"font-bold",2:"opacity-75",4:"underline",7:"bg-bg-secondary"},KC="text-text-primary";function YC(e){const r=[],s=/\x1b\[([0-9;]+)m/g;let i=0,c="text-text-primary",u;try{for(;(u=s.exec(e))!==null;){if(u.index>i){const p=e.slice(i,u.index);p&&r.push({text:p,className:c})}const f=u[1];if(!f)continue;const l=f.split(";").map(Number);if(l.length===0||l[0]===0){c="text-text-primary";continue}const d=[];for(const p of l)if(p>=30&&p<=37){const g=sv[p];g&&d.push(g)}else if(p>=40&&p<=47){const g=GC[p];g&&d.push(g)}else if(p>=90&&p<=97){const g=sv[p];g&&d.push(g)}else if(p in iv){const g=iv[p];g&&d.push(g)}else p===39?d.push(KC):p===49&&(c=c.split(" ").filter(g=>!g.startsWith("bg-")).join(" "));d.length>0&&(c=d.join(" ")),i=s.lastIndex}if(i<e.length){const f=e.slice(i);f&&r.push({text:f,className:c})}return r}catch(f){return console.warn("ANSI parsing failed, stripping codes:",f),[{text:XC(e),className:"text-text-primary"}]}}function XC(e){return e.replace(/\x1b\[([0-9;]+)m/g,"")}function ao(e){const r=YC(e),s=[];return r.forEach((i,c)=>{const u=i.text.split(`
85
+ `);u.forEach((f,l)=>{s.push(mn.createElement("span",{key:`${c}-${l}`,className:i.className,style:{display:"inline-block",whiteSpace:"pre-wrap"}},f)),l<u.length-1&&s.push(mn.createElement("br",{key:`${c}-${l}-br`}))})}),s.length===1?s[0]:s}const ZC=P.memo(function({title:r,logs:s,onClose:i,preClassName:c}){const u=P.useRef(null);return P.useEffect(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[s]),o.jsx(At,{isOpen:!0,onClose:i,title:r,size:"full",children:o.jsx("pre",{ref:u,className:c,children:s.length===0?o.jsx("span",{className:"text-text-muted",children:"No output yet"}):s.map((f,l)=>o.jsx("span",{className:f.stream==="stderr"?"text-accent-warning":"",children:ao(f.content)},l))})})}),QC=P.memo(function({logs:r,anchorRef:s,isHiding:i,onExpand:c,onClose:u}){const[f,l]=P.useState(null),d=P.useRef(null);return P.useEffect(()=>{var g;const p=(g=s.current)==null?void 0:g.getBoundingClientRect();p&&l({bottom:window.innerHeight-p.bottom,right:window.innerWidth-p.right,width:p.width,height:p.height})},[s]),P.useEffect(()=>{d.current&&(d.current.scrollTop=d.current.scrollHeight)},[r]),f?o.jsxs("div",{className:"relative",children:[o.jsx("pre",{ref:d,className:"fixed z-50 text-sm font-mono text-text-primary bg-bg-primary p-2 rounded border border-border overflow-auto transition-all duration-150 ease-out select-text",style:{bottom:f.bottom,right:f.right,width:f.width*2,maxHeight:f.height*3,transformOrigin:"bottom right",transform:i?"scale(0.01)":"scale(1)",opacity:i?0:1},children:r.map((p,g)=>o.jsx("span",{className:p.stream==="stderr"?"text-accent-warning":"",children:ao(p.content)},g))}),o.jsx("button",{onClick:()=>{u(),c()},className:"fixed z-50 px-2 py-1 rounded text-xs font-medium bg-accent-primary/30 text-text-primary hover:bg-accent-primary/50 transition-colors duration-150",style:{bottom:f.bottom+8,right:f.right+8},children:"Expand"})]}):null}),JC=P.memo(function({workdir:r}){const s=pr(z=>z.setWorkdir),i=pr(z=>z.status),c=pr(z=>z.config),u=pr(z=>z.logs),f=pr(z=>z.start),l=pr(z=>z.stop),d=pr(z=>z.fetchLogs),[p,g]=P.useState(!1),[m,b]=P.useState(!1),[_,E]=P.useState(!1),[C,y]=P.useState(!1),v=P.useRef(null),x=P.useRef(null),S=P.useRef(null),j=P.useRef(null),T=(i==null?void 0:i.state)??"off",N=c!==null,D=T==="running"||T==="warning";P.useEffect(()=>{s(r??null)},[r,s]),P.useEffect(()=>{D&&d()},[D,d]),P.useEffect(()=>{S.current&&D&&(S.current.scrollTop=S.current.scrollHeight)},[u,D]);const A=()=>{D?l():f()};return o.jsxs("div",{className:"mt-2 pt-3 border-t border-border space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:`inline-block w-2.5 h-2.5 rounded-full flex-shrink-0 ${T==="running"?"bg-accent-success":T==="warning"?"bg-accent-warning":T==="error"?"bg-accent-error":"bg-text-muted"}`}),o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Dev Server"})]}),o.jsx("button",{onClick:()=>g(!0),className:"p-1.5 rounded hover:bg-bg-tertiary transition-colors text-text-muted",title:"Configure dev server",children:o.jsx(xw,{})})]}),N?o.jsxs(o.Fragment,{children:[T==="running"||T==="warning"?o.jsxs("div",{className:"flex gap-2",children:[o.jsxs("button",{onClick:A,className:"flex-1 flex items-center justify-center gap-1.5 rounded font-medium text-sm px-3 py-1.5 bg-bg-tertiary text-text-primary hover:bg-border transition-colors",children:[o.jsx(Ew,{}),"Stop"]}),(i==null?void 0:i.url)&&o.jsxs("a",{href:i.url,target:"_blank",rel:"noopener noreferrer",className:"flex-1 flex items-center justify-center gap-1.5 rounded font-medium text-sm px-3 py-1.5 bg-accent-primary/25 text-text-primary hover:bg-accent-primary/40 transition-colors",title:i.url,children:[o.jsx(yw,{}),"Open"]})]}):o.jsx("button",{onClick:A,className:"w-full rounded font-medium text-sm px-3 py-1.5 bg-accent-primary/25 text-text-primary hover:bg-accent-primary/40 transition-colors",children:"Start"}),D&&o.jsxs("div",{ref:j,className:"relative",onMouseEnter:()=>{x.current&&clearTimeout(x.current),v.current=setTimeout(()=>{E(!0),y(!1)},500)},onMouseLeave:()=>{v.current&&clearTimeout(v.current),y(!0),x.current=setTimeout(()=>E(!1),150)},children:[o.jsx("pre",{ref:S,className:"text-sm bg-bg-primary p-2 rounded overflow-auto max-h-[200px] border border-border",children:u.length===0?o.jsx("span",{className:"text-text-muted",children:"No output yet"}):u.map((z,O)=>o.jsx("span",{className:z.stream==="stderr"?"text-accent-warning":"",children:ao(z.content)},O))}),(_||C)&&j.current&&mo.createPortal(o.jsx(QC,{logs:u,anchorRef:j,isHiding:C,onExpand:()=>b(!0),onClose:()=>E(!1)}),document.body)]})]}):o.jsx("button",{onClick:()=>g(!0),className:"w-full rounded font-medium text-sm px-3 py-1.5 bg-bg-tertiary text-text-muted hover:bg-border transition-colors",children:"Configure"}),o.jsx(VC,{isOpen:p,onClose:()=>g(!1)}),m&&o.jsx(ZC,{title:"Dev Server Logs",logs:u,onClose:()=>b(!1)})]})});function e2({isOpen:e,onClose:r,processName:s,logs:i}){return e?o.jsx(At,{isOpen:e,onClose:r,title:s,size:"lg",children:o.jsx("pre",{className:"flex-1 overflow-auto text-sm font-mono text-text-primary whitespace-pre-wrap",children:i.map((c,u)=>o.jsx("span",{className:c.stream==="stderr"?"text-accent-error":"",children:c.content},u))})}):null}const t2=P.memo(function({sessionId:r}){var _;const s=Qa(E=>E.processes),i=Qa(E=>E.stopProcess),[c,u]=P.useState(null),[f,l]=P.useState([]),d=s.filter(E=>E.status!=="exited"),p=d.filter(E=>E.status==="running").length;if(s.length===0)return null;const g=E=>{switch(E){case"running":return"bg-accent-success";case"starting":return"bg-accent-warning";case"stopping":return"bg-accent-warning";case"exited":return"bg-text-muted";default:return"bg-text-muted"}},m=E=>{const C=Qa.getState().logs[E]??[];l(C.map(y=>({content:y.content,stream:y.stream}))),u(E)},b=E=>{r&&i(E,r)};return o.jsxs("div",{className:"mt-2 pt-3 border-t border-border space-y-3",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full flex-shrink-0 bg-accent-primary"}),o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Background"}),o.jsxs("span",{className:"text-xs text-text-muted",children:["(",p," running)"]})]})}),o.jsx("div",{className:"space-y-2",children:d.map(E=>o.jsx("div",{className:"border border-border rounded p-2",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[o.jsx("span",{className:`inline-block w-2 h-2 rounded-full flex-shrink-0 ${g(E.status)}`}),o.jsx("span",{className:"text-sm text-text-primary truncate",title:E.name,children:E.name}),o.jsxs("span",{className:"text-xs text-text-muted",children:["[",E.status,"]"]})]}),o.jsxs("div",{className:"flex gap-1 ml-2",children:[o.jsx("button",{onClick:()=>m(E.id),className:"px-2 py-1 text-xs rounded bg-bg-tertiary hover:bg-border text-text-secondary transition-colors",title:"View logs",children:"Logs"}),o.jsx("button",{onClick:()=>b(E.id),className:"px-2 py-1 text-xs rounded bg-bg-tertiary hover:bg-accent-error/20 text-text-secondary hover:text-accent-error transition-colors",title:"Stop process",children:"Stop"})]})]})},E.id))}),c&&o.jsx(e2,{isOpen:!!c,onClose:()=>{u(null),l([])},processName:((_=d.find(E=>E.id===c))==null?void 0:_.name)??"",logs:f})]})});function av({summary:e,messages:r,workdir:s}){const[i,c]=P.useState(!1),u=kC(r),{branch:f}=EC(s),l=Lt(p=>p.version),d=Ce(p=>p.currentSession);return o.jsxs("div",{className:"flex flex-col h-full",children:[u&&o.jsxs("div",{className:"mb-4",children:[o.jsx("button",{onClick:()=>c(!0),className:"w-full flex items-center justify-center px-3 py-2 rounded bg-bg-tertiary hover:bg-bg-secondary transition-colors",title:"View detailed response and call-level stats",children:o.jsxs("div",{className:"flex items-center gap-2 text-sm text-text-muted",children:[o.jsx("span",{className:"text-text-secondary",children:jC(u.aiTime)}),o.jsx("span",{className:"w-px h-3 bg-border"}),o.jsx("span",{className:"text-text-secondary",children:Jx(u.avgPrefillSpeed)}),o.jsx("span",{children:"pp"}),o.jsx("span",{className:"w-px h-3 bg-border"}),o.jsx("span",{className:"text-text-secondary",children:Jx(u.avgGenerationSpeed)}),o.jsx("span",{children:"tg"})]})}),o.jsx(FC,{isOpen:i,onClose:()=>c(!1),stats:u})]}),o.jsxs("div",{className:"flex flex-col flex-1 overflow-y-auto",children:[o.jsx("div",{className:"flex items-center justify-between mb-2",children:o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Summary"})}),e?o.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:e}):o.jsx("div",{className:"text-text-muted text-sm text-center py-2",children:"No summary yet"}),o.jsxs("div",{className:"mt-4",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-primary mb-2",children:"Progress"}),o.jsx(WC,{criteria:(d==null?void 0:d.criteria)??[]})]})]}),f&&o.jsxs("div",{className:"mt-4 flex items-center gap-2 text-sm",children:[o.jsx(hw,{}),o.jsx("span",{className:"truncate text-text-secondary",title:f,children:f})]}),o.jsx(JC,{workdir:s}),o.jsx(t2,{sessionId:d==null?void 0:d.id}),l&&o.jsxs("div",{className:"mt-4 pt-4 border-t border-border text-center text-xs text-text-muted",children:[o.jsx("a",{href:"https://github.com/co-l/openfox",target:"_blank",rel:"noopener noreferrer",className:"hover:text-accent-primary transition-colors",children:"OpenFox"})," - ",o.jsxs("span",{children:["v",l]})]})]})}function n2({children:e,criteriaSidebarOpen:r=!0,onCriteriaSidebarToggle:s,messages:i}){const c=Ce(u=>u.currentSession);return o.jsxs("div",{className:"relative h-full overflow-hidden",children:[r&&o.jsx("div",{className:"fixed md:hidden inset-0 bg-secondary/50 z-40",onClick:s}),o.jsxs("div",{className:"flex h-full",children:[o.jsx("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden bg-secondary",children:e}),r?o.jsx("aside",{className:"hidden md:block w-[320px] shrink-0 border-l border-border p-4 overflow-y-auto bg-secondary",children:o.jsx(av,{summary:(c==null?void 0:c.summary)??null,messages:i,workdir:c==null?void 0:c.workdir})}):o.jsx("aside",{className:"hidden md:block w-0 shrink-0 overflow-hidden border-l-0"}),o.jsx("aside",{className:`
86
+ md:hidden
87
+ p-4 overflow-y-auto bg-secondary
88
+ transition-all duration-300 ease-in-out
89
+ fixed right-0 top-[32px] h-[calc(100vh-32px)] z-50
90
+ ${r?"w-[320px] translate-x-0 border-l border-border":"w-[320px] translate-x-full"}
91
+ `,children:o.jsx(av,{summary:(c==null?void 0:c.summary)??null,messages:i,workdir:c==null?void 0:c.workdir})})]})]})}function r2(e,r){return r||e>85?"bg-accent-error":e>60?"bg-accent-warning":"bg-accent-success"}function ay({percent:e,dangerZone:r=!1,size:s="md",className:i=""}){const c=s==="sm"?"w-12":"w-20",u=s==="sm"?"h-1":"h-1.5";return o.jsx("div",{className:`${u} bg-bg-tertiary rounded-full overflow-hidden ${c} ${i}`,children:o.jsx("div",{className:`h-full transition-all duration-300 ${r2(e,r)}`,style:{width:`${Math.min(e,100)}%`}})})}function s2({dangerZone:e,size:r="md"}){return e?o.jsx("span",{className:"text-accent-error animate-pulse text-[10px] font-medium",children:"Low!"}):null}function ov(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function i2(){const e=Ce(m=>m.contextState),r=Ce(m=>m.currentSession),s=Ce(m=>m.compactContext),[i,c]=P.useState(!1);if(!e||!r)return null;const{currentTokens:u,maxTokens:f,compactionCount:l,dangerZone:d}=e,p=Math.round(u/f*100),g=r.isRunning;return o.jsx("div",{className:"flex-shrink-0 px-4 py-1.5 border-b border-border bg-secondary",children:o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx("div",{className:"flex-1"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:ov(p,d),children:[Xl(u)," / ",Xl(f)]}),o.jsxs("span",{className:ov(p,d),children:["(",p,"%)"]}),o.jsx(ay,{percent:p,dangerZone:d}),o.jsx(s2,{dangerZone:d}),l>0&&o.jsxs("span",{className:"text-[10px] text-text-muted bg-bg-tertiary px-1 py-0.5 rounded",children:[l,"x"]})]}),o.jsx("div",{className:"flex-1 flex justify-end",children:o.jsxs("div",{className:"relative",children:[o.jsx("button",{onClick:()=>c(!i),className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"More options",children:o.jsx(Hb,{})}),i&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>c(!1)}),o.jsx("div",{className:"absolute right-0 top-full mt-1.5 z-50 bg-bg-secondary border border-border rounded-lg shadow-xl py-1 min-w-[160px]",children:o.jsx("button",{onClick:()=>{g||s(),c(!1)},disabled:g,className:"w-full px-3 py-1.5 text-left text-sm hover:bg-bg-tertiary transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:g?"Cannot compact while running":"Compact context",children:o.jsx("span",{className:d?"text-accent-error":"",children:"Compact"})})})]})]})})]})})}function lv(e){const r=[],s=String(e||"");let i=s.indexOf(","),c=0,u=!1;for(;!u;){i===-1&&(i=s.length,u=!0);const f=s.slice(c,i).trim();(f||!u)&&r.push(f),c=i+1,i=s.indexOf(",",c)}return r}function a2(e,r){const s={};return(e[e.length-1]===""?[...e,""]:e).join((s.padRight?" ":"")+","+(s.padLeft===!1?"":" ")).trim()}const o2=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,l2=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,c2={};function cv(e,r){return(c2.jsx?l2:o2).test(e)}const u2=/[ \t\n\f\r]/g;function d2(e){return typeof e=="object"?e.type==="text"?uv(e.value):!1:uv(e)}function uv(e){return e.replace(u2,"")===""}class xo{constructor(r,s,i){this.normal=s,this.property=r,i&&(this.space=i)}}xo.prototype.normal={};xo.prototype.property={};xo.prototype.space=void 0;function oy(e,r){const s={},i={};for(const c of e)Object.assign(s,c.property),Object.assign(i,c.normal);return new xo(s,i,r)}function oo(e){return e.toLowerCase()}class An{constructor(r,s){this.attribute=s,this.property=r}}An.prototype.attribute="";An.prototype.booleanish=!1;An.prototype.boolean=!1;An.prototype.commaOrSpaceSeparated=!1;An.prototype.commaSeparated=!1;An.prototype.defined=!1;An.prototype.mustUseProperty=!1;An.prototype.number=!1;An.prototype.overloadedBoolean=!1;An.prototype.property="";An.prototype.spaceSeparated=!1;An.prototype.space=void 0;let h2=0;const Ze=qs(),Gt=qs(),xh=qs(),Se=qs(),wt=qs(),Fi=qs(),Hn=qs();function qs(){return 2**++h2}const vh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ze,booleanish:Gt,commaOrSpaceSeparated:Hn,commaSeparated:Fi,number:Se,overloadedBoolean:xh,spaceSeparated:wt},Symbol.toStringTag,{value:"Module"})),Gd=Object.keys(vh);class qh extends An{constructor(r,s,i,c){let u=-1;if(super(r,s),dv(this,"space",c),typeof i=="number")for(;++u<Gd.length;){const f=Gd[u];dv(this,Gd[u],(i&vh[f])===vh[f])}}}qh.prototype.defined=!0;function dv(e,r,s){s&&(e[r]=s)}function Wi(e){const r={},s={};for(const[i,c]of Object.entries(e.properties)){const u=new qh(i,e.transform(e.attributes||{},i),c,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(u.mustUseProperty=!0),r[i]=u,s[oo(i)]=i,s[oo(u.attribute)]=i}return new xo(r,s,e.space)}const ly=Wi({properties:{ariaActiveDescendant:null,ariaAtomic:Gt,ariaAutoComplete:null,ariaBusy:Gt,ariaChecked:Gt,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:wt,ariaCurrent:null,ariaDescribedBy:wt,ariaDetails:null,ariaDisabled:Gt,ariaDropEffect:wt,ariaErrorMessage:null,ariaExpanded:Gt,ariaFlowTo:wt,ariaGrabbed:Gt,ariaHasPopup:null,ariaHidden:Gt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:wt,ariaLevel:Se,ariaLive:null,ariaModal:Gt,ariaMultiLine:Gt,ariaMultiSelectable:Gt,ariaOrientation:null,ariaOwns:wt,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:Gt,ariaReadOnly:Gt,ariaRelevant:null,ariaRequired:Gt,ariaRoleDescription:wt,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:Gt,ariaSetSize:Se,ariaSort:null,ariaValueMax:Se,ariaValueMin:Se,ariaValueNow:Se,ariaValueText:null,role:null},transform(e,r){return r==="role"?r:"aria-"+r.slice(4).toLowerCase()}});function cy(e,r){return r in e?e[r]:r}function uy(e,r){return cy(e,r.toLowerCase())}const f2=Wi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Fi,acceptCharset:wt,accessKey:wt,action:null,allow:null,allowFullScreen:Ze,allowPaymentRequest:Ze,allowUserMedia:Ze,alt:null,as:null,async:Ze,autoCapitalize:null,autoComplete:wt,autoFocus:Ze,autoPlay:Ze,blocking:wt,capture:null,charSet:null,checked:Ze,cite:null,className:wt,cols:Se,colSpan:null,content:null,contentEditable:Gt,controls:Ze,controlsList:wt,coords:Se|Fi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ze,defer:Ze,dir:null,dirName:null,disabled:Ze,download:xh,draggable:Gt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ze,formTarget:null,headers:wt,height:Se,hidden:xh,high:Se,href:null,hrefLang:null,htmlFor:wt,httpEquiv:wt,id:null,imageSizes:null,imageSrcSet:null,inert:Ze,inputMode:null,integrity:null,is:null,isMap:Ze,itemId:null,itemProp:wt,itemRef:wt,itemScope:Ze,itemType:wt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ze,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:Ze,muted:Ze,name:null,nonce:null,noModule:Ze,noValidate:Ze,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ze,optimum:Se,pattern:null,ping:wt,placeholder:null,playsInline:Ze,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ze,referrerPolicy:null,rel:wt,required:Ze,reversed:Ze,rows:Se,rowSpan:Se,sandbox:wt,scope:null,scoped:Ze,seamless:Ze,selected:Ze,shadowRootClonable:Ze,shadowRootDelegatesFocus:Ze,shadowRootMode:null,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:Gt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Se,step:null,style:null,tabIndex:Se,target:null,title:null,translate:null,type:null,typeMustMatch:Ze,useMap:null,value:Gt,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:wt,axis:null,background:null,bgColor:null,border:Se,borderColor:null,bottomMargin:Se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ze,declare:Ze,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:Ze,noHref:Ze,noShade:Ze,noWrap:Ze,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:Gt,standby:null,summary:null,text:null,topMargin:Se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Se,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ze,disableRemotePlayback:Ze,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:uy}),p2=Wi({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Hn,accentHeight:Se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Se,amplitude:Se,arabicForm:null,ascent:Se,attributeName:null,attributeType:null,azimuth:Se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Se,by:null,calcMode:null,capHeight:Se,className:wt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Se,diffuseConstant:Se,direction:null,display:null,dur:null,divisor:Se,dominantBaseline:null,download:Ze,dx:null,dy:null,edgeMode:null,editable:null,elevation:Se,enableBackground:null,end:null,event:null,exponent:Se,externalResourcesRequired:null,fill:null,fillOpacity:Se,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Fi,g2:Fi,glyphName:Fi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Se,horizOriginX:Se,horizOriginY:Se,id:null,ideographic:Se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Se,k:Se,k1:Se,k2:Se,k3:Se,k4:Se,kernelMatrix:Hn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Se,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Se,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Se,overlineThickness:Se,paintOrder:null,panose1:null,path:null,pathLength:Se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:wt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Hn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Hn,rev:Hn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Hn,requiredFeatures:Hn,requiredFonts:Hn,requiredFormats:Hn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Se,specularExponent:Se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Se,strikethroughThickness:Se,string:null,stroke:null,strokeDashArray:Hn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Se,strokeOpacity:Se,strokeWidth:null,style:null,surfaceScale:Se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Hn,tabIndex:Se,tableValues:null,target:null,targetX:Se,targetY:Se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Hn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Se,underlineThickness:Se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Se,values:null,vAlphabetic:Se,vMathematical:Se,vectorEffect:null,vHanging:Se,vIdeographic:Se,version:null,vertAdvY:Se,vertOriginX:Se,vertOriginY:Se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:cy}),dy=Wi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,r){return"xlink:"+r.slice(5).toLowerCase()}}),hy=Wi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:uy}),fy=Wi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,r){return"xml:"+r.slice(3).toLowerCase()}}),m2={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},g2=/[A-Z]/g,hv=/-[a-z]/g,x2=/^data[-\w.:]+$/i;function py(e,r){const s=oo(r);let i=r,c=An;if(s in e.normal)return e.property[e.normal[s]];if(s.length>4&&s.slice(0,4)==="data"&&x2.test(r)){if(r.charAt(4)==="-"){const u=r.slice(5).replace(hv,b2);i="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=r.slice(4);if(!hv.test(u)){let f=u.replace(g2,v2);f.charAt(0)!=="-"&&(f="-"+f),r="data"+f}}c=qh}return new c(i,r)}function v2(e){return"-"+e.toLowerCase()}function b2(e){return e.charAt(1).toUpperCase()}const my=oy([ly,f2,dy,hy,fy],"html"),fc=oy([ly,p2,dy,hy,fy],"svg");function fv(e){const r=String(e||"").trim();return r?r.split(/[ \t\n\r\f]+/g):[]}function y2(e){return e.join(" ").trim()}var Ri={},Kd,pv;function _2(){if(pv)return Kd;pv=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,s=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,c=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,f=/^[;\s]*/,l=/^\s+|\s+$/g,d=`
92
+ `,p="/",g="*",m="",b="comment",_="declaration";function E(y,v){if(typeof y!="string")throw new TypeError("First argument must be a string");if(!y)return[];v=v||{};var x=1,S=1;function j(I){var $=I.match(r);$&&(x+=$.length);var B=I.lastIndexOf(d);S=~B?I.length-B:S+I.length}function T(){var I={line:x,column:S};return function($){return $.position=new N(I),z(),$}}function N(I){this.start=I,this.end={line:x,column:S},this.source=v.source}N.prototype.content=y;function D(I){var $=new Error(v.source+":"+x+":"+S+": "+I);if($.reason=I,$.filename=v.source,$.line=x,$.column=S,$.source=y,!v.silent)throw $}function A(I){var $=I.exec(y);if($){var B=$[0];return j(B),y=y.slice(B.length),$}}function z(){A(s)}function O(I){var $;for(I=I||[];$=q();)$!==!1&&I.push($);return I}function q(){var I=T();if(!(p!=y.charAt(0)||g!=y.charAt(1))){for(var $=2;m!=y.charAt($)&&(g!=y.charAt($)||p!=y.charAt($+1));)++$;if($+=2,m===y.charAt($-1))return D("End of comment missing");var B=y.slice(2,$-2);return S+=2,j(B),y=y.slice($),S+=2,I({type:b,comment:B})}}function G(){var I=T(),$=A(i);if($){if(q(),!A(c))return D("property missing ':'");var B=A(u),X=I({type:_,property:C($[0].replace(e,m)),value:B?C(B[0].replace(e,m)):m});return A(f),X}}function W(){var I=[];O(I);for(var $;$=G();)$!==!1&&(I.push($),O(I));return I}return z(),W()}function C(y){return y?y.replace(l,m):m}return Kd=E,Kd}var mv;function S2(){if(mv)return Ri;mv=1;var e=Ri&&Ri.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Ri,"__esModule",{value:!0}),Ri.default=s;const r=e(_2());function s(i,c){let u=null;if(!i||typeof i!="string")return u;const f=(0,r.default)(i),l=typeof c=="function";return f.forEach(d=>{if(d.type!=="declaration")return;const{property:p,value:g}=d;l?c(p,g,d):g&&(u=u||{},u[p]=g)}),u}return Ri}var qa={},gv;function w2(){if(gv)return qa;gv=1,Object.defineProperty(qa,"__esModule",{value:!0}),qa.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,s=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,c=/^-(ms)-/,u=function(p){return!p||s.test(p)||e.test(p)},f=function(p,g){return g.toUpperCase()},l=function(p,g){return"".concat(g,"-")},d=function(p,g){return g===void 0&&(g={}),u(p)?p:(p=p.toLowerCase(),g.reactCompat?p=p.replace(c,l):p=p.replace(i,l),p.replace(r,f))};return qa.camelCase=d,qa}var Wa,xv;function C2(){if(xv)return Wa;xv=1;var e=Wa&&Wa.__importDefault||function(c){return c&&c.__esModule?c:{default:c}},r=e(S2()),s=w2();function i(c,u){var f={};return!c||typeof c!="string"||(0,r.default)(c,function(l,d){l&&d&&(f[(0,s.camelCase)(l,u)]=d)}),f}return i.default=i,Wa=i,Wa}var k2=C2();const E2=sc(k2),gy=xy("end"),Wh=xy("start");function xy(e){return r;function r(s){const i=s&&s.position&&s.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function j2(e){const r=Wh(e),s=gy(e);if(r&&s)return{start:r,end:s}}function eo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?vv(e.position):"start"in e||"end"in e?vv(e):"line"in e||"column"in e?bh(e):""}function bh(e){return bv(e&&e.line)+":"+bv(e&&e.column)}function vv(e){return bh(e&&e.start)+"-"+bh(e&&e.end)}function bv(e){return e&&typeof e=="number"?e:1}class xn extends Error{constructor(r,s,i){super(),typeof s=="string"&&(i=s,s=void 0);let c="",u={},f=!1;if(s&&("line"in s&&"column"in s?u={place:s}:"start"in s&&"end"in s?u={place:s}:"type"in s?u={ancestors:[s],place:s.position}:u={...s}),typeof r=="string"?c=r:!u.cause&&r&&(f=!0,c=r.message,u.cause=r),!u.ruleId&&!u.source&&typeof i=="string"){const d=i.indexOf(":");d===-1?u.ruleId=i:(u.source=i.slice(0,d),u.ruleId=i.slice(d+1))}if(!u.place&&u.ancestors&&u.ancestors){const d=u.ancestors[u.ancestors.length-1];d&&(u.place=d.position)}const l=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=c,this.line=l?l.line:void 0,this.name=eo(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=f&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}xn.prototype.file="";xn.prototype.name="";xn.prototype.reason="";xn.prototype.message="";xn.prototype.stack="";xn.prototype.column=void 0;xn.prototype.line=void 0;xn.prototype.ancestors=void 0;xn.prototype.cause=void 0;xn.prototype.fatal=void 0;xn.prototype.place=void 0;xn.prototype.ruleId=void 0;xn.prototype.source=void 0;const Vh={}.hasOwnProperty,N2=new Map,T2=/[A-Z]/g,A2=new Set(["table","tbody","thead","tfoot","tr"]),D2=new Set(["td","th"]),vy="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function L2(e,r){if(!r||r.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const s=r.filePath||void 0;let i;if(r.development){if(typeof r.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=P2(s,r.jsxDEV)}else{if(typeof r.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof r.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=H2(s,r.jsx,r.jsxs)}const c={Fragment:r.Fragment,ancestors:[],components:r.components||{},create:i,elementAttributeNameCase:r.elementAttributeNameCase||"react",evaluater:r.createEvaluater?r.createEvaluater():void 0,filePath:s,ignoreInvalidStyle:r.ignoreInvalidStyle||!1,passKeys:r.passKeys!==!1,passNode:r.passNode||!1,schema:r.space==="svg"?fc:my,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},u=by(c,e,void 0);return u&&typeof u!="string"?u:c.create(e,c.Fragment,{children:u||void 0},void 0)}function by(e,r,s){if(r.type==="element")return R2(e,r,s);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return O2(e,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return I2(e,r,s);if(r.type==="mdxjsEsm")return M2(e,r);if(r.type==="root")return B2(e,r,s);if(r.type==="text")return z2(e,r)}function R2(e,r,s){const i=e.schema;let c=i;r.tagName.toLowerCase()==="svg"&&i.space==="html"&&(c=fc,e.schema=c),e.ancestors.push(r);const u=_y(e,r.tagName,!1),f=F2(e,r);let l=Kh(e,r);return A2.has(r.tagName)&&(l=l.filter(function(d){return typeof d=="string"?!d2(d):!0})),yy(e,f,u,r),Gh(f,l),e.ancestors.pop(),e.schema=i,e.create(r,u,f,s)}function O2(e,r){if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}lo(e,r.position)}function M2(e,r){if(r.data&&r.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(r.data.estree);lo(e,r.position)}function I2(e,r,s){const i=e.schema;let c=i;r.name==="svg"&&i.space==="html"&&(c=fc,e.schema=c),e.ancestors.push(r);const u=r.name===null?e.Fragment:_y(e,r.name,!0),f=U2(e,r),l=Kh(e,r);return yy(e,f,u,r),Gh(f,l),e.ancestors.pop(),e.schema=i,e.create(r,u,f,s)}function B2(e,r,s){const i={};return Gh(i,Kh(e,r)),e.create(r,e.Fragment,i,s)}function z2(e,r){return r.value}function yy(e,r,s,i){typeof s!="string"&&s!==e.Fragment&&e.passNode&&(r.node=i)}function Gh(e,r){if(r.length>0){const s=r.length>1?r:r[0];s&&(e.children=s)}}function H2(e,r,s){return i;function i(c,u,f,l){const p=Array.isArray(f.children)?s:r;return l?p(u,f,l):p(u,f)}}function P2(e,r){return s;function s(i,c,u,f){const l=Array.isArray(u.children),d=Wh(i);return r(c,u,f,l,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function F2(e,r){const s={};let i,c;for(c in r.properties)if(c!=="children"&&Vh.call(r.properties,c)){const u=$2(e,c,r.properties[c]);if(u){const[f,l]=u;e.tableCellAlignToStyle&&f==="align"&&typeof l=="string"&&D2.has(r.tagName)?i=l:s[f]=l}}if(i){const u=s.style||(s.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return s}function U2(e,r){const s={};for(const i of r.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const u=i.data.estree.body[0];u.type;const f=u.expression;f.type;const l=f.properties[0];l.type,Object.assign(s,e.evaluater.evaluateExpression(l.argument))}else lo(e,r.position);else{const c=i.name;let u;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const l=i.value.data.estree.body[0];l.type,u=e.evaluater.evaluateExpression(l.expression)}else lo(e,r.position);else u=i.value===null?!0:i.value;s[c]=u}return s}function Kh(e,r){const s=[];let i=-1;const c=e.passKeys?new Map:N2;for(;++i<r.children.length;){const u=r.children[i];let f;if(e.passKeys){const d=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(d){const p=c.get(d)||0;f=d+"-"+p,c.set(d,p+1)}}const l=by(e,u,f);l!==void 0&&s.push(l)}return s}function $2(e,r,s){const i=py(e.schema,r);if(!(s==null||typeof s=="number"&&Number.isNaN(s))){if(Array.isArray(s)&&(s=i.commaSeparated?a2(s):y2(s)),i.property==="style"){let c=typeof s=="object"?s:q2(e,String(s));return e.stylePropertyNameCase==="css"&&(c=W2(c)),["style",c]}return[e.elementAttributeNameCase==="react"&&i.space?m2[i.property]||i.property:i.attribute,s]}}function q2(e,r){try{return E2(r,{reactCompat:!0})}catch(s){if(e.ignoreInvalidStyle)return{};const i=s,c=new xn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=e.filePath||void 0,c.url=vy+"#cannot-parse-style-attribute",c}}function _y(e,r,s){let i;if(!s)i={type:"Literal",value:r};else if(r.includes(".")){const c=r.split(".");let u=-1,f;for(;++u<c.length;){const l=cv(c[u])?{type:"Identifier",name:c[u]}:{type:"Literal",value:c[u]};f=f?{type:"MemberExpression",object:f,property:l,computed:!!(u&&l.type==="Literal"),optional:!1}:l}i=f}else i=cv(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(i.type==="Literal"){const c=i.value;return Vh.call(e.components,c)?e.components[c]:c}if(e.evaluater)return e.evaluater.evaluateExpression(i);lo(e)}function lo(e,r){const s=new xn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:r,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=vy+"#cannot-handle-mdx-estrees-without-createevaluater",s}function W2(e){const r={};let s;for(s in e)Vh.call(e,s)&&(r[V2(s)]=e[s]);return r}function V2(e){let r=e.replace(T2,G2);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function G2(e){return"-"+e.toLowerCase()}const Yd={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},K2={};function Yh(e,r){const s=K2,i=typeof s.includeImageAlt=="boolean"?s.includeImageAlt:!0,c=typeof s.includeHtml=="boolean"?s.includeHtml:!0;return Sy(e,i,c)}function Sy(e,r,s){if(Y2(e)){if("value"in e)return e.type==="html"&&!s?"":e.value;if(r&&"alt"in e&&e.alt)return e.alt;if("children"in e)return yv(e.children,r,s)}return Array.isArray(e)?yv(e,r,s):""}function yv(e,r,s){const i=[];let c=-1;for(;++c<e.length;)i[c]=Sy(e[c],r,s);return i.join("")}function Y2(e){return!!(e&&typeof e=="object")}const _v=document.createElement("i");function co(e){const r="&"+e+";";_v.innerHTML=r;const s=_v.textContent;return s.charCodeAt(s.length-1)===59&&e!=="semi"||s===r?!1:s}function Fn(e,r,s,i){const c=e.length;let u=0,f;if(r<0?r=-r>c?0:c+r:r=r>c?c:r,s=s>0?s:0,i.length<1e4)f=Array.from(i),f.unshift(r,s),e.splice(...f);else for(s&&e.splice(r,s);u<i.length;)f=i.slice(u,u+1e4),f.unshift(r,0),e.splice(...f),u+=1e4,r+=1e4}function er(e,r){return e.length>0?(Fn(e,e.length,0,r),e):r}const Sv={}.hasOwnProperty;function wy(e){const r={};let s=-1;for(;++s<e.length;)X2(r,e[s]);return r}function X2(e,r){let s;for(s in r){const c=(Sv.call(e,s)?e[s]:void 0)||(e[s]={}),u=r[s];let f;if(u)for(f in u){Sv.call(c,f)||(c[f]=[]);const l=u[f];Z2(c[f],Array.isArray(l)?l:l?[l]:[])}}}function Z2(e,r){let s=-1;const i=[];for(;++s<r.length;)(r[s].add==="after"?e:i).push(r[s]);Fn(e,0,0,i)}function Cy(e,r){const s=Number.parseInt(e,r);return s<9||s===11||s>13&&s<32||s>126&&s<160||s>55295&&s<57344||s>64975&&s<65008||(s&65535)===65535||(s&65535)===65534||s>1114111?"�":String.fromCodePoint(s)}function ar(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const bn=xs(/[A-Za-z]/),gn=xs(/[\dA-Za-z]/),Q2=xs(/[#-'*+\--9=?A-Z^-~]/);function Ql(e){return e!==null&&(e<32||e===127)}const yh=xs(/\d/),J2=xs(/[\dA-Fa-f]/),ek=xs(/[!-/:-@[-`{-~]/);function He(e){return e!==null&&e<-2}function _t(e){return e!==null&&(e<0||e===32)}function tt(e){return e===-2||e===-1||e===32}const pc=xs(new RegExp("\\p{P}|\\p{S}","u")),$s=xs(/\s/);function xs(e){return r;function r(s){return s!==null&&s>-1&&e.test(String.fromCharCode(s))}}function Vi(e){const r=[];let s=-1,i=0,c=0;for(;++s<e.length;){const u=e.charCodeAt(s);let f="";if(u===37&&gn(e.charCodeAt(s+1))&&gn(e.charCodeAt(s+2)))c=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(f=String.fromCharCode(u));else if(u>55295&&u<57344){const l=e.charCodeAt(s+1);u<56320&&l>56319&&l<57344?(f=String.fromCharCode(u,l),c=1):f="�"}else f=String.fromCharCode(u);f&&(r.push(e.slice(i,s),encodeURIComponent(f)),i=s+c+1,f=""),c&&(s+=c,c=0)}return r.join("")+e.slice(i)}function at(e,r,s,i){const c=i?i-1:Number.POSITIVE_INFINITY;let u=0;return f;function f(d){return tt(d)?(e.enter(s),l(d)):r(d)}function l(d){return tt(d)&&u++<c?(e.consume(d),l):(e.exit(s),r(d))}}const tk={tokenize:nk};function nk(e){const r=e.attempt(this.parser.constructs.contentInitial,i,c);let s;return r;function i(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),at(e,r,"linePrefix")}function c(l){return e.enter("paragraph"),u(l)}function u(l){const d=e.enter("chunkText",{contentType:"text",previous:s});return s&&(s.next=d),s=d,f(l)}function f(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return He(l)?(e.consume(l),e.exit("chunkText"),u):(e.consume(l),f)}}const rk={tokenize:sk},wv={tokenize:ik};function sk(e){const r=this,s=[];let i=0,c,u,f;return l;function l(S){if(i<s.length){const j=s[i];return r.containerState=j[1],e.attempt(j[0].continuation,d,p)(S)}return p(S)}function d(S){if(i++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,c&&x();const j=r.events.length;let T=j,N;for(;T--;)if(r.events[T][0]==="exit"&&r.events[T][1].type==="chunkFlow"){N=r.events[T][1].end;break}v(i);let D=j;for(;D<r.events.length;)r.events[D][1].end={...N},D++;return Fn(r.events,T+1,0,r.events.slice(j)),r.events.length=D,p(S)}return l(S)}function p(S){if(i===s.length){if(!c)return b(S);if(c.currentConstruct&&c.currentConstruct.concrete)return E(S);r.interrupt=!!(c.currentConstruct&&!c._gfmTableDynamicInterruptHack)}return r.containerState={},e.check(wv,g,m)(S)}function g(S){return c&&x(),v(i),b(S)}function m(S){return r.parser.lazy[r.now().line]=i!==s.length,f=r.now().offset,E(S)}function b(S){return r.containerState={},e.attempt(wv,_,E)(S)}function _(S){return i++,s.push([r.currentConstruct,r.containerState]),b(S)}function E(S){if(S===null){c&&x(),v(0),e.consume(S);return}return c=c||r.parser.flow(r.now()),e.enter("chunkFlow",{_tokenizer:c,contentType:"flow",previous:u}),C(S)}function C(S){if(S===null){y(e.exit("chunkFlow"),!0),v(0),e.consume(S);return}return He(S)?(e.consume(S),y(e.exit("chunkFlow")),i=0,r.interrupt=void 0,l):(e.consume(S),C)}function y(S,j){const T=r.sliceStream(S);if(j&&T.push(null),S.previous=u,u&&(u.next=S),u=S,c.defineSkip(S.start),c.write(T),r.parser.lazy[S.start.line]){let N=c.events.length;for(;N--;)if(c.events[N][1].start.offset<f&&(!c.events[N][1].end||c.events[N][1].end.offset>f))return;const D=r.events.length;let A=D,z,O;for(;A--;)if(r.events[A][0]==="exit"&&r.events[A][1].type==="chunkFlow"){if(z){O=r.events[A][1].end;break}z=!0}for(v(i),N=D;N<r.events.length;)r.events[N][1].end={...O},N++;Fn(r.events,A+1,0,r.events.slice(D)),r.events.length=N}}function v(S){let j=s.length;for(;j-- >S;){const T=s[j];r.containerState=T[1],T[0].exit.call(r,e)}s.length=S}function x(){c.write([null]),u=void 0,c=void 0,r.containerState._closeFlow=void 0}}function ik(e,r,s){return at(e,e.attempt(this.parser.constructs.document,r,s),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function $i(e){if(e===null||_t(e)||$s(e))return 1;if(pc(e))return 2}function mc(e,r,s){const i=[];let c=-1;for(;++c<e.length;){const u=e[c].resolveAll;u&&!i.includes(u)&&(r=u(r,s),i.push(u))}return r}const _h={name:"attention",resolveAll:ak,tokenize:ok};function ak(e,r){let s=-1,i,c,u,f,l,d,p,g;for(;++s<e.length;)if(e[s][0]==="enter"&&e[s][1].type==="attentionSequence"&&e[s][1]._close){for(i=s;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&r.sliceSerialize(e[i][1]).charCodeAt(0)===r.sliceSerialize(e[s][1]).charCodeAt(0)){if((e[i][1]._close||e[s][1]._open)&&(e[s][1].end.offset-e[s][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[s][1].end.offset-e[s][1].start.offset)%3))continue;d=e[i][1].end.offset-e[i][1].start.offset>1&&e[s][1].end.offset-e[s][1].start.offset>1?2:1;const m={...e[i][1].end},b={...e[s][1].start};Cv(m,-d),Cv(b,d),f={type:d>1?"strongSequence":"emphasisSequence",start:m,end:{...e[i][1].end}},l={type:d>1?"strongSequence":"emphasisSequence",start:{...e[s][1].start},end:b},u={type:d>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[s][1].start}},c={type:d>1?"strong":"emphasis",start:{...f.start},end:{...l.end}},e[i][1].end={...f.start},e[s][1].start={...l.end},p=[],e[i][1].end.offset-e[i][1].start.offset&&(p=er(p,[["enter",e[i][1],r],["exit",e[i][1],r]])),p=er(p,[["enter",c,r],["enter",f,r],["exit",f,r],["enter",u,r]]),p=er(p,mc(r.parser.constructs.insideSpan.null,e.slice(i+1,s),r)),p=er(p,[["exit",u,r],["enter",l,r],["exit",l,r],["exit",c,r]]),e[s][1].end.offset-e[s][1].start.offset?(g=2,p=er(p,[["enter",e[s][1],r],["exit",e[s][1],r]])):g=0,Fn(e,i-1,s-i+3,p),s=i+p.length-g-2;break}}for(s=-1;++s<e.length;)e[s][1].type==="attentionSequence"&&(e[s][1].type="data");return e}function ok(e,r){const s=this.parser.constructs.attentionMarkers.null,i=this.previous,c=$i(i);let u;return f;function f(d){return u=d,e.enter("attentionSequence"),l(d)}function l(d){if(d===u)return e.consume(d),l;const p=e.exit("attentionSequence"),g=$i(d),m=!g||g===2&&c||s.includes(d),b=!c||c===2&&g||s.includes(i);return p._open=!!(u===42?m:m&&(c||!b)),p._close=!!(u===42?b:b&&(g||!m)),r(d)}}function Cv(e,r){e.column+=r,e.offset+=r,e._bufferIndex+=r}const lk={name:"autolink",tokenize:ck};function ck(e,r,s){let i=0;return c;function c(_){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(_){return bn(_)?(e.consume(_),f):_===64?s(_):p(_)}function f(_){return _===43||_===45||_===46||gn(_)?(i=1,l(_)):p(_)}function l(_){return _===58?(e.consume(_),i=0,d):(_===43||_===45||_===46||gn(_))&&i++<32?(e.consume(_),l):(i=0,p(_))}function d(_){return _===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.exit("autolink"),r):_===null||_===32||_===60||Ql(_)?s(_):(e.consume(_),d)}function p(_){return _===64?(e.consume(_),g):Q2(_)?(e.consume(_),p):s(_)}function g(_){return gn(_)?m(_):s(_)}function m(_){return _===46?(e.consume(_),i=0,g):_===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.exit("autolink"),r):b(_)}function b(_){if((_===45||gn(_))&&i++<63){const E=_===45?b:m;return e.consume(_),E}return s(_)}}const vo={partial:!0,tokenize:uk};function uk(e,r,s){return i;function i(u){return tt(u)?at(e,c,"linePrefix")(u):c(u)}function c(u){return u===null||He(u)?r(u):s(u)}}const ky={continuation:{tokenize:hk},exit:fk,name:"blockQuote",tokenize:dk};function dk(e,r,s){const i=this;return c;function c(f){if(f===62){const l=i.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(f),e.exit("blockQuoteMarker"),u}return s(f)}function u(f){return tt(f)?(e.enter("blockQuotePrefixWhitespace"),e.consume(f),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),r):(e.exit("blockQuotePrefix"),r(f))}}function hk(e,r,s){const i=this;return c;function c(f){return tt(f)?at(e,u,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f):u(f)}function u(f){return e.attempt(ky,r,s)(f)}}function fk(e){e.exit("blockQuote")}const Ey={name:"characterEscape",tokenize:pk};function pk(e,r,s){return i;function i(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),c}function c(u){return ek(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),r):s(u)}}const jy={name:"characterReference",tokenize:mk};function mk(e,r,s){const i=this;let c=0,u,f;return l;function l(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),d}function d(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),u=31,f=gn,g(m))}function p(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,f=J2,g):(e.enter("characterReferenceValue"),u=7,f=yh,g(m))}function g(m){if(m===59&&c){const b=e.exit("characterReferenceValue");return f===gn&&!co(i.sliceSerialize(b))?s(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),r)}return f(m)&&c++<u?(e.consume(m),g):s(m)}}const kv={partial:!0,tokenize:xk},Ev={concrete:!0,name:"codeFenced",tokenize:gk};function gk(e,r,s){const i=this,c={partial:!0,tokenize:T};let u=0,f=0,l;return d;function d(N){return p(N)}function p(N){const D=i.events[i.events.length-1];return u=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,l=N,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(N)}function g(N){return N===l?(f++,e.consume(N),g):f<3?s(N):(e.exit("codeFencedFenceSequence"),tt(N)?at(e,m,"whitespace")(N):m(N))}function m(N){return N===null||He(N)?(e.exit("codeFencedFence"),i.interrupt?r(N):e.check(kv,C,j)(N)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(N))}function b(N){return N===null||He(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(N)):tt(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),at(e,_,"whitespace")(N)):N===96&&N===l?s(N):(e.consume(N),b)}function _(N){return N===null||He(N)?m(N):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),E(N))}function E(N){return N===null||He(N)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(N)):N===96&&N===l?s(N):(e.consume(N),E)}function C(N){return e.attempt(c,j,y)(N)}function y(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),v}function v(N){return u>0&&tt(N)?at(e,x,"linePrefix",u+1)(N):x(N)}function x(N){return N===null||He(N)?e.check(kv,C,j)(N):(e.enter("codeFlowValue"),S(N))}function S(N){return N===null||He(N)?(e.exit("codeFlowValue"),x(N)):(e.consume(N),S)}function j(N){return e.exit("codeFenced"),r(N)}function T(N,D,A){let z=0;return O;function O($){return N.enter("lineEnding"),N.consume($),N.exit("lineEnding"),q}function q($){return N.enter("codeFencedFence"),tt($)?at(N,G,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):G($)}function G($){return $===l?(N.enter("codeFencedFenceSequence"),W($)):A($)}function W($){return $===l?(z++,N.consume($),W):z>=f?(N.exit("codeFencedFenceSequence"),tt($)?at(N,I,"whitespace")($):I($)):A($)}function I($){return $===null||He($)?(N.exit("codeFencedFence"),D($)):A($)}}}function xk(e,r,s){const i=this;return c;function c(f){return f===null?s(f):(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),u)}function u(f){return i.parser.lazy[i.now().line]?s(f):r(f)}}const Xd={name:"codeIndented",tokenize:bk},vk={partial:!0,tokenize:yk};function bk(e,r,s){const i=this;return c;function c(p){return e.enter("codeIndented"),at(e,u,"linePrefix",5)(p)}function u(p){const g=i.events[i.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?f(p):s(p)}function f(p){return p===null?d(p):He(p)?e.attempt(vk,f,d)(p):(e.enter("codeFlowValue"),l(p))}function l(p){return p===null||He(p)?(e.exit("codeFlowValue"),f(p)):(e.consume(p),l)}function d(p){return e.exit("codeIndented"),r(p)}}function yk(e,r,s){const i=this;return c;function c(f){return i.parser.lazy[i.now().line]?s(f):He(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):at(e,u,"linePrefix",5)(f)}function u(f){const l=i.events[i.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?r(f):He(f)?c(f):s(f)}}const _k={name:"codeText",previous:wk,resolve:Sk,tokenize:Ck};function Sk(e){let r=e.length-4,s=3,i,c;if((e[s][1].type==="lineEnding"||e[s][1].type==="space")&&(e[r][1].type==="lineEnding"||e[r][1].type==="space")){for(i=s;++i<r;)if(e[i][1].type==="codeTextData"){e[s][1].type="codeTextPadding",e[r][1].type="codeTextPadding",s+=2,r-=2;break}}for(i=s-1,r++;++i<=r;)c===void 0?i!==r&&e[i][1].type!=="lineEnding"&&(c=i):(i===r||e[i][1].type==="lineEnding")&&(e[c][1].type="codeTextData",i!==c+2&&(e[c][1].end=e[i-1][1].end,e.splice(c+2,i-c-2),r-=i-c-2,i=c+2),c=void 0);return e}function wk(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Ck(e,r,s){let i=0,c,u;return f;function f(m){return e.enter("codeText"),e.enter("codeTextSequence"),l(m)}function l(m){return m===96?(e.consume(m),i++,l):(e.exit("codeTextSequence"),d(m))}function d(m){return m===null?s(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),d):m===96?(u=e.enter("codeTextSequence"),c=0,g(m)):He(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("codeTextData"),p(m))}function p(m){return m===null||m===32||m===96||He(m)?(e.exit("codeTextData"),d(m)):(e.consume(m),p)}function g(m){return m===96?(e.consume(m),c++,g):c===i?(e.exit("codeTextSequence"),e.exit("codeText"),r(m)):(u.type="codeTextData",p(m))}}class kk{constructor(r){this.left=r?[...r]:[],this.right=[]}get(r){if(r<0||r>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+r+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return r<this.left.length?this.left[r]:this.right[this.right.length-r+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(r,s){const i=s??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(r,i):r>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-r+this.left.length).reverse():this.left.slice(r).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(r,s,i){const c=s||0;this.setCursor(Math.trunc(r));const u=this.right.splice(this.right.length-c,Number.POSITIVE_INFINITY);return i&&Va(this.left,i),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(r){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(r)}pushMany(r){this.setCursor(Number.POSITIVE_INFINITY),Va(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),Va(this.right,r.reverse())}setCursor(r){if(!(r===this.left.length||r>this.left.length&&this.right.length===0||r<0&&this.left.length===0))if(r<this.left.length){const s=this.left.splice(r,Number.POSITIVE_INFINITY);Va(this.right,s.reverse())}else{const s=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);Va(this.left,s.reverse())}}}function Va(e,r){let s=0;if(r.length<1e4)e.push(...r);else for(;s<r.length;)e.push(...r.slice(s,s+1e4)),s+=1e4}function Ny(e){const r={};let s=-1,i,c,u,f,l,d,p;const g=new kk(e);for(;++s<g.length;){for(;s in r;)s=r[s];if(i=g.get(s),s&&i[1].type==="chunkFlow"&&g.get(s-1)[1].type==="listItemPrefix"&&(d=i[1]._tokenizer.events,u=0,u<d.length&&d[u][1].type==="lineEndingBlank"&&(u+=2),u<d.length&&d[u][1].type==="content"))for(;++u<d.length&&d[u][1].type!=="content";)d[u][1].type==="chunkText"&&(d[u][1]._isInFirstContentOfListItem=!0,u++);if(i[0]==="enter")i[1].contentType&&(Object.assign(r,Ek(g,s)),s=r[s],p=!0);else if(i[1]._container){for(u=s,c=void 0;u--;)if(f=g.get(u),f[1].type==="lineEnding"||f[1].type==="lineEndingBlank")f[0]==="enter"&&(c&&(g.get(c)[1].type="lineEndingBlank"),f[1].type="lineEnding",c=u);else if(!(f[1].type==="linePrefix"||f[1].type==="listItemIndent"))break;c&&(i[1].end={...g.get(c)[1].start},l=g.slice(c,s),l.unshift(i),g.splice(c,s-c+1,l))}}return Fn(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!p}function Ek(e,r){const s=e.get(r)[1],i=e.get(r)[2];let c=r-1;const u=[];let f=s._tokenizer;f||(f=i.parser[s.contentType](s.start),s._contentTypeTextTrailing&&(f._contentTypeTextTrailing=!0));const l=f.events,d=[],p={};let g,m,b=-1,_=s,E=0,C=0;const y=[C];for(;_;){for(;e.get(++c)[1]!==_;);u.push(c),_._tokenizer||(g=i.sliceStream(_),_.next||g.push(null),m&&f.defineSkip(_.start),_._isInFirstContentOfListItem&&(f._gfmTasklistFirstContentOfListItem=!0),f.write(g),_._isInFirstContentOfListItem&&(f._gfmTasklistFirstContentOfListItem=void 0)),m=_,_=_.next}for(_=s;++b<l.length;)l[b][0]==="exit"&&l[b-1][0]==="enter"&&l[b][1].type===l[b-1][1].type&&l[b][1].start.line!==l[b][1].end.line&&(C=b+1,y.push(C),_._tokenizer=void 0,_.previous=void 0,_=_.next);for(f.events=[],_?(_._tokenizer=void 0,_.previous=void 0):y.pop(),b=y.length;b--;){const v=l.slice(y[b],y[b+1]),x=u.pop();d.push([x,x+v.length-1]),e.splice(x,2,v)}for(d.reverse(),b=-1;++b<d.length;)p[E+d[b][0]]=E+d[b][1],E+=d[b][1]-d[b][0]-1;return p}const jk={resolve:Tk,tokenize:Ak},Nk={partial:!0,tokenize:Dk};function Tk(e){return Ny(e),e}function Ak(e,r){let s;return i;function i(l){return e.enter("content"),s=e.enter("chunkContent",{contentType:"content"}),c(l)}function c(l){return l===null?u(l):He(l)?e.check(Nk,f,u)(l):(e.consume(l),c)}function u(l){return e.exit("chunkContent"),e.exit("content"),r(l)}function f(l){return e.consume(l),e.exit("chunkContent"),s.next=e.enter("chunkContent",{contentType:"content",previous:s}),s=s.next,c}}function Dk(e,r,s){const i=this;return c;function c(f){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),at(e,u,"linePrefix")}function u(f){if(f===null||He(f))return s(f);const l=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?r(f):e.interrupt(i.parser.constructs.flow,s,r)(f)}}function Ty(e,r,s,i,c,u,f,l,d){const p=d||Number.POSITIVE_INFINITY;let g=0;return m;function m(v){return v===60?(e.enter(i),e.enter(c),e.enter(u),e.consume(v),e.exit(u),b):v===null||v===32||v===41||Ql(v)?s(v):(e.enter(i),e.enter(f),e.enter(l),e.enter("chunkString",{contentType:"string"}),C(v))}function b(v){return v===62?(e.enter(u),e.consume(v),e.exit(u),e.exit(c),e.exit(i),r):(e.enter(l),e.enter("chunkString",{contentType:"string"}),_(v))}function _(v){return v===62?(e.exit("chunkString"),e.exit(l),b(v)):v===null||v===60||He(v)?s(v):(e.consume(v),v===92?E:_)}function E(v){return v===60||v===62||v===92?(e.consume(v),_):_(v)}function C(v){return!g&&(v===null||v===41||_t(v))?(e.exit("chunkString"),e.exit(l),e.exit(f),e.exit(i),r(v)):g<p&&v===40?(e.consume(v),g++,C):v===41?(e.consume(v),g--,C):v===null||v===32||v===40||Ql(v)?s(v):(e.consume(v),v===92?y:C)}function y(v){return v===40||v===41||v===92?(e.consume(v),C):C(v)}}function Ay(e,r,s,i,c,u){const f=this;let l=0,d;return p;function p(_){return e.enter(i),e.enter(c),e.consume(_),e.exit(c),e.enter(u),g}function g(_){return l>999||_===null||_===91||_===93&&!d||_===94&&!l&&"_hiddenFootnoteSupport"in f.parser.constructs?s(_):_===93?(e.exit(u),e.enter(c),e.consume(_),e.exit(c),e.exit(i),r):He(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),m(_))}function m(_){return _===null||_===91||_===93||He(_)||l++>999?(e.exit("chunkString"),g(_)):(e.consume(_),d||(d=!tt(_)),_===92?b:m)}function b(_){return _===91||_===92||_===93?(e.consume(_),l++,m):m(_)}}function Dy(e,r,s,i,c,u){let f;return l;function l(b){return b===34||b===39||b===40?(e.enter(i),e.enter(c),e.consume(b),e.exit(c),f=b===40?41:b,d):s(b)}function d(b){return b===f?(e.enter(c),e.consume(b),e.exit(c),e.exit(i),r):(e.enter(u),p(b))}function p(b){return b===f?(e.exit(u),d(f)):b===null?s(b):He(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),at(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===f||b===null||He(b)?(e.exit("chunkString"),p(b)):(e.consume(b),b===92?m:g)}function m(b){return b===f||b===92?(e.consume(b),g):g(b)}}function to(e,r){let s;return i;function i(c){return He(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),s=!0,i):tt(c)?at(e,i,s?"linePrefix":"lineSuffix")(c):r(c)}}const Lk={name:"definition",tokenize:Ok},Rk={partial:!0,tokenize:Mk};function Ok(e,r,s){const i=this;let c;return u;function u(_){return e.enter("definition"),f(_)}function f(_){return Ay.call(i,e,l,s,"definitionLabel","definitionLabelMarker","definitionLabelString")(_)}function l(_){return c=ar(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),_===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),d):s(_)}function d(_){return _t(_)?to(e,p)(_):p(_)}function p(_){return Ty(e,g,s,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(_)}function g(_){return e.attempt(Rk,m,m)(_)}function m(_){return tt(_)?at(e,b,"whitespace")(_):b(_)}function b(_){return _===null||He(_)?(e.exit("definition"),i.parser.defined.push(c),r(_)):s(_)}}function Mk(e,r,s){return i;function i(l){return _t(l)?to(e,c)(l):s(l)}function c(l){return Dy(e,u,s,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function u(l){return tt(l)?at(e,f,"whitespace")(l):f(l)}function f(l){return l===null||He(l)?r(l):s(l)}}const Ik={name:"hardBreakEscape",tokenize:Bk};function Bk(e,r,s){return i;function i(u){return e.enter("hardBreakEscape"),e.consume(u),c}function c(u){return He(u)?(e.exit("hardBreakEscape"),r(u)):s(u)}}const zk={name:"headingAtx",resolve:Hk,tokenize:Pk};function Hk(e,r){let s=e.length-2,i=3,c,u;return e[i][1].type==="whitespace"&&(i+=2),s-2>i&&e[s][1].type==="whitespace"&&(s-=2),e[s][1].type==="atxHeadingSequence"&&(i===s-1||s-4>i&&e[s-2][1].type==="whitespace")&&(s-=i+1===s?2:4),s>i&&(c={type:"atxHeadingText",start:e[i][1].start,end:e[s][1].end},u={type:"chunkText",start:e[i][1].start,end:e[s][1].end,contentType:"text"},Fn(e,i,s-i+1,[["enter",c,r],["enter",u,r],["exit",u,r],["exit",c,r]])),e}function Pk(e,r,s){let i=0;return c;function c(g){return e.enter("atxHeading"),u(g)}function u(g){return e.enter("atxHeadingSequence"),f(g)}function f(g){return g===35&&i++<6?(e.consume(g),f):g===null||_t(g)?(e.exit("atxHeadingSequence"),l(g)):s(g)}function l(g){return g===35?(e.enter("atxHeadingSequence"),d(g)):g===null||He(g)?(e.exit("atxHeading"),r(g)):tt(g)?at(e,l,"whitespace")(g):(e.enter("atxHeadingText"),p(g))}function d(g){return g===35?(e.consume(g),d):(e.exit("atxHeadingSequence"),l(g))}function p(g){return g===null||g===35||_t(g)?(e.exit("atxHeadingText"),l(g)):(e.consume(g),p)}}const Fk=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],jv=["pre","script","style","textarea"],Uk={concrete:!0,name:"htmlFlow",resolveTo:Wk,tokenize:Vk},$k={partial:!0,tokenize:Kk},qk={partial:!0,tokenize:Gk};function Wk(e){let r=e.length;for(;r--&&!(e[r][0]==="enter"&&e[r][1].type==="htmlFlow"););return r>1&&e[r-2][1].type==="linePrefix"&&(e[r][1].start=e[r-2][1].start,e[r+1][1].start=e[r-2][1].start,e.splice(r-2,2)),e}function Vk(e,r,s){const i=this;let c,u,f,l,d;return p;function p(U){return g(U)}function g(U){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(U),m}function m(U){return U===33?(e.consume(U),b):U===47?(e.consume(U),u=!0,C):U===63?(e.consume(U),c=3,i.interrupt?r:L):bn(U)?(e.consume(U),f=String.fromCharCode(U),y):s(U)}function b(U){return U===45?(e.consume(U),c=2,_):U===91?(e.consume(U),c=5,l=0,E):bn(U)?(e.consume(U),c=4,i.interrupt?r:L):s(U)}function _(U){return U===45?(e.consume(U),i.interrupt?r:L):s(U)}function E(U){const ne="CDATA[";return U===ne.charCodeAt(l++)?(e.consume(U),l===ne.length?i.interrupt?r:G:E):s(U)}function C(U){return bn(U)?(e.consume(U),f=String.fromCharCode(U),y):s(U)}function y(U){if(U===null||U===47||U===62||_t(U)){const ne=U===47,Q=f.toLowerCase();return!ne&&!u&&jv.includes(Q)?(c=1,i.interrupt?r(U):G(U)):Fk.includes(f.toLowerCase())?(c=6,ne?(e.consume(U),v):i.interrupt?r(U):G(U)):(c=7,i.interrupt&&!i.parser.lazy[i.now().line]?s(U):u?x(U):S(U))}return U===45||gn(U)?(e.consume(U),f+=String.fromCharCode(U),y):s(U)}function v(U){return U===62?(e.consume(U),i.interrupt?r:G):s(U)}function x(U){return tt(U)?(e.consume(U),x):O(U)}function S(U){return U===47?(e.consume(U),O):U===58||U===95||bn(U)?(e.consume(U),j):tt(U)?(e.consume(U),S):O(U)}function j(U){return U===45||U===46||U===58||U===95||gn(U)?(e.consume(U),j):T(U)}function T(U){return U===61?(e.consume(U),N):tt(U)?(e.consume(U),T):S(U)}function N(U){return U===null||U===60||U===61||U===62||U===96?s(U):U===34||U===39?(e.consume(U),d=U,D):tt(U)?(e.consume(U),N):A(U)}function D(U){return U===d?(e.consume(U),d=null,z):U===null||He(U)?s(U):(e.consume(U),D)}function A(U){return U===null||U===34||U===39||U===47||U===60||U===61||U===62||U===96||_t(U)?T(U):(e.consume(U),A)}function z(U){return U===47||U===62||tt(U)?S(U):s(U)}function O(U){return U===62?(e.consume(U),q):s(U)}function q(U){return U===null||He(U)?G(U):tt(U)?(e.consume(U),q):s(U)}function G(U){return U===45&&c===2?(e.consume(U),B):U===60&&c===1?(e.consume(U),X):U===62&&c===4?(e.consume(U),R):U===63&&c===3?(e.consume(U),L):U===93&&c===5?(e.consume(U),H):He(U)&&(c===6||c===7)?(e.exit("htmlFlowData"),e.check($k,F,W)(U)):U===null||He(U)?(e.exit("htmlFlowData"),W(U)):(e.consume(U),G)}function W(U){return e.check(qk,I,F)(U)}function I(U){return e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),$}function $(U){return U===null||He(U)?W(U):(e.enter("htmlFlowData"),G(U))}function B(U){return U===45?(e.consume(U),L):G(U)}function X(U){return U===47?(e.consume(U),f="",Z):G(U)}function Z(U){if(U===62){const ne=f.toLowerCase();return jv.includes(ne)?(e.consume(U),R):G(U)}return bn(U)&&f.length<8?(e.consume(U),f+=String.fromCharCode(U),Z):G(U)}function H(U){return U===93?(e.consume(U),L):G(U)}function L(U){return U===62?(e.consume(U),R):U===45&&c===2?(e.consume(U),L):G(U)}function R(U){return U===null||He(U)?(e.exit("htmlFlowData"),F(U)):(e.consume(U),R)}function F(U){return e.exit("htmlFlow"),r(U)}}function Gk(e,r,s){const i=this;return c;function c(f){return He(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),u):s(f)}function u(f){return i.parser.lazy[i.now().line]?s(f):r(f)}}function Kk(e,r,s){return i;function i(c){return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),e.attempt(vo,r,s)}}const Yk={name:"htmlText",tokenize:Xk};function Xk(e,r,s){const i=this;let c,u,f;return l;function l(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),d}function d(L){return L===33?(e.consume(L),p):L===47?(e.consume(L),T):L===63?(e.consume(L),S):bn(L)?(e.consume(L),A):s(L)}function p(L){return L===45?(e.consume(L),g):L===91?(e.consume(L),u=0,E):bn(L)?(e.consume(L),x):s(L)}function g(L){return L===45?(e.consume(L),_):s(L)}function m(L){return L===null?s(L):L===45?(e.consume(L),b):He(L)?(f=m,X(L)):(e.consume(L),m)}function b(L){return L===45?(e.consume(L),_):m(L)}function _(L){return L===62?B(L):L===45?b(L):m(L)}function E(L){const R="CDATA[";return L===R.charCodeAt(u++)?(e.consume(L),u===R.length?C:E):s(L)}function C(L){return L===null?s(L):L===93?(e.consume(L),y):He(L)?(f=C,X(L)):(e.consume(L),C)}function y(L){return L===93?(e.consume(L),v):C(L)}function v(L){return L===62?B(L):L===93?(e.consume(L),v):C(L)}function x(L){return L===null||L===62?B(L):He(L)?(f=x,X(L)):(e.consume(L),x)}function S(L){return L===null?s(L):L===63?(e.consume(L),j):He(L)?(f=S,X(L)):(e.consume(L),S)}function j(L){return L===62?B(L):S(L)}function T(L){return bn(L)?(e.consume(L),N):s(L)}function N(L){return L===45||gn(L)?(e.consume(L),N):D(L)}function D(L){return He(L)?(f=D,X(L)):tt(L)?(e.consume(L),D):B(L)}function A(L){return L===45||gn(L)?(e.consume(L),A):L===47||L===62||_t(L)?z(L):s(L)}function z(L){return L===47?(e.consume(L),B):L===58||L===95||bn(L)?(e.consume(L),O):He(L)?(f=z,X(L)):tt(L)?(e.consume(L),z):B(L)}function O(L){return L===45||L===46||L===58||L===95||gn(L)?(e.consume(L),O):q(L)}function q(L){return L===61?(e.consume(L),G):He(L)?(f=q,X(L)):tt(L)?(e.consume(L),q):z(L)}function G(L){return L===null||L===60||L===61||L===62||L===96?s(L):L===34||L===39?(e.consume(L),c=L,W):He(L)?(f=G,X(L)):tt(L)?(e.consume(L),G):(e.consume(L),I)}function W(L){return L===c?(e.consume(L),c=void 0,$):L===null?s(L):He(L)?(f=W,X(L)):(e.consume(L),W)}function I(L){return L===null||L===34||L===39||L===60||L===61||L===96?s(L):L===47||L===62||_t(L)?z(L):(e.consume(L),I)}function $(L){return L===47||L===62||_t(L)?z(L):s(L)}function B(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),r):s(L)}function X(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),Z}function Z(L){return tt(L)?at(e,H,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):H(L)}function H(L){return e.enter("htmlTextData"),f(L)}}const Xh={name:"labelEnd",resolveAll:eE,resolveTo:tE,tokenize:nE},Zk={tokenize:rE},Qk={tokenize:sE},Jk={tokenize:iE};function eE(e){let r=-1;const s=[];for(;++r<e.length;){const i=e[r][1];if(s.push(e[r]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const c=i.type==="labelImage"?4:2;i.type="data",r+=c}}return e.length!==s.length&&Fn(e,0,e.length,s),e}function tE(e,r){let s=e.length,i=0,c,u,f,l;for(;s--;)if(c=e[s][1],u){if(c.type==="link"||c.type==="labelLink"&&c._inactive)break;e[s][0]==="enter"&&c.type==="labelLink"&&(c._inactive=!0)}else if(f){if(e[s][0]==="enter"&&(c.type==="labelImage"||c.type==="labelLink")&&!c._balanced&&(u=s,c.type!=="labelLink")){i=2;break}}else c.type==="labelEnd"&&(f=s);const d={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},p={type:"label",start:{...e[u][1].start},end:{...e[f][1].end}},g={type:"labelText",start:{...e[u+i+2][1].end},end:{...e[f-2][1].start}};return l=[["enter",d,r],["enter",p,r]],l=er(l,e.slice(u+1,u+i+3)),l=er(l,[["enter",g,r]]),l=er(l,mc(r.parser.constructs.insideSpan.null,e.slice(u+i+4,f-3),r)),l=er(l,[["exit",g,r],e[f-2],e[f-1],["exit",p,r]]),l=er(l,e.slice(f+1)),l=er(l,[["exit",d,r]]),Fn(e,u,e.length,l),e}function nE(e,r,s){const i=this;let c=i.events.length,u,f;for(;c--;)if((i.events[c][1].type==="labelImage"||i.events[c][1].type==="labelLink")&&!i.events[c][1]._balanced){u=i.events[c][1];break}return l;function l(b){return u?u._inactive?m(b):(f=i.parser.defined.includes(ar(i.sliceSerialize({start:u.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),d):s(b)}function d(b){return b===40?e.attempt(Zk,g,f?g:m)(b):b===91?e.attempt(Qk,g,f?p:m)(b):f?g(b):m(b)}function p(b){return e.attempt(Jk,g,m)(b)}function g(b){return r(b)}function m(b){return u._balanced=!0,s(b)}}function rE(e,r,s){return i;function i(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),c}function c(m){return _t(m)?to(e,u)(m):u(m)}function u(m){return m===41?g(m):Ty(e,f,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function f(m){return _t(m)?to(e,d)(m):g(m)}function l(m){return s(m)}function d(m){return m===34||m===39||m===40?Dy(e,p,s,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):g(m)}function p(m){return _t(m)?to(e,g)(m):g(m)}function g(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),r):s(m)}}function sE(e,r,s){const i=this;return c;function c(l){return Ay.call(i,e,u,f,"reference","referenceMarker","referenceString")(l)}function u(l){return i.parser.defined.includes(ar(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?r(l):s(l)}function f(l){return s(l)}}function iE(e,r,s){return i;function i(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),c}function c(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),r):s(u)}}const aE={name:"labelStartImage",resolveAll:Xh.resolveAll,tokenize:oE};function oE(e,r,s){const i=this;return c;function c(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),u}function u(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),f):s(l)}function f(l){return l===94&&"_hiddenFootnoteSupport"in i.parser.constructs?s(l):r(l)}}const lE={name:"labelStartLink",resolveAll:Xh.resolveAll,tokenize:cE};function cE(e,r,s){const i=this;return c;function c(f){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelLink"),u}function u(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?s(f):r(f)}}const Zd={name:"lineEnding",tokenize:uE};function uE(e,r){return s;function s(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),at(e,r,"linePrefix")}}const Wl={name:"thematicBreak",tokenize:dE};function dE(e,r,s){let i=0,c;return u;function u(p){return e.enter("thematicBreak"),f(p)}function f(p){return c=p,l(p)}function l(p){return p===c?(e.enter("thematicBreakSequence"),d(p)):i>=3&&(p===null||He(p))?(e.exit("thematicBreak"),r(p)):s(p)}function d(p){return p===c?(e.consume(p),i++,d):(e.exit("thematicBreakSequence"),tt(p)?at(e,l,"whitespace")(p):l(p))}}const Tn={continuation:{tokenize:mE},exit:xE,name:"list",tokenize:pE},hE={partial:!0,tokenize:vE},fE={partial:!0,tokenize:gE};function pE(e,r,s){const i=this,c=i.events[i.events.length-1];let u=c&&c[1].type==="linePrefix"?c[2].sliceSerialize(c[1],!0).length:0,f=0;return l;function l(_){const E=i.containerState.type||(_===42||_===43||_===45?"listUnordered":"listOrdered");if(E==="listUnordered"?!i.containerState.marker||_===i.containerState.marker:yh(_)){if(i.containerState.type||(i.containerState.type=E,e.enter(E,{_container:!0})),E==="listUnordered")return e.enter("listItemPrefix"),_===42||_===45?e.check(Wl,s,p)(_):p(_);if(!i.interrupt||_===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(_)}return s(_)}function d(_){return yh(_)&&++f<10?(e.consume(_),d):(!i.interrupt||f<2)&&(i.containerState.marker?_===i.containerState.marker:_===41||_===46)?(e.exit("listItemValue"),p(_)):s(_)}function p(_){return e.enter("listItemMarker"),e.consume(_),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||_,e.check(vo,i.interrupt?s:g,e.attempt(hE,b,m))}function g(_){return i.containerState.initialBlankLine=!0,u++,b(_)}function m(_){return tt(_)?(e.enter("listItemPrefixWhitespace"),e.consume(_),e.exit("listItemPrefixWhitespace"),b):s(_)}function b(_){return i.containerState.size=u+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,r(_)}}function mE(e,r,s){const i=this;return i.containerState._closeFlow=void 0,e.check(vo,c,u);function c(l){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,at(e,r,"listItemIndent",i.containerState.size+1)(l)}function u(l){return i.containerState.furtherBlankLines||!tt(l)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,f(l)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(fE,r,f)(l))}function f(l){return i.containerState._closeFlow=!0,i.interrupt=void 0,at(e,e.attempt(Tn,r,s),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function gE(e,r,s){const i=this;return at(e,c,"listItemIndent",i.containerState.size+1);function c(u){const f=i.events[i.events.length-1];return f&&f[1].type==="listItemIndent"&&f[2].sliceSerialize(f[1],!0).length===i.containerState.size?r(u):s(u)}}function xE(e){e.exit(this.containerState.type)}function vE(e,r,s){const i=this;return at(e,c,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function c(u){const f=i.events[i.events.length-1];return!tt(u)&&f&&f[1].type==="listItemPrefixWhitespace"?r(u):s(u)}}const Nv={name:"setextUnderline",resolveTo:bE,tokenize:yE};function bE(e,r){let s=e.length,i,c,u;for(;s--;)if(e[s][0]==="enter"){if(e[s][1].type==="content"){i=s;break}e[s][1].type==="paragraph"&&(c=s)}else e[s][1].type==="content"&&e.splice(s,1),!u&&e[s][1].type==="definition"&&(u=s);const f={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[c][1].type="setextHeadingText",u?(e.splice(c,0,["enter",f,r]),e.splice(u+1,0,["exit",e[i][1],r]),e[i][1].end={...e[u][1].end}):e[i][1]=f,e.push(["exit",f,r]),e}function yE(e,r,s){const i=this;let c;return u;function u(p){let g=i.events.length,m;for(;g--;)if(i.events[g][1].type!=="lineEnding"&&i.events[g][1].type!=="linePrefix"&&i.events[g][1].type!=="content"){m=i.events[g][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||m)?(e.enter("setextHeadingLine"),c=p,f(p)):s(p)}function f(p){return e.enter("setextHeadingLineSequence"),l(p)}function l(p){return p===c?(e.consume(p),l):(e.exit("setextHeadingLineSequence"),tt(p)?at(e,d,"lineSuffix")(p):d(p))}function d(p){return p===null||He(p)?(e.exit("setextHeadingLine"),r(p)):s(p)}}const _E={tokenize:SE};function SE(e){const r=this,s=e.attempt(vo,i,e.attempt(this.parser.constructs.flowInitial,c,at(e,e.attempt(this.parser.constructs.flow,c,e.attempt(jk,c)),"linePrefix")));return s;function i(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),r.currentConstruct=void 0,s}function c(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),r.currentConstruct=void 0,s}}const wE={resolveAll:Ry()},CE=Ly("string"),kE=Ly("text");function Ly(e){return{resolveAll:Ry(e==="text"?EE:void 0),tokenize:r};function r(s){const i=this,c=this.parser.constructs[e],u=s.attempt(c,f,l);return f;function f(g){return p(g)?u(g):l(g)}function l(g){if(g===null){s.consume(g);return}return s.enter("data"),s.consume(g),d}function d(g){return p(g)?(s.exit("data"),u(g)):(s.consume(g),d)}function p(g){if(g===null)return!0;const m=c[g];let b=-1;if(m)for(;++b<m.length;){const _=m[b];if(!_.previous||_.previous.call(i,i.previous))return!0}return!1}}}function Ry(e){return r;function r(s,i){let c=-1,u;for(;++c<=s.length;)u===void 0?s[c]&&s[c][1].type==="data"&&(u=c,c++):(!s[c]||s[c][1].type!=="data")&&(c!==u+2&&(s[u][1].end=s[c-1][1].end,s.splice(u+2,c-u-2),c=u+2),u=void 0);return e?e(s,i):s}}function EE(e,r){let s=0;for(;++s<=e.length;)if((s===e.length||e[s][1].type==="lineEnding")&&e[s-1][1].type==="data"){const i=e[s-1][1],c=r.sliceStream(i);let u=c.length,f=-1,l=0,d;for(;u--;){const p=c[u];if(typeof p=="string"){for(f=p.length;p.charCodeAt(f-1)===32;)l++,f--;if(f)break;f=-1}else if(p===-2)d=!0,l++;else if(p!==-1){u++;break}}if(r._contentTypeTextTrailing&&s===e.length&&(l=0),l){const p={type:s===e.length||d||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?f:i.start._bufferIndex+f,_index:i.start._index+u,line:i.end.line,column:i.end.column-l,offset:i.end.offset-l},end:{...i.end}};i.end={...p.start},i.start.offset===i.end.offset?Object.assign(i,p):(e.splice(s,0,["enter",p,r],["exit",p,r]),s+=2)}s++}return e}const jE={42:Tn,43:Tn,45:Tn,48:Tn,49:Tn,50:Tn,51:Tn,52:Tn,53:Tn,54:Tn,55:Tn,56:Tn,57:Tn,62:ky},NE={91:Lk},TE={[-2]:Xd,[-1]:Xd,32:Xd},AE={35:zk,42:Wl,45:[Nv,Wl],60:Uk,61:Nv,95:Wl,96:Ev,126:Ev},DE={38:jy,92:Ey},LE={[-5]:Zd,[-4]:Zd,[-3]:Zd,33:aE,38:jy,42:_h,60:[lk,Yk],91:lE,92:[Ik,Ey],93:Xh,95:_h,96:_k},RE={null:[_h,wE]},OE={null:[42,95]},ME={null:[]},IE=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:OE,contentInitial:NE,disable:ME,document:jE,flow:AE,flowInitial:TE,insideSpan:RE,string:DE,text:LE},Symbol.toStringTag,{value:"Module"}));function BE(e,r,s){let i={_bufferIndex:-1,_index:0,line:s&&s.line||1,column:s&&s.column||1,offset:s&&s.offset||0};const c={},u=[];let f=[],l=[];const d={attempt:D(T),check:D(N),consume:x,enter:S,exit:j,interrupt:D(N,{interrupt:!0})},p={code:null,containerState:{},defineSkip:C,events:[],now:E,parser:e,previous:null,sliceSerialize:b,sliceStream:_,write:m};let g=r.tokenize.call(p,d);return r.resolveAll&&u.push(r),p;function m(q){return f=er(f,q),y(),f[f.length-1]!==null?[]:(A(r,0),p.events=mc(u,p.events,p),p.events)}function b(q,G){return HE(_(q),G)}function _(q){return zE(f,q)}function E(){const{_bufferIndex:q,_index:G,line:W,column:I,offset:$}=i;return{_bufferIndex:q,_index:G,line:W,column:I,offset:$}}function C(q){c[q.line]=q.column,O()}function y(){let q;for(;i._index<f.length;){const G=f[i._index];if(typeof G=="string")for(q=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===q&&i._bufferIndex<G.length;)v(G.charCodeAt(i._bufferIndex));else v(G)}}function v(q){g=g(q)}function x(q){He(q)?(i.line++,i.column=1,i.offset+=q===-3?2:1,O()):q!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===f[i._index].length&&(i._bufferIndex=-1,i._index++)),p.previous=q}function S(q,G){const W=G||{};return W.type=q,W.start=E(),p.events.push(["enter",W,p]),l.push(W),W}function j(q){const G=l.pop();return G.end=E(),p.events.push(["exit",G,p]),G}function T(q,G){A(q,G.from)}function N(q,G){G.restore()}function D(q,G){return W;function W(I,$,B){let X,Z,H,L;return Array.isArray(I)?F(I):"tokenize"in I?F([I]):R(I);function R(ee){return Y;function Y(V){const oe=V!==null&&ee[V],re=V!==null&&ee.null,ve=[...Array.isArray(oe)?oe:oe?[oe]:[],...Array.isArray(re)?re:re?[re]:[]];return F(ve)(V)}}function F(ee){return X=ee,Z=0,ee.length===0?B:U(ee[Z])}function U(ee){return Y;function Y(V){return L=z(),H=ee,ee.partial||(p.currentConstruct=ee),ee.name&&p.parser.constructs.disable.null.includes(ee.name)?Q():ee.tokenize.call(G?Object.assign(Object.create(p),G):p,d,ne,Q)(V)}}function ne(ee){return q(H,L),$}function Q(ee){return L.restore(),++Z<X.length?U(X[Z]):B}}}function A(q,G){q.resolveAll&&!u.includes(q)&&u.push(q),q.resolve&&Fn(p.events,G,p.events.length-G,q.resolve(p.events.slice(G),p)),q.resolveTo&&(p.events=q.resolveTo(p.events,p))}function z(){const q=E(),G=p.previous,W=p.currentConstruct,I=p.events.length,$=Array.from(l);return{from:I,restore:B};function B(){i=q,p.previous=G,p.currentConstruct=W,p.events.length=I,l=$,O()}}function O(){i.line in c&&i.column<2&&(i.column=c[i.line],i.offset+=c[i.line]-1)}}function zE(e,r){const s=r.start._index,i=r.start._bufferIndex,c=r.end._index,u=r.end._bufferIndex;let f;if(s===c)f=[e[s].slice(i,u)];else{if(f=e.slice(s,c),i>-1){const l=f[0];typeof l=="string"?f[0]=l.slice(i):f.shift()}u>0&&f.push(e[c].slice(0,u))}return f}function HE(e,r){let s=-1;const i=[];let c;for(;++s<e.length;){const u=e[s];let f;if(typeof u=="string")f=u;else switch(u){case-5:{f="\r";break}case-4:{f=`
93
+ `;break}case-3:{f=`\r
94
+ `;break}case-2:{f=r?" ":" ";break}case-1:{if(!r&&c)continue;f=" ";break}default:f=String.fromCharCode(u)}c=u===-2,i.push(f)}return i.join("")}function PE(e){const i={constructs:wy([IE,...(e||{}).extensions||[]]),content:c(tk),defined:[],document:c(rk),flow:c(_E),lazy:{},string:c(CE),text:c(kE)};return i;function c(u){return f;function f(l){return BE(i,u,l)}}}function FE(e){for(;!Ny(e););return e}const Tv=/[\0\t\n\r]/g;function UE(){let e=1,r="",s=!0,i;return c;function c(u,f,l){const d=[];let p,g,m,b,_;for(u=r+(typeof u=="string"?u.toString():new TextDecoder(f||void 0).decode(u)),m=0,r="",s&&(u.charCodeAt(0)===65279&&m++,s=void 0);m<u.length;){if(Tv.lastIndex=m,p=Tv.exec(u),b=p&&p.index!==void 0?p.index:u.length,_=u.charCodeAt(b),!p){r=u.slice(m);break}if(_===10&&m===b&&i)d.push(-3),i=void 0;else switch(i&&(d.push(-5),i=void 0),m<b&&(d.push(u.slice(m,b)),e+=b-m),_){case 0:{d.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,d.push(-2);e++<g;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:i=!0,e=1}m=b+1}return l&&(i&&d.push(-5),r&&d.push(r),d.push(null)),d}}const $E=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function qE(e){return e.replace($E,WE)}function WE(e,r,s){if(r)return r;if(s.charCodeAt(0)===35){const c=s.charCodeAt(1),u=c===120||c===88;return Cy(s.slice(u?2:1),u?16:10)}return co(s)||e}const Oy={}.hasOwnProperty;function VE(e,r,s){return r&&typeof r=="object"&&(s=r,r=void 0),GE(s)(FE(PE(s).document().write(UE()(e,r,!0))))}function GE(e){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(je),autolinkProtocol:z,autolinkEmail:z,atxHeading:u(ze),blockQuote:u(re),characterEscape:z,characterReference:z,codeFenced:u(ve),codeFencedFenceInfo:f,codeFencedFenceMeta:f,codeIndented:u(ve,f),codeText:u(be,f),codeTextData:z,data:z,codeFlowValue:z,definition:u(Le),definitionDestinationString:f,definitionLabelString:f,definitionTitleString:f,emphasis:u(Oe),hardBreakEscape:u(We),hardBreakTrailing:u(We),htmlFlow:u(Ee,f),htmlFlowData:z,htmlText:u(Ee,f),htmlTextData:z,image:u(fe),label:f,link:u(je),listItem:u(It),listItemValue:b,listOrdered:u(Ue,m),listUnordered:u(Ue),paragraph:u(pe),reference:U,referenceString:f,resourceDestinationString:f,resourceTitleString:f,setextHeading:u(ze),strong:u(Ne),thematicBreak:u(ot)},exit:{atxHeading:d(),atxHeadingSequence:T,autolink:d(),autolinkEmail:oe,autolinkProtocol:V,blockQuote:d(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:Q,characterReferenceMarkerNumeric:Q,characterReferenceValue:ee,characterReference:Y,codeFenced:d(y),codeFencedFence:C,codeFencedFenceInfo:_,codeFencedFenceMeta:E,codeFlowValue:O,codeIndented:d(v),codeText:d($),codeTextData:O,data:O,definition:d(),definitionDestinationString:j,definitionLabelString:x,definitionTitleString:S,emphasis:d(),hardBreakEscape:d(G),hardBreakTrailing:d(G),htmlFlow:d(W),htmlFlowData:O,htmlText:d(I),htmlTextData:O,image:d(X),label:H,labelText:Z,lineEnding:q,link:d(B),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:ne,resourceDestinationString:L,resourceTitleString:R,resource:F,setextHeading:d(A),setextHeadingLineSequence:D,setextHeadingText:N,strong:d(),thematicBreak:d()}};My(r,(e||{}).mdastExtensions||[]);const s={};return i;function i(ue){let _e={type:"root",children:[]};const Te={stack:[_e],tokenStack:[],config:r,enter:l,exit:p,buffer:f,resume:g,data:s},Ie=[];let $e=-1;for(;++$e<ue.length;)if(ue[$e][1].type==="listOrdered"||ue[$e][1].type==="listUnordered")if(ue[$e][0]==="enter")Ie.push($e);else{const St=Ie.pop();$e=c(ue,St,$e)}for($e=-1;++$e<ue.length;){const St=r[ue[$e][0]];Oy.call(St,ue[$e][1].type)&&St[ue[$e][1].type].call(Object.assign({sliceSerialize:ue[$e][2].sliceSerialize},Te),ue[$e][1])}if(Te.tokenStack.length>0){const St=Te.tokenStack[Te.tokenStack.length-1];(St[1]||Av).call(Te,void 0,St[0])}for(_e.position={start:hs(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:hs(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},$e=-1;++$e<r.transforms.length;)_e=r.transforms[$e](_e)||_e;return _e}function c(ue,_e,Te){let Ie=_e-1,$e=-1,St=!1,Ye,Dt,mt,Kt;for(;++Ie<=Te;){const lt=ue[Ie];switch(lt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{lt[0]==="enter"?$e++:$e--,Kt=void 0;break}case"lineEndingBlank":{lt[0]==="enter"&&(Ye&&!Kt&&!$e&&!mt&&(mt=Ie),Kt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Kt=void 0}if(!$e&&lt[0]==="enter"&&lt[1].type==="listItemPrefix"||$e===-1&&lt[0]==="exit"&&(lt[1].type==="listUnordered"||lt[1].type==="listOrdered")){if(Ye){let $n=Ie;for(Dt=void 0;$n--;){const sn=ue[$n];if(sn[1].type==="lineEnding"||sn[1].type==="lineEndingBlank"){if(sn[0]==="exit")continue;Dt&&(ue[Dt][1].type="lineEndingBlank",St=!0),sn[1].type="lineEnding",Dt=$n}else if(!(sn[1].type==="linePrefix"||sn[1].type==="blockQuotePrefix"||sn[1].type==="blockQuotePrefixWhitespace"||sn[1].type==="blockQuoteMarker"||sn[1].type==="listItemIndent"))break}mt&&(!Dt||mt<Dt)&&(Ye._spread=!0),Ye.end=Object.assign({},Dt?ue[Dt][1].start:lt[1].end),ue.splice(Dt||Ie,0,["exit",Ye,lt[2]]),Ie++,Te++}if(lt[1].type==="listItemPrefix"){const $n={type:"listItem",_spread:!1,start:Object.assign({},lt[1].start),end:void 0};Ye=$n,ue.splice(Ie,0,["enter",$n,lt[2]]),Ie++,Te++,mt=void 0,Kt=!0}}}return ue[_e][1]._spread=St,Te}function u(ue,_e){return Te;function Te(Ie){l.call(this,ue(Ie),Ie),_e&&_e.call(this,Ie)}}function f(){this.stack.push({type:"fragment",children:[]})}function l(ue,_e,Te){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([_e,Te||void 0]),ue.position={start:hs(_e.start),end:void 0}}function d(ue){return _e;function _e(Te){ue&&ue.call(this,Te),p.call(this,Te)}}function p(ue,_e){const Te=this.stack.pop(),Ie=this.tokenStack.pop();if(Ie)Ie[0].type!==ue.type&&(_e?_e.call(this,ue,Ie[0]):(Ie[1]||Av).call(this,ue,Ie[0]));else throw new Error("Cannot close `"+ue.type+"` ("+eo({start:ue.start,end:ue.end})+"): it’s not open");Te.position.end=hs(ue.end)}function g(){return Yh(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function b(ue){if(this.data.expectingFirstListItemValue){const _e=this.stack[this.stack.length-2];_e.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function _(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.lang=ue}function E(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.meta=ue}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue.replace(/(\r?\n|\r)$/g,"")}function x(ue){const _e=this.resume(),Te=this.stack[this.stack.length-1];Te.label=_e,Te.identifier=ar(this.sliceSerialize(ue)).toLowerCase()}function S(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.title=ue}function j(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.url=ue}function T(ue){const _e=this.stack[this.stack.length-1];if(!_e.depth){const Te=this.sliceSerialize(ue).length;_e.depth=Te}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function D(ue){const _e=this.stack[this.stack.length-1];_e.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function A(){this.data.setextHeadingSlurpLineEnding=void 0}function z(ue){const Te=this.stack[this.stack.length-1].children;let Ie=Te[Te.length-1];(!Ie||Ie.type!=="text")&&(Ie=Me(),Ie.position={start:hs(ue.start),end:void 0},Te.push(Ie)),this.stack.push(Ie)}function O(ue){const _e=this.stack.pop();_e.value+=this.sliceSerialize(ue),_e.position.end=hs(ue.end)}function q(ue){const _e=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Te=_e.children[_e.children.length-1];Te.position.end=hs(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(_e.type)&&(z.call(this,ue),O.call(this,ue))}function G(){this.data.atHardBreak=!0}function W(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue}function I(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue}function $(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue}function B(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=_e,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function X(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=_e,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function Z(ue){const _e=this.sliceSerialize(ue),Te=this.stack[this.stack.length-2];Te.label=qE(_e),Te.identifier=ar(_e).toLowerCase()}function H(){const ue=this.stack[this.stack.length-1],_e=this.resume(),Te=this.stack[this.stack.length-1];if(this.data.inReference=!0,Te.type==="link"){const Ie=ue.children;Te.children=Ie}else Te.alt=_e}function L(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.url=ue}function R(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.title=ue}function F(){this.data.inReference=void 0}function U(){this.data.referenceType="collapsed"}function ne(ue){const _e=this.resume(),Te=this.stack[this.stack.length-1];Te.label=_e,Te.identifier=ar(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function Q(ue){this.data.characterReferenceType=ue.type}function ee(ue){const _e=this.sliceSerialize(ue),Te=this.data.characterReferenceType;let Ie;Te?(Ie=Cy(_e,Te==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ie=co(_e);const $e=this.stack[this.stack.length-1];$e.value+=Ie}function Y(ue){const _e=this.stack.pop();_e.position.end=hs(ue.end)}function V(ue){O.call(this,ue);const _e=this.stack[this.stack.length-1];_e.url=this.sliceSerialize(ue)}function oe(ue){O.call(this,ue);const _e=this.stack[this.stack.length-1];_e.url="mailto:"+this.sliceSerialize(ue)}function re(){return{type:"blockquote",children:[]}}function ve(){return{type:"code",lang:null,meta:null,value:""}}function be(){return{type:"inlineCode",value:""}}function Le(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Oe(){return{type:"emphasis",children:[]}}function ze(){return{type:"heading",depth:0,children:[]}}function We(){return{type:"break"}}function Ee(){return{type:"html",value:""}}function fe(){return{type:"image",title:null,url:"",alt:null}}function je(){return{type:"link",title:null,url:"",children:[]}}function Ue(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function It(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function pe(){return{type:"paragraph",children:[]}}function Ne(){return{type:"strong",children:[]}}function Me(){return{type:"text",value:""}}function ot(){return{type:"thematicBreak"}}}function hs(e){return{line:e.line,column:e.column,offset:e.offset}}function My(e,r){let s=-1;for(;++s<r.length;){const i=r[s];Array.isArray(i)?My(e,i):KE(e,i)}}function KE(e,r){let s;for(s in r)if(Oy.call(r,s))switch(s){case"canContainEols":{const i=r[s];i&&e[s].push(...i);break}case"transforms":{const i=r[s];i&&e[s].push(...i);break}case"enter":case"exit":{const i=r[s];i&&Object.assign(e[s],i);break}}}function Av(e,r){throw e?new Error("Cannot close `"+e.type+"` ("+eo({start:e.start,end:e.end})+"): a different token (`"+r.type+"`, "+eo({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+eo({start:r.start,end:r.end})+") is still open")}function YE(e){const r=this;r.parser=s;function s(i){return VE(i,{...r.data("settings"),...e,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function XE(e,r){const s={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(r),!0)};return e.patch(r,s),e.applyData(r,s)}function ZE(e,r){const s={type:"element",tagName:"br",properties:{},children:[]};return e.patch(r,s),[e.applyData(r,s),{type:"text",value:`
95
+ `}]}function QE(e,r){const s=r.value?r.value+`
96
+ `:"",i={},c=r.lang?r.lang.split(/\s+/):[];c.length>0&&(i.className=["language-"+c[0]]);let u={type:"element",tagName:"code",properties:i,children:[{type:"text",value:s}]};return r.meta&&(u.data={meta:r.meta}),e.patch(r,u),u=e.applyData(r,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(r,u),u}function JE(e,r){const s={type:"element",tagName:"del",properties:{},children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function ej(e,r){const s={type:"element",tagName:"em",properties:{},children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function tj(e,r){const s=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(r.identifier).toUpperCase(),c=Vi(i.toLowerCase()),u=e.footnoteOrder.indexOf(i);let f,l=e.footnoteCounts.get(i);l===void 0?(l=0,e.footnoteOrder.push(i),f=e.footnoteOrder.length):f=u+1,l+=1,e.footnoteCounts.set(i,l);const d={type:"element",tagName:"a",properties:{href:"#"+s+"fn-"+c,id:s+"fnref-"+c+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(f)}]};e.patch(r,d);const p={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(r,p),e.applyData(r,p)}function nj(e,r){const s={type:"element",tagName:"h"+r.depth,properties:{},children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function rj(e,r){if(e.options.allowDangerousHtml){const s={type:"raw",value:r.value};return e.patch(r,s),e.applyData(r,s)}}function Iy(e,r){const s=r.referenceType;let i="]";if(s==="collapsed"?i+="[]":s==="full"&&(i+="["+(r.label||r.identifier)+"]"),r.type==="imageReference")return[{type:"text",value:"!["+r.alt+i}];const c=e.all(r),u=c[0];u&&u.type==="text"?u.value="["+u.value:c.unshift({type:"text",value:"["});const f=c[c.length-1];return f&&f.type==="text"?f.value+=i:c.push({type:"text",value:i}),c}function sj(e,r){const s=String(r.identifier).toUpperCase(),i=e.definitionById.get(s);if(!i)return Iy(e,r);const c={src:Vi(i.url||""),alt:r.alt};i.title!==null&&i.title!==void 0&&(c.title=i.title);const u={type:"element",tagName:"img",properties:c,children:[]};return e.patch(r,u),e.applyData(r,u)}function ij(e,r){const s={src:Vi(r.url)};r.alt!==null&&r.alt!==void 0&&(s.alt=r.alt),r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(r,i),e.applyData(r,i)}function aj(e,r){const s={type:"text",value:r.value.replace(/\r?\n|\r/g," ")};e.patch(r,s);const i={type:"element",tagName:"code",properties:{},children:[s]};return e.patch(r,i),e.applyData(r,i)}function oj(e,r){const s=String(r.identifier).toUpperCase(),i=e.definitionById.get(s);if(!i)return Iy(e,r);const c={href:Vi(i.url||"")};i.title!==null&&i.title!==void 0&&(c.title=i.title);const u={type:"element",tagName:"a",properties:c,children:e.all(r)};return e.patch(r,u),e.applyData(r,u)}function lj(e,r){const s={href:Vi(r.url)};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function cj(e,r,s){const i=e.all(r),c=s?uj(s):By(r),u={},f=[];if(typeof r.checked=="boolean"){const g=i[0];let m;g&&g.type==="element"&&g.tagName==="p"?m=g:(m={type:"element",tagName:"p",properties:{},children:[]},i.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:r.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let l=-1;for(;++l<i.length;){const g=i[l];(c||l!==0||g.type!=="element"||g.tagName!=="p")&&f.push({type:"text",value:`
97
+ `}),g.type==="element"&&g.tagName==="p"&&!c?f.push(...g.children):f.push(g)}const d=i[i.length-1];d&&(c||d.type!=="element"||d.tagName!=="p")&&f.push({type:"text",value:`
98
+ `});const p={type:"element",tagName:"li",properties:u,children:f};return e.patch(r,p),e.applyData(r,p)}function uj(e){let r=!1;if(e.type==="list"){r=e.spread||!1;const s=e.children;let i=-1;for(;!r&&++i<s.length;)r=By(s[i])}return r}function By(e){const r=e.spread;return r??e.children.length>1}function dj(e,r){const s={},i=e.all(r);let c=-1;for(typeof r.start=="number"&&r.start!==1&&(s.start=r.start);++c<i.length;){const f=i[c];if(f.type==="element"&&f.tagName==="li"&&f.properties&&Array.isArray(f.properties.className)&&f.properties.className.includes("task-list-item")){s.className=["contains-task-list"];break}}const u={type:"element",tagName:r.ordered?"ol":"ul",properties:s,children:e.wrap(i,!0)};return e.patch(r,u),e.applyData(r,u)}function hj(e,r){const s={type:"element",tagName:"p",properties:{},children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function fj(e,r){const s={type:"root",children:e.wrap(e.all(r))};return e.patch(r,s),e.applyData(r,s)}function pj(e,r){const s={type:"element",tagName:"strong",properties:{},children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function mj(e,r){const s=e.all(r),i=s.shift(),c=[];if(i){const f={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(r.children[0],f),c.push(f)}if(s.length>0){const f={type:"element",tagName:"tbody",properties:{},children:e.wrap(s,!0)},l=Wh(r.children[1]),d=gy(r.children[r.children.length-1]);l&&d&&(f.position={start:l,end:d}),c.push(f)}const u={type:"element",tagName:"table",properties:{},children:e.wrap(c,!0)};return e.patch(r,u),e.applyData(r,u)}function gj(e,r,s){const i=s?s.children:void 0,u=(i?i.indexOf(r):1)===0?"th":"td",f=s&&s.type==="table"?s.align:void 0,l=f?f.length:r.children.length;let d=-1;const p=[];for(;++d<l;){const m=r.children[d],b={},_=f?f[d]:void 0;_&&(b.align=_);let E={type:"element",tagName:u,properties:b,children:[]};m&&(E.children=e.all(m),e.patch(m,E),E=e.applyData(m,E)),p.push(E)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(p,!0)};return e.patch(r,g),e.applyData(r,g)}function xj(e,r){const s={type:"element",tagName:"td",properties:{},children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}const Dv=9,Lv=32;function vj(e){const r=String(e),s=/\r?\n|\r/g;let i=s.exec(r),c=0;const u=[];for(;i;)u.push(Rv(r.slice(c,i.index),c>0,!0),i[0]),c=i.index+i[0].length,i=s.exec(r);return u.push(Rv(r.slice(c),c>0,!1)),u.join("")}function Rv(e,r,s){let i=0,c=e.length;if(r){let u=e.codePointAt(i);for(;u===Dv||u===Lv;)i++,u=e.codePointAt(i)}if(s){let u=e.codePointAt(c-1);for(;u===Dv||u===Lv;)c--,u=e.codePointAt(c-1)}return c>i?e.slice(i,c):""}function bj(e,r){const s={type:"text",value:vj(String(r.value))};return e.patch(r,s),e.applyData(r,s)}function yj(e,r){const s={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(r,s),e.applyData(r,s)}const _j={blockquote:XE,break:ZE,code:QE,delete:JE,emphasis:ej,footnoteReference:tj,heading:nj,html:rj,imageReference:sj,image:ij,inlineCode:aj,linkReference:oj,link:lj,listItem:cj,list:dj,paragraph:hj,root:fj,strong:pj,table:mj,tableCell:xj,tableRow:gj,text:bj,thematicBreak:yj,toml:Bl,yaml:Bl,definition:Bl,footnoteDefinition:Bl};function Bl(){}const zy=-1,gc=0,no=1,Jl=2,Zh=3,Qh=4,Jh=5,ef=6,Hy=7,Py=8,Ov=typeof self=="object"?self:globalThis,Sj=(e,r)=>{const s=(c,u)=>(e.set(u,c),c),i=c=>{if(e.has(c))return e.get(c);const[u,f]=r[c];switch(u){case gc:case zy:return s(f,c);case no:{const l=s([],c);for(const d of f)l.push(i(d));return l}case Jl:{const l=s({},c);for(const[d,p]of f)l[i(d)]=i(p);return l}case Zh:return s(new Date(f),c);case Qh:{const{source:l,flags:d}=f;return s(new RegExp(l,d),c)}case Jh:{const l=s(new Map,c);for(const[d,p]of f)l.set(i(d),i(p));return l}case ef:{const l=s(new Set,c);for(const d of f)l.add(i(d));return l}case Hy:{const{name:l,message:d}=f;return s(new Ov[l](d),c)}case Py:return s(BigInt(f),c);case"BigInt":return s(Object(BigInt(f)),c);case"ArrayBuffer":return s(new Uint8Array(f).buffer,f);case"DataView":{const{buffer:l}=new Uint8Array(f);return s(new DataView(l),f)}}return s(new Ov[u](f),c)};return i},Mv=e=>Sj(new Map,e)(0),Oi="",{toString:wj}={},{keys:Cj}=Object,Ga=e=>{const r=typeof e;if(r!=="object"||!e)return[gc,r];const s=wj.call(e).slice(8,-1);switch(s){case"Array":return[no,Oi];case"Object":return[Jl,Oi];case"Date":return[Zh,Oi];case"RegExp":return[Qh,Oi];case"Map":return[Jh,Oi];case"Set":return[ef,Oi];case"DataView":return[no,s]}return s.includes("Array")?[no,s]:s.includes("Error")?[Hy,s]:[Jl,s]},zl=([e,r])=>e===gc&&(r==="function"||r==="symbol"),kj=(e,r,s,i)=>{const c=(f,l)=>{const d=i.push(f)-1;return s.set(l,d),d},u=f=>{if(s.has(f))return s.get(f);let[l,d]=Ga(f);switch(l){case gc:{let g=f;switch(d){case"bigint":l=Py,g=f.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);g=null;break;case"undefined":return c([zy],f)}return c([l,g],f)}case no:{if(d){let b=f;return d==="DataView"?b=new Uint8Array(f.buffer):d==="ArrayBuffer"&&(b=new Uint8Array(f)),c([d,[...b]],f)}const g=[],m=c([l,g],f);for(const b of f)g.push(u(b));return m}case Jl:{if(d)switch(d){case"BigInt":return c([d,f.toString()],f);case"Boolean":case"Number":case"String":return c([d,f.valueOf()],f)}if(r&&"toJSON"in f)return u(f.toJSON());const g=[],m=c([l,g],f);for(const b of Cj(f))(e||!zl(Ga(f[b])))&&g.push([u(b),u(f[b])]);return m}case Zh:return c([l,f.toISOString()],f);case Qh:{const{source:g,flags:m}=f;return c([l,{source:g,flags:m}],f)}case Jh:{const g=[],m=c([l,g],f);for(const[b,_]of f)(e||!(zl(Ga(b))||zl(Ga(_))))&&g.push([u(b),u(_)]);return m}case ef:{const g=[],m=c([l,g],f);for(const b of f)(e||!zl(Ga(b)))&&g.push(u(b));return m}}const{message:p}=f;return c([l,{name:d,message:p}],f)};return u},Iv=(e,{json:r,lossy:s}={})=>{const i=[];return kj(!(r||s),!!r,new Map,i)(e),i},ec=typeof structuredClone=="function"?(e,r)=>r&&("json"in r||"lossy"in r)?Mv(Iv(e,r)):structuredClone(e):(e,r)=>Mv(Iv(e,r));function Ej(e,r){const s=[{type:"text",value:"↩"}];return r>1&&s.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(r)}]}),s}function jj(e,r){return"Back to reference "+(e+1)+(r>1?"-"+r:"")}function Nj(e){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=e.options.footnoteBackContent||Ej,i=e.options.footnoteBackLabel||jj,c=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",f=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let d=-1;for(;++d<e.footnoteOrder.length;){const p=e.footnoteById.get(e.footnoteOrder[d]);if(!p)continue;const g=e.all(p),m=String(p.identifier).toUpperCase(),b=Vi(m.toLowerCase());let _=0;const E=[],C=e.footnoteCounts.get(m);for(;C!==void 0&&++_<=C;){E.length>0&&E.push({type:"text",value:" "});let x=typeof s=="string"?s:s(d,_);typeof x=="string"&&(x={type:"text",value:x}),E.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+b+(_>1?"-"+_:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(d,_),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const y=g[g.length-1];if(y&&y.type==="element"&&y.tagName==="p"){const x=y.children[y.children.length-1];x&&x.type==="text"?x.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...E)}else g.push(...E);const v={type:"element",tagName:"li",properties:{id:r+"fn-"+b},children:e.wrap(g,!0)};e.patch(p,v),l.push(v)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...ec(f),id:"footnote-label"},children:[{type:"text",value:c}]},{type:"text",value:`
99
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
100
+ `}]}}const xc=(function(e){if(e==null)return Lj;if(typeof e=="function")return vc(e);if(typeof e=="object")return Array.isArray(e)?Tj(e):Aj(e);if(typeof e=="string")return Dj(e);throw new Error("Expected function, string, or object as test")});function Tj(e){const r=[];let s=-1;for(;++s<e.length;)r[s]=xc(e[s]);return vc(i);function i(...c){let u=-1;for(;++u<r.length;)if(r[u].apply(this,c))return!0;return!1}}function Aj(e){const r=e;return vc(s);function s(i){const c=i;let u;for(u in e)if(c[u]!==r[u])return!1;return!0}}function Dj(e){return vc(r);function r(s){return s&&s.type===e}}function vc(e){return r;function r(s,i,c){return!!(Rj(s)&&e.call(this,s,typeof i=="number"?i:void 0,c||void 0))}}function Lj(){return!0}function Rj(e){return e!==null&&typeof e=="object"&&"type"in e}const Fy=[],Oj=!0,Sh=!1,Mj="skip";function Uy(e,r,s,i){let c;typeof r=="function"&&typeof s!="function"?(i=s,s=r):c=r;const u=xc(c),f=i?-1:1;l(e,void 0,[])();function l(d,p,g){const m=d&&typeof d=="object"?d:{};if(typeof m.type=="string"){const _=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(d.type+(_?"<"+_+">":""))+")"})}return b;function b(){let _=Fy,E,C,y;if((!r||u(d,p,g[g.length-1]||void 0))&&(_=Ij(s(d,g)),_[0]===Sh))return _;if("children"in d&&d.children){const v=d;if(v.children&&_[0]!==Mj)for(C=(i?v.children.length:-1)+f,y=g.concat(v);C>-1&&C<v.children.length;){const x=v.children[C];if(E=l(x,C,y)(),E[0]===Sh)return E;C=typeof E[1]=="number"?E[1]:C+f}}return _}}}function Ij(e){return Array.isArray(e)?e:typeof e=="number"?[Oj,e]:e==null?Fy:[e]}function tf(e,r,s,i){let c,u,f;typeof r=="function"&&typeof s!="function"?(u=void 0,f=r,c=s):(u=r,f=s,c=i),Uy(e,u,l,c);function l(d,p){const g=p[p.length-1],m=g?g.children.indexOf(d):void 0;return f(d,m,g)}}const wh={}.hasOwnProperty,Bj={};function zj(e,r){const s=r||Bj,i=new Map,c=new Map,u=new Map,f={..._j,...s.handlers},l={all:p,applyData:Pj,definitionById:i,footnoteById:c,footnoteCounts:u,footnoteOrder:[],handlers:f,one:d,options:s,patch:Hj,wrap:Uj};return tf(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const m=g.type==="definition"?i:c,b=String(g.identifier).toUpperCase();m.has(b)||m.set(b,g)}}),l;function d(g,m){const b=g.type,_=l.handlers[b];if(wh.call(l.handlers,b)&&_)return _(l,g,m);if(l.options.passThrough&&l.options.passThrough.includes(b)){if("children"in g){const{children:C,...y}=g,v=ec(y);return v.children=l.all(g),v}return ec(g)}return(l.options.unknownHandler||Fj)(l,g,m)}function p(g){const m=[];if("children"in g){const b=g.children;let _=-1;for(;++_<b.length;){const E=l.one(b[_],g);if(E){if(_&&b[_-1].type==="break"&&(!Array.isArray(E)&&E.type==="text"&&(E.value=Bv(E.value)),!Array.isArray(E)&&E.type==="element")){const C=E.children[0];C&&C.type==="text"&&(C.value=Bv(C.value))}Array.isArray(E)?m.push(...E):m.push(E)}}}return m}}function Hj(e,r){e.position&&(r.position=j2(e))}function Pj(e,r){let s=r;if(e&&e.data){const i=e.data.hName,c=e.data.hChildren,u=e.data.hProperties;if(typeof i=="string")if(s.type==="element")s.tagName=i;else{const f="children"in s?s.children:[s];s={type:"element",tagName:i,properties:{},children:f}}s.type==="element"&&u&&Object.assign(s.properties,ec(u)),"children"in s&&s.children&&c!==null&&c!==void 0&&(s.children=c)}return s}function Fj(e,r){const s=r.data||{},i="value"in r&&!(wh.call(s,"hProperties")||wh.call(s,"hChildren"))?{type:"text",value:r.value}:{type:"element",tagName:"div",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function Uj(e,r){const s=[];let i=-1;for(r&&s.push({type:"text",value:`
101
+ `});++i<e.length;)i&&s.push({type:"text",value:`
102
+ `}),s.push(e[i]);return r&&e.length>0&&s.push({type:"text",value:`
103
+ `}),s}function Bv(e){let r=0,s=e.charCodeAt(r);for(;s===9||s===32;)r++,s=e.charCodeAt(r);return e.slice(r)}function zv(e,r){const s=zj(e,r),i=s.one(e,void 0),c=Nj(s),u=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return c&&u.children.push({type:"text",value:`
104
+ `},c),u}function $j(e,r){return e&&"run"in e?async function(s,i){const c=zv(s,{file:i,...r});await e.run(c,i)}:function(s,i){return zv(s,{file:i,...e||r})}}function Hv(e){if(e)throw e}var Qd,Pv;function qj(){if(Pv)return Qd;Pv=1;var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,s=Object.defineProperty,i=Object.getOwnPropertyDescriptor,c=function(p){return typeof Array.isArray=="function"?Array.isArray(p):r.call(p)==="[object Array]"},u=function(p){if(!p||r.call(p)!=="[object Object]")return!1;var g=e.call(p,"constructor"),m=p.constructor&&p.constructor.prototype&&e.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!g&&!m)return!1;var b;for(b in p);return typeof b>"u"||e.call(p,b)},f=function(p,g){s&&g.name==="__proto__"?s(p,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):p[g.name]=g.newValue},l=function(p,g){if(g==="__proto__")if(e.call(p,g)){if(i)return i(p,g).value}else return;return p[g]};return Qd=function d(){var p,g,m,b,_,E,C=arguments[0],y=1,v=arguments.length,x=!1;for(typeof C=="boolean"&&(x=C,C=arguments[1]||{},y=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});y<v;++y)if(p=arguments[y],p!=null)for(g in p)m=l(C,g),b=l(p,g),C!==b&&(x&&b&&(u(b)||(_=c(b)))?(_?(_=!1,E=m&&c(m)?m:[]):E=m&&u(m)?m:{},f(C,{name:g,newValue:d(x,E,b)})):typeof b<"u"&&f(C,{name:g,newValue:b}));return C},Qd}var Wj=qj();const Jd=sc(Wj);function Ch(e){if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Vj(){const e=[],r={run:s,use:i};return r;function s(...c){let u=-1;const f=c.pop();if(typeof f!="function")throw new TypeError("Expected function as last argument, not "+f);l(null,...c);function l(d,...p){const g=e[++u];let m=-1;if(d){f(d);return}for(;++m<c.length;)(p[m]===null||p[m]===void 0)&&(p[m]=c[m]);c=p,g?Gj(g,l)(...p):f(null,...p)}}function i(c){if(typeof c!="function")throw new TypeError("Expected `middelware` to be a function, not "+c);return e.push(c),r}}function Gj(e,r){let s;return i;function i(...f){const l=e.length>f.length;let d;l&&f.push(c);try{d=e.apply(this,f)}catch(p){const g=p;if(l&&s)throw g;return c(g)}l||(d&&d.then&&typeof d.then=="function"?d.then(u,c):d instanceof Error?c(d):u(d))}function c(f,...l){s||(s=!0,r(f,...l))}function u(f){c(null,f)}}const fr={basename:Kj,dirname:Yj,extname:Xj,join:Zj,sep:"/"};function Kj(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');bo(e);let s=0,i=-1,c=e.length,u;if(r===void 0||r.length===0||r.length>e.length){for(;c--;)if(e.codePointAt(c)===47){if(u){s=c+1;break}}else i<0&&(u=!0,i=c+1);return i<0?"":e.slice(s,i)}if(r===e)return"";let f=-1,l=r.length-1;for(;c--;)if(e.codePointAt(c)===47){if(u){s=c+1;break}}else f<0&&(u=!0,f=c+1),l>-1&&(e.codePointAt(c)===r.codePointAt(l--)?l<0&&(i=c):(l=-1,i=f));return s===i?i=f:i<0&&(i=e.length),e.slice(s,i)}function Yj(e){if(bo(e),e.length===0)return".";let r=-1,s=e.length,i;for(;--s;)if(e.codePointAt(s)===47){if(i){r=s;break}}else i||(i=!0);return r<0?e.codePointAt(0)===47?"/":".":r===1&&e.codePointAt(0)===47?"//":e.slice(0,r)}function Xj(e){bo(e);let r=e.length,s=-1,i=0,c=-1,u=0,f;for(;r--;){const l=e.codePointAt(r);if(l===47){if(f){i=r+1;break}continue}s<0&&(f=!0,s=r+1),l===46?c<0?c=r:u!==1&&(u=1):c>-1&&(u=-1)}return c<0||s<0||u===0||u===1&&c===s-1&&c===i+1?"":e.slice(c,s)}function Zj(...e){let r=-1,s;for(;++r<e.length;)bo(e[r]),e[r]&&(s=s===void 0?e[r]:s+"/"+e[r]);return s===void 0?".":Qj(s)}function Qj(e){bo(e);const r=e.codePointAt(0)===47;let s=Jj(e,!r);return s.length===0&&!r&&(s="."),s.length>0&&e.codePointAt(e.length-1)===47&&(s+="/"),r?"/"+s:s}function Jj(e,r){let s="",i=0,c=-1,u=0,f=-1,l,d;for(;++f<=e.length;){if(f<e.length)l=e.codePointAt(f);else{if(l===47)break;l=47}if(l===47){if(!(c===f-1||u===1))if(c!==f-1&&u===2){if(s.length<2||i!==2||s.codePointAt(s.length-1)!==46||s.codePointAt(s.length-2)!==46){if(s.length>2){if(d=s.lastIndexOf("/"),d!==s.length-1){d<0?(s="",i=0):(s=s.slice(0,d),i=s.length-1-s.lastIndexOf("/")),c=f,u=0;continue}}else if(s.length>0){s="",i=0,c=f,u=0;continue}}r&&(s=s.length>0?s+"/..":"..",i=2)}else s.length>0?s+="/"+e.slice(c+1,f):s=e.slice(c+1,f),i=f-c-1;c=f,u=0}else l===46&&u>-1?u++:u=-1}return s}function bo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const eN={cwd:tN};function tN(){return"/"}function kh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function nN(e){if(typeof e=="string")e=new URL(e);else if(!kh(e)){const r=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw r.code="ERR_INVALID_ARG_TYPE",r}if(e.protocol!=="file:"){const r=new TypeError("The URL must be of scheme file");throw r.code="ERR_INVALID_URL_SCHEME",r}return rN(e)}function rN(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const r=e.pathname;let s=-1;for(;++s<r.length;)if(r.codePointAt(s)===37&&r.codePointAt(s+1)===50){const i=r.codePointAt(s+2);if(i===70||i===102){const c=new TypeError("File URL path must not include encoded / characters");throw c.code="ERR_INVALID_FILE_URL_PATH",c}}return decodeURIComponent(r)}const eh=["history","path","basename","stem","extname","dirname"];class $y{constructor(r){let s;r?kh(r)?s={path:r}:typeof r=="string"||sN(r)?s={value:r}:s=r:s={},this.cwd="cwd"in s?"":eN.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<eh.length;){const u=eh[i];u in s&&s[u]!==void 0&&s[u]!==null&&(this[u]=u==="history"?[...s[u]]:s[u])}let c;for(c in s)eh.includes(c)||(this[c]=s[c])}get basename(){return typeof this.path=="string"?fr.basename(this.path):void 0}set basename(r){nh(r,"basename"),th(r,"basename"),this.path=fr.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?fr.dirname(this.path):void 0}set dirname(r){Fv(this.basename,"dirname"),this.path=fr.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?fr.extname(this.path):void 0}set extname(r){if(th(r,"extname"),Fv(this.dirname,"extname"),r){if(r.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(r.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=fr.join(this.dirname,this.stem+(r||""))}get path(){return this.history[this.history.length-1]}set path(r){kh(r)&&(r=nN(r)),nh(r,"path"),this.path!==r&&this.history.push(r)}get stem(){return typeof this.path=="string"?fr.basename(this.path,this.extname):void 0}set stem(r){nh(r,"stem"),th(r,"stem"),this.path=fr.join(this.dirname||"",r+(this.extname||""))}fail(r,s,i){const c=this.message(r,s,i);throw c.fatal=!0,c}info(r,s,i){const c=this.message(r,s,i);return c.fatal=void 0,c}message(r,s,i){const c=new xn(r,s,i);return this.path&&(c.name=this.path+":"+c.name,c.file=this.path),c.fatal=!1,this.messages.push(c),c}toString(r){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(r||void 0).decode(this.value)}}function th(e,r){if(e&&e.includes(fr.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+fr.sep+"`")}function nh(e,r){if(!e)throw new Error("`"+r+"` cannot be empty")}function Fv(e,r){if(!e)throw new Error("Setting `"+r+"` requires `path` to be set too")}function sN(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const iN=(function(e){const i=this.constructor.prototype,c=i[e],u=function(){return c.apply(u,arguments)};return Object.setPrototypeOf(u,i),u}),aN={}.hasOwnProperty;class nf extends iN{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Vj()}copy(){const r=new nf;let s=-1;for(;++s<this.attachers.length;){const i=this.attachers[s];r.use(...i)}return r.data(Jd(!0,{},this.namespace)),r}data(r,s){return typeof r=="string"?arguments.length===2?(ih("data",this.frozen),this.namespace[r]=s,this):aN.call(this.namespace,r)&&this.namespace[r]||void 0:r?(ih("data",this.frozen),this.namespace=r,this):this.namespace}freeze(){if(this.frozen)return this;const r=this;for(;++this.freezeIndex<this.attachers.length;){const[s,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const c=s.call(r,...i);typeof c=="function"&&this.transformers.use(c)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(r){this.freeze();const s=Hl(r),i=this.parser||this.Parser;return rh("parse",i),i(String(s),s)}process(r,s){const i=this;return this.freeze(),rh("process",this.parser||this.Parser),sh("process",this.compiler||this.Compiler),s?c(void 0,s):new Promise(c);function c(u,f){const l=Hl(r),d=i.parse(l);i.run(d,l,function(g,m,b){if(g||!m||!b)return p(g);const _=m,E=i.stringify(_,b);cN(E)?b.value=E:b.result=E,p(g,b)});function p(g,m){g||!m?f(g):u?u(m):s(void 0,m)}}}processSync(r){let s=!1,i;return this.freeze(),rh("processSync",this.parser||this.Parser),sh("processSync",this.compiler||this.Compiler),this.process(r,c),$v("processSync","process",s),i;function c(u,f){s=!0,Hv(u),i=f}}run(r,s,i){Uv(r),this.freeze();const c=this.transformers;return!i&&typeof s=="function"&&(i=s,s=void 0),i?u(void 0,i):new Promise(u);function u(f,l){const d=Hl(s);c.run(r,d,p);function p(g,m,b){const _=m||r;g?l(g):f?f(_):i(void 0,_,b)}}}runSync(r,s){let i=!1,c;return this.run(r,s,u),$v("runSync","run",i),c;function u(f,l){Hv(f),c=l,i=!0}}stringify(r,s){this.freeze();const i=Hl(s),c=this.compiler||this.Compiler;return sh("stringify",c),Uv(r),c(r,i)}use(r,...s){const i=this.attachers,c=this.namespace;if(ih("use",this.frozen),r!=null)if(typeof r=="function")d(r,s);else if(typeof r=="object")Array.isArray(r)?l(r):f(r);else throw new TypeError("Expected usable value, not `"+r+"`");return this;function u(p){if(typeof p=="function")d(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[g,...m]=p;d(g,m)}else f(p);else throw new TypeError("Expected usable value, not `"+p+"`")}function f(p){if(!("plugins"in p)&&!("settings"in p))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(p.plugins),p.settings&&(c.settings=Jd(!0,c.settings,p.settings))}function l(p){let g=-1;if(p!=null)if(Array.isArray(p))for(;++g<p.length;){const m=p[g];u(m)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function d(p,g){let m=-1,b=-1;for(;++m<i.length;)if(i[m][0]===p){b=m;break}if(b===-1)i.push([p,...g]);else if(g.length>0){let[_,...E]=g;const C=i[b][1];Ch(C)&&Ch(_)&&(_=Jd(!0,C,_)),i[b]=[p,_,...E]}}}}const oN=new nf().freeze();function rh(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function sh(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ih(e,r){if(r)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Uv(e){if(!Ch(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function $v(e,r,s){if(!s)throw new Error("`"+e+"` finished async. Use `"+r+"` instead")}function Hl(e){return lN(e)?e:new $y(e)}function lN(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function cN(e){return typeof e=="string"||uN(e)}function uN(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const dN="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",qv=[],Wv={allowDangerousHtml:!0},hN=/^(https?|ircs?|mailto|xmpp)$/i,fN=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function pN(e){const r=mN(e),s=gN(e);return xN(r.runSync(r.parse(s),s),e)}function mN(e){const r=e.rehypePlugins||qv,s=e.remarkPlugins||qv,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Wv}:Wv;return oN().use(YE).use(s).use($j,i).use(r)}function gN(e){const r=e.children||"",s=new $y;return typeof r=="string"&&(s.value=r),s}function xN(e,r){const s=r.allowedElements,i=r.allowElement,c=r.components,u=r.disallowedElements,f=r.skipHtml,l=r.unwrapDisallowed,d=r.urlTransform||vN;for(const g of fN)Object.hasOwn(r,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+dN+g.id,void 0);return tf(e,p),L2(e,{Fragment:o.Fragment,components:c,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function p(g,m,b){if(g.type==="raw"&&b&&typeof m=="number")return f?b.children.splice(m,1):b.children[m]={type:"text",value:g.value},m;if(g.type==="element"){let _;for(_ in Yd)if(Object.hasOwn(Yd,_)&&Object.hasOwn(g.properties,_)){const E=g.properties[_],C=Yd[_];(C===null||C.includes(g.tagName))&&(g.properties[_]=d(String(E||""),_,g))}}if(g.type==="element"){let _=s?!s.includes(g.tagName):u?u.includes(g.tagName):!1;if(!_&&i&&typeof m=="number"&&(_=!i(g,m,b)),_&&b&&typeof m=="number")return l&&g.children?b.children.splice(m,1,...g.children):b.children.splice(m,1),m}}}function vN(e){const r=e.indexOf(":"),s=e.indexOf("?"),i=e.indexOf("#"),c=e.indexOf("/");return r===-1||c!==-1&&r>c||s!==-1&&r>s||i!==-1&&r>i||hN.test(e.slice(0,r))?e:""}function Vv(e,r){const s=String(e);if(typeof r!="string")throw new TypeError("Expected character");let i=0,c=s.indexOf(r);for(;c!==-1;)i++,c=s.indexOf(r,c+r.length);return i}function bN(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function yN(e,r,s){const c=xc((s||{}).ignore||[]),u=_N(r);let f=-1;for(;++f<u.length;)Uy(e,"text",l);function l(p,g){let m=-1,b;for(;++m<g.length;){const _=g[m],E=b?b.children:void 0;if(c(_,E?E.indexOf(_):void 0,b))return;b=_}if(b)return d(p,g)}function d(p,g){const m=g[g.length-1],b=u[f][0],_=u[f][1];let E=0;const y=m.children.indexOf(p);let v=!1,x=[];b.lastIndex=0;let S=b.exec(p.value);for(;S;){const j=S.index,T={index:S.index,input:S.input,stack:[...g,p]};let N=_(...S,T);if(typeof N=="string"&&(N=N.length>0?{type:"text",value:N}:void 0),N===!1?b.lastIndex=j+1:(E!==j&&x.push({type:"text",value:p.value.slice(E,j)}),Array.isArray(N)?x.push(...N):N&&x.push(N),E=j+S[0].length,v=!0),!b.global)break;S=b.exec(p.value)}return v?(E<p.value.length&&x.push({type:"text",value:p.value.slice(E)}),m.children.splice(y,1,...x)):x=[p],y+x.length}}function _N(e){const r=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const s=!e[0]||Array.isArray(e[0])?e:[e];let i=-1;for(;++i<s.length;){const c=s[i];r.push([SN(c[0]),wN(c[1])])}return r}function SN(e){return typeof e=="string"?new RegExp(bN(e),"g"):e}function wN(e){return typeof e=="function"?e:function(){return e}}const ah="phrasing",oh=["autolink","link","image","label"];function CN(){return{transforms:[DN],enter:{literalAutolink:EN,literalAutolinkEmail:lh,literalAutolinkHttp:lh,literalAutolinkWww:lh},exit:{literalAutolink:AN,literalAutolinkEmail:TN,literalAutolinkHttp:jN,literalAutolinkWww:NN}}}function kN(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:ah,notInConstruct:oh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:ah,notInConstruct:oh},{character:":",before:"[ps]",after:"\\/",inConstruct:ah,notInConstruct:oh}]}}function EN(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function lh(e){this.config.enter.autolinkProtocol.call(this,e)}function jN(e){this.config.exit.autolinkProtocol.call(this,e)}function NN(e){this.config.exit.data.call(this,e);const r=this.stack[this.stack.length-1];r.type,r.url="http://"+this.sliceSerialize(e)}function TN(e){this.config.exit.autolinkEmail.call(this,e)}function AN(e){this.exit(e)}function DN(e){yN(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,LN],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),RN]],{ignore:["link","linkReference"]})}function LN(e,r,s,i,c){let u="";if(!qy(c)||(/^w/i.test(r)&&(s=r+s,r="",u="http://"),!ON(s)))return!1;const f=MN(s+i);if(!f[0])return!1;const l={type:"link",title:null,url:u+r+f[0],children:[{type:"text",value:r+f[0]}]};return f[1]?[l,{type:"text",value:f[1]}]:l}function RN(e,r,s,i){return!qy(i,!0)||/[-\d_]$/.test(s)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+s,children:[{type:"text",value:r+"@"+s}]}}function ON(e){const r=e.split(".");return!(r.length<2||r[r.length-1]&&(/_/.test(r[r.length-1])||!/[a-zA-Z\d]/.test(r[r.length-1]))||r[r.length-2]&&(/_/.test(r[r.length-2])||!/[a-zA-Z\d]/.test(r[r.length-2])))}function MN(e){const r=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!r)return[e,void 0];e=e.slice(0,r.index);let s=r[0],i=s.indexOf(")");const c=Vv(e,"(");let u=Vv(e,")");for(;i!==-1&&c>u;)e+=s.slice(0,i+1),s=s.slice(i+1),i=s.indexOf(")"),u++;return[e,s]}function qy(e,r){const s=e.input.charCodeAt(e.index-1);return(e.index===0||$s(s)||pc(s))&&(!r||s!==47)}Wy.peek=qN;function IN(){this.buffer()}function BN(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function zN(){this.buffer()}function HN(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function PN(e){const r=this.resume(),s=this.stack[this.stack.length-1];s.type,s.identifier=ar(this.sliceSerialize(e)).toLowerCase(),s.label=r}function FN(e){this.exit(e)}function UN(e){const r=this.resume(),s=this.stack[this.stack.length-1];s.type,s.identifier=ar(this.sliceSerialize(e)).toLowerCase(),s.label=r}function $N(e){this.exit(e)}function qN(){return"["}function Wy(e,r,s,i){const c=s.createTracker(i);let u=c.move("[^");const f=s.enter("footnoteReference"),l=s.enter("reference");return u+=c.move(s.safe(s.associationId(e),{after:"]",before:u})),l(),f(),u+=c.move("]"),u}function WN(){return{enter:{gfmFootnoteCallString:IN,gfmFootnoteCall:BN,gfmFootnoteDefinitionLabelString:zN,gfmFootnoteDefinition:HN},exit:{gfmFootnoteCallString:PN,gfmFootnoteCall:FN,gfmFootnoteDefinitionLabelString:UN,gfmFootnoteDefinition:$N}}}function VN(e){let r=!1;return e&&e.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:s,footnoteReference:Wy},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function s(i,c,u,f){const l=u.createTracker(f);let d=l.move("[^");const p=u.enter("footnoteDefinition"),g=u.enter("label");return d+=l.move(u.safe(u.associationId(i),{before:d,after:"]"})),g(),d+=l.move("]:"),i.children&&i.children.length>0&&(l.shift(4),d+=l.move((r?`
105
+ `:" ")+u.indentLines(u.containerFlow(i,l.current()),r?Vy:GN))),p(),d}}function GN(e,r,s){return r===0?e:Vy(e,r,s)}function Vy(e,r,s){return(s?"":" ")+e}const KN=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Gy.peek=JN;function YN(){return{canContainEols:["delete"],enter:{strikethrough:ZN},exit:{strikethrough:QN}}}function XN(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:KN}],handlers:{delete:Gy}}}function ZN(e){this.enter({type:"delete",children:[]},e)}function QN(e){this.exit(e)}function Gy(e,r,s,i){const c=s.createTracker(i),u=s.enter("strikethrough");let f=c.move("~~");return f+=s.containerPhrasing(e,{...c.current(),before:f,after:"~"}),f+=c.move("~~"),u(),f}function JN(){return"~"}function eT(e){return e.length}function tT(e,r){const s=r||{},i=(s.align||[]).concat(),c=s.stringLength||eT,u=[],f=[],l=[],d=[];let p=0,g=-1;for(;++g<e.length;){const C=[],y=[];let v=-1;for(e[g].length>p&&(p=e[g].length);++v<e[g].length;){const x=nT(e[g][v]);if(s.alignDelimiters!==!1){const S=c(x);y[v]=S,(d[v]===void 0||S>d[v])&&(d[v]=S)}C.push(x)}f[g]=C,l[g]=y}let m=-1;if(typeof i=="object"&&"length"in i)for(;++m<p;)u[m]=Gv(i[m]);else{const C=Gv(i);for(;++m<p;)u[m]=C}m=-1;const b=[],_=[];for(;++m<p;){const C=u[m];let y="",v="";C===99?(y=":",v=":"):C===108?y=":":C===114&&(v=":");let x=s.alignDelimiters===!1?1:Math.max(1,d[m]-y.length-v.length);const S=y+"-".repeat(x)+v;s.alignDelimiters!==!1&&(x=y.length+x+v.length,x>d[m]&&(d[m]=x),_[m]=x),b[m]=S}f.splice(1,0,b),l.splice(1,0,_),g=-1;const E=[];for(;++g<f.length;){const C=f[g],y=l[g];m=-1;const v=[];for(;++m<p;){const x=C[m]||"";let S="",j="";if(s.alignDelimiters!==!1){const T=d[m]-(y[m]||0),N=u[m];N===114?S=" ".repeat(T):N===99?T%2?(S=" ".repeat(T/2+.5),j=" ".repeat(T/2-.5)):(S=" ".repeat(T/2),j=S):j=" ".repeat(T)}s.delimiterStart!==!1&&!m&&v.push("|"),s.padding!==!1&&!(s.alignDelimiters===!1&&x==="")&&(s.delimiterStart!==!1||m)&&v.push(" "),s.alignDelimiters!==!1&&v.push(S),v.push(x),s.alignDelimiters!==!1&&v.push(j),s.padding!==!1&&v.push(" "),(s.delimiterEnd!==!1||m!==p-1)&&v.push("|")}E.push(s.delimiterEnd===!1?v.join("").replace(/ +$/,""):v.join(""))}return E.join(`
106
+ `)}function nT(e){return e==null?"":String(e)}function Gv(e){const r=typeof e=="string"?e.codePointAt(0):0;return r===67||r===99?99:r===76||r===108?108:r===82||r===114?114:0}function rT(e,r,s,i){const c=s.enter("blockquote"),u=s.createTracker(i);u.move("> "),u.shift(2);const f=s.indentLines(s.containerFlow(e,u.current()),sT);return c(),f}function sT(e,r,s){return">"+(s?"":" ")+e}function iT(e,r){return Kv(e,r.inConstruct,!0)&&!Kv(e,r.notInConstruct,!1)}function Kv(e,r,s){if(typeof r=="string"&&(r=[r]),!r||r.length===0)return s;let i=-1;for(;++i<r.length;)if(e.includes(r[i]))return!0;return!1}function Yv(e,r,s,i){let c=-1;for(;++c<s.unsafe.length;)if(s.unsafe[c].character===`
107
+ `&&iT(s.stack,s.unsafe[c]))return/[ \t]/.test(i.before)?"":" ";return`\\
108
+ `}function aT(e,r){const s=String(e);let i=s.indexOf(r),c=i,u=0,f=0;if(typeof r!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===c?++u>f&&(f=u):u=1,c=i+r.length,i=s.indexOf(r,c);return f}function oT(e,r){return!!(r.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function lT(e){const r=e.options.fence||"`";if(r!=="`"&&r!=="~")throw new Error("Cannot serialize code with `"+r+"` for `options.fence`, expected `` ` `` or `~`");return r}function cT(e,r,s,i){const c=lT(s),u=e.value||"",f=c==="`"?"GraveAccent":"Tilde";if(oT(e,s)){const m=s.enter("codeIndented"),b=s.indentLines(u,uT);return m(),b}const l=s.createTracker(i),d=c.repeat(Math.max(aT(u,c)+1,3)),p=s.enter("codeFenced");let g=l.move(d);if(e.lang){const m=s.enter(`codeFencedLang${f}`);g+=l.move(s.safe(e.lang,{before:g,after:" ",encode:["`"],...l.current()})),m()}if(e.lang&&e.meta){const m=s.enter(`codeFencedMeta${f}`);g+=l.move(" "),g+=l.move(s.safe(e.meta,{before:g,after:`
109
+ `,encode:["`"],...l.current()})),m()}return g+=l.move(`
110
+ `),u&&(g+=l.move(u+`
111
+ `)),g+=l.move(d),p(),g}function uT(e,r,s){return(s?"":" ")+e}function rf(e){const r=e.options.quote||'"';if(r!=='"'&&r!=="'")throw new Error("Cannot serialize title with `"+r+"` for `options.quote`, expected `\"`, or `'`");return r}function dT(e,r,s,i){const c=rf(s),u=c==='"'?"Quote":"Apostrophe",f=s.enter("definition");let l=s.enter("label");const d=s.createTracker(i);let p=d.move("[");return p+=d.move(s.safe(s.associationId(e),{before:p,after:"]",...d.current()})),p+=d.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=s.enter("destinationLiteral"),p+=d.move("<"),p+=d.move(s.safe(e.url,{before:p,after:">",...d.current()})),p+=d.move(">")):(l=s.enter("destinationRaw"),p+=d.move(s.safe(e.url,{before:p,after:e.title?" ":`
112
+ `,...d.current()}))),l(),e.title&&(l=s.enter(`title${u}`),p+=d.move(" "+c),p+=d.move(s.safe(e.title,{before:p,after:c,...d.current()})),p+=d.move(c),l()),f(),p}function hT(e){const r=e.options.emphasis||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize emphasis with `"+r+"` for `options.emphasis`, expected `*`, or `_`");return r}function uo(e){return"&#x"+e.toString(16).toUpperCase()+";"}function tc(e,r,s){const i=$i(e),c=$i(r);return i===void 0?c===void 0?s==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Ky.peek=fT;function Ky(e,r,s,i){const c=hT(s),u=s.enter("emphasis"),f=s.createTracker(i),l=f.move(c);let d=f.move(s.containerPhrasing(e,{after:c,before:l,...f.current()}));const p=d.charCodeAt(0),g=tc(i.before.charCodeAt(i.before.length-1),p,c);g.inside&&(d=uo(p)+d.slice(1));const m=d.charCodeAt(d.length-1),b=tc(i.after.charCodeAt(0),m,c);b.inside&&(d=d.slice(0,-1)+uo(m));const _=f.move(c);return u(),s.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},l+d+_}function fT(e,r,s){return s.options.emphasis||"*"}function pT(e,r){let s=!1;return tf(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return s=!0,Sh}),!!((!e.depth||e.depth<3)&&Yh(e)&&(r.options.setext||s))}function mT(e,r,s,i){const c=Math.max(Math.min(6,e.depth||1),1),u=s.createTracker(i);if(pT(e,s)){const g=s.enter("headingSetext"),m=s.enter("phrasing"),b=s.containerPhrasing(e,{...u.current(),before:`
113
+ `,after:`
114
+ `});return m(),g(),b+`
115
+ `+(c===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
116
+ `))+1))}const f="#".repeat(c),l=s.enter("headingAtx"),d=s.enter("phrasing");u.move(f+" ");let p=s.containerPhrasing(e,{before:"# ",after:`
117
+ `,...u.current()});return/^[\t ]/.test(p)&&(p=uo(p.charCodeAt(0))+p.slice(1)),p=p?f+" "+p:f,s.options.closeAtx&&(p+=" "+f),d(),l(),p}Yy.peek=gT;function Yy(e){return e.value||""}function gT(){return"<"}Xy.peek=xT;function Xy(e,r,s,i){const c=rf(s),u=c==='"'?"Quote":"Apostrophe",f=s.enter("image");let l=s.enter("label");const d=s.createTracker(i);let p=d.move("![");return p+=d.move(s.safe(e.alt,{before:p,after:"]",...d.current()})),p+=d.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=s.enter("destinationLiteral"),p+=d.move("<"),p+=d.move(s.safe(e.url,{before:p,after:">",...d.current()})),p+=d.move(">")):(l=s.enter("destinationRaw"),p+=d.move(s.safe(e.url,{before:p,after:e.title?" ":")",...d.current()}))),l(),e.title&&(l=s.enter(`title${u}`),p+=d.move(" "+c),p+=d.move(s.safe(e.title,{before:p,after:c,...d.current()})),p+=d.move(c),l()),p+=d.move(")"),f(),p}function xT(){return"!"}Zy.peek=vT;function Zy(e,r,s,i){const c=e.referenceType,u=s.enter("imageReference");let f=s.enter("label");const l=s.createTracker(i);let d=l.move("![");const p=s.safe(e.alt,{before:d,after:"]",...l.current()});d+=l.move(p+"]["),f();const g=s.stack;s.stack=[],f=s.enter("reference");const m=s.safe(s.associationId(e),{before:d,after:"]",...l.current()});return f(),s.stack=g,u(),c==="full"||!p||p!==m?d+=l.move(m+"]"):c==="shortcut"?d=d.slice(0,-1):d+=l.move("]"),d}function vT(){return"!"}Qy.peek=bT;function Qy(e,r,s){let i=e.value||"",c="`",u=-1;for(;new RegExp("(^|[^`])"+c+"([^`]|$)").test(i);)c+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++u<s.unsafe.length;){const f=s.unsafe[u],l=s.compilePattern(f);let d;if(f.atBreak)for(;d=l.exec(i);){let p=d.index;i.charCodeAt(p)===10&&i.charCodeAt(p-1)===13&&p--,i=i.slice(0,p)+" "+i.slice(d.index+1)}}return c+i+c}function bT(){return"`"}function Jy(e,r){const s=Yh(e);return!!(!r.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(s===e.url||"mailto:"+s===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}e0.peek=yT;function e0(e,r,s,i){const c=rf(s),u=c==='"'?"Quote":"Apostrophe",f=s.createTracker(i);let l,d;if(Jy(e,s)){const g=s.stack;s.stack=[],l=s.enter("autolink");let m=f.move("<");return m+=f.move(s.containerPhrasing(e,{before:m,after:">",...f.current()})),m+=f.move(">"),l(),s.stack=g,m}l=s.enter("link"),d=s.enter("label");let p=f.move("[");return p+=f.move(s.containerPhrasing(e,{before:p,after:"](",...f.current()})),p+=f.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=s.enter("destinationLiteral"),p+=f.move("<"),p+=f.move(s.safe(e.url,{before:p,after:">",...f.current()})),p+=f.move(">")):(d=s.enter("destinationRaw"),p+=f.move(s.safe(e.url,{before:p,after:e.title?" ":")",...f.current()}))),d(),e.title&&(d=s.enter(`title${u}`),p+=f.move(" "+c),p+=f.move(s.safe(e.title,{before:p,after:c,...f.current()})),p+=f.move(c),d()),p+=f.move(")"),l(),p}function yT(e,r,s){return Jy(e,s)?"<":"["}t0.peek=_T;function t0(e,r,s,i){const c=e.referenceType,u=s.enter("linkReference");let f=s.enter("label");const l=s.createTracker(i);let d=l.move("[");const p=s.containerPhrasing(e,{before:d,after:"]",...l.current()});d+=l.move(p+"]["),f();const g=s.stack;s.stack=[],f=s.enter("reference");const m=s.safe(s.associationId(e),{before:d,after:"]",...l.current()});return f(),s.stack=g,u(),c==="full"||!p||p!==m?d+=l.move(m+"]"):c==="shortcut"?d=d.slice(0,-1):d+=l.move("]"),d}function _T(){return"["}function sf(e){const r=e.options.bullet||"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bullet`, expected `*`, `+`, or `-`");return r}function ST(e){const r=sf(e),s=e.options.bulletOther;if(!s)return r==="*"?"-":"*";if(s!=="*"&&s!=="+"&&s!=="-")throw new Error("Cannot serialize items with `"+s+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(s===r)throw new Error("Expected `bullet` (`"+r+"`) and `bulletOther` (`"+s+"`) to be different");return s}function wT(e){const r=e.options.bulletOrdered||".";if(r!=="."&&r!==")")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOrdered`, expected `.` or `)`");return r}function n0(e){const r=e.options.rule||"*";if(r!=="*"&&r!=="-"&&r!=="_")throw new Error("Cannot serialize rules with `"+r+"` for `options.rule`, expected `*`, `-`, or `_`");return r}function CT(e,r,s,i){const c=s.enter("list"),u=s.bulletCurrent;let f=e.ordered?wT(s):sf(s);const l=e.ordered?f==="."?")":".":ST(s);let d=r&&s.bulletLastUsed?f===s.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((f==="*"||f==="-")&&g&&(!g.children||!g.children[0])&&s.stack[s.stack.length-1]==="list"&&s.stack[s.stack.length-2]==="listItem"&&s.stack[s.stack.length-3]==="list"&&s.stack[s.stack.length-4]==="listItem"&&s.indexStack[s.indexStack.length-1]===0&&s.indexStack[s.indexStack.length-2]===0&&s.indexStack[s.indexStack.length-3]===0&&(d=!0),n0(s)===f&&g){let m=-1;for(;++m<e.children.length;){const b=e.children[m];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){d=!0;break}}}}d&&(f=l),s.bulletCurrent=f;const p=s.containerFlow(e,i);return s.bulletLastUsed=f,s.bulletCurrent=u,c(),p}function kT(e){const r=e.options.listItemIndent||"one";if(r!=="tab"&&r!=="one"&&r!=="mixed")throw new Error("Cannot serialize items with `"+r+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return r}function ET(e,r,s,i){const c=kT(s);let u=s.bulletCurrent||sf(s);r&&r.type==="list"&&r.ordered&&(u=(typeof r.start=="number"&&r.start>-1?r.start:1)+(s.options.incrementListMarker===!1?0:r.children.indexOf(e))+u);let f=u.length+1;(c==="tab"||c==="mixed"&&(r&&r.type==="list"&&r.spread||e.spread))&&(f=Math.ceil(f/4)*4);const l=s.createTracker(i);l.move(u+" ".repeat(f-u.length)),l.shift(f);const d=s.enter("listItem"),p=s.indentLines(s.containerFlow(e,l.current()),g);return d(),p;function g(m,b,_){return b?(_?"":" ".repeat(f))+m:(_?u:u+" ".repeat(f-u.length))+m}}function jT(e,r,s,i){const c=s.enter("paragraph"),u=s.enter("phrasing"),f=s.containerPhrasing(e,i);return u(),c(),f}const NT=xc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function TT(e,r,s,i){return(e.children.some(function(f){return NT(f)})?s.containerPhrasing:s.containerFlow).call(s,e,i)}function AT(e){const r=e.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}r0.peek=DT;function r0(e,r,s,i){const c=AT(s),u=s.enter("strong"),f=s.createTracker(i),l=f.move(c+c);let d=f.move(s.containerPhrasing(e,{after:c,before:l,...f.current()}));const p=d.charCodeAt(0),g=tc(i.before.charCodeAt(i.before.length-1),p,c);g.inside&&(d=uo(p)+d.slice(1));const m=d.charCodeAt(d.length-1),b=tc(i.after.charCodeAt(0),m,c);b.inside&&(d=d.slice(0,-1)+uo(m));const _=f.move(c+c);return u(),s.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},l+d+_}function DT(e,r,s){return s.options.strong||"*"}function LT(e,r,s,i){return s.safe(e.value,i)}function RT(e){const r=e.options.ruleRepetition||3;if(r<3)throw new Error("Cannot serialize rules with repetition `"+r+"` for `options.ruleRepetition`, expected `3` or more");return r}function OT(e,r,s){const i=(n0(s)+(s.options.ruleSpaces?" ":"")).repeat(RT(s));return s.options.ruleSpaces?i.slice(0,-1):i}const s0={blockquote:rT,break:Yv,code:cT,definition:dT,emphasis:Ky,hardBreak:Yv,heading:mT,html:Yy,image:Xy,imageReference:Zy,inlineCode:Qy,link:e0,linkReference:t0,list:CT,listItem:ET,paragraph:jT,root:TT,strong:r0,text:LT,thematicBreak:OT};function MT(){return{enter:{table:IT,tableData:Xv,tableHeader:Xv,tableRow:zT},exit:{codeText:HT,table:BT,tableData:ch,tableHeader:ch,tableRow:ch}}}function IT(e){const r=e._align;this.enter({type:"table",align:r.map(function(s){return s==="none"?null:s}),children:[]},e),this.data.inTable=!0}function BT(e){this.exit(e),this.data.inTable=void 0}function zT(e){this.enter({type:"tableRow",children:[]},e)}function ch(e){this.exit(e)}function Xv(e){this.enter({type:"tableCell",children:[]},e)}function HT(e){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,PT));const s=this.stack[this.stack.length-1];s.type,s.value=r,this.exit(e)}function PT(e,r){return r==="|"?r:e}function FT(e){const r=e||{},s=r.tableCellPadding,i=r.tablePipeAlign,c=r.stringLength,u=s?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
118
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:f,tableCell:d,tableRow:l}};function f(_,E,C,y){return p(g(_,C,y),_.align)}function l(_,E,C,y){const v=m(_,C,y),x=p([v]);return x.slice(0,x.indexOf(`
119
+ `))}function d(_,E,C,y){const v=C.enter("tableCell"),x=C.enter("phrasing"),S=C.containerPhrasing(_,{...y,before:u,after:u});return x(),v(),S}function p(_,E){return tT(_,{align:E,alignDelimiters:i,padding:s,stringLength:c})}function g(_,E,C){const y=_.children;let v=-1;const x=[],S=E.enter("table");for(;++v<y.length;)x[v]=m(y[v],E,C);return S(),x}function m(_,E,C){const y=_.children;let v=-1;const x=[],S=E.enter("tableRow");for(;++v<y.length;)x[v]=d(y[v],_,E,C);return S(),x}function b(_,E,C){let y=s0.inlineCode(_,E,C);return C.stack.includes("tableCell")&&(y=y.replace(/\|/g,"\\$&")),y}}function UT(){return{exit:{taskListCheckValueChecked:Zv,taskListCheckValueUnchecked:Zv,paragraph:qT}}}function $T(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:WT}}}function Zv(e){const r=this.stack[this.stack.length-2];r.type,r.checked=e.type==="taskListCheckValueChecked"}function qT(e){const r=this.stack[this.stack.length-2];if(r&&r.type==="listItem"&&typeof r.checked=="boolean"){const s=this.stack[this.stack.length-1];s.type;const i=s.children[0];if(i&&i.type==="text"){const c=r.children;let u=-1,f;for(;++u<c.length;){const l=c[u];if(l.type==="paragraph"){f=l;break}}f===s&&(i.value=i.value.slice(1),i.value.length===0?s.children.shift():s.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,s.position.start=Object.assign({},i.position.start)))}}this.exit(e)}function WT(e,r,s,i){const c=e.children[0],u=typeof e.checked=="boolean"&&c&&c.type==="paragraph",f="["+(e.checked?"x":" ")+"] ",l=s.createTracker(i);u&&l.move(f);let d=s0.listItem(e,r,s,{...i,...l.current()});return u&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),d;function p(g){return g+f}}function VT(){return[CN(),WN(),YN(),MT(),UT()]}function GT(e){return{extensions:[kN(),VN(e),XN(),FT(e),$T()]}}const KT={tokenize:e3,partial:!0},i0={tokenize:t3,partial:!0},a0={tokenize:n3,partial:!0},o0={tokenize:r3,partial:!0},YT={tokenize:s3,partial:!0},l0={name:"wwwAutolink",tokenize:QT,previous:u0},c0={name:"protocolAutolink",tokenize:JT,previous:d0},Fr={name:"emailAutolink",tokenize:ZT,previous:h0},xr={};function XT(){return{text:xr}}let Is=48;for(;Is<123;)xr[Is]=Fr,Is++,Is===58?Is=65:Is===91&&(Is=97);xr[43]=Fr;xr[45]=Fr;xr[46]=Fr;xr[95]=Fr;xr[72]=[Fr,c0];xr[104]=[Fr,c0];xr[87]=[Fr,l0];xr[119]=[Fr,l0];function ZT(e,r,s){const i=this;let c,u;return f;function f(m){return!Eh(m)||!h0.call(i,i.previous)||af(i.events)?s(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(m))}function l(m){return Eh(m)?(e.consume(m),l):m===64?(e.consume(m),d):s(m)}function d(m){return m===46?e.check(YT,g,p)(m):m===45||m===95||gn(m)?(u=!0,e.consume(m),d):g(m)}function p(m){return e.consume(m),c=!0,d}function g(m){return u&&c&&bn(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),r(m)):s(m)}}function QT(e,r,s){const i=this;return c;function c(f){return f!==87&&f!==119||!u0.call(i,i.previous)||af(i.events)?s(f):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(KT,e.attempt(i0,e.attempt(a0,u),s),s)(f))}function u(f){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),r(f)}}function JT(e,r,s){const i=this;let c="",u=!1;return f;function f(m){return(m===72||m===104)&&d0.call(i,i.previous)&&!af(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),c+=String.fromCodePoint(m),e.consume(m),l):s(m)}function l(m){if(bn(m)&&c.length<5)return c+=String.fromCodePoint(m),e.consume(m),l;if(m===58){const b=c.toLowerCase();if(b==="http"||b==="https")return e.consume(m),d}return s(m)}function d(m){return m===47?(e.consume(m),u?p:(u=!0,d)):s(m)}function p(m){return m===null||Ql(m)||_t(m)||$s(m)||pc(m)?s(m):e.attempt(i0,e.attempt(a0,g),s)(m)}function g(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),r(m)}}function e3(e,r,s){let i=0;return c;function c(f){return(f===87||f===119)&&i<3?(i++,e.consume(f),c):f===46&&i===3?(e.consume(f),u):s(f)}function u(f){return f===null?s(f):r(f)}}function t3(e,r,s){let i,c,u;return f;function f(p){return p===46||p===95?e.check(o0,d,l)(p):p===null||_t(p)||$s(p)||p!==45&&pc(p)?d(p):(u=!0,e.consume(p),f)}function l(p){return p===95?i=!0:(c=i,i=void 0),e.consume(p),f}function d(p){return c||i||!u?s(p):r(p)}}function n3(e,r){let s=0,i=0;return c;function c(f){return f===40?(s++,e.consume(f),c):f===41&&i<s?u(f):f===33||f===34||f===38||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===60||f===63||f===93||f===95||f===126?e.check(o0,r,u)(f):f===null||_t(f)||$s(f)?r(f):(e.consume(f),c)}function u(f){return f===41&&i++,e.consume(f),c}}function r3(e,r,s){return i;function i(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),i):l===38?(e.consume(l),u):l===93?(e.consume(l),c):l===60||l===null||_t(l)||$s(l)?r(l):s(l)}function c(l){return l===null||l===40||l===91||_t(l)||$s(l)?r(l):i(l)}function u(l){return bn(l)?f(l):s(l)}function f(l){return l===59?(e.consume(l),i):bn(l)?(e.consume(l),f):s(l)}}function s3(e,r,s){return i;function i(u){return e.consume(u),c}function c(u){return gn(u)?s(u):r(u)}}function u0(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||_t(e)}function d0(e){return!bn(e)}function h0(e){return!(e===47||Eh(e))}function Eh(e){return e===43||e===45||e===46||e===95||gn(e)}function af(e){let r=e.length,s=!1;for(;r--;){const i=e[r][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){s=!0;break}if(i._gfmAutolinkLiteralWalkedInto){s=!1;break}}return e.length>0&&!s&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),s}const i3={tokenize:f3,partial:!0};function a3(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:u3,continuation:{tokenize:d3},exit:h3}},text:{91:{name:"gfmFootnoteCall",tokenize:c3},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:o3,resolveTo:l3}}}}function o3(e,r,s){const i=this;let c=i.events.length;const u=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let f;for(;c--;){const d=i.events[c][1];if(d.type==="labelImage"){f=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return l;function l(d){if(!f||!f._balanced)return s(d);const p=ar(i.sliceSerialize({start:f.end,end:i.now()}));return p.codePointAt(0)!==94||!u.includes(p.slice(1))?s(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),r(d))}}function l3(e,r){let s=e.length;for(;s--;)if(e[s][1].type==="labelImage"&&e[s][0]==="enter"){e[s][1];break}e[s+1][1].type="data",e[s+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[s+3][1].start),end:Object.assign({},e[e.length-1][1].end)},c={type:"gfmFootnoteCallMarker",start:Object.assign({},e[s+3][1].end),end:Object.assign({},e[s+3][1].end)};c.end.column++,c.end.offset++,c.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},c.end),end:Object.assign({},e[e.length-1][1].start)},f={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},l=[e[s+1],e[s+2],["enter",i,r],e[s+3],e[s+4],["enter",c,r],["exit",c,r],["enter",u,r],["enter",f,r],["exit",f,r],["exit",u,r],e[e.length-2],e[e.length-1],["exit",i,r]];return e.splice(s,e.length-s+1,...l),e}function c3(e,r,s){const i=this,c=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u=0,f;return l;function l(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),d}function d(m){return m!==94?s(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",p)}function p(m){if(u>999||m===93&&!f||m===null||m===91||_t(m))return s(m);if(m===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return c.includes(ar(i.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),r):s(m)}return _t(m)||(f=!0),u++,e.consume(m),m===92?g:p}function g(m){return m===91||m===92||m===93?(e.consume(m),u++,p):p(m)}}function u3(e,r,s){const i=this,c=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u,f=0,l;return d;function d(E){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(E){return E===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):s(E)}function g(E){if(f>999||E===93&&!l||E===null||E===91||_t(E))return s(E);if(E===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return u=ar(i.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return _t(E)||(l=!0),f++,e.consume(E),E===92?m:g}function m(E){return E===91||E===92||E===93?(e.consume(E),f++,g):g(E)}function b(E){return E===58?(e.enter("definitionMarker"),e.consume(E),e.exit("definitionMarker"),c.includes(u)||c.push(u),at(e,_,"gfmFootnoteDefinitionWhitespace")):s(E)}function _(E){return r(E)}}function d3(e,r,s){return e.check(vo,r,e.attempt(i3,r,s))}function h3(e){e.exit("gfmFootnoteDefinition")}function f3(e,r,s){const i=this;return at(e,c,"gfmFootnoteDefinitionIndent",5);function c(u){const f=i.events[i.events.length-1];return f&&f[1].type==="gfmFootnoteDefinitionIndent"&&f[2].sliceSerialize(f[1],!0).length===4?r(u):s(u)}}function p3(e){let s=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:u,resolveAll:c};return s==null&&(s=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function c(f,l){let d=-1;for(;++d<f.length;)if(f[d][0]==="enter"&&f[d][1].type==="strikethroughSequenceTemporary"&&f[d][1]._close){let p=d;for(;p--;)if(f[p][0]==="exit"&&f[p][1].type==="strikethroughSequenceTemporary"&&f[p][1]._open&&f[d][1].end.offset-f[d][1].start.offset===f[p][1].end.offset-f[p][1].start.offset){f[d][1].type="strikethroughSequence",f[p][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},f[p][1].start),end:Object.assign({},f[d][1].end)},m={type:"strikethroughText",start:Object.assign({},f[p][1].end),end:Object.assign({},f[d][1].start)},b=[["enter",g,l],["enter",f[p][1],l],["exit",f[p][1],l],["enter",m,l]],_=l.parser.constructs.insideSpan.null;_&&Fn(b,b.length,0,mc(_,f.slice(p+1,d),l)),Fn(b,b.length,0,[["exit",m,l],["enter",f[d][1],l],["exit",f[d][1],l],["exit",g,l]]),Fn(f,p-1,d-p+3,b),d=p+b.length-2;break}}for(d=-1;++d<f.length;)f[d][1].type==="strikethroughSequenceTemporary"&&(f[d][1].type="data");return f}function u(f,l,d){const p=this.previous,g=this.events;let m=0;return b;function b(E){return p===126&&g[g.length-1][1].type!=="characterEscape"?d(E):(f.enter("strikethroughSequenceTemporary"),_(E))}function _(E){const C=$i(p);if(E===126)return m>1?d(E):(f.consume(E),m++,_);if(m<2&&!s)return d(E);const y=f.exit("strikethroughSequenceTemporary"),v=$i(E);return y._open=!v||v===2&&!!C,y._close=!C||C===2&&!!v,l(E)}}}class m3{constructor(){this.map=[]}add(r,s,i){g3(this,r,s,i)}consume(r){if(this.map.sort(function(u,f){return u[0]-f[0]}),this.map.length===0)return;let s=this.map.length;const i=[];for(;s>0;)s-=1,i.push(r.slice(this.map[s][0]+this.map[s][1]),this.map[s][2]),r.length=this.map[s][0];i.push(r.slice()),r.length=0;let c=i.pop();for(;c;){for(const u of c)r.push(u);c=i.pop()}this.map.length=0}}function g3(e,r,s,i){let c=0;if(!(s===0&&i.length===0)){for(;c<e.map.length;){if(e.map[c][0]===r){e.map[c][1]+=s,e.map[c][2].push(...i);return}c+=1}e.map.push([r,s,i])}}function x3(e,r){let s=!1;const i=[];for(;r<e.length;){const c=e[r];if(s){if(c[0]==="enter")c[1].type==="tableContent"&&i.push(e[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(c[1].type==="tableContent"){if(e[r-1][1].type==="tableDelimiterMarker"){const u=i.length-1;i[u]=i[u]==="left"?"center":"right"}}else if(c[1].type==="tableDelimiterRow")break}else c[0]==="enter"&&c[1].type==="tableDelimiterRow"&&(s=!0);r+=1}return i}function v3(){return{flow:{null:{name:"table",tokenize:b3,resolveAll:y3}}}}function b3(e,r,s){const i=this;let c=0,u=0,f;return l;function l(O){let q=i.events.length-1;for(;q>-1;){const I=i.events[q][1].type;if(I==="lineEnding"||I==="linePrefix")q--;else break}const G=q>-1?i.events[q][1].type:null,W=G==="tableHead"||G==="tableRow"?N:d;return W===N&&i.parser.lazy[i.now().line]?s(O):W(O)}function d(O){return e.enter("tableHead"),e.enter("tableRow"),p(O)}function p(O){return O===124||(f=!0,u+=1),g(O)}function g(O){return O===null?s(O):He(O)?u>1?(u=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),_):s(O):tt(O)?at(e,g,"whitespace")(O):(u+=1,f&&(f=!1,c+=1),O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),f=!0,g):(e.enter("data"),m(O)))}function m(O){return O===null||O===124||_t(O)?(e.exit("data"),g(O)):(e.consume(O),O===92?b:m)}function b(O){return O===92||O===124?(e.consume(O),m):m(O)}function _(O){return i.interrupt=!1,i.parser.lazy[i.now().line]?s(O):(e.enter("tableDelimiterRow"),f=!1,tt(O)?at(e,E,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):E(O))}function E(O){return O===45||O===58?y(O):O===124?(f=!0,e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),C):T(O)}function C(O){return tt(O)?at(e,y,"whitespace")(O):y(O)}function y(O){return O===58?(u+=1,f=!0,e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),v):O===45?(u+=1,v(O)):O===null||He(O)?j(O):T(O)}function v(O){return O===45?(e.enter("tableDelimiterFiller"),x(O)):T(O)}function x(O){return O===45?(e.consume(O),x):O===58?(f=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),S):(e.exit("tableDelimiterFiller"),S(O))}function S(O){return tt(O)?at(e,j,"whitespace")(O):j(O)}function j(O){return O===124?E(O):O===null||He(O)?!f||c!==u?T(O):(e.exit("tableDelimiterRow"),e.exit("tableHead"),r(O)):T(O)}function T(O){return s(O)}function N(O){return e.enter("tableRow"),D(O)}function D(O){return O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),D):O===null||He(O)?(e.exit("tableRow"),r(O)):tt(O)?at(e,D,"whitespace")(O):(e.enter("data"),A(O))}function A(O){return O===null||O===124||_t(O)?(e.exit("data"),D(O)):(e.consume(O),O===92?z:A)}function z(O){return O===92||O===124?(e.consume(O),A):A(O)}}function y3(e,r){let s=-1,i=!0,c=0,u=[0,0,0,0],f=[0,0,0,0],l=!1,d=0,p,g,m;const b=new m3;for(;++s<e.length;){const _=e[s],E=_[1];_[0]==="enter"?E.type==="tableHead"?(l=!1,d!==0&&(Qv(b,r,d,p,g),g=void 0,d=0),p={type:"table",start:Object.assign({},E.start),end:Object.assign({},E.end)},b.add(s,0,[["enter",p,r]])):E.type==="tableRow"||E.type==="tableDelimiterRow"?(i=!0,m=void 0,u=[0,0,0,0],f=[0,s+1,0,0],l&&(l=!1,g={type:"tableBody",start:Object.assign({},E.start),end:Object.assign({},E.end)},b.add(s,0,[["enter",g,r]])),c=E.type==="tableDelimiterRow"?2:g?3:1):c&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")?(i=!1,f[2]===0&&(u[1]!==0&&(f[0]=f[1],m=Pl(b,r,u,c,void 0,m),u=[0,0,0,0]),f[2]=s)):E.type==="tableCellDivider"&&(i?i=!1:(u[1]!==0&&(f[0]=f[1],m=Pl(b,r,u,c,void 0,m)),u=f,f=[u[1],s,0,0])):E.type==="tableHead"?(l=!0,d=s):E.type==="tableRow"||E.type==="tableDelimiterRow"?(d=s,u[1]!==0?(f[0]=f[1],m=Pl(b,r,u,c,s,m)):f[1]!==0&&(m=Pl(b,r,f,c,s,m)),c=0):c&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")&&(f[3]=s)}for(d!==0&&Qv(b,r,d,p,g),b.consume(r.events),s=-1;++s<r.events.length;){const _=r.events[s];_[0]==="enter"&&_[1].type==="table"&&(_[1]._align=x3(r.events,s))}return e}function Pl(e,r,s,i,c,u){const f=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",l="tableContent";s[0]!==0&&(u.end=Object.assign({},zi(r.events,s[0])),e.add(s[0],0,[["exit",u,r]]));const d=zi(r.events,s[1]);if(u={type:f,start:Object.assign({},d),end:Object.assign({},d)},e.add(s[1],0,[["enter",u,r]]),s[2]!==0){const p=zi(r.events,s[2]),g=zi(r.events,s[3]),m={type:l,start:Object.assign({},p),end:Object.assign({},g)};if(e.add(s[2],0,[["enter",m,r]]),i!==2){const b=r.events[s[2]],_=r.events[s[3]];if(b[1].end=Object.assign({},_[1].end),b[1].type="chunkText",b[1].contentType="text",s[3]>s[2]+1){const E=s[2]+1,C=s[3]-s[2]-1;e.add(E,C,[])}}e.add(s[3]+1,0,[["exit",m,r]])}return c!==void 0&&(u.end=Object.assign({},zi(r.events,c)),e.add(c,0,[["exit",u,r]]),u=void 0),u}function Qv(e,r,s,i,c){const u=[],f=zi(r.events,s);c&&(c.end=Object.assign({},f),u.push(["exit",c,r])),i.end=Object.assign({},f),u.push(["exit",i,r]),e.add(s+1,0,u)}function zi(e,r){const s=e[r],i=s[0]==="enter"?"start":"end";return s[1][i]}const _3={name:"tasklistCheck",tokenize:w3};function S3(){return{text:{91:_3}}}function w3(e,r,s){const i=this;return c;function c(d){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?s(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),u)}function u(d){return _t(d)?(e.enter("taskListCheckValueUnchecked"),e.consume(d),e.exit("taskListCheckValueUnchecked"),f):d===88||d===120?(e.enter("taskListCheckValueChecked"),e.consume(d),e.exit("taskListCheckValueChecked"),f):s(d)}function f(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):s(d)}function l(d){return He(d)?r(d):tt(d)?e.check({tokenize:C3},r,s)(d):s(d)}}function C3(e,r,s){return at(e,i,"whitespace");function i(c){return c===null?s(c):r(c)}}function k3(e){return wy([XT(),a3(),p3(e),v3(),S3()])}const E3={};function j3(e){const r=this,s=e||E3,i=r.data(),c=i.micromarkExtensions||(i.micromarkExtensions=[]),u=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),f=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);c.push(k3(s)),u.push(VT()),f.push(GT(s))}function N3(e,r){if(e==null)return{};var s={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(r.indexOf(i)!==-1)continue;s[i]=e[i]}return s}function T3(e,r){if(e==null)return{};var s,i,c=N3(e,r);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(i=0;i<u.length;i++)s=u[i],r.indexOf(s)===-1&&{}.propertyIsEnumerable.call(e,s)&&(c[s]=e[s])}return c}function jh(e,r){(r==null||r>e.length)&&(r=e.length);for(var s=0,i=Array(r);s<r;s++)i[s]=e[s];return i}function A3(e){if(Array.isArray(e))return jh(e)}function D3(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function L3(e,r){if(e){if(typeof e=="string")return jh(e,r);var s={}.toString.call(e).slice(8,-1);return s==="Object"&&e.constructor&&(s=e.constructor.name),s==="Map"||s==="Set"?Array.from(e):s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?jh(e,r):void 0}}function R3(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
120
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Nh(e){return A3(e)||D3(e)||L3(e)||R3()}function ho(e){"@babel/helpers - typeof";return ho=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ho(e)}function O3(e,r){if(ho(e)!="object"||!e)return e;var s=e[Symbol.toPrimitive];if(s!==void 0){var i=s.call(e,r);if(ho(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function M3(e){var r=O3(e,"string");return ho(r)=="symbol"?r:r+""}function f0(e,r,s){return(r=M3(r))in e?Object.defineProperty(e,r,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[r]=s,e}function Th(){return Th=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var s=arguments[r];for(var i in s)({}).hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},Th.apply(null,arguments)}function Jv(e,r){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(c){return Object.getOwnPropertyDescriptor(e,c).enumerable})),s.push.apply(s,i)}return s}function Hi(e){for(var r=1;r<arguments.length;r++){var s=arguments[r]!=null?arguments[r]:{};r%2?Jv(Object(s),!0).forEach(function(i){f0(e,i,s[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):Jv(Object(s)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(s,i))})}return e}function I3(e){var r=e.length;if(r===0||r===1)return e;if(r===2)return[e[0],e[1],"".concat(e[0],".").concat(e[1]),"".concat(e[1],".").concat(e[0])];if(r===3)return[e[0],e[1],e[2],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0])];if(r>=4)return[e[0],e[1],e[2],e[3],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[2],".").concat(e[3]),"".concat(e[3],".").concat(e[0]),"".concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[0]),"".concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[3],".").concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[2],".").concat(e[1],".").concat(e[0])]}var uh={};function B3(e){if(e.length===0||e.length===1)return e;var r=e.join(".");return uh[r]||(uh[r]=I3(e)),uh[r]}function z3(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0,i=e.filter(function(u){return u!=="token"}),c=B3(i);return c.reduce(function(u,f){return Hi(Hi({},u),s[f])},r)}function eb(e){return e.join(" ")}function H3(e,r){var s=0;return function(i){return s+=1,i.map(function(c,u){return p0({node:c,stylesheet:e,useInlineStyles:r,key:"code-segment-".concat(s,"-").concat(u)})})}}function p0(e){var r=e.node,s=e.stylesheet,i=e.style,c=i===void 0?{}:i,u=e.useInlineStyles,f=e.key,l=r.properties,d=r.type,p=r.tagName,g=r.value;if(d==="text")return g;if(p){var m=H3(s,u),b;if(!u)b=Hi(Hi({},l),{},{className:eb(l.className)});else{var _=Object.keys(s).reduce(function(v,x){return x.split(".").forEach(function(S){v.includes(S)||v.push(S)}),v},[]),E=l.className&&l.className.includes("token")?["token"]:[],C=l.className&&E.concat(l.className.filter(function(v){return!_.includes(v)}));b=Hi(Hi({},l),{},{className:eb(C)||void 0,style:z3(l.className,Object.assign({},l.style,c),s)})}var y=m(r.children);return mn.createElement(p,Th({key:f},b),y)}}const P3=(function(e,r){var s=e.listLanguages();return s.indexOf(r)!==-1});var F3=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function tb(e,r){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(c){return Object.getOwnPropertyDescriptor(e,c).enumerable})),s.push.apply(s,i)}return s}function ms(e){for(var r=1;r<arguments.length;r++){var s=arguments[r]!=null?arguments[r]:{};r%2?tb(Object(s),!0).forEach(function(i){f0(e,i,s[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):tb(Object(s)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(s,i))})}return e}var U3=/\n/g;function $3(e){return e.match(U3)}function q3(e){var r=e.lines,s=e.startingLineNumber,i=e.style;return r.map(function(c,u){var f=u+s;return mn.createElement("span",{key:"line-".concat(u),className:"react-syntax-highlighter-line-number",style:typeof i=="function"?i(f):i},"".concat(f,`
121
+ `))})}function W3(e){var r=e.codeString,s=e.codeStyle,i=e.containerStyle,c=i===void 0?{float:"left",paddingRight:"10px"}:i,u=e.numberStyle,f=u===void 0?{}:u,l=e.startingLineNumber;return mn.createElement("code",{style:Object.assign({},s,c)},q3({lines:r.replace(/\n$/,"").split(`
122
+ `),style:f,startingLineNumber:l}))}function V3(e){return"".concat(e.toString().length,".25em")}function m0(e,r){return{type:"element",tagName:"span",properties:{key:"line-number--".concat(e),className:["comment","linenumber","react-syntax-highlighter-line-number"],style:r},children:[{type:"text",value:e}]}}function g0(e,r,s){var i={display:"inline-block",minWidth:V3(s),paddingRight:"1em",textAlign:"right",userSelect:"none"},c=typeof e=="function"?e(r):e,u=ms(ms({},i),c);return u}function Vl(e){var r=e.children,s=e.lineNumber,i=e.lineNumberStyle,c=e.largestLineNumber,u=e.showInlineLineNumbers,f=e.lineProps,l=f===void 0?{}:f,d=e.className,p=d===void 0?[]:d,g=e.showLineNumbers,m=e.wrapLongLines,b=e.wrapLines,_=b===void 0?!1:b,E=_?ms({},typeof l=="function"?l(s):l):{};if(E.className=E.className?[].concat(Nh(E.className.trim().split(/\s+/)),Nh(p)):p,s&&u){var C=g0(i,s,c);r.unshift(m0(s,C))}return m&g&&(E.style=ms({display:"flex"},E.style)),{type:"element",tagName:"span",properties:E,children:r}}function x0(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];e.length===void 0&&(e=[e]);for(var i=0;i<e.length;i++){var c=e[i];if(c.type==="text")s.push(Vl({children:[c],className:Nh(new Set(r))}));else if(c.children){var u,f=r.concat(((u=c.properties)===null||u===void 0?void 0:u.className)||[]);x0(c.children,f).forEach(function(l){return s.push(l)})}}return s}function G3(e,r,s,i,c,u,f,l,d){var p,g=x0(e.value),m=[],b=-1,_=0;function E(T,N){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return Vl({children:T,lineNumber:N,lineNumberStyle:l,largestLineNumber:f,showInlineLineNumbers:c,lineProps:s,className:D,showLineNumbers:i,wrapLongLines:d,wrapLines:r})}function C(T,N){if(i&&N&&c){var D=g0(l,N,f);T.unshift(m0(N,D))}return T}function y(T,N){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return r||D.length>0?E(T,N,D):C(T,N)}for(var v=function(){var N=g[_],D=N.children[0].value,A=$3(D);if(A){var z=D.split(`
123
+ `);z.forEach(function(O,q){var G=i&&m.length+u,W={type:"text",value:"".concat(O,`
124
+ `)};if(q===0){var I=g.slice(b+1,_).concat(Vl({children:[W],className:N.properties.className})),$=y(I,G);m.push($)}else if(q===z.length-1){var B=g[_+1]&&g[_+1].children&&g[_+1].children[0],X={type:"text",value:"".concat(O)};if(B){var Z=Vl({children:[X],className:N.properties.className});g.splice(_+1,0,Z)}else{var H=[X],L=y(H,G,N.properties.className);m.push(L)}}else{var R=[W],F=y(R,G,N.properties.className);m.push(F)}}),b=_}_++};_<g.length;)v();if(b!==g.length-1){var x=g.slice(b+1,g.length);if(x&&x.length){var S=i&&m.length+u,j=y(x,S);m.push(j)}}return r?m:(p=[]).concat.apply(p,m)}function K3(e){var r=e.rows,s=e.stylesheet,i=e.useInlineStyles;return r.map(function(c,u){return p0({node:c,stylesheet:s,useInlineStyles:i,key:"code-segment-".concat(u)})})}function v0(e){return e&&typeof e.highlightAuto<"u"}function Y3(e){var r=e.astGenerator,s=e.language,i=e.code,c=e.defaultCodeValue;if(v0(r)){var u=P3(r,s);return s==="text"?{value:c,language:"text"}:u?r.highlight(s,i):r.highlightAuto(i)}try{return s&&s!=="text"?{value:r.highlight(i,s)}:{value:c}}catch{return{value:c}}}function X3(e,r){return function(i){var c,u,f=i.language,l=i.children,d=i.style,p=d===void 0?r:d,g=i.customStyle,m=g===void 0?{}:g,b=i.codeTagProps,_=b===void 0?{className:f?"language-".concat(f):void 0,style:ms(ms({},p['code[class*="language-"]']),p['code[class*="language-'.concat(f,'"]')])}:b,E=i.useInlineStyles,C=E===void 0?!0:E,y=i.showLineNumbers,v=y===void 0?!1:y,x=i.showInlineLineNumbers,S=x===void 0?!0:x,j=i.startingLineNumber,T=j===void 0?1:j,N=i.lineNumberContainerStyle,D=i.lineNumberStyle,A=D===void 0?{}:D,z=i.wrapLines,O=i.wrapLongLines,q=O===void 0?!1:O,G=i.lineProps,W=G===void 0?{}:G,I=i.renderer,$=i.PreTag,B=$===void 0?"pre":$,X=i.CodeTag,Z=X===void 0?"code":X,H=i.code,L=H===void 0?(Array.isArray(l)?l[0]:l)||"":H,R=i.astGenerator,F=T3(i,F3);R=R||e;var U=v?mn.createElement(W3,{containerStyle:N,codeStyle:_.style||{},numberStyle:A,startingLineNumber:T,codeString:L}):null,ne=p.hljs||p['pre[class*="language-"]']||{backgroundColor:"#fff"},Q=v0(R)?"hljs":"prismjs",ee=C?Object.assign({},F,{style:Object.assign({},ne,m)}):Object.assign({},F,{className:F.className?"".concat(Q," ").concat(F.className):Q,style:Object.assign({},m)});if(q?_.style=ms({whiteSpace:"pre-wrap"},_.style):_.style=ms({whiteSpace:"pre"},_.style),!R)return mn.createElement(B,ee,U,mn.createElement(Z,_,L));(z===void 0&&I||q)&&(z=!0),I=I||K3;var Y=[{type:"text",value:L}],V=Y3({astGenerator:R,language:f,code:L,defaultCodeValue:Y});V.language===null&&(V.value=Y);var oe=(c=(u=L.match(/\n/g))===null||u===void 0?void 0:u.length)!==null&&c!==void 0?c:0,re=T+oe,ve=G3(V,z,W,v,S,T,re,A,q);return mn.createElement(B,ee,mn.createElement(Z,_,!S&&U,I({rows:ve,stylesheet:p,useInlineStyles:C})))}}const nb=/[#.]/g;function Z3(e,r){const s=e||"",i={};let c=0,u,f;for(;c<s.length;){nb.lastIndex=c;const l=nb.exec(s),d=s.slice(c,l?l.index:s.length);d&&(u?u==="#"?i.id=d:Array.isArray(i.className)?i.className.push(d):i.className=[d]:f=d,c+=d.length),l&&(u=l[0],c++)}return{type:"element",tagName:f||r||"div",properties:i,children:[]}}function b0(e,r,s){const i=s?t5(s):void 0;function c(u,f,...l){let d;if(u==null){d={type:"root",children:[]};const p=f;l.unshift(p)}else{d=Z3(u,r);const p=d.tagName.toLowerCase(),g=i?i.get(p):void 0;if(d.tagName=g||p,Q3(f))l.unshift(f);else for(const[m,b]of Object.entries(f))J3(e,d.properties,m,b)}for(const p of l)Ah(d.children,p);return d.type==="element"&&d.tagName==="template"&&(d.content={type:"root",children:d.children},d.children=[]),d}return c}function Q3(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const r=e,s=Object.keys(e);for(const i of s){const c=r[i];if(c&&typeof c=="object"){if(!Array.isArray(c))return!0;const u=c;for(const f of u)if(typeof f!="number"&&typeof f!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function J3(e,r,s,i){const c=py(e,s);let u;if(i!=null){if(typeof i=="number"){if(Number.isNaN(i))return;u=i}else typeof i=="boolean"?u=i:typeof i=="string"?c.spaceSeparated?u=fv(i):c.commaSeparated?u=lv(i):c.commaOrSpaceSeparated?u=fv(lv(i).join(" ")):u=rb(c,c.property,i):Array.isArray(i)?u=[...i]:u=c.property==="style"?e5(i):String(i);if(Array.isArray(u)){const f=[];for(const l of u)f.push(rb(c,c.property,l));u=f}c.property==="className"&&Array.isArray(r.className)&&(u=r.className.concat(u)),r[c.property]=u}}function Ah(e,r){if(r!=null)if(typeof r=="number"||typeof r=="string")e.push({type:"text",value:String(r)});else if(Array.isArray(r))for(const s of r)Ah(e,s);else if(typeof r=="object"&&"type"in r)r.type==="root"?Ah(e,r.children):e.push(r);else throw new Error("Expected node, nodes, or string, got `"+r+"`")}function rb(e,r,s){if(typeof s=="string"){if(e.number&&s&&!Number.isNaN(Number(s)))return Number(s);if((e.boolean||e.overloadedBoolean)&&(s===""||oo(s)===oo(r)))return!0}return s}function e5(e){const r=[];for(const[s,i]of Object.entries(e))r.push([s,i].join(": "));return r.join("; ")}function t5(e){const r=new Map;for(const s of e)r.set(s.toLowerCase(),s);return r}const n5=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],r5=b0(my,"div");b0(fc,"g",n5);const s5=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],sb={0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};function y0(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=48&&r<=57}function i5(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=102||r>=65&&r<=70||r>=48&&r<=57}function a5(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=122||r>=65&&r<=90}function ib(e){return a5(e)||y0(e)}const o5=["","Named character references must be terminated by a semicolon","Numeric character references must be terminated by a semicolon","Named character references cannot be empty","Numeric character references cannot be empty","Named character references must be known","Numeric character references cannot be disallowed","Numeric character references cannot be outside the permissible Unicode range"];function l5(e,r){const s={},i=typeof s.additional=="string"?s.additional.charCodeAt(0):s.additional,c=[];let u=0,f=-1,l="",d,p;s.position&&("start"in s.position||"indent"in s.position?(p=s.position.indent,d=s.position.start):d=s.position);let g=(d?d.line:0)||1,m=(d?d.column:0)||1,b=E(),_;for(u--;++u<=e.length;)if(_===10&&(m=(p?p[f]:0)||1),_=e.charCodeAt(u),_===38){const v=e.charCodeAt(u+1);if(v===9||v===10||v===12||v===32||v===38||v===60||Number.isNaN(v)||i&&v===i){l+=String.fromCharCode(_),m++;continue}const x=u+1;let S=x,j=x,T;if(v===35){j=++S;const W=e.charCodeAt(j);W===88||W===120?(T="hexadecimal",j=++S):T="decimal"}else T="named";let N="",D="",A="";const z=T==="named"?ib:T==="decimal"?y0:i5;for(j--;++j<=e.length;){const W=e.charCodeAt(j);if(!z(W))break;A+=String.fromCharCode(W),T==="named"&&s5.includes(A)&&(N=A,D=co(A))}let O=e.charCodeAt(j)===59;if(O){j++;const W=T==="named"?co(A):!1;W&&(N=A,D=W)}let q=1+j-x,G="";if(!(!O&&s.nonTerminated===!1))if(!A)T!=="named"&&C(4,q);else if(T==="named"){if(O&&!D)C(5,1);else if(N!==A&&(j=S+N.length,q=1+j-S,O=!1),!O){const W=N?1:3;if(s.attribute){const I=e.charCodeAt(j);I===61?(C(W,q),D=""):ib(I)?D="":C(W,q)}else C(W,q)}G=D}else{O||C(2,q);let W=Number.parseInt(A,T==="hexadecimal"?16:10);if(c5(W))C(7,q),G="�";else if(W in sb)C(6,q),G=sb[W];else{let I="";u5(W)&&C(6,q),W>65535&&(W-=65536,I+=String.fromCharCode(W>>>10|55296),W=56320|W&1023),G=I+String.fromCharCode(W)}}if(G){y(),b=E(),u=j-1,m+=j-x+1,c.push(G);const W=E();W.offset++,s.reference&&s.reference.call(s.referenceContext||void 0,G,{start:b,end:W},e.slice(x-1,j)),b=W}else A=e.slice(x-1,j),l+=A,m+=A.length,u=j-1}else _===10&&(g++,f++,m=0),Number.isNaN(_)?y():(l+=String.fromCharCode(_),m++);return c.join("");function E(){return{line:g,column:m,offset:u+((d?d.offset:0)||0)}}function C(v,x){let S;s.warning&&(S=E(),S.column+=x,S.offset+=x,s.warning.call(s.warningContext||void 0,o5[v],S,v))}function y(){l&&(c.push(l),s.text&&s.text.call(s.textContext||void 0,l,{start:b,end:E()}),l="")}}function c5(e){return e>=55296&&e<=57343||e>1114111}function u5(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534}var d5=0,Fl={},rn={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++d5}),e.__id},clone:function e(r,s){s=s||{};var i,c;switch(rn.util.type(r)){case"Object":if(c=rn.util.objId(r),s[c])return s[c];i={},s[c]=i;for(var u in r)r.hasOwnProperty(u)&&(i[u]=e(r[u],s));return i;case"Array":return c=rn.util.objId(r),s[c]?s[c]:(i=[],s[c]=i,r.forEach(function(f,l){i[l]=e(f,s)}),i);default:return r}}},languages:{plain:Fl,plaintext:Fl,text:Fl,txt:Fl,extend:function(e,r){var s=rn.util.clone(rn.languages[e]);for(var i in r)s[i]=r[i];return s},insertBefore:function(e,r,s,i){i=i||rn.languages;var c=i[e],u={};for(var f in c)if(c.hasOwnProperty(f)){if(f==r)for(var l in s)s.hasOwnProperty(l)&&(u[l]=s[l]);s.hasOwnProperty(f)||(u[f]=c[f])}var d=i[e];return i[e]=u,rn.languages.DFS(rn.languages,function(p,g){g===d&&p!=e&&(this[p]=u)}),u},DFS:function e(r,s,i,c){c=c||{};var u=rn.util.objId;for(var f in r)if(r.hasOwnProperty(f)){s.call(r,f,r[f],i||f);var l=r[f],d=rn.util.type(l);d==="Object"&&!c[u(l)]?(c[u(l)]=!0,e(l,s,null,c)):d==="Array"&&!c[u(l)]&&(c[u(l)]=!0,e(l,s,f,c))}}},plugins:{},highlight:function(e,r,s){var i={code:e,grammar:r,language:s};if(rn.hooks.run("before-tokenize",i),!i.grammar)throw new Error('The language "'+i.language+'" has no grammar.');return i.tokens=rn.tokenize(i.code,i.grammar),rn.hooks.run("after-tokenize",i),ro.stringify(rn.util.encode(i.tokens),i.language)},tokenize:function(e,r){var s=r.rest;if(s){for(var i in s)r[i]=s[i];delete r.rest}var c=new h5;return Gl(c,c.head,e),_0(e,c,r,c.head,0),p5(c)},hooks:{all:{},add:function(e,r){var s=rn.hooks.all;s[e]=s[e]||[],s[e].push(r)},run:function(e,r){var s=rn.hooks.all[e];if(!(!s||!s.length))for(var i=0,c;c=s[i++];)c(r)}},Token:ro};function ro(e,r,s,i){this.type=e,this.content=r,this.alias=s,this.length=(i||"").length|0}function ab(e,r,s,i){e.lastIndex=r;var c=e.exec(s);if(c&&i&&c[1]){var u=c[1].length;c.index+=u,c[0]=c[0].slice(u)}return c}function _0(e,r,s,i,c,u){for(var f in s)if(!(!s.hasOwnProperty(f)||!s[f])){var l=s[f];l=Array.isArray(l)?l:[l];for(var d=0;d<l.length;++d){if(u&&u.cause==f+","+d)return;var p=l[d],g=p.inside,m=!!p.lookbehind,b=!!p.greedy,_=p.alias;if(b&&!p.pattern.global){var E=p.pattern.toString().match(/[imsuy]*$/)[0];p.pattern=RegExp(p.pattern.source,E+"g")}for(var C=p.pattern||p,y=i.next,v=c;y!==r.tail&&!(u&&v>=u.reach);v+=y.value.length,y=y.next){var x=y.value;if(r.length>e.length)return;if(!(x instanceof ro)){var S=1,j;if(b){if(j=ab(C,v,e,m),!j||j.index>=e.length)break;var A=j.index,T=j.index+j[0].length,N=v;for(N+=y.value.length;A>=N;)y=y.next,N+=y.value.length;if(N-=y.value.length,v=N,y.value instanceof ro)continue;for(var D=y;D!==r.tail&&(N<T||typeof D.value=="string");D=D.next)S++,N+=D.value.length;S--,x=e.slice(v,N),j.index-=v}else if(j=ab(C,0,x,m),!j)continue;var A=j.index,z=j[0],O=x.slice(0,A),q=x.slice(A+z.length),G=v+x.length;u&&G>u.reach&&(u.reach=G);var W=y.prev;O&&(W=Gl(r,W,O),v+=O.length),f5(r,W,S);var I=new ro(f,g?rn.tokenize(z,g):z,_,z);if(y=Gl(r,W,I),q&&Gl(r,y,q),S>1){var $={cause:f+","+d,reach:G};_0(e,r,s,y.prev,v,$),u&&$.reach>u.reach&&(u.reach=$.reach)}}}}}}function h5(){var e={value:null,prev:null,next:null},r={value:null,prev:e,next:null};e.next=r,this.head=e,this.tail=r,this.length=0}function Gl(e,r,s){var i=r.next,c={value:s,prev:r,next:i};return r.next=c,i.prev=c,e.length++,c}function f5(e,r,s){for(var i=r.next,c=0;c<s&&i!==e.tail;c++)i=i.next;r.next=i,i.prev=r,e.length-=c}function p5(e){for(var r=[],s=e.head.next;s!==e.tail;)r.push(s.value),s=s.next;return r}const S0=rn;function w0(){}w0.prototype=S0;const Jt=new w0;Jt.highlight=m5;Jt.register=g5;Jt.alias=x5;Jt.registered=v5;Jt.listLanguages=b5;Jt.util.encode=y5;Jt.Token.stringify=Dh;function m5(e,r){if(typeof e!="string")throw new TypeError("Expected `string` for `value`, got `"+e+"`");let s,i;if(r&&typeof r=="object")s=r;else{if(i=r,typeof i!="string")throw new TypeError("Expected `string` for `name`, got `"+i+"`");if(Object.hasOwn(Jt.languages,i))s=Jt.languages[i];else throw new Error("Unknown language: `"+i+"` is not registered")}return{type:"root",children:S0.highlight.call(Jt,e,s,i)}}function g5(e){if(typeof e!="function"||!e.displayName)throw new Error("Expected `function` for `syntax`, got `"+e+"`");Object.hasOwn(Jt.languages,e.displayName)||e(Jt)}function x5(e,r){const s=Jt.languages;let i={};typeof e=="string"?r&&(i[e]=r):i=e;let c;for(c in i)if(Object.hasOwn(i,c)){const u=i[c],f=typeof u=="string"?[u]:u;let l=-1;for(;++l<f.length;)s[f[l]]=s[c]}}function v5(e){if(typeof e!="string")throw new TypeError("Expected `string` for `aliasOrLanguage`, got `"+e+"`");return Object.hasOwn(Jt.languages,e)}function b5(){const e=Jt.languages,r=[];let s;for(s in e)Object.hasOwn(e,s)&&typeof e[s]=="object"&&r.push(s);return r}function Dh(e,r){if(typeof e=="string")return{type:"text",value:e};if(Array.isArray(e)){const i=[];let c=-1;for(;++c<e.length;)e[c]!==null&&e[c]!==void 0&&e[c]!==""&&i.push(Dh(e[c],r));return i}const s={attributes:{},classes:["token",e.type],content:Dh(e.content,r),language:r,tag:"span",type:e.type};return e.alias&&s.classes.push(...typeof e.alias=="string"?[e.alias]:e.alias),Jt.hooks.run("wrap",s),r5(s.tag+"."+s.classes.join("."),_5(s.attributes),s.content)}function y5(e){return e}function _5(e){let r;for(r in e)Object.hasOwn(e,r)&&(e[r]=l5(e[r]));return e}var pt=X3(Jt,{});pt.registerLanguage=function(e,r){return Jt.register(r)};pt.alias=function(e,r){return Jt.alias(e,r)};Ws.displayName="markup";Ws.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function Ws(e){e.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(r){r.type==="entity"&&(r.attributes.title=r.content.value.replace(/&amp;/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(s,i){var c={};c["language-"+i]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:e.languages[i]},c.cdata=/^<!\[CDATA\[|\]\]>$/i;var u={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:c}};u["language-"+i]={pattern:/[\s\S]+/,inside:e.languages[i]};var f={};f[s]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return s}),"i"),lookbehind:!0,greedy:!0,inside:u},e.languages.insertBefore("markup","cdata",f)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(r,s){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+r+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[s,"language-"+s],inside:e.languages[s]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend("markup",{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}bc.displayName="css";bc.aliases=[];function bc(e){(function(r){var s=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;r.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+s.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+s.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+s.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+s.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:s,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},r.languages.css.atrule.inside.rest=r.languages.css;var i=r.languages.markup;i&&(i.tag.addInlined("style","css"),i.tag.addAttribute("style","css"))})(e)}Vs.displayName="clike";Vs.aliases=[];function Vs(e){e.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}}yo.displayName="javascript";yo.aliases=["js"];function yo(e){e.register(Vs),e.languages.javascript=e.languages.extend("clike",{"class-name":[e.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),e.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,e.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:e.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:e.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:e.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:e.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:e.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),e.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:e.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),e.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),e.languages.markup&&(e.languages.markup.tag.addInlined("script","javascript"),e.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),e.languages.js=e.languages.javascript}of.displayName="sql";of.aliases=[];function of(e){e.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/}}yc.displayName="c";yc.aliases=[];function yc(e){e.register(Vs),e.languages.c=e.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),e.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),e.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},e.languages.c.string],char:e.languages.c.char,comment:e.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:e.languages.c}}}}),e.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete e.languages.c.boolean}lf.displayName="cpp";lf.aliases=[];function lf(e){e.register(yc),(function(r){var s=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,i=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,function(){return s.source});r.languages.cpp=r.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,function(){return s.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:s,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),r.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,function(){return i})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),r.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:r.languages.cpp}}}}),r.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),r.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:r.languages.extend("cpp",{})}}),r.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},r.languages.cpp["base-clause"])})(e)}cf.displayName="bash";cf.aliases=["sh","shell"];function cf(e){(function(r){var s="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",i={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},c={bash:i,environment:{pattern:RegExp("\\$"+s),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+s),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};r.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+s),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:c},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:i}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:c},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:c.entity}}],environment:{pattern:RegExp("\\$?"+s),alias:"constant"},variable:c.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},i.inside=r.languages.bash;for(var u=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],f=c.variable[1].inside,l=0;l<u.length;l++)f[u[l]]=r.languages.bash[u[l]];r.languages.sh=r.languages.bash,r.languages.shell=r.languages.bash})(e)}uf.displayName="yaml";uf.aliases=["yml"];function uf(e){(function(r){var s=/[*&][^\s[\]{},]+/,i=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,c="(?:"+i.source+"(?:[ ]+"+s.source+")?|"+s.source+"(?:[ ]+"+i.source+")?)",u=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),f=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function l(d,p){p=(p||"").replace(/m/g,"")+"m";var g=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return c}).replace(/<<value>>/g,function(){return d});return RegExp(g,p)}r.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return c})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return c}).replace(/<<key>>/g,function(){return"(?:"+u+"|"+f+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:l(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:l(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:l(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:l(f),lookbehind:!0,greedy:!0},number:{pattern:l(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:i,important:s,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},r.languages.yml=r.languages.yaml})(e)}df.displayName="markdown";df.aliases=["md"];function df(e){e.register(Ws),(function(r){var s=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function i(l){return l=l.replace(/<inner>/g,function(){return s}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+l+")")}var c=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,u=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return c}),f=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;r.languages.markdown=r.languages.extend("markup",{}),r.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:r.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+u+f+"(?:"+u+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+u+f+")(?:"+u+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(c),inside:r.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+u+")"+f+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+u+"$"),inside:{"table-header":{pattern:RegExp(c),alias:"important",inside:r.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:i(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:i(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:i(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:i(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(l){["url","bold","italic","strike","code-snippet"].forEach(function(d){l!==d&&(r.languages.markdown[l].inside.content.inside[d]=r.languages.markdown[d])})}),r.hooks.add("after-tokenize",function(l){if(l.language!=="markdown"&&l.language!=="md")return;function d(p){if(!(!p||typeof p=="string"))for(var g=0,m=p.length;g<m;g++){var b=p[g];if(b.type!=="code"){d(b.content);continue}var _=b.content[1],E=b.content[3];if(_&&E&&_.type==="code-language"&&E.type==="code-block"&&typeof _.content=="string"){var C=_.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");C=(/[a-z][\w-]*/i.exec(C)||[""])[0].toLowerCase();var y="language-"+C;E.alias?typeof E.alias=="string"?E.alias=[E.alias,y]:E.alias.push(y):E.alias=[y]}}}d(l.tokens)}),r.hooks.add("wrap",function(l){if(l.type==="code-block"){for(var d="",p=0,g=l.classes.length;p<g;p++){var m=l.classes[p],b=/language-(.+)/.exec(m);if(b){d=b[1];break}}var _=r.languages[d];if(_)l.content=r.highlight(l.content.value,_,d);else if(d&&d!=="none"&&r.plugins.autoloader){var E="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);l.attributes.id=E,r.plugins.autoloader.loadLanguages(d,function(){var C=document.getElementById(E);C&&(C.innerHTML=r.highlight(C.textContent,r.languages[d],d))})}}}),RegExp(r.languages.markup.tag.pattern.source,"gi"),r.languages.md=r.languages.markdown})(e)}hf.displayName="ruby";hf.aliases=["rb"];function hf(e){e.register(Vs),(function(r){r.languages.ruby=r.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),r.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var s={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:r.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete r.languages.ruby.function;var i="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",c=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;r.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+i+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:s,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:s,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+c),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+c+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),r.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+i),greedy:!0,inside:{interpolation:s,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:s,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:s,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+i),greedy:!0,inside:{interpolation:s,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:s,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete r.languages.ruby.string,r.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),r.languages.rb=r.languages.ruby})(e)}ff.displayName="diff";ff.aliases=[];function ff(e){(function(r){r.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var s={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(s).forEach(function(i){var c=s[i],u=[];/^\w+$/.test(i)||u.push(/\w+/.exec(i)[0]),i==="diff"&&u.push("bold"),r.languages.diff[i]={pattern:RegExp("^(?:["+c+`].*(?:\r
125
+ ?|
126
+ |(?![\\s\\S])))+`,"m"),alias:u,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(i)[0]}}}}),Object.defineProperty(r.languages.diff,"PREFIXES",{value:s})})(e)}pf.displayName="docker";pf.aliases=["dockerfile"];function pf(e){(function(r){var s=/\\[\r\n](?:\s|\\[\r\n]|#.*(?!.))*(?![\s#]|\\[\r\n])/.source,i=/(?:[ \t]+(?![ \t])(?:<SP_BS>)?|<SP_BS>)/.source.replace(/<SP_BS>/g,function(){return s}),c=/"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"|'(?:[^'\\\r\n]|\\(?:\r\n|[\s\S]))*'/.source,u=/--[\w-]+=(?:<STR>|(?!["'])(?:[^\s\\]|\\.)+)/.source.replace(/<STR>/g,function(){return c}),f={pattern:RegExp(c),greedy:!0},l={pattern:/(^[ \t]*)#.*/m,lookbehind:!0,greedy:!0};function d(p,g){return p=p.replace(/<OPT>/g,function(){return u}).replace(/<SP>/g,function(){return i}),RegExp(p,g)}r.languages.docker={instruction:{pattern:/(^[ \t]*)(?:ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|ONBUILD|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)(?=\s)(?:\\.|[^\r\n\\])*(?:\\$(?:\s|#.*$)*(?![\s#])(?:\\.|[^\r\n\\])*)*/im,lookbehind:!0,greedy:!0,inside:{options:{pattern:d(/(^(?:ONBUILD<SP>)?\w+<SP>)<OPT>(?:<SP><OPT>)*/.source,"i"),lookbehind:!0,greedy:!0,inside:{property:{pattern:/(^|\s)--[\w-]+/,lookbehind:!0},string:[f,{pattern:/(=)(?!["'])(?:[^\s\\]|\\.)+/,lookbehind:!0}],operator:/\\$/m,punctuation:/=/}},keyword:[{pattern:d(/(^(?:ONBUILD<SP>)?HEALTHCHECK<SP>(?:<OPT><SP>)*)(?:CMD|NONE)\b/.source,"i"),lookbehind:!0,greedy:!0},{pattern:d(/(^(?:ONBUILD<SP>)?FROM<SP>(?:<OPT><SP>)*(?!--)[^ \t\\]+<SP>)AS/.source,"i"),lookbehind:!0,greedy:!0},{pattern:d(/(^ONBUILD<SP>)\w+/.source,"i"),lookbehind:!0,greedy:!0},{pattern:/^\w+/,greedy:!0}],comment:l,string:f,variable:/\$(?:\w+|\{[^{}"'\\]*\})/,operator:/\\$/m}},comment:l},r.languages.dockerfile=r.languages.docker})(e)}mf.displayName="go";mf.aliases=[];function mf(e){e.register(Vs),e.languages.go=e.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),e.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete e.languages.go["class-name"]}gf.displayName="graphql";gf.aliases=[];function gf(e){e.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:"string",inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:e.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:"class-name"},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},e.hooks.add("after-tokenize",function(s){if(s.language!=="graphql")return;var i=s.tokens.filter(function(y){return typeof y!="string"&&y.type!=="comment"&&y.type!=="scalar"}),c=0;function u(y){return i[c+y]}function f(y,v){v=v||0;for(var x=0;x<y.length;x++){var S=u(x+v);if(!S||S.type!==y[x])return!1}return!0}function l(y,v){for(var x=1,S=c;S<i.length;S++){var j=i[S],T=j.content;if(j.type==="punctuation"&&typeof T=="string"){if(y.test(T))x++;else if(v.test(T)&&(x--,x===0))return S}}return-1}function d(y,v){var x=y.alias;x?Array.isArray(x)||(y.alias=x=[x]):y.alias=x=[],x.push(v)}for(;c<i.length;){var p=i[c++];if(p.type==="keyword"&&p.content==="mutation"){var g=[];if(f(["definition-mutation","punctuation"])&&u(1).content==="("){c+=2;var m=l(/^\($/,/^\)$/);if(m===-1)continue;for(;c<m;c++){var b=u(0);b.type==="variable"&&(d(b,"variable-input"),g.push(b.content))}c=m+1}if(f(["punctuation","property-query"])&&u(0).content==="{"&&(c++,d(u(0),"property-mutation"),g.length>0)){var _=l(/^\{$/,/^\}$/);if(_===-1)continue;for(var E=c;E<_;E++){var C=i[E];C.type==="variable"&&g.indexOf(C.content)>=0&&d(C,"variable-input")}}}}})}xf.displayName="scss";xf.aliases=[];function xf(e){e.register(bc),e.languages.scss=e.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),e.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),e.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),e.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),e.languages.scss.atrule.inside.rest=e.languages.scss}vf.displayName="json";vf.aliases=["webmanifest"];function vf(e){e.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},e.languages.webmanifest=e.languages.json}bf.displayName="java";bf.aliases=[];function bf(e){e.register(Vs),(function(r){var s=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,i=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,c={pattern:RegExp(/(^|[^\w.])/.source+i+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};r.languages.java=r.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[c,{pattern:RegExp(/(^|[^\w.])/.source+i+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:c.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+i+/[A-Z]\w*\b/.source),lookbehind:!0,inside:c.inside}],keyword:s,function:[r.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),r.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),r.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":c,keyword:s,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+i+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:c.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+i+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:c.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,function(){return s.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(e)}_c.displayName="typescript";_c.aliases=["ts"];function _c(e){e.register(yo),(function(r){r.languages.typescript=r.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),r.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete r.languages.typescript.parameter,delete r.languages.typescript["literal-property"];var s=r.languages.extend("typescript",{});delete s["class-name"],r.languages.typescript["class-name"].inside=s,r.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:s}}}}),r.languages.ts=r.languages.typescript})(e)}yf.displayName="python";yf.aliases=["py"];function yf(e){e.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},e.languages.python["string-interpolation"].inside.interpolation.inside.rest=e.languages.python,e.languages.py=e.languages.python}Sc.displayName="jsx";Sc.aliases=[];function Sc(e){e.register(yo),e.register(Ws),(function(r){var s=r.util.clone(r.languages.javascript),i=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,c=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,u=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function f(p,g){return p=p.replace(/<S>/g,function(){return i}).replace(/<BRACES>/g,function(){return c}).replace(/<SPREAD>/g,function(){return u}),RegExp(p,g)}u=f(u).source,r.languages.jsx=r.languages.extend("markup",s),r.languages.jsx.tag.pattern=f(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),r.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,r.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,r.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,r.languages.jsx.tag.inside.comment=s.comment,r.languages.insertBefore("inside","attr-name",{spread:{pattern:f(/<SPREAD>/.source),inside:r.languages.jsx}},r.languages.jsx.tag),r.languages.insertBefore("inside","special-attr",{script:{pattern:f(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:r.languages.jsx}}},r.languages.jsx.tag);var l=function(p){return p?typeof p=="string"?p:typeof p.content=="string"?p.content:p.content.map(l).join(""):""},d=function(p){for(var g=[],m=0;m<p.length;m++){var b=p[m],_=!1;if(typeof b!="string"&&(b.type==="tag"&&b.content[0]&&b.content[0].type==="tag"?b.content[0].content[0].content==="</"?g.length>0&&g[g.length-1].tagName===l(b.content[0].content[1])&&g.pop():b.content[b.content.length-1].content==="/>"||g.push({tagName:l(b.content[0].content[1]),openedBraces:0}):g.length>0&&b.type==="punctuation"&&b.content==="{"?g[g.length-1].openedBraces++:g.length>0&&g[g.length-1].openedBraces>0&&b.type==="punctuation"&&b.content==="}"?g[g.length-1].openedBraces--:_=!0),(_||typeof b=="string")&&g.length>0&&g[g.length-1].openedBraces===0){var E=l(b);m<p.length-1&&(typeof p[m+1]=="string"||p[m+1].type==="plain-text")&&(E+=l(p[m+1]),p.splice(m+1,1)),m>0&&(typeof p[m-1]=="string"||p[m-1].type==="plain-text")&&(E=l(p[m-1])+E,p.splice(m-1,1),m--),p[m]=new r.Token("plain-text",E,null,E)}b.content&&typeof b.content!="string"&&d(b.content)}};r.hooks.add("after-tokenize",function(p){p.language!=="jsx"&&p.language!=="tsx"||d(p.tokens)})})(e)}_f.displayName="tsx";_f.aliases=[];function _f(e){e.register(Sc),e.register(_c),(function(r){var s=r.util.clone(r.languages.typescript);r.languages.tsx=r.languages.extend("jsx",s),delete r.languages.tsx.parameter,delete r.languages.tsx["literal-property"];var i=r.languages.tsx.tag;i.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+i.pattern.source+")",i.pattern.flags),i.lookbehind=!0})(e)}Sf.displayName="rust";Sf.aliases=[];function Sf(e){(function(r){for(var s=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,i=0;i<2;i++)s=s.replace(/<self>/g,function(){return s});s=s.replace(/<self>/g,function(){return/[^\s\S]/.source}),r.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+s),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},r.languages.rust["closure-params"].inside.rest=r.languages.rust,r.languages.rust.attribute.inside.string=r.languages.rust.string})(e)}wf.displayName="toml";wf.aliases=[];function wf(e){(function(r){var s=/(?:[\w-]+|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*")/.source;function i(c){return c.replace(/__/g,function(){return s})}r.languages.toml={comment:{pattern:/#.*/,greedy:!0},table:{pattern:RegExp(i(/(^[\t ]*\[\s*(?:\[\s*)?)__(?:\s*\.\s*__)*(?=\s*\])/.source),"m"),lookbehind:!0,greedy:!0,alias:"class-name"},key:{pattern:RegExp(i(/(^[\t ]*|[{,]\s*)__(?:\s*\.\s*__)*(?=\s*=)/.source),"m"),lookbehind:!0,greedy:!0,alias:"property"},string:{pattern:/"""(?:\\[\s\S]|[^\\])*?"""|'''[\s\S]*?'''|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},date:[{pattern:/\b\d{4}-\d{2}-\d{2}(?:[T\s]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?\b/i,alias:"number"},{pattern:/\b\d{2}:\d{2}:\d{2}(?:\.\d+)?\b/,alias:"number"}],number:/(?:\b0(?:x[\da-zA-Z]+(?:_[\da-zA-Z]+)*|o[0-7]+(?:_[0-7]+)*|b[10]+(?:_[10]+)*))\b|[-+]?\b\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?\b|[-+]?\b(?:inf|nan)\b/,boolean:/\b(?:false|true)\b/,punctuation:/[.,=[\]{}]/}})(e)}const Kl={'code[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"]::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},prolog:{color:"hsl(220, 10%, 40%)"},cdata:{color:"hsl(220, 10%, 40%)"},doctype:{color:"hsl(220, 14%, 71%)"},punctuation:{color:"hsl(220, 14%, 71%)"},entity:{color:"hsl(220, 14%, 71%)",cursor:"help"},"attr-name":{color:"hsl(29, 54%, 61%)"},"class-name":{color:"hsl(29, 54%, 61%)"},boolean:{color:"hsl(29, 54%, 61%)"},constant:{color:"hsl(29, 54%, 61%)"},number:{color:"hsl(29, 54%, 61%)"},atrule:{color:"hsl(29, 54%, 61%)"},keyword:{color:"hsl(286, 60%, 67%)"},property:{color:"hsl(355, 65%, 65%)"},tag:{color:"hsl(355, 65%, 65%)"},symbol:{color:"hsl(355, 65%, 65%)"},deleted:{color:"hsl(355, 65%, 65%)"},important:{color:"hsl(355, 65%, 65%)"},selector:{color:"hsl(95, 38%, 62%)"},string:{color:"hsl(95, 38%, 62%)"},char:{color:"hsl(95, 38%, 62%)"},builtin:{color:"hsl(95, 38%, 62%)"},inserted:{color:"hsl(95, 38%, 62%)"},regex:{color:"hsl(95, 38%, 62%)"},"attr-value":{color:"hsl(95, 38%, 62%)"},"attr-value > .token.punctuation":{color:"hsl(95, 38%, 62%)"},variable:{color:"hsl(207, 82%, 66%)"},operator:{color:"hsl(207, 82%, 66%)"},function:{color:"hsl(207, 82%, 66%)"},url:{color:"hsl(187, 47%, 55%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(220, 14%, 71%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(220, 14%, 71%)"},".language-css .token.selector":{color:"hsl(355, 65%, 65%)"},".language-css .token.property":{color:"hsl(220, 14%, 71%)"},".language-css .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.string.url":{color:"hsl(95, 38%, 62%)"},".language-css .token.important":{color:"hsl(286, 60%, 67%)"},".language-css .token.atrule .token.rule":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.operator":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(5, 48%, 51%)"},".language-json .token.operator":{color:"hsl(220, 14%, 71%)"},".language-json .token.null.keyword":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.url":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.operator":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.content":{color:"hsl(207, 82%, 66%)"},".language-markdown .token.url > .token.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.url-reference.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(95, 38%, 62%)"},".language-markdown .token.bold .token.content":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.italic .token.content":{color:"hsl(286, 60%, 67%)"},".language-markdown .token.strike .token.content":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.list.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(355, 65%, 65%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.cr:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.lf:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.space:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},".line-highlight.line-highlight":{background:"hsla(220, 100%, 80%, 0.04)"},".line-highlight.line-highlight:before":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(220, 100%, 80%, 0.04)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".command-line .command-line-prompt":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(220, 14%, 45%)"},".command-line .command-line-prompt > span:before":{color:"hsl(220, 14%, 45%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(286, 60%, 67%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(224, 13%, 17%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(224, 13%, 17%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(224, 13%, 17%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(224, 13%, 17%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(219, 13%, 22%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(220, 14%, 71%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(220, 14%, 71%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(220, 14%, 71%)"}};pt.registerLanguage("typescript",_c);pt.registerLanguage("javascript",yo);pt.registerLanguage("tsx",_f);pt.registerLanguage("jsx",Sc);pt.registerLanguage("python",yf);pt.registerLanguage("bash",cf);pt.registerLanguage("json",vf);pt.registerLanguage("css",bc);pt.registerLanguage("html",Ws);pt.registerLanguage("markup",Ws);pt.registerLanguage("xml",Ws);pt.registerLanguage("sql",of);pt.registerLanguage("yaml",uf);pt.registerLanguage("markdown",df);pt.registerLanguage("diff",ff);pt.registerLanguage("rust",Sf);pt.registerLanguage("go",mf);pt.registerLanguage("java",bf);pt.registerLanguage("c",yc);pt.registerLanguage("cpp",lf);pt.registerLanguage("ruby",hf);pt.registerLanguage("toml",wf);pt.registerLanguage("scss",xf);pt.registerLanguage("graphql",gf);pt.registerLanguage("docker",pf);function C0(e=2e3){const[r,s]=P.useState(!1),i=P.useCallback(async c=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(c);else{const u=document.createElement("textarea");u.value=c,u.style.position="fixed",u.style.left="-9999px",document.body.appendChild(u),u.select(),document.execCommand("copy"),document.body.removeChild(u)}s(!0),setTimeout(()=>s(!1),e)}catch(u){console.error("Failed to copy:",u)}},[e]);return{copied:r,copy:i}}const S5={code({className:e,children:r,...s}){const i=/language-(\w+)/.exec(e||"");if(!i&&!String(r).includes(`
127
+ `))return o.jsx("code",{className:"bg-bg-tertiary px-1 py-0.5 rounded text-accent-secondary font-mono text-xs",...s,children:r});const u=(i==null?void 0:i[1])||"text",f=String(r).replace(/\n$/,""),{copied:l,copy:d}=C0();return o.jsxs("div",{className:"relative group my-1.5 rounded overflow-hidden",children:[o.jsxs("div",{className:"absolute bottom-0 right-0 flex items-center gap-2 px-2 py-1 text-xs text-text-muted/70 bg-bg-tertiary/60 rounded-tl rounded-tr z-10",children:[o.jsx("span",{children:u}),o.jsx("button",{type:"button",onClick:p=>{p.preventDefault(),p.stopPropagation(),d(f)},className:"opacity-0 group-hover:opacity-100 transition-opacity hover:text-text-primary p-0.5",title:"Copy code",children:l?o.jsx(Pr,{}):o.jsx(oc,{})})]}),o.jsx("div",{className:"overflow-x-auto",children:o.jsx(pt,{style:Kl,language:u,PreTag:"div",customStyle:{margin:0,fontSize:"0.75rem"},codeTagProps:{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"}},children:f})})]})},p({children:e}){return o.jsx("p",{className:"mb-1.5 last:mb-0 leading-tight",children:e})},ul({children:e}){return o.jsx("ul",{className:"list-disc list-inside mb-1.5 space-y-0.5",children:e})},ol({children:e}){return o.jsx("ol",{className:"list-decimal list-inside mb-1.5 space-y-0.5",children:e})},li({children:e}){return o.jsx("li",{className:"text-text-primary text-sm list-item",children:e})},h1({children:e}){return o.jsx("h1",{className:"text-base font-bold mb-1.5 mt-2 first:mt-0 text-sky-400",children:e})},h2({children:e}){return o.jsx("h2",{className:"text-sm font-bold mb-1.5 mt-2 first:mt-0 text-sky-400",children:e})},h3({children:e}){return o.jsx("h3",{className:"text-sm font-bold mb-1.5 mt-1.5 first:mt-0 text-sky-400",children:e})},h4({children:e}){return o.jsx("h4",{className:"text-sm font-bold mb-1.5 mt-1.5 first:mt-0 text-sky-400",children:e})},strong({children:e}){return o.jsx("strong",{className:"font-bold text-amber-400",children:e})},a({href:e,children:r}){return o.jsx("a",{href:e,className:"text-accent-primary hover:underline text-sm",target:"_blank",rel:"noopener noreferrer",children:r})},blockquote({children:e}){return o.jsx("blockquote",{className:"border-l-2 border-accent-primary pl-2 my-1.5 text-text-secondary italic text-sm",children:e})},table({children:e}){return o.jsx("div",{className:"overflow-x-auto my-1.5",children:o.jsx("table",{className:"min-w-full border border-border",children:e})})},th({children:e}){return o.jsx("th",{className:"border border-border bg-bg-tertiary px-2 py-1 text-left font-semibold text-sm",children:e})},td({children:e}){return o.jsx("td",{className:"border border-border px-2 py-1 text-sm",children:e})},hr(){return o.jsx("hr",{className:"border-border my-2"})},input({checked:e,...r}){return o.jsx("input",{type:"checkbox",checked:e,disabled:!0,className:"mr-1.5 w-3.5 h-3.5",...r})}},Gs=P.memo(function({content:r,className:s=""}){const i=P.useMemo(()=>{let c=w5(r);return c=C5(c),c},[r]);return o.jsx("div",{className:`markdown-content [&_li>p]:inline ${s}`,children:o.jsx(pN,{remarkPlugins:[j3],components:S5,children:i})})});function w5(e){let r=e.replace(/^(\s*)•\s/gm,"$1- ");return r=r.replace(/^(\d+)\.\s*\n(?=\S)/gm,"$1. "),r}function C5(e){const r=/```/g,s=e.match(r);if(((s==null?void 0:s.length)??0)%2===1){const c=e.lastIndexOf("```");return e.slice(c+3).includes(`
128
+ `),e+"\n```"}return e}const k5=P.memo(function({content:r,variant:s="default"}){return s==="labeled"?o.jsxs("div",{className:"text-text-muted text-sm italic feed-item",children:[o.jsx("span",{className:"text-purple-400",children:"thinking:"}),o.jsx("div",{className:"ml-1.5 mt-0.5",children:o.jsx(Gs,{content:r})})]}):o.jsx("div",{className:"text-text-muted text-sm italic bg-secondary rounded p-1.5 feed-item whitespace-pre-wrap",children:r})});function k0({tool:e,className:r="w-4 h-4 text-text-muted flex-shrink-0"}){return e==="glob"||e==="grep"?o.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}):e==="run_command"||e==="bash"?o.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}):o.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}const E5={...Kl,'pre[class*="language-"]':{...Kl['pre[class*="language-"]'],background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word",overflowX:"hidden"},'code[class*="language-"]':{...Kl['code[class*="language-"]'],background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"}},j5={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",py:"python",rb:"ruby",rs:"rust",go:"go",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",php:"php",swift:"swift",kt:"kotlin",scala:"scala",sh:"bash",bash:"bash",zsh:"bash",fish:"bash",ps1:"powershell",sql:"sql",html:"html",htm:"html",css:"css",scss:"scss",sass:"sass",less:"less",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",md:"markdown",markdown:"markdown",toml:"toml",ini:"ini",conf:"ini",dockerfile:"docker",makefile:"makefile",cmake:"cmake",graphql:"graphql",gql:"graphql",vue:"vue",svelte:"svelte"};function wc(e){var c;if(!e)return"text";const r=e.split("/").pop()??"",s=r.toLowerCase();if(s==="dockerfile")return"docker";if(s==="makefile")return"makefile";if(s==="cmakelists.txt")return"cmake";const i=(c=r.split(".").pop())==null?void 0:c.toLowerCase();return i?j5[i]??"text":"text"}const E0={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},N5={...E0,display:"inline"},T5={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},fo=P.memo(function({code:r,language:s,variant:i}){const c=i==="inline"?"span":i==="block-nowrap"?"div":"pre",u=i==="inline"?N5:i==="block-nowrap"?E0:T5;return o.jsx(pt,{style:E5,language:s,PreTag:c,customStyle:u,children:r})});function j0({src:e,alt:r,isOpen:s,onClose:i}){return s?o.jsx(At,{isOpen:s,onClose:i,title:"",size:"full",children:o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsx("img",{src:e,alt:r,className:"max-w-full max-h-[80vh] object-contain rounded-lg shadow-2xl"})})}):null}const A5=P.memo(function({oldString:r,newString:s,filePath:i}){const c=P.useMemo(()=>wc(i),[i]),u=r.split(`
129
+ `),f=s.split(`
130
+ `),l=r.length>0,d=s.length>0;return!l&&!d?o.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"No changes"}):o.jsxs("div",{className:"rounded overflow-hidden border border-border grid grid-cols-[3px_1.5rem_1fr]",children:[l&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"bg-red-400/60"}),o.jsx("div",{className:"bg-red-950/30 text-red-400/70 text-sm font-mono text-center",children:u.map((p,g)=>o.jsx("div",{className:"leading-[1.5rem]",children:"-"},g))}),o.jsx("div",{className:"bg-red-950/30 pr-2 line-through decoration-red-400/30 overflow-x-auto min-w-0",children:o.jsx(fo,{code:r,language:c,variant:"block-nowrap"})})]}),d&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"bg-green-400/60"}),o.jsx("div",{className:"bg-green-950/30 text-green-400/70 text-sm font-mono text-center",children:f.map((p,g)=>o.jsx("div",{className:"leading-[1.5rem]",children:"+"},g))}),o.jsx("div",{className:"bg-green-950/30 pr-2 overflow-x-auto min-w-0",children:o.jsx(fo,{code:s,language:c,variant:"block-nowrap"})})]})]})}),D5=P.memo(function({content:r,filePath:s}){const i=P.useMemo(()=>wc(s),[s]);return o.jsx("div",{className:"rounded overflow-hidden border border-border max-h-[45vh] overflow-y-auto",children:o.jsxs("div",{className:"grid grid-cols-[3px_1.5rem_1fr]",children:[o.jsx("div",{className:"bg-green-400/60"}),o.jsx("div",{className:"bg-green-950/30 text-green-400/70 text-sm font-mono text-center",children:r.split(`
131
+ `).map((c,u)=>o.jsx("div",{className:"leading-[1.5rem]",children:"+"},u))}),o.jsx("div",{className:"bg-green-950/30 pr-2 min-w-0 overflow-x-hidden",children:o.jsx(fo,{code:r,language:i,variant:"block"})})]})})}),L5=P.memo(function({regions:r,filePath:s}){const i=P.useMemo(()=>wc(s),[s]);return r.length===0?o.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"No changes"}):o.jsx("div",{className:"space-y-2",children:r.map((c,u)=>o.jsx(R5,{region:c,language:i},u))})}),R5=P.memo(function({region:r,language:s}){const i=O5(r),c=Math.max(...r.beforeContext.map(f=>f.lineNumber),...r.afterContext.map(f=>f.lineNumber),...r.edits.flatMap(f=>[f.startLine,f.endLine])),u=String(c).length;return o.jsx("div",{className:"rounded overflow-hidden border border-border font-mono text-sm",children:i.map((f,l)=>o.jsx(M5,{item:f,language:s,lineNumWidth:u},l))})});function O5(e){const r=[];for(const s of e.beforeContext)r.push({type:"context",lineNumber:s.lineNumber,content:s.content});for(const s of e.edits){const i=s.oldContent.split(`
132
+ `);for(let u=0;u<i.length;u++)r.push({type:"removed",lineNumber:s.startLine+u,content:i[u]});const c=s.newContent.split(`
133
+ `);for(let u=0;u<c.length;u++)r.push({type:"added",lineNumber:s.startLine+u,content:c[u]})}for(const s of e.afterContext)r.push({type:"context",lineNumber:s.lineNumber,content:s.content});return r}const M5=P.memo(function({item:r,language:s,lineNumWidth:i}){const c=String(r.lineNumber).padStart(i," "),u=r.type==="context"?"bg-bg-secondary":r.type==="removed"?"bg-red-950/30":"bg-green-950/30",f=r.type==="context"?"text-text-muted":r.type==="removed"?"text-red-400/70":"text-green-400/70",l=r.type==="context"?" ":r.type==="removed"?"-":"+",d=r.type==="removed"?"line-through decoration-red-400/30":"",p=r.type==="context"?"bg-transparent":r.type==="removed"?"bg-red-400/60":"bg-green-400/60";return o.jsxs("div",{className:`grid grid-cols-[3px_auto_1.25rem_1fr] ${u}`,children:[o.jsx("div",{className:p}),o.jsx("div",{className:"px-2 text-text-muted text-right select-none leading-[1.5rem]",children:c}),o.jsx("div",{className:`text-center select-none leading-[1.5rem] ${f}`,children:l}),o.jsx("div",{className:`pr-2 overflow-x-auto min-w-0 ${d}`,children:o.jsx(fo,{code:r.content||" ",language:s,variant:"inline"})})]})}),I5=P.memo(function({result:r,metadata:s,filePath:i,heightExpanded:c=!1}){const[u,f]=P.useState(!1),l=P.useMemo(()=>wc(i),[i]),d=s==null?void 0:s.mimeType,p=s==null?void 0:s.base64Data;if(d!=null&&d.startsWith("image/")&&p){const b=`data:${d};base64,${p}`;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`rounded overflow-hidden border border-border ${c?"":"max-h-[45vh]"} flex items-center justify-center cursor-pointer hover:border-accent-primary transition-colors`,onClick:()=>f(!0),children:o.jsx("img",{src:b,alt:i,className:"max-w-full max-h-[45vh] object-contain"})}),o.jsx(j0,{src:b,alt:i,isOpen:u,onClose:()=>f(!1)})]})}if(!r)return o.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"Empty file"});const g=r.split(`
134
+ `),m=g.filter(b=>!b.startsWith(`
135
+ [`)&&!b.startsWith("[")).map(b=>b.replace(/^\d+: /,"")).join(`
136
+ `);return o.jsx("div",{className:`rounded overflow-hidden border border-border ${c?"":"max-h-[45vh]"} overflow-y-auto`,children:o.jsxs("div",{className:"grid grid-cols-[2.5rem_1fr]",children:[o.jsx("div",{className:"bg-bg-tertiary text-text-muted text-xs font-mono text-right pr-2 select-none py-0.5",children:g.filter(b=>!b.startsWith(`
137
+ [`)&&!b.startsWith("[")).map((b,_)=>{const E=b.match(/^(\d+): /);return o.jsx("div",{className:"leading-[1.5rem]",children:E?E[1]:_+1},_)})}),o.jsx("div",{className:"min-w-0 overflow-x-hidden py-0.5",children:o.jsx(fo,{code:m,language:l,variant:"block"})})]})})}),B5={error:{icon:"✗",color:"text-accent-error",bg:"bg-red-500/10",border:"border-red-500/30"},warning:{icon:"⚠",color:"text-accent-warning",bg:"bg-yellow-500/10",border:"border-yellow-500/30"},info:{icon:"ℹ",color:"text-accent-info",bg:"bg-blue-500/10",border:"border-blue-500/30"},hint:{icon:"💡",color:"text-text-muted",bg:"bg-gray-500/10",border:"border-gray-500/30"}},ob=P.memo(function({diagnostics:r}){if(r.length===0)return null;const s=r.filter(u=>u.severity==="error"),i=r.filter(u=>u.severity==="warning"),c=r.filter(u=>u.severity==="info"||u.severity==="hint");return o.jsxs("div",{className:"rounded border border-border overflow-hidden mt-2",children:[o.jsxs("div",{className:"flex items-center gap-3 px-2 py-1.5 bg-bg-tertiary border-b border-border",children:[o.jsx("span",{className:"text-xs font-medium text-text-secondary",children:"LSP Diagnostics"}),s.length>0&&o.jsxs("span",{className:"text-xs text-accent-error font-medium",children:[s.length," error",s.length!==1?"s":""]}),i.length>0&&o.jsxs("span",{className:"text-xs text-accent-warning font-medium",children:[i.length," warning",i.length!==1?"s":""]}),c.length>0&&o.jsxs("span",{className:"text-xs text-text-muted",children:[c.length," info"]})]}),o.jsx("div",{className:"max-h-48 overflow-y-auto",children:r.map((u,f)=>{const l=B5[u.severity];return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${l.bg} border-b border-border last:border-b-0`,children:[o.jsx("span",{className:`${l.color} text-xs flex-shrink-0 w-4 text-center`,children:l.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["Ln ",u.range.start.line+1,":",u.range.start.character+1]}),u.code&&o.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["[",u.code,"]"]})]}),o.jsx("div",{className:"text-xs text-text-primary break-words",children:u.message})]})]},f)})})]})}),z5=P.memo(function({command:r,timeout:s,startedAt:i,streamingOutput:c,status:u,result:f,error:l,durationMs:d}){const p=P.useRef(null),[g,m]=P.useState(0);P.useEffect(()=>{p.current&&u==="pending"&&(p.current.scrollTop=p.current.scrollHeight)},[c,u]),P.useEffect(()=>{if(u!=="pending"||!i)return;const C=setInterval(()=>{m(Date.now()-i)},100);return()=>clearInterval(C)},[u,i]);const b=s/1e3,_=u==="pending"?g/1e3:(d??0)/1e3,E=u==="pending"?(c==null?void 0:c.map(C=>C.content).join(""))??"":f??"";return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs flex-1 min-w-0",children:[o.jsx("span",{className:"text-text-muted flex-shrink-0",children:"$"}),o.jsx("code",{className:"text-text-primary break-all",children:r})]}),o.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted flex-shrink-0",children:[u==="pending"&&o.jsx("span",{className:"animate-pulse text-accent-warning",children:"running"}),u==="interrupted"&&o.jsx("span",{className:"text-red-400",children:"interrupted"}),o.jsxs("span",{className:u==="pending"?"text-text-secondary":"text-text-muted",children:[_.toFixed(1),"s / ",b,"s"]})]})]}),u==="pending"&&o.jsx("div",{className:"h-1 bg-bg-tertiary rounded overflow-hidden",children:o.jsx("div",{className:"h-full bg-accent-warning transition-all duration-100",style:{width:`${Math.min(100,g/s*100)}%`}})}),(E||u==="pending")&&o.jsx("pre",{ref:p,className:`text-xs bg-bg-primary p-2 rounded max-h-64 overflow-y-auto ${u==="pending"?"border border-accent-warning/30":""}`,style:{overflowX:"hidden",whiteSpace:"normal"},children:u==="pending"&&c?c.map((C,y)=>o.jsx("span",{className:C.stream==="stderr"?"text-accent-warning":"",children:ao(C.content)},y)):ao(E)}),u==="error"&&l&&o.jsx("div",{className:"text-xs text-accent-error bg-accent-error/10 p-2 rounded",children:l}),u!=="pending"&&d!==void 0&&o.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",(d/1e3).toFixed(2),"s"]})]})});function H5(e){switch(e){case"sensitive_file":return{title:"Sensitive File Access",description:"Accessing files that may contain secrets"};case"both":return{title:"Sensitive File Access",description:"Accessing sensitive files outside project"};case"dangerous_command":return{title:"Dangerous Command",description:"Running potentially dangerous command"};case"outside_workdir":default:return{title:"Path Access Request",description:"Accessing paths outside project directory"}}}function P5({confirmation:e}){const r=Ce(g=>g.confirmPath),s=Ce(g=>g.currentSession),i=Ce(g=>g.switchDangerLevel),{title:c,description:u}=H5(e.reason),f=e.reason==="sensitive_file"||e.reason==="both",l=f?"border-red-500/50":"border-amber-500/50",d=f?"bg-red-500/10":"bg-amber-500/10",p=()=>{s!=null&&s.id&&i("dangerous"),r(e.callId,!0,!1)};return o.jsxs("div",{className:`border ${l} ${d} rounded p-3 my-2`,children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(Vb,{}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:`text-sm font-medium ${f?"text-red-400":"text-amber-400"}`,children:c}),o.jsx("div",{className:"text-xs text-text-muted",children:u})]})]}),o.jsxs("div",{className:"text-xs text-text-muted mb-2",children:[o.jsx("span",{className:"font-medium",children:e.tool})," ","wants to access:"]}),o.jsx("div",{className:"bg-bg-primary rounded p-2 mb-3 max-h-24 overflow-y-auto",children:o.jsx("ul",{className:"space-y-0.5",children:e.paths.map((g,m)=>o.jsx("li",{className:`text-xs font-mono ${f?"text-red-300":"text-amber-300"} break-all`,children:g},m))})}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{onClick:()=>r(e.callId,!1),className:"flex-1 px-3 py-1.5 text-xs font-medium rounded bg-bg-tertiary hover:bg-bg-tertiary/80 text-text-secondary border border-border transition-colors",children:"Deny"}),o.jsx("button",{onClick:()=>r(e.callId,!0,!1),className:"flex-1 px-3 py-1.5 text-xs font-medium rounded bg-accent-primary hover:bg-accent-primary/80 text-text-primary transition-colors",children:"Allow"}),o.jsx("button",{onClick:p,className:"flex-1 px-3 py-1.5 text-xs font-medium rounded bg-red-600 hover:bg-red-700 text-white transition-colors",title:"Enable dangerous mode and allow this request",children:"Allow Everything"})]})]})}function F5(e,r){if(e==="read_file"){const i=String(r.path??""),c=r.offset,u=r.limit,f=[];return c!==void 0&&c!==1&&f.push(`offset=${c}`),u!==void 0&&f.push(`limit=${u}`),f.length>0?`${i} [${f.join(", ")}]`:i}if(e==="write_file"||e==="edit_file")return String(r.path??"");if(e==="run_command"||e==="bash")return String(r.command??"");if(e==="return_value"){const i=String(r.content??"");return i.length>60?i.slice(0,60)+"...":i}const s=JSON.stringify(r);return s.length>50?s.slice(0,50)+"...":s}function lb(e,r,s){return F5(e,r)}function U5(e){return JSON.stringify(e,null,2)}const $5={pending:{icon:"●",color:"text-accent-warning",animate:!0},success:{icon:"✓",color:"text-accent-success",animate:!1},error:{icon:"✗",color:"text-accent-error",animate:!1},interrupted:{icon:"✗",color:"text-red-400",animate:!1}},q5=P.memo(function({tool:r,args:s,status:i,variant:c="compact",forceCompact:u,result:f,error:l,durationMs:d,diagnostics:p,editContext:g,startedAt:m,streamingOutput:b,metadata:_,callId:E}){const C=r==="edit_file"||r==="write_file",y=r==="run_command"&&i==="pending",v=r==="read_file",S=u?!1:C||y||r==="return_value",[j,T]=P.useState(S),N=$5[i],D=Ce(z=>z.pendingPathConfirmation),A=i==="pending"&&D&&E&&D.callId===E?D:null;return c==="compact"?o.jsxs("div",{className:"flex items-center gap-1.5 text-xs bg-secondary rounded px-2 py-1.5",children:[o.jsx(k0,{tool:r}),o.jsx("span",{className:"text-accent-primary font-medium",children:r}),o.jsx("span",{className:"text-text-muted truncate flex-1",children:lb(r,s)}),o.jsx("span",{className:`${N.color} ${N.animate?"animate-pulse":""}`,children:i==="pending"?"...":"done"})]}):o.jsxs("div",{className:"border border-border rounded overflow-hidden my-1 min-w-0",children:[o.jsxs("button",{className:"w-full flex items-center gap-1.5 p-2 bg-secondary hover:bg-secondary/80 text-left",onClick:()=>T(!j),children:[o.jsx("span",{className:`${N.color} ${N.animate?"animate-pulse":""}`,children:N.icon}),o.jsx("span",{className:"font-mono text-accent-primary text-sm",children:r}),o.jsx("span",{className:"text-text-muted text-xs flex-1 truncate",children:lb(r,s)}),o.jsx("span",{className:"text-text-muted text-xs",children:j?"▼":"▶"})]}),A&&o.jsx(P5,{confirmation:A}),(j||v)&&o.jsxs("div",{className:"p-2 bg-primary border-t border-border space-y-2 min-w-0",children:[r==="run_command"&&o.jsx(z5,{command:String(s.command??""),timeout:s.timeout??12e4,startedAt:m,streamingOutput:b,status:i,result:f,error:l,durationMs:d}),r==="edit_file"&&i==="success"&&o.jsxs(o.Fragment,{children:[g&&g.regions.length>0?o.jsx(L5,{regions:g.regions,filePath:String(s.path??"")}):o.jsx(A5,{oldString:String(s.old_string??""),newString:String(s.new_string??""),filePath:String(s.path??"")}),p&&p.length>0&&o.jsx(ob,{diagnostics:p})]}),r==="write_file"&&i==="success"&&o.jsxs(o.Fragment,{children:[o.jsx(D5,{content:String(s.content??""),filePath:String(s.path??"")}),p&&p.length>0&&o.jsx(ob,{diagnostics:p})]}),r==="read_file"&&i==="success"&&o.jsx(I5,{result:f,metadata:_,filePath:String(s.path??""),heightExpanded:j}),r==="return_value"&&(()=>{const z=(b==null?void 0:b.map(q=>q.content).join(""))??"",O=i==="pending"&&z?z:String(s.content??"");return o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] text-accent-primary font-medium mb-1 uppercase tracking-wide",children:"Sub-Agent Summary"}),o.jsx("div",{className:"text-xs prose prose-invert prose-sm max-w-none",children:o.jsx(Gs,{content:O})})]})})(),r!=="edit_file"&&r!=="write_file"&&r!=="run_command"&&r!=="read_file"&&r!=="return_value"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] text-text-muted mb-0.5",children:"Arguments:"}),o.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded overflow-x-auto",children:U5(s)})]}),i==="success"&&f!==void 0&&o.jsxs("div",{children:[o.jsxs("div",{className:"text-[10px] text-text-muted mb-0.5",children:["Result",d!==void 0&&` (${d}ms)`,":"]}),o.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded overflow-x-auto max-h-32",children:f||"No output"})]})]}),i==="success"&&(r==="edit_file"||r==="write_file"||r==="read_file")&&d!==void 0&&o.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",d,"ms"]}),i==="error"&&l&&r!=="run_command"&&o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] text-accent-error mb-0.5",children:"Error:"}),o.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded text-accent-error",children:l})]})]})]})}),W5={read_file:"Reading file",write_file:"Writing file",edit_file:"Editing file",run_command:"Running command",glob:"Searching files",grep:"Searching content",ask_user:"Asking user",criterion:"Managing criterion",todo_write:"Updating tasks"};function V5(e){return W5[e]??`Preparing ${e}`}const G5=P.memo(function({name:r}){const s=V5(r);return o.jsx("div",{className:"border border-border rounded overflow-hidden my-1 min-w-0 animate-pulse",children:o.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-bg-tertiary",children:[o.jsx("span",{className:"text-accent-warning animate-pulse",children:"..."}),o.jsx(k0,{tool:r}),o.jsx("span",{className:"font-mono text-accent-primary text-sm",children:r}),o.jsxs("span",{className:"text-text-muted text-xs flex-1",children:[s,"..."]})]})})}),K5={pending:{icon:"○",color:"text-text-muted"},in_progress:{icon:"●",color:"text-accent-warning",animate:!0},completed:{icon:"✓",color:"text-accent-success"}},Y5=P.memo(function({todos:r}){return Array.isArray(r)?r.length===0?o.jsx("div",{className:"text-xs text-text-muted italic my-1",children:"No tasks"}):o.jsxs("div",{className:"my-1 rounded border border-border bg-bg-tertiary overflow-hidden",children:[o.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-bg-secondary",children:o.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Tasks"})}),o.jsx("div",{children:r.map((s,i)=>{const c=K5[s.status];return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${i>0?"border-t border-border":""}`,children:[o.jsx("span",{className:`${(c==null?void 0:c.color)??"text-text-muted"} ${c!=null&&c.animate?"animate-pulse":""} text-sm leading-tight`,children:(c==null?void 0:c.icon)??"○"}),o.jsx("span",{className:`text-sm leading-tight ${s.status==="completed"?"text-text-muted":"text-text-primary"}`,children:s.content})]},i)})})]}):o.jsx("div",{className:"text-xs text-accent-warning italic my-1",children:"⚠️ Invalid todos data"})}),cb={add:{icon:"○",color:"text-text-muted"},update:{icon:"○",color:"text-text-muted"},remove:{icon:"○",color:"text-text-muted"},complete:{icon:"◉",color:"text-purple-400"},pass:{icon:"✓",color:"text-accent-success"},fail:{icon:"✗",color:"text-accent-error"},get:{icon:"○",color:"text-text-muted"}},N0=P.memo(function({toolCalls:r,criteria:s}){if(r.length===0)return null;const i=new Map((s==null?void 0:s.map(u=>[u.id,u]))??[]),c=r.find(u=>{var f,l;return u.arguments.action==="get"&&((f=u.result)==null?void 0:f.success)&&((l=u.result)==null?void 0:l.output)});return o.jsxs("div",{className:"my-1 rounded border border-border bg-secondary overflow-hidden",children:[o.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-secondary",children:o.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Acceptance Criteria"})}),o.jsx("div",{className:"bg-primary",children:c?(()=>{const u=c.result.output;if(u==="No criteria defined yet.")return o.jsxs("div",{className:"flex items-start gap-2 px-2 py-1.5",children:[o.jsx("span",{className:"text-text-muted text-sm leading-tight flex-shrink-0",children:"○"}),o.jsx("div",{className:"flex-1 min-w-0 text-text-muted text-sm",children:"No criteria defined yet."})]});try{return JSON.parse(u).map((l,d)=>o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${d>0?"border-t border-border":""}`,children:[o.jsx("span",{className:"text-text-muted text-sm leading-tight flex-shrink-0",children:"○"}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx(Gs,{content:`[${l.id}] ${l.description}`})})]},l.id??d))}catch{return r.map((f,l)=>o.jsx(ub,{tc:f,index:l,criteriaMap:i},f.id??l))}})():r.map((u,f)=>o.jsx(ub,{tc:u,index:f,criteriaMap:i},u.id??f))})]})});function ub({tc:e,index:r,criteriaMap:s}){const i=e.arguments.action,c=i&&cb[i]?cb[i]:{icon:"○",color:"text-text-muted"},u=e.arguments,f=i==="remove",l=u.id,d=u.description,p=l?s.get(l):void 0,g=d??(p==null?void 0:p.description)??(f&&l?`[${l}]`:"Criterion updated"),m=u.reason,b=i==="fail";return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${r>0?"border-t border-border":""}`,children:[o.jsx("span",{className:`${c.color} text-sm leading-tight flex-shrink-0`,children:c.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:f?"line-through text-text-muted":"",children:o.jsx(Gs,{content:g})}),m&&o.jsxs("div",{className:`mt-1 text-sm ${b?"text-accent-error":"text-text-muted"}`,children:[o.jsx("span",{className:"text-text-muted",children:"└ "}),'"',m,'"']})]})]})}function X5(e){return e==="criterion"}const Z5="#6b7280";function nc(e,r){var s;return((s=e.find(i=>i.id===r))==null?void 0:s.color)??Z5}const Tt=Un(e=>{const r=async()=>{await zh("/api/agents",e)};return{defaults:[],userItems:[],loading:!1,fetchAgents:r,fetchAgent:async s=>{try{const i=await ke(`/api/agents/${s}`);return i.ok?await i.json():null}catch{return null}},fetchDefaultContent:async s=>{try{const i=await ke(`/api/agents/defaults/${s}`);return i.ok?await i.json():null}catch{return null}},createAgent:async s=>{const i=await gs("POST","/api/agents",s);return i.success&&await r(),i},updateAgent:async(s,i)=>{const c=await gs("PUT",`/api/agents/${s}`,i);return c.success&&await r(),c},deleteAgent:async s=>{try{const i=await ke(`/api/agents/${s}`,{method:"DELETE"}),c=await i.json();return i.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==s)})),{success:!0}):{success:!1,error:c.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateAgent:async s=>{try{const i=await ke(`/api/agents/${s}/duplicate`,{method:"POST"}),c=await i.json();return i.ok?(await r(),{success:!0}):{success:!1,error:c.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}});function Q5(e){const r=[];let s=[];const i=()=>{s.length>0&&(r.push({type:"criteria_group",toolCalls:s}),s=[])};for(const c of e)c.type==="tool_call"&&X5(c.toolCall.name)?s.push(c.toolCall):(i(),r.push(c));return i(),r}function J5(e,r){if(e.segments&&e.segments.length>0)return eA(e.segments,e.toolCalls??[],e.preparingToolCalls??[],e.stats,r);const s=[];if(e.thinkingContent&&s.push({type:"thinking",content:e.thinkingContent}),e.content&&s.push({type:"text",content:e.content}),e.toolCalls)for(const i of e.toolCalls)s.push({type:"tool_call",toolCall:i});if(e.preparingToolCalls)for(const i of e.preparingToolCalls)s.push({type:"preparing_tool_call",preparing:i});return r&&e.stats&&s.push({type:"stats",stats:e.stats}),s}function eA(e,r,s,i,c){const u=[],f=new Map(r.map(l=>[l.id,l]));for(const l of e)switch(l.type){case"text":u.push({type:"text",content:l.content});break;case"thinking":l.content&&l.content.trim().length>0&&u.push({type:"thinking",content:l.content});break;case"tool_call":{const d=f.get(l.toolCallId);d&&u.push({type:"tool_call",toolCall:d});break}}for(const l of s)u.push({type:"preparing_tool_call",preparing:l});return c&&i&&u.push({type:"stats",stats:i}),u}const Cf=P.memo(function({message:r,showStats:s=!0,showThinking:i=!0,showVerboseToolOutput:c=!0}){const u=Ce(b=>{var _;return(_=b.currentSession)==null?void 0:_.criteria}),f=Tt(b=>b.defaults),l=Tt(b=>b.userItems),d=[...f,...l],p=J5(r,s),g=i?p:p.filter(b=>b.type!=="thinking"),m=Q5(g);return m.length===0?null:o.jsx("div",{className:"feed-item",children:o.jsxs("div",{className:"min-w-0",children:[m.map((b,_)=>{var E,C;switch(b.type){case"thinking":return o.jsx(k5,{content:b.content},_);case"text":return o.jsx("div",{className:"prose prose-sm prose-invert max-w-none",children:o.jsx(Gs,{content:b.content})},_);case"preparing_tool_call":return o.jsx(G5,{name:b.preparing.name},`preparing-${b.preparing.index}`);case"tool_call":{const y=b.toolCall,v=y.result;if(y.name==="todo_write"){const j=y.arguments.todos,T=Array.isArray(j)?j:[];return o.jsx(Y5,{todos:T},_)}const x=(E=v==null?void 0:v.output)==null?void 0:E.includes("[interrupted by user]"),S=v?x?"interrupted":v.success?"success":"error":"pending";return o.jsx(q5,{tool:y.name,args:y.arguments,status:S,variant:"expandable",forceCompact:!c,result:v==null?void 0:v.output,error:v==null?void 0:v.error,durationMs:v==null?void 0:v.durationMs,diagnostics:v==null?void 0:v.diagnostics,editContext:v==null?void 0:v.editContext,startedAt:y.startedAt,streamingOutput:y.streamingOutput,metadata:v==null?void 0:v.metadata,callId:y.id},_)}case"criteria_group":return o.jsx(N0,{toolCalls:b.toolCalls,criteria:u},_);case"stats":{const y=b.stats;if(!y||"error"in y)return null;const v=((C=y.model.split("/").pop())==null?void 0:C.split("-").slice(0,2).join("-"))??y.model,x=nc(d,y.mode),S=T=>T>=1e3?`${(T/1e3).toFixed(1)}k`:T.toString(),j=T=>T>=1e3?`${(T/1e3).toFixed(1)}k`:T.toFixed(1);return o.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[10px] text-text-muted mt-3",children:[o.jsx("span",{className:"flex-1 h-px bg-border"}),o.jsx("span",{className:"text-text-secondary",children:v}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsx("span",{style:{color:x},children:y.mode}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[y.totalTime.toFixed(1),"s"]}),y.toolTime>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[y.toolTime.toFixed(1),"s tools"]})]}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[S(y.prefillTokens)," @ ",j(y.prefillSpeed)," pp"]}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[S(y.generationTokens)," @ ",j(y.generationSpeed)," tg"]}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsx("button",{type:"button",className:"text-text-muted hover:text-text-secondary transition-colors",title:"View detailed stats",onClick:()=>{const T=new CustomEvent("open-turn-stats",{detail:{stats:y}});window.dispatchEvent(T)},children:o.jsx(vw,{className:"w-3 h-3"})}),o.jsx("span",{className:"flex-1 h-px bg-border"})]},_)}}}),r.partial&&o.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-accent-warning mt-1",children:[o.jsx(Vb,{}),o.jsx("span",{children:"Aborted"})]})]})})}),Nt=Un((e,r)=>({defaults:[],userItems:[],activeWorkflowId:"default",loading:!1,templateVariables:[],fetchTemplateVariables:async()=>{try{const i=await(await ke("/api/workflows/template-variables")).json();e({templateVariables:i.variables??[]})}catch{}},fetchWorkflows:async()=>{e({loading:!0});try{const i=await(await ke("/api/workflows")).json();e({defaults:i.defaults??[],userItems:i.userItems??[],activeWorkflowId:i.activeWorkflowId??"default",loading:!1})}catch{e({loading:!1})}},fetchWorkflow:async s=>{try{const i=await ke(`/api/workflows/${s}`);return i.ok?await i.json():null}catch{return null}},fetchDefaultContent:async s=>{try{const i=await ke(`/api/workflows/defaults/${s}`);return i.ok?await i.json():null}catch{return null}},createWorkflow:async s=>{const i=await gs("POST","/api/workflows",s);return i.success&&await r().fetchWorkflows(),i},updateWorkflow:async(s,i)=>{const c=await gs("PUT",`/api/workflows/${s}`,i);return c.success&&await r().fetchWorkflows(),c},deleteWorkflow:async s=>{try{const i=await ke(`/api/workflows/${s}`,{method:"DELETE"}),c=await i.json();return i.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==s)})),{success:!0}):{success:!1,error:c.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateWorkflow:async s=>{try{const i=await ke(`/api/workflows/${s}/duplicate`,{method:"POST"}),c=await i.json();return i.ok?(await r().fetchWorkflows(),{success:!0}):{success:!1,error:c.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}));function rc(e,r){const s=parseInt(e.slice(1,3),16),i=parseInt(e.slice(3,5),16),c=parseInt(e.slice(5,7),16);return`rgba(${s},${i},${c},${r})`}function tA(e){if(e<60)return`${e}s`;const r=Math.floor(e/60),s=Math.round(e%60);return s>0?`${r}m ${s}s`:`${r}m`}function nA(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}const rA=P.memo(function({data:r}){var f;const s=Nt(l=>l.defaults),i=Nt(l=>l.userItems),u=((f=[...s,...i].find(l=>l.id===r.workflowId))==null?void 0:f.color)??r.workflowColor??"#8b949e";return o.jsxs("div",{className:"feed-item rounded p-3 border",style:{borderColor:rc(u,.3),backgroundColor:rc(u,.08)},children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(jw,{color:u}),o.jsx("span",{className:"text-sm font-medium",style:{color:u},children:r.workflowName??"Task Completed"})]}),o.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-5 gap-2",children:[o.jsx(Ka,{label:"Iterations",value:String(r.iterations)}),o.jsx(Ka,{label:"Total time",value:tA(r.totalTimeSeconds)}),o.jsx(Ka,{label:"Tool calls",value:String(r.totalToolCalls)}),o.jsx(Ka,{label:"Tokens",value:nA(r.totalTokensGenerated)}),o.jsx(Ka,{label:"Speed",value:r.avgGenerationSpeed>0?`${r.avgGenerationSpeed} tok/s`:"-"})]})]})});function Ka({label:e,value:r}){return o.jsxs("div",{className:"bg-bg-primary/50 rounded px-2 py-1",children:[o.jsx("div",{className:"text-sm text-text-muted",children:e}),o.jsx("div",{className:"text-sm text-text-primary font-medium",children:r})]})}const sA=P.memo(function({data:r}){var f;const s=Nt(l=>l.defaults),i=Nt(l=>l.userItems),u=((f=[...s,...i].find(l=>l.id===r.workflowId))==null?void 0:f.color)??r.workflowColor??"#6b7280";return o.jsxs("div",{className:"feed-item flex items-center gap-2 px-3 py-2 rounded border",style:{borderColor:rc(u,.3),backgroundColor:rc(u,.08)},children:[o.jsx(_w,{className:"w-3 h-3 shrink-0",color:u}),o.jsx("span",{className:"text-sm font-medium",style:{color:u},children:r.workflowName}),o.jsx("span",{className:"text-text-muted text-sm",children:"started"})]})});function iA({attachments:e,messageId:r}){const[s,i]=P.useState(null),c=Ce(g=>g.visionFallbackByMessage),u=Ce(g=>g.messages),f=P.useMemo(()=>{const g=u.findIndex(m=>m.id===r);if(g===-1)return null;for(let m=g+1;m<u.length;m++){const b=u[m];if(b&&b.role==="assistant")return b.id}return null},[u,r]),l=g=>{i(g)},d=()=>{i(null)},p=g=>{const m=`${r}-${g}`;if(c[m])return c[m];if(f){const b=`${f}-${g}`;return c[b]}return null};return e.length===0?null:o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mt-3 flex flex-wrap gap-3",children:e.map(g=>{const m=p(g.id);return o.jsxs("div",{className:"relative inline-block",children:[o.jsxs("button",{onClick:()=>l(g.data),className:"group relative inline-block",title:g.filename,disabled:(m==null?void 0:m.type)==="start",children:[o.jsx("img",{src:g.data,alt:g.filename,className:"max-w-[256px] max-h-[256px] object-contain rounded-lg border border-border hover:border-accent-primary transition-colors cursor-pointer"}),(m==null?void 0:m.type)==="start"&&o.jsx("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center rounded-lg",children:o.jsx("span",{className:"text-xs text-text-primary animate-pulse",children:"Describing image..."})})]}),(m==null?void 0:m.type)==="done"&&m.description&&o.jsxs("div",{className:"mt-2 p-2 bg-bg-tertiary rounded text-xs text-text-secondary max-w-[256px]",children:[m.description.slice(0,200),m.description.length>200?"...":""]})]},g.id)})}),s&&o.jsx(j0,{src:s,alt:"Attached image",isOpen:!0,onClose:d})]})}function aA({isOpen:e,onClose:r,promptContext:s}){const[i,c]=P.useState({systemPrompt:!1,messages:!0,tools:!0,requestOptions:!0,injectedFiles:!0,userMessage:!0}),u=f=>{c(l=>({...l,[f]:!l[f]}))};return o.jsx(At,{isOpen:e,onClose:r,title:"Prompt Inspector",size:"lg",children:o.jsxs("div",{className:"space-y-4",children:[o.jsx(Mi,{title:"User Message",expanded:i.userMessage??!0,onToggle:()=>u("userMessage"),children:o.jsx("pre",{className:"text-sm text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-48 overflow-auto",children:s.userMessage||"(empty)"})}),s.messages.length>0&&o.jsx(Mi,{title:`Prompt Messages (${s.messages.length})`,expanded:i.messages??!0,onToggle:()=>u("messages"),children:o.jsx("div",{className:"space-y-2",children:s.messages.map((f,l)=>o.jsxs("div",{className:"border border-border rounded overflow-hidden",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-bg-tertiary/50 text-xs text-text-muted",children:[o.jsx("span",{className:"font-mono text-text-primary",children:f.role}),o.jsx("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:f.source}),f.toolCallId&&o.jsx("span",{className:"font-mono",children:f.toolCallId}),f.attachments&&f.attachments.length>0&&o.jsxs("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:[f.attachments.length," attachment",f.attachments.length===1?"":"s"]})]}),f.attachments&&f.attachments.length>0&&o.jsx("div",{className:"border-b border-border px-3 py-2 text-xs text-text-muted",children:f.attachments.map(d=>d.filename).join(", ")}),o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded-b p-3 max-h-64 overflow-auto font-mono",children:f.content||"(empty)"})]},`${f.role}-${l}`))})}),o.jsx(Mi,{title:`Tools (${s.tools.length})`,expanded:i.tools??!0,onToggle:()=>u("tools"),children:o.jsxs("div",{className:"space-y-2",children:[s.tools.length===0&&o.jsx("div",{className:"text-sm text-text-muted",children:"No tools sent with this request."}),s.tools.map((f,l)=>o.jsxs("div",{className:"bg-bg-tertiary rounded p-3 space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("span",{className:"font-mono text-sm text-text-primary",children:f.name}),o.jsx("span",{className:"text-xs text-text-muted",children:"parameters"})]}),o.jsx("div",{className:"text-sm text-text-secondary",children:f.description}),o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap max-h-48 overflow-auto font-mono",children:JSON.stringify(f.parameters,null,2)})]},`${f.name}-${l}`))]})}),o.jsx(Mi,{title:"Request Options",expanded:i.requestOptions??!0,onToggle:()=>u("requestOptions"),children:o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-48 overflow-auto font-mono lowercase",children:JSON.stringify(s.requestOptions,null,2)})}),s.injectedFiles.length>0&&o.jsx(Mi,{title:`Injected Files (${s.injectedFiles.length})`,expanded:i.injectedFiles??!0,onToggle:()=>u("injectedFiles"),children:o.jsx("div",{className:"space-y-2",children:s.injectedFiles.map((f,l)=>o.jsx(oA,{file:f,expanded:i[`file-${l}`]??!1,onToggle:()=>u(`file-${l}`)},l))})}),o.jsx(Mi,{title:"System Prompt",expanded:i.systemPrompt??!1,onToggle:()=>u("systemPrompt"),badge:`${Math.round(s.systemPrompt.length/1e3)}K chars`,children:o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-96 overflow-auto font-mono",children:s.systemPrompt})})]})})}function oA({file:e,expanded:r,onToggle:s}){return o.jsxs("div",{className:"bg-bg-tertiary rounded overflow-hidden",children:[o.jsxs("button",{onClick:s,className:"w-full flex items-center gap-2 p-2 hover:bg-bg-primary/30 transition-colors",children:[o.jsx(mr,{className:`w-3 h-3 text-text-muted transition-transform ${r?"rotate-90":""}`}),o.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${e.source==="global"?"bg-purple-500/20 text-purple-400":e.source==="project"?"bg-blue-500/20 text-blue-400":"bg-green-500/20 text-green-400"}`,children:e.source}),o.jsx("span",{className:"text-sm text-text-primary font-mono truncate flex-1 text-left",children:e.path}),e.content&&o.jsxs("span",{className:"text-xs text-text-muted",children:[Math.round(e.content.length/1e3),"K chars"]})]}),r&&e.content&&o.jsx("div",{className:"border-t border-border/50 p-2",children:o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap max-h-64 overflow-auto font-mono",children:e.content})})]})}function Mi({title:e,expanded:r,onToggle:s,badge:i,children:c}){return o.jsxs("div",{className:"border border-border rounded overflow-hidden",children:[o.jsx("button",{onClick:s,className:"w-full flex items-center justify-between p-3 bg-bg-tertiary/50 hover:bg-bg-tertiary transition-colors",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(mr,{className:`w-4 h-4 text-text-muted transition-transform ${r?"rotate-90":""}`}),o.jsx("span",{className:"font-medium text-text-primary",children:e}),i&&o.jsx("span",{className:"text-xs text-text-muted bg-bg-tertiary px-1.5 py-0.5 rounded",children:i})]})}),r&&o.jsx("div",{className:"p-3 border-t border-border",children:c})]})}function lA({content:e,promptContext:r,align:s="right"}){const[i,c]=P.useState(!1),[u,f]=P.useState(!1),[l,d]=P.useState(!1),p=P.useRef(null);P.useEffect(()=>{const b=_=>{p.current&&!p.current.contains(_.target)&&c(!1)};return i&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[i]);const g=async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(e);else{const b=document.createElement("textarea");b.value=e,b.style.position="fixed",b.style.left="-999999px",document.body.appendChild(b),b.select(),document.execCommand("copy"),document.body.removeChild(b)}d(!0),c(!1),window.setTimeout(()=>d(!1),1500)}catch(b){console.error("Failed to copy:",b)}},m=s==="right";return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`flex items-start gap-1.5 ${m?"":"order-first"}`,children:[l&&o.jsx(Pr,{className:"w-4 h-4 text-accent-success"}),o.jsxs("div",{ref:p,className:"relative",children:[o.jsx("button",{onClick:()=>c(!i),className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary",title:"Message options",children:o.jsx(Ih,{})}),i&&o.jsxs("div",{className:`absolute top-full mt-1 bg-bg-secondary border border-border rounded shadow-xl z-50 py-1 min-w-36 ${m?"right-0":"left-0"}`,children:[o.jsxs("button",{onClick:g,className:"w-full px-3 py-1.5 text-left text-sm text-text-primary hover:bg-bg-tertiary flex items-center gap-2",children:[o.jsx(oc,{className:"w-4 h-4"}),"Copy"]}),r&&o.jsxs("button",{onClick:()=>{f(!0),c(!1)},className:"w-full px-3 py-1.5 text-left text-sm text-text-primary hover:bg-bg-tertiary flex items-center gap-2",children:[o.jsx(lc,{className:"w-4 h-4"}),"Inspect"]})]})]})]}),r&&o.jsx(aA,{isOpen:u,onClose:()=>f(!1),promptContext:r})]})}function cA({message:e}){const[r,s]=P.useState(!1);if(e.messageKind!=="auto-prompt")return null;const i=e.metadata,c=(i==null?void 0:i.color)??"#6b7280",u=(i==null?void 0:i.name)??"Agent",f=(i==null?void 0:i.type)??"agent",d={agent:"definition injected",workflow:"instructions",compaction:"prompt injected",subagent:"instructions"}[f]??"injected",p=f==="workflow"||f==="subagent";return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[10px] text-text-muted font-mono mt-3 mb-4",children:[o.jsx("span",{className:"flex-1 h-px bg-border"}),o.jsx("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${p?"":"cursor-pointer"}`,style:{backgroundColor:c},onClick:()=>!p&&s(!0)}),o.jsx("span",{className:p?"":"cursor-pointer hover:text-text-secondary transition-colors",style:{color:c},onClick:()=>!p&&s(!0),children:u}),o.jsx("span",{children:"·"}),o.jsx("span",{className:p?"":"cursor-pointer hover:text-text-secondary transition-colors",onClick:()=>!p&&s(!0),children:d}),o.jsx("span",{className:"flex-1 h-px bg-border"})]}),p&&o.jsx("div",{className:"flex justify-center feed-item mb-4",children:o.jsx("div",{className:"max-w-[75%] rounded p-3 bg-bg-tertiary/50 text-text-secondary text-sm",style:{borderLeft:`3px solid ${c}`},children:o.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs",children:e.content})})}),o.jsx(At,{isOpen:r,onClose:()=>s(!1),title:`${u} Prompt`,size:"lg",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:c}}),o.jsx("span",{className:"text-sm text-text-primary font-medium",children:u}),o.jsxs("span",{className:"text-xs text-text-muted",children:["(",f,")"]})]}),o.jsx("div",{className:"h-full min-h-96",children:o.jsx("pre",{className:"text-sm text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-4 h-full min-h-96 overflow-auto font-mono",children:e.content})})]})})]})}function uA({message:e,promptContext:r}){const s=e.messageKind==="auto-prompt",i=e.messageKind==="command",c=e.isSystemGenerated;return o.jsxs("div",{className:"flex justify-end items-start gap-1.5 feed-item",children:[!c&&o.jsx(lA,{content:e.content,promptContext:r,align:"right"}),o.jsxs("div",{className:`max-w-[75%] rounded p-2 ${c?i?"bg-teal-500/10 border border-teal-500/30":s?"bg-slate-500/10 border border-slate-500/30":"bg-amber-500/10 border border-amber-500/30":"bg-accent-primary/15 text-text-primary"}`,children:[c&&o.jsx("span",{className:`text-[10px] block mb-0.5 ${i?"text-teal-400":s?"text-slate-400":"text-amber-400"}`,children:i?"Command":s?"Auto":"System"}),o.jsx("div",{className:`whitespace-pre-wrap text-sm ${c?`${i?"text-teal-200":s?"text-slate-200":"text-amber-200 italic"}`:""}`,children:e.content}),e.attachments&&e.attachments.length>0&&o.jsx(iA,{attachments:e.attachments,messageId:e.id})]})]})}const T0=P.memo(function({message:r,isLastAssistantMessage:s=!1,promptContext:i}){const c=r.role==="user",u=r.role==="assistant",f=r.role==="system",l=r.role==="tool";if(u)return o.jsx(Cf,{message:r,showStats:s});if(f&&r.isCompacted)return o.jsxs("div",{className:"feed-item bg-bg-tertiary/50 border border-border rounded p-2",children:[o.jsx("div",{className:"text-text-muted text-xs mb-0.5",children:"[Compacted]"}),o.jsx("div",{className:"text-text-secondary text-xs whitespace-pre-wrap",children:r.content.replace(`[COMPACTED HISTORY]
138
+ `,"")})]});if(l)return o.jsxs("div",{className:"feed-item bg-bg-tertiary/30 border-l-2 border-accent-primary rounded-r p-2",children:[o.jsxs("div",{className:"text-accent-primary text-xs mb-0.5",children:["Tool: ",r.toolName]}),o.jsxs("pre",{className:"text-text-secondary text-xs whitespace-pre-wrap overflow-x-auto max-h-32",children:[r.content.slice(0,500),r.content.length>500&&"..."]})]});if(r.messageKind==="workflow-started")try{const d=JSON.parse(r.content);return o.jsx(sA,{data:d})}catch{}if(r.messageKind==="task-completed")try{const d=JSON.parse(r.content);return o.jsx(rA,{data:d})}catch{}return r.messageKind==="context-reset"?o.jsxs("div",{className:"flex items-center gap-4 mb-6 text-text-muted text-xs uppercase tracking-wide",children:[o.jsx("div",{className:"flex-1 border-t border-border"}),o.jsx("span",{children:r.content}),o.jsx("div",{className:"flex-1 border-t border-border"})]}):r.messageKind==="auto-prompt"&&r.isSystemGenerated?o.jsx(cA,{message:r}):c?o.jsx(uA,{message:r,promptContext:i}):o.jsx("div",{className:"flex justify-start feed-item",children:o.jsx("div",{className:"max-w-[75%] rounded p-2 bg-bg-tertiary text-text-primary",children:o.jsx(Gs,{content:r.content})})})});function dA({stats:e,onClose:r}){var s;return o.jsx(At,{isOpen:!0,onClose:r,title:"Turn Stats",size:"md",children:o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"flex items-center gap-3",children:o.jsxs("p",{className:"text-xs text-text-muted",children:[e.model," · ",e.mode]})}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[o.jsx(Ul,{label:"Total Time",value:`${e.totalTime.toFixed(1)}s`}),o.jsx(Ul,{label:"Prefill",value:e.prefillTokens>=1e3?`${(e.prefillTokens/1e3).toFixed(1)}k`:String(e.prefillTokens)}),o.jsx(Ul,{label:"Generated",value:e.generationTokens>=1e3?`${(e.generationTokens/1e3).toFixed(1)}k`:String(e.generationTokens)}),o.jsx(Ul,{label:"LLM Calls",value:String(((s=e.llmCalls)==null?void 0:s.length)??1)})]}),e.llmCalls&&e.llmCalls.length>0&&o.jsxs("div",{children:[o.jsx("h4",{className:"text-sm font-medium text-text-secondary mb-2",children:"LLM Calls"}),e.llmCalls.map((i,c)=>o.jsxs("div",{className:"bg-bg-tertiary/30 rounded p-3 mb-2",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsxs("span",{className:"text-xs text-text-muted",children:["Call ",c+1]}),o.jsxs("span",{className:"text-xs text-text-muted",children:[i.ttft.toFixed(2),"s TTFT · ",i.completionTime.toFixed(2),"s gen"]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-text-muted",children:"Tokens:"})," ",o.jsxs("span",{className:"text-text-primary",children:[i.promptTokens," → ",i.completionTokens]})]}),o.jsxs("div",{className:"flex flex-wrap gap-x-2 gap-y-1",children:[i.temperature!==void 0&&o.jsx($l,{label:"temp",value:i.temperature.toFixed(2)}),i.topP!==void 0&&o.jsx($l,{label:"topP",value:i.topP.toFixed(2)}),i.topK!==void 0&&o.jsx($l,{label:"topK",value:String(i.topK)}),i.maxTokens!==void 0&&o.jsx($l,{label:"maxTok",value:String(i.maxTokens)})]})]})]},c))]})]})})}function Ul({label:e,value:r}){return o.jsxs("div",{className:"bg-bg-tertiary/50 rounded p-3",children:[o.jsx("div",{className:"text-xs text-text-muted",children:e}),o.jsx("div",{className:"text-lg font-semibold text-text-primary",children:r})]})}function $l({label:e,value:r}){return o.jsxs("span",{className:"bg-bg-tertiary px-1.5 py-0.5 rounded text-text-primary",children:[o.jsxs("span",{className:"text-text-muted",children:[e,":"]})," ",r]})}const A0=(e,r)=>{const s=P.useRef(!0),i=P.useRef(null),[c,u]=P.useState(!0),f=()=>{const l=e.current;l&&(l.scrollTop=l.scrollHeight)};return P.useEffect(()=>{const l=e.current;if(!l)return;const d=_=>{if(_.deltaY>0){requestAnimationFrame(()=>requestAnimationFrame(()=>{l.scrollHeight-l.scrollTop-l.offsetHeight<100&&(s.current=!0,u(!0))}));return}s.current=!1,u(!1)},p=_=>{_.touches[0]&&(i.current=_.touches[0].clientY)},g=_=>{if(i.current===null)return;const E=_.touches[0];if(!E)return;if(E.clientY-i.current>0){s.current=!1,u(!1);return}requestAnimationFrame(()=>requestAnimationFrame(()=>{l.scrollHeight-l.scrollTop-l.offsetHeight<100&&(s.current=!0,u(!0))}))},m=new MutationObserver(()=>{s.current&&requestAnimationFrame(f)}),b=setInterval(()=>{s.current&&f()},1e3);return l.addEventListener("wheel",d,{passive:!0}),l.addEventListener("touchstart",p,{passive:!0}),l.addEventListener("touchmove",g,{passive:!0}),m.observe(l,{childList:!0,subtree:!0,characterData:!0}),()=>{l.removeEventListener("wheel",d),l.removeEventListener("touchstart",p),l.removeEventListener("touchmove",g),m.disconnect(),clearInterval(b)}},[r==null?void 0:r.id]),{force_scroll_to_bottom:()=>{s.current=!0,u(!0),f()},isAutoScrollActive:c,setAutoScroll:l=>{s.current=l,u(l),l&&f()}}},hA={verifier:"Verification",code_reviewer:"Code Review",test_generator:"Test Generation",debugger:"Debug"};function fA(e){return{backgroundColor:`${e}20`,color:e,borderColor:`${e}4d`}}function db(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function pA({contextState:e}){const{currentTokens:r,maxTokens:s,compactionCount:i,dangerZone:c}=e,u=Math.round(r/s*100);return o.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[o.jsxs("span",{className:db(u,c),children:[Xl(r),"/",Xl(s)]}),o.jsxs("span",{className:db(u,c),children:["(",u,"%)"]}),o.jsx(ay,{percent:u,dangerZone:c,size:"sm"}),c&&o.jsx("span",{className:"text-accent-error animate-pulse",children:"Low!"}),i>0&&o.jsxs("span",{className:"text-text-muted bg-bg-tertiary px-1 rounded",children:[i,"x"]})]})}const mA=P.memo(function({messages:r,subAgentType:s,subAgentId:i,isStreaming:c}){const u=P.useRef(null),f=P.useRef(null),[l,d]=P.useState(!1),p=Tt(D=>D.defaults),g=Tt(D=>D.userItems),m=[...p,...g],b=Ce(D=>D.subAgentContextStates[i]),{showThinking:_,showVerboseToolOutput:E}=_b(),{isAutoScrollActive:C,setAutoScroll:y}=A0(f,null);P.useEffect(()=>{c||y(!0)},[c]);const v=P.useCallback(()=>{const D=!l;d(D),D&&setTimeout(()=>{var A;(A=u.current)==null||A.scrollIntoView({block:"start",behavior:"smooth"})},220)},[l]),x=m.find(D=>D.id===s),S=(x==null?void 0:x.name)??hA[s]??s,j=nc(m,s),T=fA(j),N=r.filter(D=>D.role!=="tool");return o.jsxs("div",{ref:u,className:"feed-item border border-border rounded overflow-hidden bg-secondary",children:[o.jsxs("div",{className:"w-full flex items-center justify-between px-2 py-1 border-b relative",style:T,children:[o.jsx("span",{className:"text-xs font-medium",children:S}),o.jsx("div",{className:"absolute left-1/2 -translate-x-1/2",children:b&&o.jsx(pA,{contextState:b})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("button",{type:"button",className:"text-sm text-text-muted hover:text-text-primary flex items-center gap-1.5",onClick:()=>y(!C),children:[o.jsx("span",{className:`w-1 h-1 rounded-full ${C?"bg-accent-success":"border border-text-muted"}`}),"live"]}),o.jsxs("button",{type:"button",className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-tertiary",onClick:v,children:[l?"▼":"▶"," Expand"]})]})]}),o.jsx("div",{ref:f,className:`${l?"max-h-[calc(100vh-10rem)]":"max-h-80"} overflow-y-auto p-2 transition-[max-height] duration-200`,children:N.map(D=>D.role==="assistant"?o.jsx(Cf,{message:D,showStats:!0,showThinking:_,showVerboseToolOutput:E},D.id):o.jsx(T0,{message:D,isLastAssistantMessage:!1},D.id))})]})});function gA(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")}function xA({agent:e,isBuiltIn:r,isConfirmingDelete:s,onView:i,onEdit:c,onDuplicate:u,onDelete:f}){return o.jsxs(Yb,{isBuiltIn:r,isConfirmingDelete:s,onView:i,onEdit:c,onDuplicate:u,onDelete:f,children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:e.color??"#6b7280"}}),o.jsx("span",{className:"text-text-primary text-sm font-medium",children:e.name}),o.jsx("span",{className:"text-text-muted text-xs font-mono",children:e.id}),r&&o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-bg-primary text-text-muted",children:"Built-in"})]}),e.description&&o.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:e.description}),o.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.allowedTools.slice(0,5).map(l=>o.jsx("span",{className:"text-[10px] font-mono text-text-muted bg-bg-primary px-1 py-0.5 rounded",children:l},l)),e.allowedTools.length>5&&o.jsxs("span",{className:"text-[10px] text-text-muted",children:["+",e.allowedTools.length-5," more"]})]})]})}function hb({title:e,agents:r,subagents:s,isBuiltIn:i,onView:c,onDuplicate:u,onEdit:f,onDelete:l}){if(r.length===0&&s.length===0)return null;const d=p=>o.jsx(xA,{agent:p,isBuiltIn:i,isConfirmingDelete:!1,onView:()=>c(p.id),onEdit:i?void 0:()=>f==null?void 0:f(p.id),onDuplicate:()=>u(p.id),onDelete:i?void 0:()=>l==null?void 0:l(p.id)},p.id);return o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:e}),o.jsxs("div",{className:"space-y-2",children:[r.map(d),s.length>0&&o.jsxs("div",{className:"mt-3",children:[o.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1.5",children:"Sub-agents"}),o.jsx("div",{className:"space-y-2",children:s.map(d)})]})]})]})}function vA({isOpen:e,onClose:r,initialEditId:s}){const i=Tt(pe=>pe.defaults),c=Tt(pe=>pe.userItems),u=Tt(pe=>pe.loading),f=Tt(pe=>pe.fetchAgents),l=Tt(pe=>pe.fetchAgent),d=Tt(pe=>pe.fetchDefaultContent),p=Tt(pe=>pe.createAgent),g=Tt(pe=>pe.updateAgent),m=Tt(pe=>pe.deleteAgent),[b,_]=P.useState("list"),[E,C]=P.useState(null),[y,v]=P.useState(!1),[x,S]=P.useState(""),[j,T]=P.useState(""),[N,D]=P.useState(""),[A,z]=P.useState(!0),[O,q]=P.useState([]),[G,W]=P.useState("#6b7280"),[I,$]=P.useState(""),[B,X]=P.useState(""),[Z,H]=P.useState(!1),[L,R]=P.useState([]);function F(pe){const Ne=new Map;for(const Me of pe){const ot=Me.indexOf(":");if(ot===-1)Ne.set(Me,new Set);else{const ue=Me.slice(0,ot),Te=Me.slice(ot+1).split(",").filter(Boolean);Ne.set(ue,new Set(Te))}}return Ne}function U(pe){const Ne=[];for(const[Me,ot]of pe)ot.size===0?Ne.push(Me):Ne.push(`${Me}:${[...ot].join(",")}`);return Ne}const ne=F(O),Q=(pe,Ne)=>{const Me=new Map(ne),ot=Me.get(pe)||new Set,ue=new Set(ot);ue.has(Ne)?ue.delete(Ne):ue.add(Ne),ue.size===0?Me.set(pe,new Set):Me.set(pe,ue),q(U(Me))},ee=pe=>{const Ne=new Map(ne);Ne.has(pe)?Ne.delete(pe):Ne.set(pe,new Set),q(U(Ne))},Y=pe=>{S(pe.metadata.name),T(pe.metadata.id),D(pe.metadata.description),z(pe.metadata.subagent),q(pe.metadata.allowedTools),W(pe.metadata.color??"#6b7280"),$(pe.prompt),X("")},V=(pe,Ne,Me)=>{S(pe.metadata.name+" (copy)"),T(`${Ne}-copy-${Date.now()}`),D(pe.metadata.description),z(pe.metadata.subagent),q(pe.metadata.allowedTools),W(pe.metadata.color??"#6b7280"),$(pe.prompt),X(""),C(null),v(!1),_("edit")},oe=(pe,Ne)=>{Y(pe),C(Ne),v(!0),_("edit")};P.useEffect(()=>{e&&(f(),ke("/api/tools").then(pe=>pe.json()).then(pe=>R(pe.tools||[])).catch(()=>R([])),s?i.some(Ne=>Ne.id===s)?d(s).then(Ne=>{Ne&&V(Ne,s)}):l(s).then(Ne=>{Ne&&(Y(Ne),C(s),v(!1),_("edit"))}):(_("list"),C(null),v(!1)))},[e,f,l,d,s]);const re=async pe=>{if(i.some(Me=>Me.id===pe)){const Me=await d(pe);if(!Me)return;oe(Me,pe)}else{const Me=await l(pe);if(!Me)return;oe(Me,pe)}},ve=async pe=>{const Ne=await d(pe);Ne&&V(Ne,pe)},be=()=>{C(null),S(""),T(""),D(""),z(!0),q(["read_file"]),W("#6b7280"),$(""),X(""),v(!1),_("edit")},Le=async pe=>{const Ne=await l(pe);Ne&&(Y(Ne),C(pe),v(!1),_("edit"))},Oe=async pe=>{await m(pe)},ze=async()=>{const pe=E??j;if(!pe||!x||!I){X("Name and prompt are required.");return}H(!0),X("");const Ne={metadata:{id:pe,name:x,description:N,subagent:A,allowedTools:O,color:G},prompt:I},Me=E?await g(E,Ne):await p(Ne);if(H(!1),!Me.success){X(Me.error??"Failed to save agent.");return}s?r():_("list")},We=()=>{s?r():(_("list"),v(!1))},Ee=pe=>{S(pe),E||T(gA(pe))},fe=i.filter(pe=>pe.subagent),je=i.filter(pe=>!pe.subagent),Ue=c.filter(pe=>pe.subagent),It=c.filter(pe=>!pe.subagent);return b==="edit"?o.jsx(At,{isOpen:e,onClose:We,title:y?`${x}`:E?"Edit Agent":"New Agent",size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"space-y-3",children:[B&&o.jsx(Uh,{message:B}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ps,{label:"Name",value:x,onChange:Ee,placeholder:"My Agent",readOnly:y}),o.jsx(Ps,{label:"ID",value:j,onChange:T,readOnly:!0,placeholder:"my_agent",hint:"(read-only)",mono:!0})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ps,{label:"Description",value:N,onChange:D,placeholder:"What this agent does",readOnly:y}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Type"}),o.jsxs("div",{className:"flex items-center gap-3 h-[34px]",children:[o.jsx("button",{onClick:()=>!y&&z(!0),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${A?"bg-accent-primary/25 text-accent-primary":"bg-bg-tertiary text-text-muted hover:text-text-secondary"} ${y?"pointer-events-none opacity-60":""}`,children:"Sub-agent"}),o.jsx("button",{onClick:()=>!y&&z(!1),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${A?"bg-bg-tertiary text-text-muted hover:text-text-secondary":"bg-accent-primary/25 text-accent-primary"} ${y?"pointer-events-none opacity-60":""}`,children:"Top-level"}),o.jsxs("div",{className:"flex items-center gap-1.5 ml-auto",children:[o.jsx("label",{className:"text-xs text-text-secondary",children:"Color"}),o.jsx("input",{type:"color",value:G,onChange:pe=>!y&&W(pe.target.value),disabled:y,className:"w-6 h-6 rounded cursor-pointer border border-border bg-transparent"})]})]})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Tools"}),o.jsx("div",{className:"flex flex-wrap gap-1.5 p-2 bg-bg-tertiary border border-border rounded max-h-32 overflow-y-auto",children:L.map(pe=>{const Ne=ne.has(pe.name),Me=pe.actions.length>0,ot=ne.get(pe.name)||new Set,ue=o.jsxs("button",{className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${Ne?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted"}`,children:[o.jsx("span",{children:pe.name}),Me&&o.jsx("span",{className:`text-[10px] ${Ne&&ot.size>0?"text-accent-primary":"text-text-muted"}`,children:"*"})]},pe.name);return Me?y?o.jsxs("button",{className:"px-1.5 py-0.5 rounded text-xs font-mono flex items-center gap-1 bg-bg-primary text-text-muted pointer-events-none opacity-60",children:[o.jsx("span",{children:pe.name}),o.jsx("span",{className:"text-[10px]",children:"*"})]},pe.name):o.jsx(go,{trigger:ue,minWidth:"160px",items:[...pe.actions.map(_e=>({label:o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",htmlFor:`${pe.name}-${_e}`,children:[o.jsx("input",{type:"checkbox",id:`${pe.name}-${_e}`,checked:ot.has(_e),onChange:()=>Q(pe.name,_e),disabled:y,className:"w-3 h-3 rounded accent-accent-primary"}),o.jsx("span",{children:_e})]}),closeOnClick:!1})),{label:Ne?"Deselect all":"Select all",closeOnClick:!1,onClick:()=>{if(Ne)ee(pe.name);else{const _e=new Map(ne);_e.set(pe.name,new Set(pe.actions)),q(U(_e))}}}]},pe.name):o.jsx("button",{onClick:()=>!y&&ee(pe.name),className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${Ne?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted hover:text-text-secondary"} ${y?"pointer-events-none":"cursor-pointer"}`,children:o.jsx("span",{children:pe.name})},pe.name)})})]})]}),o.jsxs("div",{className:"flex-1 min-h-[150px] border-t border-border pt-3 flex flex-col",children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Prompt"}),o.jsx("textarea",{value:I,onChange:pe=>!y&&$(pe.target.value),readOnly:y,placeholder:"Instructions for this agent...",className:`h-80 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-y focus:outline-none focus:ring-1 focus:ring-accent-primary ${y?"opacity-60":""}`})]}),o.jsx(Iw,{onCancel:We,onSave:ze,saving:Z,saveDisabled:!x||!I||y}),y&&o.jsx("div",{className:"flex justify-end mt-2",children:o.jsx(st,{variant:"primary",onClick:()=>{S(x+" (copy)"),T(`${E}-copy-${Date.now()}`),C(null),v(!1)},children:"Duplicate & Customize"})})]})}):o.jsxs(At,{isOpen:e,onClose:r,title:"Agents",size:"lg",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:"Agents define behavior, tools, and prompts for top-level modes and sub-agents."}),o.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:o.jsx(st,{variant:"primary",size:"sm",onClick:be,children:"+ New"})})]}),u&&i.length===0&&c.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"Loading agents..."}):i.length===0&&c.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"No agents defined."}):o.jsxs("div",{className:"space-y-4",children:[i.length>0&&o.jsx(hb,{title:"Built-in",agents:je,subagents:fe,isBuiltIn:!0,onView:re,onDuplicate:ve}),c.length>0&&o.jsx(hb,{title:"Custom",agents:It,subagents:Ue,isBuiltIn:!1,onView:re,onDuplicate:ve,onEdit:Le,onDelete:Oe})]})]})}function bA(){const e=Ce(v=>{var x;return(x=v.currentSession)==null?void 0:x.mode}),r=Ce(v=>v.switchMode),s=Tt(v=>v.defaults),i=Tt(v=>v.userItems),c=Tt(v=>v.fetchAgents),u=[...s,...i],[f,l]=P.useState(!1),[d,p]=P.useState(!1),[g,m]=P.useState(null),b=P.useRef(null);if(P.useEffect(()=>{c()},[c]),P.useEffect(()=>{function v(x){b.current&&!b.current.contains(x.target)&&l(!1)}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[]),!e)return null;const _=u.filter(v=>!v.subagent),E=_.find(v=>v.id===e),C=(E==null?void 0:E.name)??e,y=nc(u,e);return o.jsxs("div",{className:"relative",ref:b,children:[o.jsxs("button",{type:"button",onClick:()=>l(!f),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors",title:"Switch agent",children:[o.jsx("span",{className:"text-sm font-medium",style:{color:y},children:C}),o.jsx(mr,{className:`w-3 h-3 text-text-muted transition-transform ${f?"rotate-180":""}`})]}),f&&_.length>0&&o.jsxs("div",{className:"absolute bottom-full left-0 mb-1 w-56 bg-bg-secondary border border-border rounded-lg shadow-lg overflow-hidden z-50",children:[_.map((v,x)=>{const S=v.id===e,j=nc(u,v.id),T=x<4?`Ctrl+${x+1}`:null;return o.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 text-sm transition-colors group ${S?"bg-bg-tertiary":"hover:bg-bg-tertiary cursor-pointer"}`,children:[o.jsxs("button",{type:"button",onClick:()=>{S||r(v.id),l(!1)},className:"flex-1 text-left flex items-center gap-2 min-w-0",children:[o.jsx("span",{className:"font-medium truncate",style:{color:j},children:v.name}),S&&o.jsx(Pr,{className:"w-3.5 h-3.5 text-text-muted shrink-0"})]}),T&&o.jsxs("span",{className:"shrink-0 px-1.5 py-0.5 text-[10px] bg-bg-tertiary text-text-muted rounded",children:["Ctrl+",x+1]})]},v.id)}),o.jsx("div",{className:"border-t border-border p-1",children:o.jsx("button",{type:"button",onClick:()=>{l(!1),p(!0)},className:"w-full text-left px-3 py-1.5 rounded text-sm text-text-muted hover:text-text-primary hover:bg-bg-tertiary transition-colors",children:"Manage Agents..."})})]}),o.jsx(vA,{isOpen:d,onClose:()=>{p(!1),m(null)},initialEditId:g})]})}function yA(){const e=Ce(i=>i.currentSession),r=Ce(i=>i.switchDangerLevel);if(!e)return null;const s=e.dangerLevel??"normal";return o.jsxs("div",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded bg-bg-tertiary/50",children:[o.jsx("button",{type:"button",onClick:()=>r("normal"),className:`px-2 py-0.5 text-xs font-medium rounded transition-colors ${s==="normal"?"bg-accent-success/20 text-accent-success":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Normal mode - requires path confirmation",children:"Normal"}),o.jsx("button",{type:"button",onClick:()=>r("dangerous"),className:`px-2 py-0.5 text-xs font-medium rounded transition-colors ${s==="dangerous"?"bg-red-500/20 text-red-400":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Dangerous mode - bypasses all confirmations",children:"Dangerous"})]})}function _A({question:e}){const r=Ce(f=>f.answerQuestion),[s,i]=P.useState(""),c=()=>{r(e.callId,s)},u=f=>{f.key==="Enter"&&!f.shiftKey&&(f.preventDefault(),c())};return o.jsx(At,{isOpen:!0,onClose:()=>{},size:"sm",closeOnBackdropClick:!1,closeOnEscape:!1,showCloseButton:!1,children:o.jsxs("div",{className:"space-y-4",children:[o.jsx("p",{className:"text-sm text-text-primary",children:e.question}),o.jsx("textarea",{value:s,onChange:f=>i(f.target.value),onKeyDown:u,placeholder:"Type your answer here...",className:"w-full min-h-[120px] px-3 py-2 bg-bg-tertiary border border-border rounded text-sm text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-accent-primary/50 resize-y",autoFocus:!0}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(st,{variant:"secondary",size:"sm",onClick:()=>r(e.callId,""),children:"Skip"}),o.jsx(st,{variant:"primary",size:"sm",onClick:c,children:"Send Answer"})]})]})})}function SA(){const e=Ce(i=>i.connectionStatus),r=Ce(i=>i.reconnect);if(e==="connected")return null;const s=e==="reconnecting";return o.jsxs("div",{className:`
139
+ flex items-center justify-between px-4 py-2
140
+ text-sm font-medium
141
+ ${s?"bg-amber-500/15 border-b border-amber-500/30 text-amber-300":"bg-red-500/15 border-b border-red-500/30 text-red-300"}
142
+ `,children:[o.jsx("div",{className:"flex items-center gap-2",children:s?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"flex gap-1",children:[o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"}),o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse",style:{animationDelay:"150ms"}}),o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse",style:{animationDelay:"300ms"}})]}),o.jsx("span",{children:"Reconnecting to server..."})]}):o.jsxs(o.Fragment,{children:[o.jsx(Tw,{}),o.jsx("span",{children:"Connection lost"})]})}),o.jsx("button",{onClick:()=>r(),disabled:s,className:`
143
+ px-3 py-1 rounded text-xs font-medium
144
+ transition-colors
145
+ ${s?"bg-amber-500/20 text-amber-400 cursor-not-allowed opacity-50":"bg-red-500/20 text-red-300 hover:bg-red-500/30 hover:text-red-200"}
146
+ `,children:s?"Reconnecting...":"Reconnect"})]})}function wA(){const e=aw(),r=e?"bg-amber-400":"bg-accent-primary";return o.jsxs("div",{className:"flex items-center gap-3 text-xs text-text-muted py-2",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsxs("span",{className:"flex gap-0.5",children:[o.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${r}`,style:{animationDelay:"0ms"}}),o.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${r}`,style:{animationDelay:"150ms"}}),o.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${r}`,style:{animationDelay:"300ms"}})]}),o.jsx("span",{className:"text-text-secondary",children:e?"Running... (abort in progress)":"Running"})]}),!e&&o.jsx("span",{className:"text-text-muted",children:"esc to interrupt"})]})}function CA({attachment:e,onRemove:r}){const s=i=>i<1024?`${i} B`:i<1048576?`${(i/1024).toFixed(1)} KB`:`${(i/1048576).toFixed(1)} MB`;return o.jsxs("div",{className:"relative inline-flex flex-col items-center p-2 bg-bg-tertiary rounded-lg border border-border",children:[o.jsx(io,{onClick:()=>r(e.id),className:"absolute -top-2 -right-2",size:"sm",variant:"overlay","aria-label":`Remove ${e.filename}`}),o.jsx("img",{src:e.data,alt:e.filename,className:"w-16 h-16 object-cover rounded-md bg-bg-secondary"}),o.jsx("div",{className:"mt-1 text-xs text-text-muted text-center max-w-16 truncate",title:e.filename,children:e.filename}),o.jsx("div",{className:"text-[10px] text-text-muted",children:s(e.size)})]})}function kA({history:e,selectedIndex:r,onSelect:s,onEscape:i,onNavigate:c}){const u=P.useRef(null),f=P.useRef(null);P.useEffect(()=>{f.current&&u.current&&f.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[r]);const l=p=>{switch(p.key){case"Enter":p.preventDefault(),e[r]&&s(e[r].content);break;case"Escape":p.preventDefault(),i();break;case"ArrowUp":p.preventDefault(),c("up");break;case"ArrowDown":p.preventDefault(),c("down");break}},d=p=>{s(p)};return o.jsx("div",{ref:u,role:"list",className:"mb-2 p-2 bg-bg-secondary border border-border rounded-lg overflow-y-auto max-h-64",onKeyDown:l,children:e.map((p,g)=>o.jsxs("div",{ref:g===r?f:null,role:"listitem",onClick:()=>d(p.content),className:`
147
+ p-2 rounded cursor-pointer transition-colors
148
+ ${g===r?"bg-accent-primary/20 border border-accent-primary":"hover:bg-bg-tertiary"}
149
+ `,children:[o.jsxs("div",{className:"text-xs text-text-muted font-mono",children:[p.formattedTimestamp,p.sessionName&&o.jsxs(o.Fragment,{children:[" | ",o.jsx("span",{className:"text-accent-primary font-medium",children:p.sessionName})]})]}),o.jsx("div",{className:"text-sm text-text-primary mt-1",children:p.trimmedContent})]},p.id))})}const dn=Un((e,r)=>({defaults:[],userItems:[],loading:!1,fetchCommands:async()=>{await zh("/api/commands",e)},fetchCommand:async s=>{try{const i=await ke(`/api/commands/${s}`);return i.ok?await i.json():null}catch{return null}},fetchDefaultContent:async s=>{try{const i=await ke(`/api/commands/defaults/${s}`);return i.ok?await i.json():null}catch{return null}},createCommand:async s=>{const i=await gs("POST","/api/commands",s);return i.success&&await r().fetchCommands(),i},updateCommand:async(s,i)=>{const c=await gs("PUT",`/api/commands/${s}`,i);return c.success&&await r().fetchCommands(),c},deleteCommand:async s=>{try{const i=await ke(`/api/commands/${s}`,{method:"DELETE"}),c=await i.json();return i.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==s)})),{success:!0}):{success:!1,error:c.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateCommand:async s=>{try{const i=await ke(`/api/commands/${s}/duplicate`,{method:"POST"}),c=await i.json();return i.ok?(await r().fetchCommands(),{success:!0}):{success:!1,error:c.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}})),EA={maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576};async function jA(e,r={}){const s={...EA,...r};if(!e.type.startsWith("image/"))throw new Error("File is not an image");if(!["image/png","image/jpeg","image/gif"].includes(e.type))throw new Error(`Unsupported image format: ${e.type}. Only PNG, JPG, and GIF are supported.`);if(e.size<=s.maxSizeBytes){const c=await e.arrayBuffer(),u=OA(c),f=`data:${e.type};base64,${u}`,l=await D0(f);return{dataUrl:f,mimeType:e.type,size:e.size,width:l.width,height:l.height}}return await NA(e,s)}async function NA(e,r){const s=await AA(e),i=await D0(s),{width:c,height:u}=TA(i.width,i.height,r.maxWidth,r.maxHeight),f=DA();f.width=c,f.height=u;const l=f.getContext("2d");if(!l)throw new Error("Failed to get canvas context");l.imageSmoothingEnabled=!0,l.imageSmoothingQuality="high",l.drawImage(i,0,0,c,u);let d=r.quality,p;do{if(p=f.toDataURL(e.type.startsWith("image/gif")?"image/png":e.type,d),fb(p)<=r.maxSizeBytes||d<=.3)break;d-=.1}while(!0);const g=fb(p);return{dataUrl:p,mimeType:e.type.startsWith("image/gif")?"image/png":e.type,size:g,width:c,height:u}}function TA(e,r,s,i){const c=e/r;return e>r&&e>s?{width:s,height:Math.round(s/c)}:r>e&&r>i?{width:Math.round(i*c),height:i}:{width:e,height:r}}function AA(e){return new Promise((r,s)=>{const i=RA(),c=new i;c.onload=()=>r(c.result),c.onerror=()=>s(new Error("Failed to read file")),c.readAsDataURL(e)})}function D0(e){return new Promise((r,s)=>{const i=LA(),c=new i;c.onload=()=>r(c),c.onerror=()=>s(new Error("Failed to load image")),c.src=e})}function DA(){var r;const e=kf();if(!((r=e.document)!=null&&r.createElement))throw new Error("Image compression requires browser canvas APIs");return e.document.createElement("canvas")}function LA(){const e=kf();if(!e.Image)throw new Error("Image compression requires browser image APIs");return e.Image}function RA(){const e=kf();if(!e.FileReader)throw new Error("Image compression requires browser file APIs");return e.FileReader}function kf(){return globalThis}function OA(e){const r=new Uint8Array(e);let s="";for(let i=0;i<r.byteLength;i++){const c=r[i];c!==void 0&&(s+=String.fromCharCode(c))}return btoa(s)}function fb(e){const s=e.split(",")[1];return s?Math.round(s.length*3/4):0}function MA(e){return["image/png","image/jpeg","image/gif"].includes(e.type)}function IA(e,r=50*1024*1024){return e.size>r?{valid:!1,error:`Image file is too large (${pb(e.size)}). Maximum size is ${pb(r)}.`}:{valid:!0}}function pb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function dh(e,r,s,i={}){const{maxSizeBytes:c=50*1024*1024,filename:u}=i;if(!MA(e)){s(`Unsupported file type: ${e.type}. Only PNG, JPG, and GIF are supported.`);return}const f=IA(e,c);if(!f.valid){s(f.error??"Image file is too large");return}try{const l=await jA(e,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),d={id:Ab(),filename:u??e.name,mimeType:l.mimeType,size:l.size,data:l.dataUrl};r(d)}catch(l){const d=l instanceof Error?l.message??"Failed to process image":"Failed to process image";s(d)}}function BA(e){const r={};let s=null;for(const i of e){if(i.role==="user"&&!i.isSystemGenerated){s=i.id;continue}i.role==="assistant"&&i.promptContext&&s&&r[s]===void 0&&(r[s]=i.promptContext)}return r}function hh(e){return{contextWindow:e.contextWindow,temperature:e.temperature??null,topP:e.topP??null,topK:e.topK??null,maxTokens:e.maxTokens??null}}function zA({label:e,children:r}){return o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-sm font-medium text-text-secondary border-b border-border/50 pb-1",children:e}),r]})}function Ya({label:e,value:r,onChange:s,min:i,max:c,step:u=1,helpText:f,defaultValue:l}){const[d,p]=P.useState((r==null?void 0:r.toString())??""),[g,m]=P.useState(r===null);P.useEffect(()=>{p((r==null?void 0:r.toString())??""),m(r===null)},[r]);const b=E=>{if(p(E),E==="")s(null);else{const C=parseFloat(E);isNaN(C)||s(C)}},_=()=>{g?(m(!1),l!==void 0&&(p(l.toString()),s(l))):(m(!0),s(null))};return o.jsxs("div",{children:[o.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium text-text-secondary mb-1",children:[e,o.jsx("button",{type:"button",onClick:_,className:`text-xs px-1.5 py-0.5 rounded border ${g?"border-accent-primary/50 bg-accent-primary/10 text-accent-primary":"border-border text-text-muted hover:text-text-secondary"}`,title:g?"Click to set a custom value":"Click to use default",children:g?"default":"custom"})]}),o.jsx("input",{type:"number",min:i,max:c,step:u,value:d,readOnly:g,onChange:E=>b(E.target.value),onClick:()=>g&&_(),placeholder:g?"Using profile default (click to edit)":"",className:`w-full bg-bg-tertiary border border-border rounded px-3 py-2 text-text-primary focus:outline-none focus:border-accent-primary ${g?"opacity-50 cursor-pointer":""}`}),f&&o.jsx("p",{className:"text-xs text-text-muted mt-1",children:f})]})}function HA({isOpen:e,onClose:r,providerId:s,model:i}){const[c,u]=P.useState(()=>hh(i)),[f,l]=P.useState(!1),d=Lt(m=>m.updateModelSettings);P.useEffect(()=>{u(hh(i))},[i]);const p=async()=>{if(c.contextWindow<1024||c.contextWindow>1e7)return;l(!0);const m=c.temperature!==(i.temperature??null)||c.topP!==(i.topP??null)||c.topK!==(i.topK??null)||c.maxTokens!==(i.maxTokens??null);await d(s,i.id,{contextWindow:c.contextWindow,...m&&{temperature:c.temperature,topP:c.topP,topK:c.topK,maxTokens:c.maxTokens}}),l(!1),r()},g=()=>{u(hh(i)),r()};return e?o.jsx(At,{isOpen:e,onClose:r,title:"Model Properties",size:"sm",footer:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(st,{variant:"secondary",onClick:g,disabled:f,children:"Cancel"}),o.jsx(st,{variant:"primary",onClick:p,disabled:f||c.contextWindow<1024||c.contextWindow>1e7,children:f?"Saving...":"Save"})]}),children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Model Name"}),o.jsx("p",{className:"text-text-primary bg-bg-tertiary px-3 py-2 rounded font-mono text-sm break-all",children:i.id})]}),o.jsx(Ya,{label:"Context Window",value:c.contextWindow,onChange:m=>m!==null&&u(b=>({...b,contextWindow:m})),min:1024,max:1e7,helpText:"Range: 1,024 - 10,000,000 tokens"}),o.jsxs(zA,{label:"Sampling Parameters",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ya,{label:"Temperature",value:c.temperature,onChange:m=>u(b=>({...b,temperature:m})),min:0,max:2,step:.1,helpText:"0.0 - 2.0",defaultValue:1}),o.jsx(Ya,{label:"Top P",value:c.topP,onChange:m=>u(b=>({...b,topP:m})),min:0,max:1,step:.05,helpText:"0.0 - 1.0",defaultValue:1})]}),o.jsx(Ya,{label:"Top K",value:c.topK,onChange:m=>u(b=>({...b,topK:m})),min:1,max:200,helpText:"1 - 200 (leave as default if not supported)"})]}),o.jsx(Ya,{label:"Max Tokens",value:c.maxTokens,onChange:m=>u(b=>({...b,maxTokens:m})),min:256,max:32e3,helpText:"Maximum tokens to generate per response"}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Source"}),o.jsxs("p",{className:"text-text-primary bg-bg-tertiary px-3 py-2 rounded text-sm",children:[i.source==="backend"&&"Auto-detected from backend",i.source==="user"&&"Manually set",i.source==="default"&&"Default value"]})]})]})}):null}function PA(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function FA(){var $;const[,e]=gr(),r=Ce(B=>B.currentSession),s=Ce(B=>B.setSessionProvider),[i,c]=P.useState(!1),[u,f]=P.useState([]),[l,d]=P.useState(null),p=P.useRef(null),[g,m]=P.useState(null),b=P.useRef(new Set),_=Lt(B=>B.providers),E=Lt(B=>B.activeProviderId),C=Lt(B=>B.model);Lt(B=>B.backend);const y=Lt(B=>B.llmStatus),v=Lt(B=>B.activating),x=Lt(B=>B.activateProvider),S=Lt(B=>B.refreshModel),j=Lt(B=>B.refreshProviderModels);P.useEffect(()=>{function B(X){p.current&&!p.current.contains(X.target)&&(c(!1),f([]),b.current=new Set)}return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]),P.useEffect(()=>{if(i){const B=_.map(X=>X.id);f(B),B.forEach(X=>{b.current.has(X)||(b.current.add(X),D(X))})}},[i,_]),_.find(B=>B.id===E);const T=y==="disconnected",N=C?(($=C.split("/").pop())==null?void 0:$.replace(/-/g," "))??C:"detecting...",D=async B=>{d(B);try{await j(B)}catch{}finally{d(null)}},A=B=>{u.includes(B.id)?f(u.filter(X=>X!==B.id)):(f([...u,B.id]),D(B.id))},z=async B=>{if(B.id===E){A(B);return}r?(s(B.id,void 0),Lt.getState().syncFromSession(B.id,""),c(!1),f([])):await x(B.id)&&(c(!1),f([]))},O=B=>{A(B)},q=async(B,X)=>{B.stopPropagation(),b.current.delete(X),await j(X),await D(X)},G=(B,X)=>{m({providerId:B,model:X})},W=()=>{m(null)},I=async(B,X)=>{if(console.log("[ProviderSelector.handleModelClick] providerId:",B,"model:",X),r){console.log("[ProviderSelector.handleModelClick] Calling setSessionProvider"),s(B,X),Lt.getState().syncFromSession(B,X),f([]),c(!1);return}d("activating");try{(await ke(`/api/providers/${B}/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:X})})).ok&&(await Lt.getState().fetchConfig(),f([]),c(!1))}catch{}finally{d(null)}};return _.length===0?o.jsxs("button",{type:"button",onClick:()=>S(),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors group",title:T?"LLM server is offline. Click to retry.":C??"Click to refresh model",children:[T?o.jsx("span",{className:"text-sm text-accent-error animate-pulse",children:"LLM offline"}):o.jsx("span",{className:"text-sm text-accent-primary",children:N}),o.jsx("span",{className:"text-text-muted opacity-0 group-hover:opacity-100 transition-opacity",children:"↻"})]}):o.jsxs("div",{className:"relative",ref:p,children:[o.jsxs("button",{type:"button",onClick:()=>c(!i),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors group",title:"Click to switch provider or model",children:[T?o.jsx("span",{className:"text-sm text-accent-error animate-pulse",children:"offline"}):o.jsx("span",{className:"text-sm text-accent-primary",children:N}),o.jsx(mr,{className:"w-3 h-3 text-text-muted transition-transform",rotate:i?180:0})]}),i&&o.jsxs("div",{className:"absolute bottom-full right-0 mb-1 w-72 bg-bg-secondary border border-border rounded-lg shadow-lg z-50 overflow-hidden",children:[o.jsx("div",{className:"py-1",children:_.map(B=>{var X;return o.jsxs("div",{children:[o.jsxs("div",{className:`px-3 py-2 flex items-center justify-between ${B.id===E?"bg-bg-tertiary":"hover:bg-bg-tertiary"} ${v?"opacity-50 cursor-wait":"cursor-pointer"}`,children:[o.jsxs("div",{onClick:()=>!v&&z(B),className:"flex flex-col min-w-0 flex-1 cursor-pointer",children:[o.jsx("span",{className:`text-sm font-medium truncate ${B.id===E?"text-accent-primary":"text-text-primary"}`,children:B.name}),o.jsx("span",{className:"text-xs text-text-muted truncate",children:B.backend!=="auto"&&US(B.backend)})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[B.id===E?o.jsx("span",{className:"text-accent-success",title:"Active",children:o.jsx(Pr,{className:"w-4 h-4"})}):o.jsx("span",{className:"w-4"}),o.jsx("button",{type:"button",onClick:Z=>{Z.stopPropagation(),q(Z,B.id)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Refresh models",children:o.jsx(ww,{className:`w-4 h-4 ${l===B.id?"animate-spin":""} ${B.id===E?"text-accent-primary":"text-text-muted"}`})}),o.jsx("button",{type:"button",onClick:Z=>{Z.stopPropagation(),O(B)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Show models",children:o.jsx(mr,{className:`w-4 h-4 transition-transform ${u.includes(B.id)?"rotate-180":""} ${B.id===E?"text-accent-primary":"text-text-muted"}`})})]})]}),u.includes(B.id)&&o.jsx("div",{className:"bg-bg-primary border-t border-border",children:l===B.id?o.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"Loading models..."}):(X=B.models)!=null&&X.length?B.models.map(Z=>{var H;return o.jsxs("button",{type:"button",onClick:()=>I(B.id,Z.id),disabled:l==="activating",className:`w-full px-4 py-1.5 text-left hover:bg-bg-tertiary transition-colors text-sm flex items-center justify-between group ${l==="activating"?"opacity-50 cursor-wait":""} ${C===Z.id?"text-accent-primary":"text-text-secondary"}`,children:[o.jsx("span",{className:"truncate flex-1",children:((H=Z.id.split("/").pop())==null?void 0:H.replace(/-/g," "))??Z.id}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[o.jsx("span",{className:"text-xs text-text-muted",children:PA(Z.contextWindow)}),o.jsx("button",{type:"button",onClick:L=>{L.stopPropagation(),G(B.id,Z)},className:"opacity-0 group-hover:opacity-100 p-0.5 hover:bg-bg-tertiary rounded transition-opacity",title:"Edit model context",children:o.jsx(pw,{className:"w-3 h-3 text-text-muted"})})]}),C===Z.id&&o.jsx("span",{className:"text-accent-success flex-shrink-0 ml-1",children:o.jsx(Pr,{className:"w-3.5 h-3.5"})})]},Z.id)}):o.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"No models available"})})]},B.id)})}),o.jsx("div",{className:"border-t border-border px-3 py-2",children:o.jsx("button",{onClick:()=>e("/onboarding"),className:"text-xs text-accent-primary hover:underline",children:"Manage providers"})})]}),g&&o.jsx(HA,{isOpen:!0,onClose:W,providerId:g.providerId,model:g.model})]})}function UA(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function $A({onClick:e}){return o.jsx("button",{type:"button",onClick:e,className:"p-1.5 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors",title:"View",children:o.jsx(lc,{})})}function L0({isOpen:e,onClose:r,initialEditId:s}){const i=dn(fe=>fe.defaults),c=dn(fe=>fe.userItems),u=dn(fe=>fe.loading),f=dn(fe=>fe.fetchCommands),l=dn(fe=>fe.fetchCommand),d=dn(fe=>fe.fetchDefaultContent),p=dn(fe=>fe.createCommand),g=dn(fe=>fe.updateCommand),m=dn(fe=>fe.deleteCommand),[b,_]=P.useState(null),[E,C]=P.useState(null),{view:y,editingId:v,formError:x,saving:S,formData:j,setView:T,setEditingId:N,setFormError:D,setFormData:A,setSaving:z}=Qb(),{requestDelete:O,clearConfirm:q,isConfirming:G}=Hh(),W=P.useRef(!1),I=Tt(fe=>fe.defaults),$=Tt(fe=>fe.userItems),B=Tt(fe=>fe.fetchAgents),Z=[...I,...$].filter(fe=>!fe.subagent),H=P.useRef(f),L=P.useRef(B),R=P.useRef(l),F=P.useRef(d),U=P.useRef(s),ne=P.useRef(T),Q=P.useRef(N),ee=P.useRef(D),Y=P.useRef(q);P.useEffect(()=>{H.current=f,L.current=B,R.current=l,F.current=d,U.current=s,ne.current=T,Q.current=N,ee.current=D,Y.current=q}),P.useEffect(()=>{if(e)if(H.current(),L.current(),W.current||(Y.current(),W.current=!0),U.current){const fe=i.some(je=>je.id===U.current);ne.current("edit"),Q.current(U.current),ee.current(""),fe?F.current(U.current).then(je=>{je&&A({name:je.metadata.name+" (copy)",id:`${U.current}-copy-${Date.now()}`,prompt:je.prompt,agentMode:je.metadata.agentMode??"",isDefault:!0})}):R.current(U.current).then(je=>{je&&A({name:je.metadata.name,id:je.metadata.id,prompt:je.prompt,agentMode:je.metadata.agentMode??"",isDefault:!1})})}else ne.current("list"),Q.current(null);else W.current=!1},[e]);const V=async fe=>{_(fe);const je=await d(fe);C((je==null?void 0:je.prompt)??null)},oe=async fe=>{if(i.some(Ue=>Ue.id===fe)){const Ue=await d(fe);Ue&&(N(null),A({name:`${Ue.metadata.name} (copy)`,id:`${fe}-copy-${Date.now()}`,prompt:Ue.prompt,agentMode:Ue.metadata.agentMode??"",isDefault:!0}),D(""),T("edit"))}else{const Ue=await l(fe);Ue&&(N(null),A({name:`${Ue.metadata.name} (copy)`,id:`${fe}-copy-${Date.now()}`,prompt:Ue.prompt,agentMode:Ue.metadata.agentMode??"",isDefault:!1}),D(""),T("edit"))}},re=()=>{A({name:"",id:"",prompt:"",agentMode:"",isDefault:!1}),N(null),T("edit")},ve=async fe=>{const je=await l(fe);je&&(N(fe),A({name:je.metadata.name,id:je.metadata.id,prompt:je.prompt,agentMode:je.metadata.agentMode??"",isDefault:!1}),D(""),T("edit"))},be=async fe=>{await m(fe),q()},Le=async()=>{const fe=v??j.id;if(!fe||!j.name||!j.prompt){D("Name and message are required.");return}z(!0),D("");const je={metadata:{id:fe,name:j.name,...j.agentMode?{agentMode:j.agentMode}:{}},prompt:j.prompt},Ue=v?await g(v,je):await p(je);if(z(!1),!Ue.success){D(Ue.error??"Failed to save command.");return}s?r():T("list")},Oe=()=>{s?r():(T("list"),_(null),C(null))},ze=fe=>{A(je=>({...je,name:fe})),(!v||j.isDefault)&&A(je=>({...je,id:UA(fe)}))},We=()=>{_(null),C(null),T("list")},Ee=()=>{b&&(_(null),T("edit"),N(b),d(b).then(fe=>{fe&&A({name:`${fe.metadata.name} (copy)`,id:`${b}-copy-${Date.now()}`,prompt:fe.prompt,agentMode:fe.metadata.agentMode??"",isDefault:!0})}))};if(b){const fe=i.find(je=>je.id===b);return o.jsx(At,{isOpen:e,onClose:We,title:`Default: ${(fe==null?void 0:fe.name)??b}`,size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"space-y-3 mb-3",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[o.jsx("span",{className:"px-1.5 py-0.5 rounded bg-bg-tertiary text-text-secondary",children:"Built-in"}),o.jsx("span",{className:"font-mono",children:b})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Name"}),o.jsx("div",{className:"px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm",children:fe==null?void 0:fe.name})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Agent Mode"}),o.jsx("div",{className:"px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm text-text-muted",children:(fe==null?void 0:fe.agentMode)||"None"})]})]}),o.jsxs("div",{className:"flex-1 min-h-[120px] border-t border-border pt-3 flex flex-col",children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Message"}),o.jsx("textarea",{value:E??"",readOnly:!0,placeholder:"...",className:"flex-1 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none opacity-60"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border flex-shrink-0",children:[o.jsx(st,{variant:"secondary",onClick:We,children:"Close"}),o.jsx(st,{variant:"primary",onClick:Ee,children:"Duplicate & Customize"})]})]})})}return y==="edit"?o.jsx(At,{isOpen:e,onClose:Oe,title:v?"Edit Command":"New Command",size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[x&&o.jsx(Uh,{message:x}),o.jsxs("div",{className:"space-y-3 mb-3",children:[o.jsx(Zb,{name:j.name,id:j.id,nameLabel:"Name",idLabel:"ID",namePlaceholder:"My Command",idPlaceholder:"my-command",readOnlyId:!!v&&!j.isDefault,onNameChange:ze,onIdChange:fe=>A(je=>({...je,id:fe}))}),o.jsxs("div",{children:[o.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:["Agent Mode ",o.jsx("span",{className:"text-text-muted",children:"(optional)"})]}),o.jsxs("select",{value:j.agentMode,onChange:fe=>A(je=>({...je,agentMode:fe.target.value})),className:"w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",children:[o.jsx("option",{value:"",children:"None (keep current mode)"}),Z.map(fe=>o.jsx("option",{value:fe.id,children:fe.name},fe.id))]})]})]}),o.jsxs("div",{className:"flex-1 min-h-[120px] border-t border-border pt-3 flex flex-col",children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Message"}),o.jsx("textarea",{value:j.prompt,onChange:fe=>A(je=>({...je,prompt:fe.target.value})),placeholder:"The message that will be sent when this command is triggered...",className:"h-80 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-y focus:outline-none focus:ring-1 focus:ring-accent-primary"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border flex-shrink-0",children:[o.jsx(st,{variant:"secondary",onClick:Oe,children:"Cancel"}),o.jsx(st,{variant:"primary",onClick:Le,disabled:S||!j.name||!j.prompt,children:S?"Saving...":"Save"})]})]})}):o.jsxs(At,{isOpen:e,onClose:r,title:"Commands",size:"lg",children:[o.jsx(Kb,{description:"Commands are pre-defined messages you can send with a single click.",onNew:re}),o.jsxs(Xb,{loading:u,hasItems:i.length>0||c.length>0,loadingLabel:"Loading commands...",emptyLabel:"No commands created yet.",children:[i.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Built-in"}),o.jsx("div",{className:"space-y-2",children:i.map(fe=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsx("div",{className:"min-w-0 flex-1 mr-3",children:o.jsx("span",{className:"text-text-primary text-sm font-medium",children:fe.name})}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx($A,{onClick:()=>V(fe.id)}),o.jsx(so,{onClick:()=>oe(fe.id)})]})]},fe.id))})]}),c.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Custom"}),o.jsx("div",{className:"space-y-2",children:c.map(fe=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsx("div",{className:"min-w-0 flex-1 mr-3",children:o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("span",{className:"text-text-primary text-sm font-medium",children:fe.name})})}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx(Ui,{onClick:()=>ve(fe.id)}),o.jsx(so,{onClick:()=>oe(fe.id)}),G(fe.id,"delete")?o.jsx(Ph,{onConfirm:()=>be(fe.id),onCancel:q}):o.jsx(Fh,{onClick:()=>O(fe.id)})]})]},fe.id))})]})]})]})}function qA(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function WA(e){let r=1;for(;e.some(s=>s.id===`s${r}`);)r++;return`s${r}`}const VA=[{value:"agent",label:"Agent"},{value:"sub_agent",label:"Sub-Agent"},{value:"shell",label:"Shell"}],R0={all_criteria_passed:"All passed",all_criteria_completed_or_passed:"All completed",any_criteria_blocked:"Blocked",has_pending_criteria:"Pending/Failed",step_result:"Result",always:"Always"},O0=[{value:"all_criteria_passed",label:"All criteria passed"},{value:"all_criteria_completed_or_passed",label:"All criteria completed or passed"},{value:"any_criteria_blocked",label:"Any criteria blocked (retry limit)"},{value:"has_pending_criteria",label:"Has pending or failed criteria"},{value:"step_result",label:"Step result is..."},{value:"always",label:"Always (fallback)"}],Bs=150,Hr=54,Ii=80,zn=30,Bi=70,mb=100,zs=50,ql=50,gb=4;function Ef(e,r){if(e.type==="agent"){const s=r.find(i=>i.id===e.toolMode);return{name:(s==null?void 0:s.name)??(e.toolMode||"Agent"),color:(s==null?void 0:s.color)||"#3b82f6"}}if(e.type==="sub_agent"){const s=r.find(i=>i.id===e.subAgentType);return{name:(s==null?void 0:s.name)??(e.subAgentType||"Sub-Agent"),color:(s==null?void 0:s.color)||"#a855f7"}}return{name:"Shell",color:"#22c55e"}}function GA(e,r,s,i){const c=ql+zs+Bs+mb+Bs+zs+ql,u=c/2,f=ql+zs+Bs/2,l=ql+zs+Bs+mb+Bs/2,d=[],p=[],g=new Map,m=e.filter(I=>I.type==="agent"||I.type==="shell"),b=e.filter(I=>I.type==="sub_agent"),_=b.length>0,E=_?f:u,C=m.length>0?l:u,y=zs+zn/2;if(d.push({id:"$start",type:"terminal",label:"Start",cx:E,cy:y,w:Ii,h:zn}),g.set("$start",{cx:E,cy:y,w:Ii,h:zn}),e.length===0){const I=y+zn/2+Bi*2+zn/2;return d.push({id:"$done",type:"terminal",label:"Done",cx:E,cy:I,w:Ii,h:zn}),g.set("$done",{cx:E,cy:I,w:Ii,h:zn}),{nodes:d,edges:p,width:c,height:I+zn/2+zs,posMap:g}}const v=y+zn/2+Bi,x=(I,$)=>{I.forEach((B,X)=>{const Z=v+X*(Hr+Bi)+Hr/2,{name:H,color:L}=Ef(B,i);d.push({id:B.id,type:"step",label:H,color:L,cx:$,cy:Z,w:Bs,h:Hr}),g.set(B.id,{cx:$,cy:Z,w:Bs,h:Hr})})};x(m,E),x(b,C);const S=m.length>0?v+(m.length-1)*(Hr+Bi)+Hr/2:y,j=_?v+(b.length-1)*(Hr+Bi)+Hr/2:y,T=Math.max(S,j)+Hr/2+Bi+zn/2;d.push({id:"$done",type:"terminal",label:"Done",cx:E,cy:T,w:Ii,h:zn}),g.set("$done",{cx:E,cy:T,w:Ii,h:zn});const N=[];r&&g.has(r)&&N.push({from:"$start",to:r,label:s,edgeKey:"start",direction:"down",backEdgeIndex:0});let D=0;for(const I of e)I.transitions.forEach(($,B)=>{if(!$.goto||!g.has($.goto))return;const X=g.get(I.id),Z=g.get($.goto),H=$.when.type==="step_result"?`${$.when.result}`:R0[$.when.type]??$.when.type,L=I.id===$.goto;let R;L?R="back":Z.cy>X.cy+1?R="down":Z.cy<X.cy-1?R="back":R="same",N.push({from:I.id,to:$.goto,label:H,edgeKey:`${I.id}:${B}`,direction:R,backEdgeIndex:R==="back"?D++:0})});const A=new Map,z=new Map,O=new Map,q=new Map;for(const I of N)I.direction==="down"&&(A.set(I.from,(A.get(I.from)??0)+1),z.set(I.to,(z.get(I.to)??0)+1));const G=new Map,W=new Map;for(const I of N){if(I.direction!=="same")continue;const $=[I.from,I.to].sort().join("|");G.set($,(G.get($)??0)+1)}for(const I of N){if(I.direction==="back"||I.direction==="same"){let R=0;if(I.direction==="same"){const F=[I.from,I.to].sort().join("|");R=W.get(F)??0,W.set(F,R+1)}p.push({...I,fromPort:0,toPort:0,sameEdgeIndex:R});continue}const $=A.get(I.from)??1,B=z.get(I.to)??1,X=O.get(I.from)??0,Z=q.get(I.to)??0;O.set(I.from,X+1),q.set(I.to,Z+1);const H=$===1?0:-.6+1.2*X/($-1),L=B===1?0:-.6+1.2*Z/(B-1);p.push({...I,fromPort:H,toPort:L,sameEdgeIndex:0})}return{nodes:d,edges:p,width:c,height:T+zn/2+zs,posMap:g}}function KA({steps:e,entryStep:r,selectedNodeId:s,selectedEdgeKey:i,startConditionLabel:c,agentTypes:u,isReadOnly:f,onSelectNode:l,onSelectEdge:d,onRemoveStep:p,onCreateTransition:g,onReconnectTo:m,onReconnectFrom:b,onDeleteTransition:_}){const E=P.useRef(null),C=P.useRef(!1),[y,v]=P.useState(null),[x,S]=P.useState(null),[j,T]=P.useState(null),{nodes:N,edges:D,width:A,height:z,posMap:O}=P.useMemo(()=>GA(e,r,c,u),[e,r,c,u]),q=P.useCallback(Q=>{var re;const ee=E.current;if(!ee)return{x:0,y:0};const Y=ee.createSVGPoint();Y.x=Q.clientX,Y.y=Q.clientY;const V=(re=ee.getScreenCTM())==null?void 0:re.inverse();if(!V)return{x:0,y:0};const oe=Y.matrixTransform(V);return{x:oe.x,y:oe.y}},[]),G=P.useCallback(Q=>!Q||!x||Q==="$start"?!1:x.type==="reconnect-from"?Q!=="$done":!0,[x]),W=P.useCallback((Q,ee)=>{if(f)return;Q.stopPropagation(),Q.preventDefault();const Y=q(Q);S({type:"new",fromNodeId:ee,mouseX:Y.x,mouseY:Y.y})},[q,f]),I=P.useCallback((Q,ee)=>{if(f)return;Q.stopPropagation(),Q.preventDefault();const Y=q(Q);S({type:"reconnect-to",fromNodeId:ee.from,edgeKey:ee.edgeKey,mouseX:Y.x,mouseY:Y.y})},[q,f]),$=P.useCallback((Q,ee)=>{if(f)return;Q.stopPropagation(),Q.preventDefault();const Y=q(Q);S({type:"reconnect-from",fromNodeId:ee.from,fixedTargetId:ee.to,edgeKey:ee.edgeKey,mouseX:Y.x,mouseY:Y.y})},[q,f]),B=P.useCallback(Q=>{if(!x)return;const ee=q(Q);S(Y=>Y?{...Y,mouseX:ee.x,mouseY:ee.y}:null)},[x,q]),X=P.useCallback(()=>{x&&(C.current=!0,j&&G(j)&&(x.type==="new"?g(x.fromNodeId,j):x.type==="reconnect-to"?m(x.edgeKey,j):x.type==="reconnect-from"&&b(x.edgeKey,j)),S(null),T(null))},[x,j,G,g,m,b]),Z=P.useCallback(()=>{if(C.current){C.current=!1;return}l(null),d(null)},[l,d]);P.useEffect(()=>{if(f)return;const Q=ee=>{ee.target instanceof HTMLInputElement||ee.target instanceof HTMLTextAreaElement||ee.target instanceof HTMLSelectElement||(ee.key==="Delete"||ee.key==="Backspace")&&i&&i!=="start"&&(ee.preventDefault(),_(i),d(null))};return document.addEventListener("keydown",Q),()=>document.removeEventListener("keydown",Q)},[f,i,_,d]);const H=Q=>{const ee=O.get(Q.from),Y=O.get(Q.to);if(!ee||!Y)return null;let V,oe,re,ve="middle",be,Le;if(Q.direction==="down"){const Oe=ee.cx+Q.fromPort*(ee.w/2-10),ze=ee.cy+ee.h/2,We=Y.cx+Q.toPort*(Y.w/2-10),Ee=Y.cy-Y.h/2,fe=Ee-ze,je=We-Oe;V=`M ${Oe} ${ze} C ${Oe} ${ze+fe*.4}, ${We-je*.2} ${Ee-fe*.1}, ${We} ${Ee}`,oe=Oe+(We-Oe)*.5,re=ze+fe*.6,be={x:Oe,y:ze},Le={x:We,y:Ee}}else if(Q.direction==="back"){const Oe=Q.from===Q.to,ze=ee.cx>=A/2,We=Q.backEdgeIndex*16,Ee=ze?A-20-We:20+We;if(Oe){const fe=ee.cx>=A/2,je=30+Q.backEdgeIndex*14,Ue=ee.cy-ee.h/2,It=fe?ee.cx+ee.w/2:ee.cx-ee.w/2,pe=fe?It+je:It-je,Ne=ee.cx+(fe?ee.w/4:-ee.w/4),Me=Ue-20-Q.backEdgeIndex*10;V=`M ${It} ${ee.cy} C ${pe} ${ee.cy}, ${pe} ${Me}, ${Ne} ${Ue}`,oe=pe+10,re=Me+4,ve="middle",be={x:It,y:ee.cy},Le={x:Ne,y:Ue}}else{const fe=ze?ee.cx+ee.w/2:ee.cx-ee.w/2,je=Y.cx+(ze?Y.w/4:-Y.w/4),Ue=Math.min(ee.cy,Y.cy)-Y.h/2-18-Q.backEdgeIndex*14;V=`M ${fe} ${ee.cy} L ${Ee} ${ee.cy} L ${Ee} ${Ue} L ${je} ${Ue} L ${je} ${Y.cy-Y.h/2}`,oe=Ee,re=(ee.cy+Ue)/2,ve=ze?"start":"end",be={x:fe,y:ee.cy},Le={x:je,y:Y.cy-Y.h/2}}}else{const Oe=Y.cx>ee.cx,ze=Q.sameEdgeIndex===0?-12:12,We=Oe?ee.cx+ee.w/2:ee.cx-ee.w/2,Ee=Oe?Y.cx-Y.w/2:Y.cx+Y.w/2,fe=ee.cy+ze,je=Y.cy+ze,Ue=(We+Ee)/2;V=`M ${We} ${fe} C ${Ue} ${fe}, ${Ue} ${je}, ${Ee} ${je}`,oe=Ue,re=(fe+je)/2-6,be={x:We,y:fe},Le={x:Ee,y:je}}return{path:V,labelX:oe,labelY:re,labelAnchor:ve,fromPt:be,toPt:Le}},L=(Q,ee)=>{const Y=H(Q);if(!Y)return null;const{path:V,labelX:oe,labelY:re,labelAnchor:ve}=Y,be=i===Q.edgeKey,Le=Q.label&&!(Q.from==="$start"&&Q.label==="Always");return o.jsxs("g",{children:[o.jsx("path",{d:V,fill:"none",stroke:"transparent",strokeWidth:14,className:"cursor-pointer",onClick:Oe=>{Oe.stopPropagation(),d(be?null:Q.edgeKey)}}),o.jsx("path",{d:V,fill:"none",stroke:be?"#58a6ff":"#484f58",strokeWidth:be?2.2:1.2,markerEnd:be?"url(#arrow-selected)":"url(#arrow)",pointerEvents:"none"}),Le&&o.jsx("text",{x:oe+(ve==="start"?5:ve==="end"?-5:0),y:re+3,textAnchor:ve,className:"text-[8px]",fill:be?"#79c0ff":"#8b949e",style:{paintOrder:"stroke",stroke:"#0d1117",strokeWidth:3,strokeLinejoin:"round"},pointerEvents:"none",children:Q.label})]},ee)},R=()=>{if(!i||x)return null;const Q=D.find(re=>re.edgeKey===i);if(!Q)return null;const ee=H(Q);if(!ee)return null;const{fromPt:Y,toPt:V}=ee,oe=6;return o.jsxs(o.Fragment,{children:[Q.edgeKey!=="start"&&o.jsx("circle",{cx:Y.x,cy:Y.y,r:oe,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:re=>$(re,Q)}),o.jsx("circle",{cx:V.x,cy:V.y,r:oe,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:re=>I(re,Q)})]})},F=()=>{if(!x)return null;let Q,ee,Y,V;if(x.type==="reconnect-from"){const ve=O.get(x.fixedTargetId);if(!ve)return null;Q=x.mouseX,ee=x.mouseY,Y=ve.cx,V=ve.cy-ve.h/2}else{const ve=O.get(x.fromNodeId);if(!ve)return null;Q=ve.cx,ee=ve.cy+ve.h/2,Y=x.mouseX,V=x.mouseY}const oe=V-ee,re=Math.abs(oe)>10?`M ${Q} ${ee} C ${Q} ${ee+oe*.4}, ${Y} ${V-oe*.4}, ${Y} ${V}`:`M ${Q} ${ee} L ${Y} ${V}`;return o.jsx("path",{d:re,fill:"none",stroke:"#58a6ff",strokeWidth:2,strokeDasharray:"6 3",strokeOpacity:.7,pointerEvents:"none"})},U=Q=>{const ee=Q.cy+Q.h/2,Y=(x==null?void 0:x.fromNodeId)===Q.id;return o.jsx("circle",{cx:Q.cx,cy:ee,r:gb,fill:Y?"#58a6ff":"#1c2128",stroke:Y?"#58a6ff":"#484f58",strokeWidth:1.5,strokeOpacity:Y?1:.5,className:"cursor-crosshair",onMouseDown:V=>W(V,Q.id)})},ne=Q=>{const ee=Q.cy-Q.h/2,Y=x&&j===Q.id&&G(Q.id);return o.jsx("circle",{cx:Q.cx,cy:ee,r:gb,fill:Y?"#3fb950":"#1c2128",stroke:Y?"#3fb950":"#484f58",strokeWidth:1.5,strokeOpacity:Y?1:.5})};return o.jsxs("svg",{ref:E,viewBox:`0 0 ${A} ${z}`,className:"block w-full",preserveAspectRatio:"xMidYMin meet",onMouseMove:B,onMouseUp:X,onClick:Z,children:[o.jsxs("defs",{children:[o.jsx("marker",{id:"arrow",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"7",markerHeight:"5",orient:"auto",children:o.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#484f58"})}),o.jsx("marker",{id:"arrow-selected",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"7",markerHeight:"5",orient:"auto",children:o.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#58a6ff"})})]}),D.map((Q,ee)=>L(Q,ee)),N.map(Q=>{const ee=s===Q.id,Y=Q.cx-Q.w/2,V=Q.cy-Q.h/2,oe=y===Q.id,re=x&&j===Q.id&&G(Q.id);if(Q.type==="terminal"){const be=Q.id==="$start",Le=be?"#58a6ff":"#3fb950",Oe=be,ze=!be;return o.jsxs("g",{onClick:We=>{We.stopPropagation(),be&&!f&&d("start")},className:be&&!f?"cursor-pointer":void 0,children:[re&&o.jsx("rect",{x:Y-3,y:V-3,width:Q.w+6,height:Q.h+6,rx:Q.h/2+3,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),be&&i==="start"&&o.jsx("rect",{x:Y-3,y:V-3,width:Q.w+6,height:Q.h+6,rx:Q.h/2+3,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),o.jsx("rect",{x:Y,y:V,width:Q.w,height:Q.h,rx:Q.h/2,fill:Le,fillOpacity:.08,stroke:Le,strokeOpacity:.4,strokeWidth:1.5}),o.jsx("text",{x:Q.cx,y:Q.cy+4,textAnchor:"middle",fill:Le,className:"text-[10px] font-medium",pointerEvents:"none",children:Q.label}),Oe&&U(Q),ze&&ne(Q)]},Q.id)}const ve=Q.color??"#6b7280";return o.jsxs("g",{onClick:be=>{be.stopPropagation(),f||l(ee?null:Q.id)},onMouseEnter:()=>v(Q.id),onMouseLeave:()=>v(null),className:f?void 0:"cursor-pointer",children:[re&&o.jsx("rect",{x:Y-3,y:V-3,width:Q.w+6,height:Q.h+6,rx:12,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),ee&&o.jsx("rect",{x:Y-3,y:V-3,width:Q.w+6,height:Q.h+6,rx:12,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),o.jsx("rect",{x:Y,y:V,width:Q.w,height:Q.h,rx:10,fill:ve,fillOpacity:.08,stroke:ve,strokeOpacity:.6,strokeWidth:ee?2:1.5}),o.jsx("text",{x:Q.cx,y:Q.cy+4,textAnchor:"middle",fill:"#c9d1d9",className:"text-[11px] font-medium",pointerEvents:"none",children:Q.label}),!f&&U(Q),!f&&ne(Q),oe&&!x&&!f&&o.jsxs("g",{onClick:be=>{be.stopPropagation(),p(Q.id)},className:"cursor-pointer",children:[o.jsx("circle",{cx:Y+Q.w-2,cy:V+2,r:8,fill:"#0d1117",fillOpacity:.9,stroke:"#f85149",strokeOpacity:.5,strokeWidth:1}),o.jsx("line",{x1:Y+Q.w-5,y1:V-1,x2:Y+Q.w+1,y2:V+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"}),o.jsx("line",{x1:Y+Q.w+1,y1:V-1,x2:Y+Q.w-5,y2:V+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"})]})]},Q.id)}),x&&N.map(Q=>G(Q.id)?o.jsx("rect",{x:Q.cx-Q.w/2-8,y:Q.cy-Q.h/2-8,width:Q.w+16,height:Q.h+16,fill:"transparent",rx:12,onMouseEnter:()=>T(Q.id),onMouseLeave:()=>T(null),onMouseUp:ee=>{ee.stopPropagation(),X()}},`drop-${Q.id}`):null),F(),R()]})}const ir="w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",Us="w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",hn="block text-[11px] text-text-secondary mb-0.5";function YA({fromLabel:e,toLabel:r,condition:s,fromStep:i,agentTypes:c,onUpdateCondition:u,onDelete:f}){const l=i&&(i.type==="sub_agent"||i.type==="agent")?c.find(p=>p.id===(i.type==="sub_agent"?i.subAgentType:i.toolMode)):void 0,d=(l==null?void 0:l.results)&&l.results.length>0;return o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-blue-500/15 text-blue-300",children:"Transition"}),o.jsx("button",{onClick:f,className:"p-1 rounded text-text-muted hover:text-accent-error text-xs",children:"Delete"})]}),o.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[o.jsx("span",{className:"font-medium text-text-primary",children:e}),o.jsx(zb,{}),o.jsx("span",{className:"font-medium text-text-primary",children:r})]}),o.jsxs("div",{children:[o.jsx("label",{className:hn,children:"Condition"}),o.jsx("select",{value:s.type,onChange:p=>{u(p.target.value==="step_result"?{type:"step_result",result:"success"}:{type:p.target.value})},className:Us,children:O0.map(p=>o.jsx("option",{value:p.value,children:p.label},p.value))})]}),s.type==="step_result"&&o.jsxs("div",{children:[o.jsx("label",{className:hn,children:"Result"}),d?o.jsx("select",{value:s.result??l.results[0],onChange:p=>{u({type:"step_result",result:p.target.value})},className:Us,children:l.results.map(p=>o.jsx("option",{value:p,children:p},p))}):o.jsx("input",{type:"text",value:s.result??"success",onChange:p=>u({type:"step_result",result:p.target.value}),placeholder:"e.g. success, passed, failed",className:ir})]}),o.jsx("p",{className:"text-text-muted text-[10px]",children:"Drag handles to reconnect. Press Delete to remove."})]})}function fh({variables:e,onInsert:r}){return e.length===0?null:o.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:e.map(s=>o.jsx("button",{type:"button",onClick:()=>r(s.name),title:s.description,className:"px-1.5 py-0.5 rounded text-[10px] font-mono bg-bg-primary border border-border text-text-secondary hover:text-accent-primary hover:border-accent-primary/40 transition-colors",children:`{{${s.name}}}`},s.name))})}function XA({step:e,isEntry:r,agentTypes:s,transitionCount:i,templateVariables:c,onUpdate:u,onRemove:f,onSetEntry:l}){const{color:d,name:p}=Ef(e,s);return o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold",style:{backgroundColor:d+"20",color:d},children:p}),r&&o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-accent-primary/15 text-accent-primary",children:"Entry"})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[!r&&o.jsx("button",{onClick:l,className:"p-1 rounded text-text-muted hover:text-accent-primary text-xs",children:"Set entry"}),o.jsx("button",{onClick:f,className:"p-1 rounded text-text-muted hover:text-accent-error text-xs",children:"Delete"})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:hn,children:"Type"}),o.jsx("select",{value:e.type,onChange:g=>{const m=g.target.value,b=m==="sub_agent"?"verification":"build";if(m==="agent"){const _=s.find(E=>!E.subagent);u({...e,type:m,phase:b,toolMode:(_==null?void 0:_.id)??"builder",name:(_==null?void 0:_.name)??"Agent"})}else if(m==="sub_agent"){const _=s.find(E=>E.subagent);u({...e,type:m,phase:b,subAgentType:(_==null?void 0:_.id)??"",name:(_==null?void 0:_.name)??"Sub-Agent"})}else u({...e,type:m,phase:b,name:"Shell"})},className:Us,children:VA.map(g=>o.jsx("option",{value:g.value,children:g.label},g.value))})]}),e.type==="agent"&&o.jsxs("div",{children:[o.jsx("label",{className:hn,children:"Agent Type"}),o.jsx("select",{value:e.toolMode??"builder",onChange:g=>{const m=s.find(b=>b.id===g.target.value);u({...e,toolMode:g.target.value,name:(m==null?void 0:m.name)??g.target.value})},className:Us,children:s.filter(g=>!g.subagent).map(g=>o.jsx("option",{value:g.id,children:g.name},g.id))})]}),e.type==="sub_agent"&&o.jsxs("div",{children:[o.jsx("label",{className:hn,children:"Sub-Agent Type"}),o.jsxs("select",{value:e.subAgentType??"",onChange:g=>{const m=s.find(b=>b.id===g.target.value);u({...e,subAgentType:g.target.value,name:(m==null?void 0:m.name)??g.target.value})},className:Us,children:[o.jsx("option",{value:"",children:"— select —"}),s.filter(g=>g.subagent).map(g=>o.jsx("option",{value:g.id,children:g.name},g.id))]})]}),(e.type==="agent"||e.type==="sub_agent")&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:hn,children:"Prompt"}),o.jsx("textarea",{value:e.prompt??"",onChange:g=>u({...e,prompt:g.target.value||void 0}),rows:6,className:`${ir} resize-y text-xs`,placeholder:"Injected on first entry..."}),o.jsx(fh,{variables:c,onInsert:g=>u({...e,prompt:(e.prompt??"")+`{{${g}}}`})})]}),o.jsxs("div",{children:[o.jsx("label",{className:hn,children:"Nudge Prompt"}),o.jsx("textarea",{value:e.nudgePrompt??"",onChange:g=>u({...e,nudgePrompt:g.target.value||void 0}),rows:6,className:`${ir} resize-y text-xs`,placeholder:"Injected on re-entry..."}),o.jsx(fh,{variables:c,onInsert:g=>u({...e,nudgePrompt:(e.nudgePrompt??"")+`{{${g}}}`})})]})]}),e.type==="shell"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:hn,children:"Command"}),o.jsx("textarea",{value:e.command??"",onChange:g=>u({...e,command:g.target.value}),rows:3,className:`${ir} font-mono text-xs resize-y`,placeholder:"cd {{workdir}} && npm run lint"}),o.jsx(fh,{variables:c,onInsert:g=>u({...e,command:(e.command??"")+`{{${g}}}`})})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{children:[o.jsx("label",{className:hn,children:"Timeout (ms)"}),o.jsx("input",{type:"number",value:e.timeout??6e4,onChange:g=>u({...e,timeout:Number(g.target.value)}),className:`${ir} font-mono text-xs`})]}),o.jsxs("div",{children:[o.jsx("label",{className:hn,children:"Success Codes"}),o.jsx("input",{value:(e.successExitCodes??[0]).join(", "),onChange:g=>u({...e,successExitCodes:g.target.value.split(",").map(m=>Number(m.trim())).filter(m=>!isNaN(m))}),className:`${ir} font-mono text-xs`})]})]})]}),o.jsx("div",{className:"pt-1 border-t border-border/50",children:o.jsxs("p",{className:"text-text-muted text-[10px]",children:[i," outgoing transition",i!==1?"s":""," — drag from the bottom port to connect."]})})]})}const xb=[];function M0({isOpen:e,onClose:r,initialEditId:s}){const i=Nt(me=>me.defaults),c=Nt(me=>me.userItems),u=Nt(me=>me.loading),f=Nt(me=>me.templateVariables),l=Nt(me=>me.fetchWorkflows),d=Nt(me=>me.fetchWorkflow),p=Nt(me=>me.fetchDefaultContent),g=Nt(me=>me.fetchTemplateVariables),m=Nt(me=>me.createWorkflow),b=Nt(me=>me.updateWorkflow),_=Nt(me=>me.deleteWorkflow),{requestDelete:E,clearConfirm:C,isConfirming:y}=Hh(),[v,x]=P.useState("list"),[S,j]=P.useState(null),[T,N]=P.useState(!1),[D,A]=P.useState(null),[z,O]=P.useState(null),[q,G]=P.useState(""),[W,I]=P.useState(""),[$,B]=P.useState(""),[X,Z]=P.useState("1.0.0"),[H,L]=P.useState("#3b82f6"),[R,F]=P.useState(""),[U,ne]=P.useState(50),[Q,ee]=P.useState(xb),[Y,V]=P.useState({type:"always"}),[oe,re]=P.useState(""),[ve,be]=P.useState(!1),[Le,Oe]=P.useState([]),[ze]=P.useState(null);P.useEffect(()=>{e&&(l(),g(),ke("/api/agents").then(me=>me.json()).then(me=>Oe(me.agents??[])).catch(()=>{}),A(null),O(null),s?i.some(ye=>ye.id===s)?p(s).then(ye=>{ye&&(G(ye.metadata.name+" (copy)"),I(`${s}-copy-${Date.now()}`),B(ye.metadata.description),Z(ye.metadata.version),L(ye.metadata.color??"#3b82f6"),F(ye.entryStep),ne(ye.settings.maxIterations),ee(ye.steps),V(ye.startCondition??{type:"always"}),re(""),j(null),N(!1),x("edit"))}):d(s).then(ye=>{ye&&(G(ye.metadata.name),I(ye.metadata.id),B(ye.metadata.description),Z(ye.metadata.version),L(ye.metadata.color??"#3b82f6"),F(ye.entryStep),ne(ye.settings.maxIterations),ee(ye.steps),V(ye.startCondition??{type:"always"}),re(""),j(s),N(!1),x("edit"))}):(x("list"),j(null),N(!1)))},[e,l,d,p,g,s]);const We=async me=>{const ye=await d(me);ye&&(j(me),G(ye.metadata.name),I(ye.metadata.id),B(ye.metadata.description),Z(ye.metadata.version),L(ye.metadata.color??"#3b82f6"),F(ye.entryStep),ne(ye.settings.maxIterations),ee(ye.steps),V(ye.startCondition??{type:"always"}),re(""),A(null),O(null),x("edit"))},Ee=async()=>{var Qe;const me=S??W;if(!me||!q)return re("Name is required."),!1;if(Q.length===0)return re("Add at least one step."),!1;let ye=R;if(!ye||!Q.some(Pe=>Pe.id===ye)){if(ye=((Qe=Q.find(Pe=>Pe.id))==null?void 0:Qe.id)??"",!ye)return re("All steps need an ID."),!1;F(ye)}be(!0),re("");const we={metadata:{id:me,name:q,description:$,version:X||"1.0.0",color:H},entryStep:ye,settings:{maxIterations:U},steps:Q,startCondition:Y},Ve=S?await b(S,we):await m(we);return be(!1),Ve.success?(S||j(me),!0):(re(Ve.error??"Failed to save."),!1)},fe=async()=>{await Ee()},je=async()=>{await Ee()&&(s?r():x("list"))},Ue=()=>{s?r():x("list")},It=me=>{G(me),S||I(qA(me))},pe=async me=>{if(i.some(we=>we.id===me)){const we=await p(me);if(!we)return;G(we.metadata.name),I(we.metadata.id),B(we.metadata.description),Z(we.metadata.version),L(we.metadata.color??"#3b82f6"),F(we.entryStep),ne(we.settings.maxIterations),ee(we.steps),V(we.startCondition??{type:"always"}),re(""),j(me),N(!0)}else{const we=await d(me);if(!we)return;G(we.metadata.name),I(we.metadata.id),B(we.metadata.description),Z(we.metadata.version),L(we.metadata.color??"#3b82f6"),F(we.entryStep),ne(we.settings.maxIterations),ee(we.steps),V(we.startCondition??{type:"always"}),re(""),j(me),N(!0)}x("edit")},Ne=async me=>{const we=i.some(Ve=>Ve.id===me)?await p(me):await d(me);we&&(G(we.metadata.name+" (copy)"),I(`${me}-copy-${Date.now()}`),B(we.metadata.description),Z(we.metadata.version),L(we.metadata.color??"#3b82f6"),F(we.entryStep),ne(we.settings.maxIterations),ee(we.steps),V(we.startCondition??{type:"always"}),re(""),j(null),N(!1),x("edit"))},Me=()=>{j(null),G(""),I(""),B(""),Z("1.0.0"),L("#3b82f6"),F(""),ne(50),ee(structuredClone(xb)),V({type:"always"}),re(""),A(null),O(null),N(!1),x("edit")},ot=async me=>{await _(me),C()},ue=P.useCallback(me=>{A(me),O(null)},[]),_e=P.useCallback(me=>{O(me),A(null)},[]),Te=D!==null?Number(D):-1,Ie=Te>=0?Q[Te]??null:null,$e=P.useCallback(me=>{ee(ye=>ye.map((we,Ve)=>Ve===Te?me:we))},[Te]),St=Y.type==="step_result"?`${Y.result}`:R0[Y.type]??Y.type,Ye=()=>{const me=Q.length,ye=WA(Q),we=Le.find(Ve=>!Ve.subagent);ee([...Q,{id:ye,name:(we==null?void 0:we.name)??"Agent",type:"agent",phase:"build",toolMode:(we==null?void 0:we.id)??"builder",transitions:[]}]),R||F(ye),ue(String(me))},Dt=P.useCallback((me,ye)=>{me==="$start"?(F(ye),_e("start")):ee(we=>{const Ve=we.find(Pe=>Pe.id===me),Qe=Ve?Ve.transitions.length:0;return _e(`${me}:${Qe}`),we.map(Pe=>Pe.id===me?{...Pe,transitions:[...Pe.transitions,{when:{type:"always"},goto:ye}]}:Pe)})},[_e]),mt=P.useCallback((me,ye)=>{if(me==="start")F(ye);else{const we=me.lastIndexOf(":"),Ve=me.slice(0,we),Qe=parseInt(me.slice(we+1));ee(Pe=>Pe.map(Yt=>Yt.id===Ve?{...Yt,transitions:Yt.transitions.map((Rt,Bt)=>Bt===Qe?{...Rt,goto:ye}:Rt)}:Yt))}},[]),Kt=P.useCallback((me,ye)=>{const we=me.lastIndexOf(":"),Ve=me.slice(0,we),Qe=parseInt(me.slice(we+1));ee(Pe=>{const Yt=Pe.find(Bt=>Bt.id===Ve);if(!Yt)return Pe;const Rt=Yt.transitions[Qe];return Rt?Pe.map(Bt=>Bt.id===Ve?{...Bt,transitions:Bt.transitions.filter((Ur,ie)=>ie!==Qe)}:Bt.id===ye?{...Bt,transitions:[...Bt.transitions,Rt]}:Bt):Pe}),O(null)},[]),lt=P.useCallback(me=>{if(me==="start")F("");else{const ye=me.lastIndexOf(":"),we=me.slice(0,ye),Ve=parseInt(me.slice(ye+1));ee(Qe=>Qe.map(Pe=>Pe.id===we?{...Pe,transitions:Pe.transitions.filter((Yt,Rt)=>Rt!==Ve)}:Pe))}O(null)},[]),$n=P.useCallback((me,ye)=>{if(me==="start")V(ye);else{const we=me.lastIndexOf(":"),Ve=me.slice(0,we),Qe=parseInt(me.slice(we+1));ee(Pe=>Pe.map(Yt=>Yt.id===Ve?{...Yt,transitions:Yt.transitions.map((Rt,Bt)=>Bt===Qe?{...Rt,when:ye}:Rt)}:Yt))}},[]),sn=me=>Ef(me,Le).name,Gi=()=>{if(!z)return null;if(z==="start"){const Rt=Q.find(Bt=>Bt.id===R);return{type:"start",fromLabel:"Start",toLabel:Rt?sn(Rt):"(none)",condition:Y}}const me=z.lastIndexOf(":"),ye=z.slice(0,me),we=parseInt(z.slice(me+1)),Ve=Q.find(Rt=>Rt.id===ye);if(!Ve)return null;const Qe=Ve.transitions[we];if(!Qe)return null;const Pe=Q.find(Rt=>Rt.id===Qe.goto),Yt=Qe.goto==="$done"?"Done":Pe?sn(Pe):Qe.goto;return{type:"step",fromLabel:sn(Ve),toLabel:Yt,condition:Qe.when}};if(v==="edit"){const me=Gi();return o.jsxs(At,{isOpen:e,onClose:Ue,title:T?q:S?"Edit Workflow":"New Workflow",size:"full",children:[oe&&o.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded mb-3",children:oe}),o.jsxs("div",{className:"flex items-end gap-3 mb-3 pb-3 border-b border-border flex-wrap",children:[o.jsxs("div",{className:"min-w-[140px]",children:[o.jsx("label",{className:hn,children:"Name"}),o.jsx("input",{value:q,onChange:ye=>It(ye.target.value),placeholder:"Workflow name",className:`${ir} ${T?"opacity-50":""}`,readOnly:T})]}),o.jsxs("div",{className:"min-w-[100px]",children:[o.jsx("label",{className:hn,children:"ID"}),o.jsx("input",{value:W,readOnly:!0,className:`${ir} font-mono opacity-50`})]}),o.jsxs("div",{className:"flex-1 min-w-[140px]",children:[o.jsx("label",{className:hn,children:"Description"}),o.jsx("input",{value:$,onChange:ye=>!T&&B(ye.target.value),readOnly:T,placeholder:"What does this workflow do?",className:`${ir} ${T?"opacity-50":""}`})]}),o.jsxs("div",{className:"w-20",children:[o.jsx("label",{className:hn,children:"Max Iter."}),o.jsx("input",{type:"number",value:U,onChange:ye=>!T&&ne(Number(ye.target.value)),readOnly:T,className:`${ir} font-mono ${T?"opacity-50":""}`})]}),o.jsxs("div",{children:[o.jsx("label",{className:hn,children:"Color"}),o.jsx("input",{type:"color",value:H,onChange:ye=>!T&&L(ye.target.value),disabled:T,className:`w-8 h-8 rounded border border-border bg-transparent ${T?"opacity-50":"cursor-pointer"}`})]})]}),o.jsxs("div",{className:"flex gap-3",style:{height:"calc(90vh - 220px)",minHeight:300},children:[o.jsxs("div",{className:"flex-1 min-w-0 bg-bg-primary/50 border border-border rounded-lg flex flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/50 shrink-0",children:[o.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider font-medium",children:"Flow"}),!T&&o.jsx("button",{onClick:Ye,className:"text-[11px] text-accent-primary hover:text-accent-primary/80",children:"+ Add Step"})]}),o.jsxs("div",{className:"flex-1 min-h-0 p-2 overflow-auto",children:[o.jsx(KA,{steps:Q,entryStep:R,selectedNodeId:(Ie==null?void 0:Ie.id)??null,selectedEdgeKey:z,startConditionLabel:St,agentTypes:Le,isReadOnly:T,onSelectNode:ye=>{if(ye===null){ue(null);return}const we=Q.findIndex(Ve=>Ve.id===ye);ue(we>=0?String(we):null)},onSelectEdge:_e,onRemoveStep:ye=>{var Ve;const we=Q.findIndex(Qe=>Qe.id===ye);if(ee(Qe=>Qe.filter(Pe=>Pe.id!==ye)),Te===we&&ue(null),R===ye){const Qe=Q.filter(Pe=>Pe.id!==ye);F(((Ve=Qe[0])==null?void 0:Ve.id)??"")}},onCreateTransition:Dt,onReconnectTo:mt,onReconnectFrom:Kt,onDeleteTransition:lt}),Q.length===0&&o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-text-muted",children:[o.jsx("p",{className:"text-xs mb-2",children:"No steps yet"}),o.jsx("button",{onClick:Ye,className:"px-3 py-1.5 rounded bg-accent-primary/10 text-accent-primary text-xs hover:bg-accent-primary/20",children:"+ Add your first step"})]})]})]}),o.jsxs("div",{className:"w-[300px] shrink-0 border border-border rounded-lg bg-bg-secondary flex flex-col overflow-hidden",children:[o.jsx("div",{className:"px-3 py-1.5 border-b border-border shrink-0",children:o.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider font-medium",children:"Properties"})}),o.jsx("div",{className:"p-3 overflow-y-auto flex-1 min-h-0",children:T&&(me||Ie)?o.jsx("p",{className:"text-text-muted text-xs text-center py-8",children:'View only — click "Duplicate & Customize" to edit.'}):me?me.type==="start"?o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-blue-500/20 text-blue-300",children:"Start"})}),R&&o.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[o.jsx("span",{className:"text-text-primary font-medium",children:"Start"}),o.jsx(zb,{}),o.jsx("span",{className:"text-text-primary font-medium",children:me.toLabel})]}),o.jsxs("div",{children:[o.jsx("label",{className:hn,children:"Activation Condition"}),o.jsx("select",{value:Y.type,onChange:ye=>V(ye.target.value==="step_result"?{type:"step_result",result:"success"}:{type:ye.target.value}),className:Us,children:O0.map(ye=>o.jsx("option",{value:ye.value,children:ye.label},ye.value))})]}),Y.type==="step_result"&&o.jsxs("div",{children:[o.jsx("label",{className:hn,children:"Result"}),R&&(()=>{const ye=Q.find(Pe=>Pe.id===R),we=ye&&(ye.type==="sub_agent"||ye.type==="agent")?Le.find(Pe=>Pe.id===(ye.type==="sub_agent"?ye.subAgentType:ye.toolMode)):void 0,Ve=(we==null?void 0:we.results)&&we.results.length>0,Qe=(we==null?void 0:we.results)??[];return Ve?o.jsx("select",{value:Y.result??Qe[0],onChange:Pe=>V({type:"step_result",result:Pe.target.value}),className:Us,children:Qe.map(Pe=>o.jsx("option",{value:Pe,children:Pe},Pe))}):o.jsx("input",{type:"text",value:Y.result??"success",onChange:Pe=>V({type:"step_result",result:Pe.target.value}),placeholder:"e.g. success, passed, failed",className:ir})})()]}),o.jsx("p",{className:"text-text-muted text-[10px]",children:"Workflow only proceeds when this condition is met. Drag the target handle to change entry step."})]}):o.jsx(YA,{fromLabel:me.fromLabel,toLabel:me.toLabel,condition:me.condition,fromStep:me.type==="step"?Q.find(ye=>ye.id===me.fromLabel):void 0,agentTypes:Le,onUpdateCondition:ye=>$n(z,ye),onDelete:()=>lt(z)}):Ie?o.jsx(XA,{step:Ie,isEntry:Ie.id===R,agentTypes:Le,transitionCount:Ie.transitions.length,templateVariables:f,onUpdate:$e,onRemove:()=>{var ye;if(Ie&&(ee(Q.filter((we,Ve)=>Ve!==Te)),ue(null),R===Ie.id)){const we=Q.filter((Ve,Qe)=>Qe!==Te);F(((ye=we[0])==null?void 0:ye.id)??"")}},onSetEntry:()=>F(Ie.id)}):o.jsxs("p",{className:"text-text-muted text-xs text-center py-8",children:["Click a node or edge to edit.",o.jsx("br",{}),"Drag from a port to connect."]})})]})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border",children:[o.jsx(st,{variant:"secondary",onClick:Ue,children:"Close"}),T?o.jsx(st,{variant:"primary",onClick:()=>{G(q+" (copy)"),I(`${S}-copy-${Date.now()}`),j(null),N(!1)},children:"Duplicate & Customize"}):o.jsxs(o.Fragment,{children:[o.jsx(st,{variant:"secondary",onClick:fe,disabled:ve||!q,children:ve?"Saving...":"Save"}),o.jsx(st,{variant:"primary",onClick:je,disabled:ve||!q,children:"Save & Close"})]})]})]})}return o.jsxs(At,{isOpen:e,onClose:r,title:"Workflows",size:"lg",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:"Workflows define the orchestrator's step sequence when running tasks."}),o.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:o.jsx(st,{variant:"primary",size:"sm",onClick:Me,children:"+ New"})})]}),u&&i.length===0&&c.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"Loading workflows..."}):i.length===0&&c.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"No workflows installed."}):o.jsxs("div",{className:"space-y-4",children:[i.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Built-in"}),o.jsx("div",{className:"space-y-2",children:i.map(me=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsxs("div",{className:"min-w-0 flex-1 mr-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-text-primary text-sm font-medium",children:me.name}),o.jsxs("span",{className:"text-text-muted text-xs",children:["v",me.version]})]}),o.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:me.description})]}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx("button",{onClick:()=>pe(me.id),className:"p-1.5 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors",title:"View",children:o.jsx(lc,{})}),o.jsx(so,{onClick:()=>Ne(me.id)})]})]},me.id))})]}),c.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Custom"}),o.jsx("div",{className:"space-y-2",children:c.map(me=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsxs("div",{className:"min-w-0 flex-1 mr-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-text-primary text-sm font-medium",children:me.name}),o.jsxs("span",{className:"text-text-muted text-xs",children:["v",me.version]})]}),o.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:me.description})]}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx(so,{onClick:()=>Ne(me.id)}),o.jsx(Ui,{onClick:()=>We(me.id)}),y(me.id,"delete")?o.jsx(Ph,{onConfirm:()=>ot(me.id),onCancel:()=>{}}):o.jsx(Fh,{onClick:()=>E(me.id)})]})]},me.id))})]})]})]})}function ZA(e,r){const s=e.startCondition;if(!s||s.type==="always")return!0;switch(s.type){case"has_pending_criteria":return r.some(i=>i.status.type!=="passed");case"all_criteria_passed":return r.length===0||r.every(i=>i.status.type==="passed");case"all_criteria_completed_or_passed":return r.every(i=>i.status.type==="completed"||i.status.type==="passed");case"any_criteria_blocked":return r.some(i=>i.status.type==="failed"&&i.attempts.filter(c=>c.status==="failed").length>=4);case"step_result":return null;default:return null}}function QA({onSendCommand:e,onSelectWorkflow:r,onOpenCommandsManager:s,onOpenWorkflowsManager:i,onAttach:c,textareaContent:u,attachments:f,criteria:l}){const[d,p]=P.useState(!1),[g,m]=P.useState("commands"),[b,_]=P.useState(""),[E,C]=P.useState(0),[y,v]=P.useState(null),[x,S]=P.useState(null),j=P.useRef(null),T=P.useRef(null),N=dn(F=>F.defaults),D=dn(F=>F.userItems),A=dn(F=>F.fetchCommands),z=Nt(F=>F.defaults),O=Nt(F=>F.userItems),q=Nt(F=>F.fetchWorkflows),G=[...N,...D],W=[...z,...O];P.useEffect(()=>{d&&(g==="commands"?A():g==="workflows"&&q())},[d,g,A,q]),P.useEffect(()=>{d&&(_(""),C(0),requestAnimationFrame(()=>{var F;return(F=j.current)==null?void 0:F.focus()}))},[d,g]),P.useEffect(()=>{if(!d)return;const F=U=>{var ne;(ne=T.current)!=null&&ne.contains(U.target)||p(!1)};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[d]);const I=F=>{switch(F.key){case"ArrowDown":F.preventDefault(),C(U=>{const Q=(g==="commands"?G:W).filter(ee=>{const Y=b.toLowerCase();return!Y||ee.name.toLowerCase().includes(Y)});return Math.min(U+1,Q.length-1)});break;case"ArrowUp":F.preventDefault(),C(U=>Math.max(U-1,0));break;case"Enter":F.preventDefault();break;case"Escape":F.preventDefault(),p(!1);break}},$=F=>{_(F),C(0)},B=G.filter(F=>!b||F.name.toLowerCase().includes(b.toLowerCase())),X=W.filter(F=>!b||F.name.toLowerCase().includes(b.toLowerCase())),Z=async F=>{const U=await dn.getState().fetchCommand(F);U&&e(U.prompt,U.metadata.agentMode,u,f),p(!1)},H=F=>{r(F),p(!1)},L=(F,U)=>{U.stopPropagation(),p(!1),v(F)},R=(F,U)=>{U.stopPropagation(),p(!1),S(F)};return o.jsxs("div",{ref:T,className:"relative",children:[o.jsx("button",{type:"button",onClick:()=>p(!d),className:"px-1.5 py-2 rounded-r bg-bg-secondary text-text-muted hover:text-text-primary hover:bg-bg-tertiary transition-colors border-l border-border/50",title:"More options",children:o.jsx(Hb,{className:"w-4 h-4"})}),d&&o.jsxs("div",{className:"absolute bottom-full right-0 mb-1 w-80 bg-bg-secondary border border-border rounded-lg shadow-xl z-50 overflow-hidden",children:[o.jsxs("div",{className:"flex border-b border-border",children:[o.jsx("button",{type:"button",onClick:()=>{m("commands"),_(""),C(0)},className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${g==="commands"?"text-accent-primary border-b-2 border-accent-primary":"text-text-muted hover:text-text-primary"}`,children:"Commands"}),o.jsx("button",{type:"button",onClick:()=>{m("workflows"),_(""),C(0)},className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${g==="workflows"?"text-accent-primary border-b-2 border-accent-primary":"text-text-muted hover:text-text-primary"}`,children:"Workflows"}),o.jsx("button",{type:"button",onClick:()=>m("attach"),className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${g==="attach"?"text-accent-primary border-b-2 border-accent-primary":"text-text-muted hover:text-text-primary"}`,children:"Attach"})]}),g!=="attach"&&o.jsx("div",{className:"p-2 border-b border-border",children:o.jsx("input",{ref:j,value:b,onChange:F=>$(F.target.value),onKeyDown:I,placeholder:g==="commands"?"Search commands...":"Search workflows...",className:"w-full px-2 py-1 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary"})}),o.jsx("div",{className:"overflow-y-auto max-h-64 p-1",children:g==="commands"?B.length===0?o.jsx("div",{className:"px-3 py-2 text-text-muted text-sm",children:G.length===0?"No commands yet":"No matches"}):B.map((F,U)=>o.jsxs("div",{className:`flex items-center gap-1 px-3 py-2 rounded transition-colors group ${U===E?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[o.jsx("button",{type:"button",onClick:()=>Z(F.id),className:"flex-1 text-left",children:o.jsx("div",{className:"text-sm text-text-primary font-medium",children:F.name})}),o.jsx(Ui,{className:"opacity-0 group-hover:opacity-100",onClick:ne=>L(F.id,ne)})]},F.id)):g==="workflows"?X.length===0?o.jsx("div",{className:"px-3 py-2 text-text-muted text-sm",children:W.length===0?"No workflows yet":"No matches"}):X.map((F,U)=>{const ne=ZA(F,l),Q=F.color??"#3b82f6";return o.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 rounded transition-colors group ${U===E?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[o.jsxs("button",{type:"button",onClick:()=>H(F.id),className:"flex-1 text-left flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:Q}}),o.jsx("span",{className:"text-sm text-text-primary font-medium flex-1",children:F.name}),ne!==null&&o.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{backgroundColor:ne?"#22c55e":"#6b7280"},title:ne?"Entry condition met":"Entry condition not met"})]}),o.jsx(Ui,{className:"opacity-0 group-hover:opacity-100",onClick:ee=>R(F.id,ee)})]},F.id)}):o.jsxs("div",{className:"p-4 flex flex-col items-center gap-3",children:[o.jsxs("button",{type:"button",onClick:()=>{c(),p(!1)},className:"flex items-center gap-2 px-4 py-2 rounded bg-bg-tertiary hover:bg-accent-primary/20 text-text-primary transition-colors",children:[o.jsx(uw,{className:"w-4 h-4"}),o.jsx("span",{className:"text-sm font-medium",children:"Attach image"})]}),o.jsx("span",{className:"text-xs text-text-muted",children:"or drag & drop into chat"})]})}),g!=="attach"&&o.jsx("div",{className:"border-t border-border p-1",children:o.jsx("button",{type:"button",onClick:()=>{p(!1),g==="commands"?s():i()},className:"w-full text-left px-3 py-1.5 rounded text-sm text-text-muted hover:text-text-primary hover:bg-bg-tertiary transition-colors",children:g==="commands"?"Manage Commands...":"Manage Workflows..."})})]}),o.jsx(L0,{isOpen:!!y,onClose:()=>v(null),initialEditId:y}),o.jsx(M0,{isOpen:!!x,onClose:()=>S(null),initialEditId:x})]})}function I0(e,r){if(!r)return!0;const s=r.toLowerCase().split(/\s+/),i=e.toLowerCase().split(/\s+/);return s.every(c=>{for(const u of i){let f=0;for(let l=0;l<u.length&&f<c.length;l++)u[l]===c[f]&&f++;if(f===c.length)return!0}return!1})}function B0(e,r,s,i,c){switch(e.key){case"ArrowDown":e.preventDefault(),s(u=>Math.min(u+1,r));break;case"ArrowUp":e.preventDefault(),s(u=>Math.max(u-1,0));break;case"Enter":e.preventDefault(),i();break;case"Escape":e.preventDefault(),c();break}}function JA({isOpen:e,onClose:r,onCloseComplete:s,onSelectCommand:i,onSelectWorkflow:c,onCloseCompleteAction:u,textareaContent:f,onSearchMessages:l,onToggleAutoScroll:d,isAutoScrollActive:p}){const g=dn(R=>R.fetchCommands),m=Nt(R=>R.fetchWorkflows),b=Tt(R=>R.fetchAgents),_=dn(R=>R.defaults),E=dn(R=>R.userItems),C=Nt(R=>R.defaults),y=Nt(R=>R.userItems),v=Tt(R=>R.defaults),x=Tt(R=>R.userItems),S=Ce(R=>{var F;return(F=R.currentSession)==null?void 0:F.mode}),j=Ce(R=>{var F;return((F=R.currentSession)==null?void 0:F.dangerLevel)??"normal"}),T=Ce(R=>R.switchMode),N=Ce(R=>R.switchDangerLevel),D=Ce(R=>{var F;return(F=R.currentSession)==null?void 0:F.projectId}),A=Ce(R=>R.createSession),z=P.useRef(void 0),[O,q]=P.useState(""),[G,W]=P.useState(0),I=P.useRef(null),$=P.useRef(!1);P.useEffect(()=>{e&&($.current=!0)},[e]),P.useEffect(()=>{if(e){g(),m(),b(),q(""),W(0);const R=setTimeout(()=>{var F;return(F=I.current)==null?void 0:F.focus()},50);return()=>clearTimeout(R)}},[e,g,m,b]),P.useEffect(()=>{var R;!e&&$.current&&(s==null||s(),(R=z.current)==null||R.call(z),z.current=void 0)},[e,s]);const B=(R,F)=>{const U=new Set(F.map(ne=>ne.id));return[...R.filter(ne=>!U.has(ne.id)),...F]},Z=[{id:"create-session",name:"New Session",prefix:"Action > Create",action:()=>D&&A(D)},{id:"navigate-session",name:"Another Session",prefix:"Action > Navigate to",action:()=>{z.current=u,r()}},{id:"search-messages",name:"Messages",prefix:"Action > Search",action:()=>{r(),l==null||l()}},{id:"toggle-autoscroll",name:p?"Auto-scroll Off":"Auto-scroll On",prefix:"Action > Toggle",action:()=>{r(),d==null||d(!p)}},...B(v,x).filter(R=>!R.subagent&&R.id!==S).map(R=>({id:R.id,name:R.name,prefix:"Agent > Switch to",action:()=>T(R.id)})),...B(_,E).map(R=>({id:R.id,name:R.name,prefix:"Command > Launch",action:()=>i(R.id,f)})),...B(C,y).map(R=>({id:R.id,name:R.name,prefix:"Workflow > Run",action:()=>c(R.id)})),...["normal","dangerous"].filter(R=>R!==j).map(R=>({id:R,name:R.charAt(0).toUpperCase()+R.slice(1),prefix:"Mode > Switch to",action:()=>N(R)}))].filter(R=>I0(`${R.prefix} ${R.name}`,O)),H=Z.length-1,L=R=>{B0(R,H,W,()=>{var F;(F=Z[G])==null||F.action(),r()},r)};return e?mo.createPortal(o.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh] p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),o.jsxs("div",{className:"relative w-full max-w-md bg-bg-secondary border border-border rounded shadow-xl",children:[o.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border",children:[o.jsx("input",{ref:I,type:"text",value:O,onChange:R=>{q(R.target.value),W(0)},onKeyDown:L,placeholder:"Search...",className:"flex-1 bg-transparent text-sm focus:outline-none placeholder:text-text-muted"}),o.jsx(Bh,{onClick:r,className:"shrink-0","aria-label":"Close"})]}),o.jsx("div",{className:"overflow-y-auto max-h-[60vh] p-2",children:Z.length===0?o.jsx("div",{className:"px-3 py-4 text-center text-text-muted text-sm",children:_.length+E.length+C.length+y.length>0?"No matches":"No agents, commands, or workflows yet"}):Z.map((R,F)=>o.jsxs("button",{type:"button",onClick:()=>{R.action(),r()},className:`w-full text-left px-3 py-2 rounded text-sm transition-colors ${F===G?"bg-accent-primary/20 text-text-primary":"text-text-secondary hover:bg-bg-tertiary hover:text-text-primary"}`,children:[o.jsxs("span",{className:"text-text-muted font-normal",children:[R.prefix," "]}),o.jsx("span",{children:R.name})]},R.id))})]})]}),document.body):null}function e4(e){const r=new Date(e),s=new Date;if(r.getDate()===s.getDate()&&r.getMonth()===s.getMonth()&&r.getFullYear()===s.getFullYear())return r.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1});const c=r.getFullYear(),u=String(r.getMonth()+1).padStart(2,"0"),f=String(r.getDate()).padStart(2,"0"),l=String(r.getHours()).padStart(2,"0"),d=String(r.getMinutes()).padStart(2,"0");return`${c}/${u}/${f} ${l}:${d}`}function t4({isOpen:e,onClose:r,messages:s,onSelectMessage:i}){const[c,u]=P.useState(""),[f,l]=P.useState(0),d=P.useRef(null),p=P.useRef(!1),g=s.filter(C=>C.role==="user"&&!C.isSystemGenerated&&C.messageKind!=="auto-prompt"&&C.messageKind!=="command");P.useEffect(()=>{e&&(p.current=!0)},[e]),P.useEffect(()=>{if(e){u(""),l(0);const C=setTimeout(()=>{var y;return(y=d.current)==null?void 0:y.focus()},50);return()=>clearTimeout(C)}},[e]);const m=g.filter(C=>I0(C.content,c)),b=m.length-1,_=C=>{B0(C,b,l,()=>{m[f]&&(i(m[f].id),r())},r)},E=C=>{i(C),r()};return e?mo.createPortal(o.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh] p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),o.jsxs("div",{className:"relative w-full max-w-md bg-bg-secondary border border-border rounded shadow-xl",children:[o.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border",children:[o.jsx(Wb,{}),o.jsx("input",{ref:d,type:"text",value:c,onChange:C=>{u(C.target.value),l(0)},onKeyDown:_,placeholder:"Search messages...",className:"flex-1 bg-transparent text-sm focus:outline-none placeholder:text-text-muted"}),o.jsx("button",{type:"button",onClick:r,className:"p-0.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors","aria-label":"Close",children:o.jsx(Gb,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"overflow-y-auto max-h-[60vh] p-2",children:m.length===0?o.jsx("div",{className:"px-3 py-4 text-center text-text-muted text-sm",children:g.length>0?"No matches":"No messages yet"}):m.map((C,y)=>o.jsx("button",{type:"button",onClick:()=>E(C.id),className:`w-full text-left px-3 py-2 rounded text-sm transition-colors ${y===f?"bg-accent-primary/20 text-text-primary":"text-text-secondary hover:bg-bg-tertiary hover:text-text-primary"}`,children:o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsx("span",{className:"truncate flex-1",children:C.content}),o.jsx("span",{className:"text-text-muted text-xs shrink-0",children:e4(C.timestamp)})]})},C.id))})]})]}),document.body):null}function n4(e){return e==="criterion"}function r4(e){var r,s;return e.role!=="assistant"||e.subAgentId||(r=e.content)!=null&&r.trim()||(s=e.thinkingContent)!=null&&s.trim()||!e.toolCalls||e.toolCalls.length===0?!1:e.toolCalls.every(i=>n4(i.name))}function s4(e,r=[]){const s=[];let i=null,c=[],u,f=1;const l=new Map,d=new Map,p=[];for(const _ of r)_.type==="message"?l.set(_.message.id,_):_.type==="subagent"?d.set(_.subAgentId,_):_.type==="criteria-batch"&&p.push(_);let g=0;const m=()=>{if(c.length>0){const _=p[g];_&&_.type==="criteria-batch"&&_.toolCalls.length===c.length&&_.toolCalls.every((C,y)=>{var v;return C.id===((v=c[y])==null?void 0:v.id)})?s.push(_):s.push({type:"criteria-batch",toolCalls:[...c]}),g++,c=[]}},b=()=>{if(!i)return;const _=i,E=d.get(_.subAgentId);E&&E.type==="subagent"&&E.messages.length===_.messages.length&&E.messages.every((y,v)=>y===_.messages[v])?s.push(E):s.push({type:"subagent",subAgentId:_.subAgentId,subAgentType:_.subAgentType,messages:_.messages}),i=null};for(const _ of e)if(_.role!=="tool"){if(_.contextWindowId&&u&&_.contextWindowId!==u&&(m(),b(),f++,s.push({type:"context-divider",windowSequence:f})),u=_.contextWindowId,r4(_)){b();for(const E of _.toolCalls)c.push(E);continue}if(m(),_.subAgentId&&_.subAgentType)i&&i.subAgentId===_.subAgentId?i.messages.push(_):(b(),i={subAgentId:_.subAgentId,subAgentType:_.subAgentType,messages:[_]});else{b();const E=l.get(_.id);E&&E.type==="message"&&E.message===_?s.push(E):s.push({type:"message",message:_})}}return m(),b(),s}function i4(e){const{year:r,month:s,day:i}=ty(e);return`${r}/${s}/${i} ${uc(e)}`}function a4(e,r){return e.length<=r?e:e.substring(0,r)+"..."}const o4=10,l4=150;function c4(e){const r=[];if(e.recentUserPrompts)for(const s of e.recentUserPrompts)r.push({id:s.id,content:s.content,timestamp:s.timestamp,sessionId:e.id,sessionName:e.title||e.id});return r}function u4(e){return[...e].sort((i,c)=>new Date(c.timestamp).getTime()-new Date(i.timestamp).getTime()).slice(0,o4).reverse().map(i=>({id:i.id,content:i.content,timestamp:i.timestamp,formattedTimestamp:i4(i.timestamp),trimmedContent:a4(i.content,l4),sessionId:i.sessionId,sessionName:i.sessionName}))}function d4(e,r,s){const i=[],c=e.filter(u=>u.role==="user"&&!u.isSystemGenerated&&u.messageKind!=="auto-prompt");for(const u of c)i.push({id:u.id,content:u.content,timestamp:u.timestamp,sessionId:s??"",sessionName:"This session"});for(const u of r)s&&u.id===s||i.push(...c4(u));return u4(i)}function h4(e,r=[],s=null){const[i,c]=P.useState(0),[u,f]=P.useState(!1),l=P.useMemo(()=>d4(e,r,s),[e,r,s]),d=P.useCallback(()=>{l.length>0&&(c(l.length-1),f(!0))},[l.length]),p=P.useCallback(()=>{f(!1),c(0)},[]),g=P.useCallback(()=>{c(_=>l.length===0?_:_===0?l.length-1:_-1)},[l.length]),m=P.useCallback(()=>{c(_=>l.length===0?_:_===l.length-1?0:_+1)},[l.length]),b=P.useCallback(()=>{if(l.length===0||!u)return null;const _=l[i];return(_==null?void 0:_.content)??null},[l,i,u]);return{history:l,selectedIndex:i,showHistory:u,openHistory:d,closeHistory:p,navigateUp:g,navigateDown:m,selectCurrent:b}}function f4({criteriaSidebarOpen:e,onCriteriaSidebarToggle:r}={}){const s=e??!0,[i,c]=P.useState(""),[u,f]=P.useState([]),[l,d]=P.useState(!1),[p,g]=P.useState(null),[m,b]=P.useState(!1),[_,E]=P.useState(!1),[C,y]=P.useState(!1),[v,x]=P.useState(!1),[S,j]=P.useState(null),[T,N]=P.useState(null),D=P.useRef(null),A=P.useRef(null),z=P.useRef(null),O=Ce(ie=>ie.currentSession),q=Ce(ie=>ie.messages),G=Ce(ie=>ie.streamingMessage),W=Ce(ie=>ie.sessions),I=Ce(ie=>ie.error),$=Ce(ie=>ie.pendingQuestion),B=Ib(),X=Ce(ie=>ie.sendMessage),Z=Ce(ie=>ie.clearError),H=Ce(ie=>ie.acceptAndBuild),L=Ce(ie=>ie.stopGeneration),R=Ce(ie=>ie.launchRunner),F=Ce(ie=>ie.cancelQueued),U=iw(),{showThinking:ne,showVerboseToolOutput:Q,showStats:ee,showAgentDefinitions:Y,showWorkflowBars:V}=_b(),oe=Nt(ie=>ie.defaults),re=Nt(ie=>ie.userItems),ve=[...oe,...re],be=Nt(ie=>ie.fetchWorkflows),Le=Tt(ie=>ie.defaults),Oe=Tt(ie=>ie.userItems),ze=[...Le,...Oe].filter(ie=>!ie.subagent);P.useEffect(()=>{be()},[be]);const{history:We,selectedIndex:Ee,showHistory:fe,openHistory:je,closeHistory:Ue,navigateUp:It,navigateDown:pe,selectCurrent:Ne}=h4(q,W,O==null?void 0:O.id),Me=P.useCallback(ie=>{j(ie),St(!1);const Ae=document.querySelector(`[data-message-id="${ie}"]`);Ae&&Ae.scrollIntoView({behavior:"smooth",block:"center"}),setTimeout(()=>j(null),3e3)},[]);P.useEffect(()=>{const ie=Ae=>{N(Ae.detail.stats)};return window.addEventListener("open-turn-stats",ie),()=>window.removeEventListener("open-turn-stats",ie)},[]);const ot=P.useMemo(()=>G?q.map(ie=>ie.id===G.id?G:ie):q,[q,G]),ue=P.useRef([]),_e=P.useMemo(()=>{const ie=s4(ot,ue.current);return ue.current=ie,ie},[ot]),Te=P.useMemo(()=>BA(q),[q]),{force_scroll_to_bottom:Ie,isAutoScrollActive:$e,setAutoScroll:St}=A0(D,O),Ye=P.useCallback(()=>{const ie=A.current;if(!ie)return;ie.style.height="auto";const Ae=Math.min(200,ie.scrollHeight);ie.style.height=`${Ae}px`},[]);P.useEffect(()=>{if(!(O!=null&&O.id))return;const ie=`openfox:draft:${O.id}`,Ae=localStorage.getItem(ie);Ae!==null&&c(Ae)},[O==null?void 0:O.id]),P.useEffect(()=>{var ie;(ie=A.current)==null||ie.focus(),Ye()},[O==null?void 0:O.id,Ye]),P.useEffect(()=>{if(!(O!=null&&O.id))return;const ie=`openfox:draft:${O.id}`,Ae=setTimeout(()=>{i?localStorage.setItem(ie,i):localStorage.removeItem(ie)},500);return()=>clearTimeout(Ae)},[O==null?void 0:O.id,i]),P.useEffect(()=>{Ye()},[i,Ye]),P.useEffect(()=>{const ie=Ae=>{Ae.key==="Escape"&&B&&L(),Ae.key==="ScrollLock"&&St(!$e)};return window.addEventListener("keydown",ie),()=>window.removeEventListener("keydown",ie)},[B,L,$e]);const Dt=P.useRef(0);P.useEffect(()=>{const ie=Ae=>{if(Ae.key==="Shift"&&!Ae.ctrlKey&&!Ae.metaKey&&!Ae.altKey){const qe=Date.now();qe-Dt.current<300?(Ae.preventDefault(),y(!0),Dt.current=0):Dt.current=qe}};return window.addEventListener("keydown",ie),()=>window.removeEventListener("keydown",ie)},[]),P.useEffect(()=>{const ie=A.current;if(!ie)return;const Ae=async qe=>{var en;if(document.activeElement!==ie)return;const Ct=(en=qe.clipboardData)==null?void 0:en.items;if(Ct){for(const yn of Array.from(Ct))if(yn.type.startsWith("image/")){qe.preventDefault();const vr=yn.getAsFile();if(!vr)continue;await dh(vr,Ks=>f(_n=>[..._n,Ks]),g,{filename:"pasted-image"})}}};return ie.addEventListener("paste",Ae),()=>ie.removeEventListener("paste",Ae)},[]);const mt=()=>{c(""),f([]),O!=null&&O.id&&localStorage.removeItem(`openfox:draft:${O.id}`)},Kt=async ie=>{ie.preventDefault(),!(!i.trim()&&u.length===0)&&(Ie(),X(i,u.length>0?u:void 0),mt())},lt=ie=>{if((ie.ctrlKey||ie.metaKey)&&ie.code.startsWith("Digit")){const qe=parseInt(ie.code.slice(-1),10)-1,Ct=ze[qe];Ct&&(ie.preventDefault(),Ce.getState().switchMode(Ct.id));return}if(fe)switch(ie.key){case"Enter":ie.preventDefault();const Ae=Ne();Ae&&(c(Ae),Ue());return;case"Escape":ie.preventDefault(),Ue(),B&&L();return;case"ArrowUp":ie.preventDefault(),It();return;case"ArrowDown":ie.preventDefault(),pe();return}if(ie.key==="ArrowUp"&&i.trim()===""&&!fe){ie.preventDefault(),je();return}ie.key==="Enter"&&!ie.shiftKey&&(ie.preventDefault(),Kt(ie))},$n=P.useCallback(async ie=>{const Ae=ie.target.files;if(!(!Ae||Ae.length===0)){g(null);for(const qe of Array.from(Ae))await dh(qe,Ct=>f(en=>[...en,Ct]),g);z.current&&(z.current.value="")}},[]),sn=P.useCallback(ie=>{ie.preventDefault(),ie.stopPropagation(),d(!0)},[]),Gi=P.useCallback(ie=>{ie.preventDefault(),ie.stopPropagation(),d(!1)},[]),me=P.useCallback(async ie=>{ie.preventDefault(),ie.stopPropagation(),d(!1),g(null);const Ae=ie.dataTransfer.files;if(!(!Ae||Ae.length===0))for(const qe of Array.from(Ae))await dh(qe,Ct=>f(en=>[...en,Ct]),g)},[]),ye=P.useCallback(ie=>{f(Ae=>Ae.filter(qe=>qe.id!==ie))},[]),we=P.useCallback(()=>{var ie;(ie=z.current)==null||ie.click()},[]),Ve=(O==null?void 0:O.mode)==="planner",Qe=(O==null?void 0:O.mode)==="builder",Pe=((O==null?void 0:O.criteria.length)??0)>0,Yt=(O==null?void 0:O.phase)==="done",Rt=_e.some(ie=>ie.type==="message"&&ie.message.role==="assistant"),Bt=Ve&&Pe&&!B&&Rt&&!Yt,Ur=ie=>{const Ae=i.trim()?i:void 0,qe=u.length>0?u:void 0;Ve?H(ie,Ae,qe):Qe&&R(Ae,qe,ie),mt()};return o.jsxs(o.Fragment,{children:[o.jsxs(n2,{criteriaSidebarOpen:s,onCriteriaSidebarToggle:r,messages:ot,children:[$&&o.jsx(_A,{question:$}),o.jsx(i2,{}),T&&o.jsx(dA,{stats:T,onClose:()=>N(null)}),o.jsx(SA,{}),o.jsxs("div",{ref:D,"data-testid":"chat-scroll-container",className:"flex-1 min-w-0 overflow-y-auto relative bg-primary",children:[o.jsx("div",{className:"pt-4",children:_e.map((ie,Ae)=>{if(ie.type==="context-divider")return o.jsxs("div",{className:"flex items-center gap-2 feed-item px-2 md:px-4",children:[o.jsx("div",{className:"flex-1 border-t border-border"}),o.jsx("span",{className:"text-[10px] text-text-muted font-medium px-2",children:"Earlier context summarized"}),o.jsx("div",{className:"flex-1 border-t border-border"})]},Ae);if(ie.type==="subagent"){const yn=ie.messages.some(vr=>vr.isStreaming);return o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(mA,{messages:ie.messages,subAgentType:ie.subAgentType,subAgentId:ie.subAgentId,isStreaming:yn})},Ae)}if(ie.type==="criteria-batch")return o.jsx("div",{className:"feed-item px-2 md:px-4",children:o.jsx(N0,{toolCalls:ie.toolCalls,criteria:O==null?void 0:O.criteria})},Ae);const qe=ie.message;if(qe.role==="assistant")return o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(Cf,{message:qe,showStats:ee,showThinking:ne,showVerboseToolOutput:Q})},Ae);const Ct=!Y&&qe.messageKind==="auto-prompt",en=!V&&(qe.messageKind==="workflow-started"||qe.messageKind==="task-completed");return Ct||en?null:o.jsx("div",{className:"px-2 md:px-4",children:o.jsx("div",{"data-message-id":qe.id,className:S===qe.id?"rounded animate-highlight-fade":void 0,children:o.jsx(T0,{message:qe,isLastAssistantMessage:!1,promptContext:qe.role==="user"?Te[qe.id]:void 0})})},Ae)})}),o.jsxs("div",{className:"px-2 md:px-4 pb-4",children:[I&&o.jsx("div",{className:"feed-item bg-red-500/10 border border-red-500/50 rounded p-2",children:o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-red-400 text-sm font-medium",children:I.code}),o.jsx("div",{className:"text-red-300 text-xs mt-0.5",children:I.message})]}),o.jsx(io,{onClick:Z,className:"text-red-400 hover:text-red-300 p-0.5",size:"sm"})]})}),Bt&&o.jsx("div",{className:"flex justify-center gap-2 feed-item flex-wrap",children:ve.map(ie=>{const Ae=ie.color??"#3b82f6",qe=parseInt(Ae.slice(1,3),16),Ct=parseInt(Ae.slice(3,5),16),en=parseInt(Ae.slice(5,7),16),yn=`rgba(${qe},${Ct},${en},0.12)`,vr=`rgba(${qe},${Ct},${en},0.22)`,Ks=`rgba(${qe},${Ct},${en},0.25)`;return o.jsxs("button",{onClick:()=>H(ie.id),className:"px-4 py-1.5 rounded text-sm font-medium transition-colors",style:{backgroundColor:yn,color:Ae,border:`1px solid ${Ks}`},onMouseEnter:_n=>{_n.currentTarget.style.backgroundColor=vr},onMouseLeave:_n=>{_n.currentTarget.style.backgroundColor=yn},children:["▶ ",ie.name]},ie.id)})}),B&&o.jsx(wA,{})]})]}),o.jsxs("form",{onSubmit:Kt,className:"relative p-2 md:p-4 bg-secondary",children:[o.jsxs("button",{type:"button",className:"absolute -top-8 right-12 md:right-16 text-sm text-text-muted hover:text-text-primary z-10 flex items-center gap-1.5",onClick:()=>St(!$e),children:[$e?o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-success"}):o.jsx(mr,{className:"w-3 h-3 text-text-muted"}),$e?"live":"scroll to bottom"]}),o.jsx("button",{type:"button",onClick:()=>x(!0),className:"absolute -top-8 right-2 md:right-4 text-sm text-text-muted hover:text-text-primary z-10 flex items-center p-0.5 rounded hover:bg-bg-tertiary transition-colors","aria-label":"Search messages",children:o.jsx(Wb,{})}),o.jsx("input",{ref:z,type:"file",accept:".png,.jpg,.jpeg,.gif",onChange:$n,className:"hidden",multiple:!0}),p&&o.jsx("div",{className:"mb-2 p-2 bg-red-500/10 border border-red-500/50 rounded text-red-300 text-sm",children:p}),u.length>0&&o.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:u.map(ie=>o.jsx(CA,{attachment:ie,onRemove:ye},ie.id))}),fe&&o.jsx(kA,{history:We,selectedIndex:Ee,onSelect:ie=>{c(ie),Ue()},onEscape:Ue,onNavigate:ie=>{ie==="up"?It():pe()}}),U.length>0&&o.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:U.map(ie=>o.jsxs("div",{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded text-xs ${ie.mode==="asap"?"bg-amber-500/15 text-amber-300 border border-amber-500/30":"bg-blue-500/15 text-blue-300 border border-blue-500/30"}`,children:[o.jsxs("span",{className:"font-medium",children:[ie.mode==="asap"?"ASAP":"Queue",":"]}),o.jsx("span",{className:"truncate max-w-[200px]",children:ie.content}),o.jsx(io,{onClick:()=>F(ie.queueId),size:"sm"})]},ie.queueId))}),o.jsxs("div",{className:`flex items-end gap-3 p-3 rounded transition-colors ${l?"bg-accent-primary/10":"bg-primary"}`,onDragOver:sn,onDragLeave:Gi,onDrop:me,children:[o.jsx("textarea",{ref:A,value:i,onChange:ie=>{c(ie.target.value),fe&&Ue()},onKeyDown:lt,placeholder:"What would you like to build?",className:"flex-1 bg-transparent text-sm placeholder:text-text-muted resize-none overflow-y-auto focus:outline-none",style:{minHeight:"24px",maxHeight:"200px"},spellCheck:!1}),o.jsxs("div",{className:"flex items-center self-center",children:[o.jsx("button",{type:"button",onClick:()=>{var ie;!i.trim()&&u.length===0||((ie=D.current)==null||ie.scrollTo({top:D.current.scrollHeight,behavior:"smooth"}),X(i,u),mt())},disabled:!i.trim()&&u.length===0,className:"px-4 py-1.5 rounded-l bg-accent-primary/20 text-sm text-accent-primary font-medium hover:bg-accent-primary/30 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:"Send"}),o.jsx(QA,{onSendCommand:(ie,Ae,qe,Ct)=>{var yn;Ae&&(O==null?void 0:O.mode)!==Ae&&Ce.getState().switchMode(Ae);const en=qe&&qe.trim()?`${qe.trim()}
150
+
151
+ ${ie}`:ie;(yn=D.current)==null||yn.scrollTo({top:D.current.scrollHeight,behavior:"smooth"}),X(en,Ct!=null&&Ct.length?Ct:void 0,{messageKind:"command",isSystemGenerated:!0}),mt()},onSelectWorkflow:Ur,onOpenCommandsManager:()=>b(!0),onOpenWorkflowsManager:()=>E(!0),onAttach:we,textareaContent:i,attachments:u.length>0?u:void 0,criteria:(O==null?void 0:O.criteria)??[]})]})]}),o.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(bA,{}),o.jsx(yA,{})]}),o.jsx(FA,{})]})]}),o.jsx(L0,{isOpen:m,onClose:()=>b(!1)}),o.jsx(M0,{isOpen:_,onClose:()=>E(!1)}),o.jsx(JA,{isOpen:C,onClose:()=>y(!1),onSearchMessages:()=>x(!0),isAutoScrollActive:$e,onToggleAutoScroll:St,textareaContent:i,onCloseComplete:()=>{var ie;return(ie=A.current)==null?void 0:ie.focus()},onCloseCompleteAction:()=>window.dispatchEvent(new CustomEvent("open-session-dropdown")),onSelectCommand:async(ie,Ae)=>{const qe=await dn.getState().fetchCommand(ie);if(qe){const Ct=Ae!=null&&Ae.trim()?`${Ae.trim()}
152
+
153
+ ${qe.prompt}`:qe.prompt;qe.metadata.agentMode&&Ce.getState().switchMode(qe.metadata.agentMode),X(Ct,u!=null&&u.length?u:void 0,{messageKind:"command",isSystemGenerated:!0}),mt()}},onSelectWorkflow:ie=>{const Ae=i.trim()||void 0,qe=u.length>0?u:void 0;(O==null?void 0:O.mode)==="planner"?Ce.getState().acceptAndBuild(ie,Ae,qe):Ce.getState().launchRunner(Ae,qe,ie),mt()}})]}),v&&o.jsx(t4,{isOpen:v,onClose:()=>x(!1),messages:q,onSelectMessage:Me})]})}P.memo(function({item:r}){const[s,i]=P.useState(!1);return r.type==="start"?o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-amber-500/10 border border-amber-500/30 rounded text-amber-300 text-sm",children:[o.jsx("span",{className:"animate-pulse",children:"●"}),o.jsx("span",{children:"Delegating image to fallback vision model..."}),r.filename&&o.jsxs("span",{className:"text-amber-400/70",children:["(",r.filename,")"]})]}):o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 bg-accent-success/10 border border-accent-success/30 rounded",children:[o.jsx("span",{className:"text-accent-success",children:"✓"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"text-accent-success text-sm",children:"Image description done"}),o.jsx("button",{type:"button",onClick:()=>i(!s),className:"text-xs text-accent-primary hover:text-accent-primary/80 transition-colors",children:s?"Hide":"Show"})]}),s&&r.description&&o.jsx("div",{className:"mt-2 text-xs prose prose-invert prose-sm max-w-none",children:o.jsx(Gs,{content:r.description})})]})]})});function vb({isOpen:e,isRetry:r,onSubmit:s,onCancel:i}){const[c,u]=P.useState(""),f=P.useRef(null);P.useEffect(()=>{e&&(u(""),setTimeout(()=>{var d;return(d=f.current)==null?void 0:d.focus()},100))},[e]);const l=d=>{d.preventDefault(),c.trim()&&s(c)};return o.jsx(At,{isOpen:e,onClose:i,title:r?"Invalid Password":"Password Required",size:"sm",children:o.jsxs("form",{onSubmit:l,className:"space-y-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:r?"The password you entered was incorrect. Please try again.":"This server requires a password to connect."}),o.jsx(dc,{ref:f,type:"password",value:c,onChange:d=>u(d.target.value),placeholder:"Enter password",autoFocus:!0}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(st,{type:"button",variant:"secondary",onClick:i,children:"Cancel"}),o.jsx(st,{type:"submit",disabled:!c.trim(),children:r?"Try Again":"Connect"})]})]})})}const p4=[8e3,11434,8080],m4=[{name:"OpenCode Go",url:"https://opencode.ai/zen/go/v1",backend:"opencode-go"}];function bb(e){switch(e){case"vllm":return"vLLM";case"sglang":return"SGLang";case"ollama":return"Ollama";case"llamacpp":return"llama.cpp";case"openai":return"OpenAI";case"anthropic":return"Anthropic";case"opencode-go":return"OpenCode Go";case"auto":return"Auto";case"unknown":return"Unknown";default:return e}}function g4({currentStep:e,totalSteps:r,labels:s,onStepClick:i}){return o.jsx("div",{className:"flex justify-center py-6",children:o.jsx("div",{className:"flex items-center",children:Array.from({length:r},(c,u)=>{const f=u+1,l=f<e,d=f===e;return o.jsxs("div",{className:"flex items-center",children:[o.jsx("button",{onClick:()=>i==null?void 0:i(f),className:`size-8 rounded-full flex items-center justify-center text-sm font-medium transition-colors shrink-0 ${l?"bg-accent-primary text-text-primary hover:opacity-80":d?"bg-accent-primary text-text-primary":"bg-bg-tertiary text-text-muted"}`,children:l?"✓":f}),o.jsx("button",{onClick:()=>i==null?void 0:i(f),className:`ml-2 mr-4 text-sm whitespace-nowrap hidden sm:block ${d?"text-text-primary font-medium":"text-text-muted hover:text-text-secondary"}`,children:s[u]}),u<r-1&&o.jsx("div",{className:`w-12 sm:w-20 h-0.5 mr-4 ${l?"bg-accent-primary":"bg-border"}`})]},u)})})})}function x4({onNext:e}){const[r,s]=P.useState([]),[i,c]=P.useState([]),[u,f]=P.useState(!1),[l,d]=P.useState(""),[p,g]=P.useState(""),[m,b]=P.useState(""),[_,E]=P.useState("auto"),[C,y]=P.useState(!1),[v,x]=P.useState(null),[S,j]=P.useState(null),[T,N]=P.useState(null),[D,A]=P.useState("");P.useEffect(()=>{z()},[]);async function z(){try{const $=await ke("/api/providers");if($.ok){const X=(await $.json()).providers.map(Z=>({id:Z.id,name:Z.name,url:Z.url,backend:Z.backend,model:null,apiKey:Z.apiKey}));s(X),c(X)}}catch{}}async function O($){y(!0),x(null);const B=_!=="auto";try{const Z=await(await ke("/api/providers/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:$,skipBackendDetection:B})})).json();Z.success?(B||E(Z.backend??"auto"),x({success:!0,model:Z.model??void 0})):x({success:!1,error:Z.error??"Connection failed"})}catch(X){x({success:!1,error:X instanceof Error?X.message:"Connection failed"})}y(!1)}function q(){if(!p)return;const $=l||`Provider ${i.length+1}`,B={id:`temp-${Date.now()}`,name:$,url:p,backend:v!=null&&v.success?_:"auto",model:v!=null&&v.success?v.model??null:null,apiKey:m||void 0};c([...i,B]),d(""),g(""),b(""),x(null)}function G($){j($),r.some(X=>X.id===$)?ke(`/api/providers/${$}`,{method:"DELETE"}).then(()=>{c(i.filter(X=>X.id!==$)),s(r.filter(X=>X.id!==$)),j(null)}).catch(()=>{j(null)}):(c(i.filter(X=>X.id!==$)),j(null))}async function W(){for(const B of i)(B.id.startsWith("temp-")||!r.some(X=>X.id===B.id))&&((await ke("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:B.name,url:B.url,backend:B.backend,model:B.model,apiKey:B.apiKey})})).ok||console.error("Failed to add provider",B));const $=i.filter(B=>!B.id.startsWith("temp-"));e({providers:$})}const I=i.length>0;return o.jsxs("div",{className:"max-w-xl mx-auto",children:[o.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"LLM Providers"}),o.jsx("p",{className:"text-text-secondary mb-8",children:"Manage your LLM server connections"}),o.jsxs("div",{className:"space-y-4",children:[i.length>0?o.jsx("div",{className:"space-y-2",children:i.map($=>o.jsxs("div",{className:"flex items-center justify-between bg-bg-secondary rounded-lg p-4 border border-border",children:[o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"px-2 py-0.5 bg-accent-primary/25 text-accent-primary rounded text-xs font-medium",children:bb($.backend)}),T===$.id?o.jsx("input",{type:"text",value:D,onChange:B=>A(B.target.value),onKeyDown:B=>{B.key==="Enter"&&(c(i.map(X=>X.id===$.id?{...X,name:D}:X)),N(null)),B.key==="Escape"&&N(null)},onBlur:()=>{c(i.map(B=>B.id===$.id?{...B,name:D}:B)),N(null)},className:"px-2 py-0.5 bg-bg-primary border border-accent-primary rounded text-text-primary text-sm focus:outline-none",autoFocus:!0}):o.jsx("span",{className:"text-text-primary font-medium cursor-pointer hover:text-accent-primary",onClick:()=>{N($.id),A($.name)},title:"Click to edit",children:$.name})]}),o.jsx("p",{className:"text-text-muted text-sm mt-1",children:$.url}),$.model&&o.jsxs("p",{className:"text-text-secondary text-xs mt-0.5",children:["Model: ",$.model]})]}),o.jsx("button",{onClick:()=>G($.id),disabled:S===$.id,className:"p-2 text-text-muted hover:text-red-500 transition-colors disabled:opacity-50",title:"Remove provider",children:o.jsx(qb,{})})]},$.id))}):o.jsx("div",{className:"bg-bg-secondary rounded-lg p-8 text-center border border-border",children:o.jsx("p",{className:"text-text-muted",children:"No providers configured yet"})}),u?o.jsxs("form",{onSubmit:$=>{$.preventDefault(),p&&q()},className:"space-y-4 p-4 bg-bg-tertiary rounded-lg",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-2",children:"Service Presets"}),o.jsx("div",{className:"grid grid-cols-2 gap-2",children:m4.map($=>o.jsx("button",{type:"button",onClick:()=>{d($.name),g($.url),E($.backend),x(null)},className:`p-2 rounded border text-center text-sm transition-colors ${p===$.url?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:$.name},$.name))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-2",children:"Local Presets"}),o.jsx("div",{className:"grid grid-cols-3 gap-2",children:p4.map($=>o.jsxs("button",{type:"button",onClick:()=>{d(""),g(`http://localhost:${$}`),E("auto"),x(null)},className:`p-2 rounded border text-center text-sm transition-colors ${p===`http://localhost:${$}`?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:["localhost:",$]},$))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Or enter address manually"}),o.jsx("input",{type:"text",name:"url",value:p,onChange:$=>{g($.target.value),x(null)},onKeyDown:$=>{$.key==="Enter"&&($.preventDefault(),O(p))},placeholder:"http://localhost:8000",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Provider name (optional)"}),o.jsx("input",{type:"text",name:"name",value:l,onChange:$=>d($.target.value),onKeyDown:$=>{$.key==="Enter"&&($.preventDefault(),q())},placeholder:"My LLM Server",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"API key (optional)"}),o.jsx("input",{type:"password",name:"apiKey",value:m,onChange:$=>b($.target.value),placeholder:"sk-...",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),v&&o.jsx("div",{className:`p-3 rounded-lg ${v.success?"bg-accent-primary/10":"bg-red-500/10"}`,children:v.success?o.jsxs("p",{className:"text-accent-primary font-medium",children:["✓ Connected to ",bb(_),v.model&&` (${v.model})`]}):o.jsx("p",{className:"text-red-500",children:v.error})}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{type:"button",onClick:()=>O(p),disabled:!p||C,className:"flex-1 px-4 py-2 bg-bg-secondary border border-border rounded-lg hover:border-text-muted disabled:opacity-50",children:C?o.jsx($b,{className:"w-4 h-4"}):"Test Connection"}),o.jsx("button",{type:"submit",disabled:!p,className:"flex-1 px-4 py-2 bg-accent-primary text-text-primary rounded-lg hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors font-medium",children:v!=null&&v.success?"Add Provider ✓":"Add Provider"})]}),o.jsx("button",{type:"button",onClick:()=>{f(!1),d(""),g(""),x(null)},className:"w-full text-center text-text-muted hover:text-text-secondary text-sm",children:"Cancel"})]}):o.jsxs("button",{onClick:()=>f(!0),className:"w-full flex items-center justify-center gap-2 px-4 py-3 bg-bg-secondary border border-dashed border-border rounded-lg text-text-secondary hover:text-text-primary hover:border-text-muted transition-colors",children:[o.jsx(Ub,{className:"w-4 h-4"}),"Add Provider"]}),o.jsx("button",{onClick:W,disabled:!I,className:"w-full mt-6 px-6 py-3 bg-accent-primary text-text-primary rounded-lg font-medium hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Continue"})]})]})}function v4({onNext:e}){const[r,s]=P.useState(""),[i,c]=P.useState(!1);return P.useEffect(()=>{ke("/api/config").then(u=>u.json()).then(u=>{u.workdir?s(u.workdir):fetch("/api/directories?path="+encodeURIComponent("/home")).then(f=>f.json()).then(f=>{f.current&&s(f.current)}).catch(()=>{})}).catch(()=>{fetch("/api/directories?path="+encodeURIComponent("/home")).then(u=>u.json()).then(u=>{u.current&&s(u.current)}).catch(()=>{})})},[]),o.jsxs("div",{className:"max-w-xl mx-auto",children:[o.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"Your Projects Folder"}),o.jsx("p",{className:"text-text-secondary mb-8",children:"Where should OpenFox create project folders?"}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Workspace directory"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{type:"text",value:r,onChange:u=>s(u.target.value),placeholder:"/home/user/projects",className:"flex-1 px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"}),o.jsx("button",{onClick:()=>c(!0),className:"px-4 py-2 bg-bg-secondary border border-border rounded-lg hover:border-text-muted",children:"Browse"})]})]}),i&&o.jsx(sy,{initialPath:r||void 0,onSelect:u=>{s(u),c(!1)},onClose:()=>c(!1)}),o.jsx("button",{onClick:()=>e({workdir:r}),disabled:!r,className:"w-full mt-6 px-6 py-3 bg-accent-primary text-text-primary rounded-lg font-medium hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Continue"})]})]})}function b4({onNext:e}){const[r,s]=P.useState(!1),[i,c]=P.useState("http://localhost:11434"),[u,f]=P.useState("qwen3-vl:2b"),{copied:l,copy:d}=C0();P.useEffect(()=>{ke("/api/config").then(g=>g.json()).then(g=>{g.visionFallback&&(s(g.visionFallback.enabled),c(g.visionFallback.url),f(g.visionFallback.model))}).catch(()=>{})},[]);function p(g){if(g){e({});return}e({visionFallback:{enabled:r,url:i,model:u,timeout:120}})}return o.jsxs("div",{className:"max-w-xl mx-auto",children:[o.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"Vision (Optional)"}),o.jsx("p",{className:"text-text-secondary mb-8",children:"Configure a vision model for non-vision models"}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"bg-bg-secondary rounded-lg p-4 border border-border",children:[o.jsx("p",{className:"text-text-secondary text-sm mb-2",children:"To enable vision support, you need an Ollama server with a vision model:"}),o.jsx("a",{href:"https://ollama.com/download",target:"_blank",rel:"noopener noreferrer",className:"text-accent-primary hover:underline text-sm",children:"Download Ollama"}),o.jsxs("div",{className:"mt-3 p-2 bg-bg-primary rounded border border-border flex items-center justify-between gap-2",children:[o.jsx("code",{className:"text-text-secondary text-xs",children:"ollama pull qwen3-vl:2b"}),o.jsx("button",{onClick:()=>d("ollama pull qwen3-vl:2b"),className:"text-text-muted hover:text-text-primary transition-colors",title:"Copy",children:l?o.jsx(Pr,{className:"w-4 h-4 text-accent-primary"}):o.jsx(fw,{className:"w-4 h-4"})})]})]}),o.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:r,onChange:g=>s(g.target.checked),className:"w-5 h-5 rounded border-border bg-bg-secondary text-accent-primary focus:ring-accent-primary"}),o.jsx("span",{className:"text-text-primary",children:"Enable vision fallback for non-vision models"})]}),r&&o.jsxs("div",{className:"space-y-4 pl-8",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Vision server URL"}),o.jsx("input",{type:"text",value:i,onChange:g=>c(g.target.value),placeholder:"http://localhost:11434",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Vision model name"}),o.jsx("input",{type:"text",value:u,onChange:g=>f(g.target.value),placeholder:"qwen3-vl:2b",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]})]}),o.jsxs("div",{className:"flex items-center justify-between pt-4",children:[o.jsx("button",{onClick:()=>p(!0),className:"text-text-muted hover:text-text-secondary text-sm underline",children:"Skip for now"}),o.jsx("button",{onClick:()=>p(!1),className:"px-6 py-3 bg-accent-primary text-text-primary rounded-lg font-medium hover:bg-accent-primary/90 transition-colors",children:"Finish Setup"})]})]})]})}function y4({onComplete:e}){const[r,s]=P.useState(1),[i,c]=P.useState(!1),[u,f]=P.useState({});async function l(m){f(b=>({...b,providers:m.providers})),s(2)}async function d(m){f(b=>({...b,...m})),s(3)}async function p(m){c(!0);try{if(!(await ke("/api/init/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:u.workdir,visionFallback:m.visionFallback})})).ok)throw new Error("Failed to save config");e()}catch(b){console.error("Failed to save onboarding data:",b),c(!1)}}const g=m=>{s(m)};return o.jsxs("div",{className:"w-full max-w-xl mx-auto px-6 py-16 relative",children:[o.jsx(io,{onClick:e,className:"absolute top-4 right-4 p-2",variant:"modal",size:"xl"}),o.jsx(g4,{currentStep:r,totalSteps:3,labels:["LLM Server","Projects Folder","Vision"],onStepClick:g}),o.jsx("div",{className:"max-w-xl mx-auto",children:i?o.jsxs("div",{className:"text-center",children:[o.jsx(Ub,{className:"w-6 h-6"}),o.jsx("p",{className:"mt-4 text-text-secondary",children:"Saving your settings..."})]}):o.jsxs(o.Fragment,{children:[r===1&&o.jsx(x4,{onNext:l}),r===2&&o.jsx(v4,{onNext:d}),r===3&&o.jsx(b4,{onNext:p})]})})]})}function jf(){return typeof window>"u"?!1:localStorage.getItem("openfox_token")!==null}function z0(){return o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(hc,{})})}function _4({sidebarOpen:e,onSidebarToggle:r}){const[,s]=Mh("/p/:projectId"),i=s==null?void 0:s.projectId,c=Ce(m=>m.connectionStatus),u=Ce(m=>m.listSessions),f=Ce(m=>m.clearSession),l=Qt(m=>m.currentProject),d=Qt(m=>m.loadProject),p=jf(),g=c==="connected"||p;return P.useEffect(()=>{g&&i&&((l==null?void 0:l.id)!==i&&d(i),u(i),f())},[g,i,l==null?void 0:l.id,d,u,f]),!l||l.id!==i?o.jsx(z0,{}):o.jsxs(o.Fragment,{children:[o.jsx(ry,{projectId:i,isOpen:e,onClose:r}),o.jsx("div",{className:"flex-1 min-w-0 bg-primary",children:o.jsx(_C,{})})]})}function S4({sidebarOpen:e,onSidebarToggle:r,rightSidebarOpen:s,onRightSidebarToggle:i}){const[,c]=Mh("/p/:projectId/s/:sessionId"),u=c==null?void 0:c.projectId,f=c==null?void 0:c.sessionId,[,l]=gr(),d=Ce(S=>S.connectionStatus),p=Ce(S=>S.currentSession),g=Ce(S=>S.loadSession),m=Ce(S=>S.listSessions),b=Ce(S=>S.pendingSessionCreate),_=Ce(S=>S.error),E=Ce(S=>S.clearError),C=Qt(S=>S.currentProject),y=Qt(S=>S.loadProject),v=jf(),x=d==="connected"||v;return P.useEffect(()=>{x&&u&&(C==null?void 0:C.id)!==u&&y(u)},[x,u,C==null?void 0:C.id,y]),P.useEffect(()=>{x&&f&&(p==null?void 0:p.id)!==f&&!b&&g(f),x&&u&&m(u)},[x,f,p==null?void 0:p.id,g,m,b,u]),P.useEffect(()=>{(_==null?void 0:_.code)==="NOT_FOUND"&&u&&(E(),l(`/p/${u}`))},[_,u,E,l]),!C||C.id!==u?o.jsx(z0,{}):o.jsxs(o.Fragment,{children:[o.jsx(ry,{projectId:u,isOpen:e,onClose:r}),o.jsx("div",{className:"flex-1 min-w-0 bg-primary",children:o.jsx(f4,{criteriaSidebarOpen:s,onCriteriaSidebarToggle:i})})]})}function w4(){const e=Lt(s=>s.fetchConfig);function r(){e(),window.history.back()}return o.jsx("div",{className:"flex-1 overflow-y-auto",children:o.jsx(y4,{onComplete:r})})}function C4(){const{connectionStatus:e}=ow(),r=Lt(B=>B.fetchConfig),s=Lt(B=>B.refreshProviderModels),i=Zt(B=>B.getSetting),c=Lt(B=>B.providers),u=Lt(B=>B.activeProviderId),[,f]=gr(),l=jf(),[d,p]=P.useState(!1);P.useEffect(()=>{(e==="connected"||l)&&r().then(()=>{p(!0);for(const B of fS)i(B);i(yt.DISPLAY_THEME)})},[e,l,r,i]),P.useEffect(()=>{d&&u&&s(u).then(()=>{r()})},[d,u,s,r]);const g=Zt(B=>B.settings);P.useEffect(()=>{d&&c.length===0&&f("/onboarding")},[d,c.length]),P.useEffect(()=>{const{getSavedTheme:B,applyPreset:X,applyTokens:Z}=fs.getState(),H=B();if(H)try{const L=JSON.parse(H);L.preset?X(L.preset):L.tokens&&Z(L.tokens)}catch{X("dark")}else{const L=g[yt.DISPLAY_THEME],R=lw(L),F=JSON.parse(R);X(F.preset),fs.getState().saveTheme(R)}},[g[yt.DISPLAY_THEME]]);const m=()=>{const B=localStorage.getItem("openfox:leftSidebar");return B!==null?B==="true":!1},b=()=>{const B=localStorage.getItem("openfox:rightSidebar");return B!==null?B==="true":!0},[_,E]=P.useState(m),[C,y]=P.useState(b),[v,x]=P.useState(!1),[S,j]=P.useState(!1),[T,N]=P.useState(!1),D=pS();P.useEffect(()=>{const B=()=>{N(window.innerWidth<768)};return B(),window.addEventListener("resize",B),()=>window.removeEventListener("resize",B)},[]);const A=T?v:_,z=T?S:C,O=()=>{T?x(!v):E(!_)},q=()=>{T?j(!S):y(!C)};P.useEffect(()=>{T||localStorage.setItem("openfox:leftSidebar",String(_))},[_,T]),P.useEffect(()=>{T||localStorage.setItem("openfox:rightSidebar",String(C))},[C,T]),P.useEffect(()=>{(e==="connected"||l)&&r()},[e,r,l]);const G=Ce(B=>B.showPasswordModal),W=Ce(B=>B.passwordModalRetry),I=Ce(B=>B.submitPassword),$=Ce(B=>B.cancelPassword);return e!=="connected"&&!G&&!l?o.jsxs(o.Fragment,{children:[o.jsx(vb,{isOpen:!0,isRetry:W,onSubmit:I,onCancel:$}),o.jsx("div",{className:"h-screen flex items-center justify-center",children:o.jsx(xC,{text:"Connecting to server..."})})]}):o.jsxs(o.Fragment,{children:[o.jsx(vb,{isOpen:G,isRetry:W,onSubmit:I,onCancel:$}),o.jsxs("div",{className:"flex flex-col",style:{height:T?`calc(${D.offsetTop}px + ${D.height}px)`:"100vh"},children:[o.jsx(hC,{}),o.jsx(aC,{onMenuClick:O,onCriteriaToggle:q}),o.jsx("div",{className:"flex-1 flex overflow-hidden",children:o.jsxs(IS,{children:[o.jsx(Ha,{path:"/onboarding",children:o.jsx(w4,{})}),o.jsx(Ha,{path:"/p/:projectId/s/:sessionId",children:o.jsx(S4,{sidebarOpen:A,onSidebarToggle:O,rightSidebarOpen:z,onRightSidebarToggle:q})}),o.jsx(Ha,{path:"/p/:projectId/new",children:o.jsx(yC,{})}),o.jsx(Ha,{path:"/p/:projectId",children:o.jsx(_4,{sidebarOpen:A,onSidebarToggle:O})}),o.jsx(Ha,{path:"/",children:o.jsx(bC,{})})]})})]})]})}cS.createRoot(document.getElementById("root")).render(o.jsx(mn.StrictMode,{children:o.jsx(C4,{})}));