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.
- package/dist/{chunk-JUFRVZMV.js → chunk-K3CI5UEC.js} +13 -8
- package/dist/{chunk-FBB4JVTK.js → chunk-MIG4XMTI.js} +2 -2
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/package.json +1 -1
- package/dist/{serve-H4VVKZCI.js → serve-HFJLUGA3.js} +2 -2
- package/dist/server/index.js +1 -1
- package/dist/web/assets/index-BqUNWNpD.js +153 -0
- package/dist/web/assets/{index-CNLQHprm.css → index-CuARFUOg.css} +1 -1
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
- package/dist/web/assets/index-COmqC5Os.js +0 -153
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
var GS=Object.defineProperty;var VS=(e,r,i)=>r in e?GS(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i;var dr=(e,r,i)=>VS(e,typeof r!="symbol"?r+"":r,i);function KS(e,r){for(var i=0;i<r.length;i++){const s=r[i];if(typeof s!="string"&&!Array.isArray(s)){for(const c in s)if(c!=="default"&&!(c in e)){const u=Object.getOwnPropertyDescriptor(s,c);u&&Object.defineProperty(e,c,u.get?u:{enumerable:!0,get:()=>s[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"]'))s(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"&&s(f)}).observe(document,{childList:!0,subtree:!0});function i(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 s(c){if(c.ep)return;c.ep=!0;const u=i(c);fetch(c.href,u)}})();function tc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ad={exports:{}},Ia={};/**
|
|
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 mx;function YS(){if(mx)return Ia;mx=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function i(s,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:s,key:f,ref:c!==void 0?c:null,props:u}}return Ia.Fragment=r,Ia.jsx=i,Ia.jsxs=i,Ia}var gx;function XS(){return gx||(gx=1,Ad.exports=YS()),Ad.exports}var o=XS(),Dd={exports:{}},Ve={};/**
|
|
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 xx;function ZS(){if(xx)return Ve;xx=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=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 _(L){return L===null||typeof L!="object"?null:(L=b&&L[b]||L["@@iterator"],typeof L=="function"?L:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,y={};function x(L,$,U){this.props=L,this.context=$,this.refs=y,this.updater=U||k}x.prototype.isReactComponent={},x.prototype.setState=function(L,$){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,$,"setState")},x.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function v(){}v.prototype=x.prototype;function S(L,$,U){this.props=L,this.context=$,this.refs=y,this.updater=U||k}var j=S.prototype=new v;j.constructor=S,C(j,x.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 B(L,$,U){var ne=U.ref;return{$$typeof:e,type:L,key:$,ref:ne!==void 0?ne:null,props:U}}function O(L,$){return B(L.type,$,L.props)}function q(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function V(L){var $={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(U){return $[U]})}var W=/\/+/g;function I(L,$){return typeof L=="object"&&L!==null&&L.key!=null?V(""+L.key):$.toString(36)}function F(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(N,N):(L.status="pending",L.then(function($){L.status==="pending"&&(L.status="fulfilled",L.value=$)},function($){L.status==="pending"&&(L.status="rejected",L.reason=$)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function P(L,$,U,ne,Q){var ee=typeof L;(ee==="undefined"||ee==="boolean")&&(L=null);var Y=!1;if(L===null)Y=!0;else switch(ee){case"bigint":case"string":case"number":Y=!0;break;case"object":switch(L.$$typeof){case e:case r:Y=!0;break;case g:return Y=L._init,P(Y(L._payload),$,U,ne,Q)}}if(Y)return Q=Q(L),Y=ne===""?"."+I(L,0):ne,T(Q)?(U="",Y!=null&&(U=Y.replace(W,"$&/")+"/"),P(Q,$,U,"",function(re){return re})):Q!=null&&(q(Q)&&(Q=O(Q,U+(Q.key==null||L&&L.key===Q.key?"":(""+Q.key).replace(W,"$&/")+"/")+Y)),$.push(Q)),1;Y=0;var G=ne===""?".":ne+":";if(T(L))for(var oe=0;oe<L.length;oe++)ne=L[oe],ee=G+I(ne,oe),Y+=P(ne,$,U,ee,Q);else if(oe=_(L),typeof oe=="function")for(L=oe.call(L),oe=0;!(ne=L.next()).done;)ne=ne.value,ee=G+I(ne,oe++),Y+=P(ne,$,U,ee,Q);else if(ee==="object"){if(typeof L.then=="function")return P(F(L),$,U,ne,Q);throw $=String(L),Error("Objects are not valid as a React child (found: "+($==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":$)+"). If you meant to render a collection of children, use an array instead.")}return Y}function X(L,$,U){if(L==null)return L;var ne=[],Q=0;return P(L,ne,"","",function(ee){return $.call(U,ee,Q++)}),ne}function Z(L){if(L._status===-1){var $=L._result;$=$(),$.then(function(U){(L._status===0||L._status===-1)&&(L._status=1,L._result=U)},function(U){(L._status===0||L._status===-1)&&(L._status=2,L._result=U)}),L._status===-1&&(L._status=0,L._result=$)}if(L._status===1)return L._result.default;throw L._result}var z=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var $=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent($))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},R={map:X,forEach:function(L,$,U){X(L,function(){$.apply(this,arguments)},U)},count:function(L){var $=0;return X(L,function(){$++}),$},toArray:function(L){return X(L,function($){return $})||[]},only:function(L){if(!q(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return Ve.Activity=m,Ve.Children=R,Ve.Component=x,Ve.Fragment=i,Ve.Profiler=c,Ve.PureComponent=S,Ve.StrictMode=s,Ve.Suspense=d,Ve.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,Ve.__COMPILER_RUNTIME={__proto__:null,c:function(L){return D.H.useMemoCache(L)}},Ve.cache=function(L){return function(){return L.apply(null,arguments)}},Ve.cacheSignal=function(){return null},Ve.cloneElement=function(L,$,U){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var ne=C({},L.props),Q=L.key;if($!=null)for(ee in $.key!==void 0&&(Q=""+$.key),$)!A.call($,ee)||ee==="key"||ee==="__self"||ee==="__source"||ee==="ref"&&$.ref===void 0||(ne[ee]=$[ee]);var ee=arguments.length-2;if(ee===1)ne.children=U;else if(1<ee){for(var Y=Array(ee),G=0;G<ee;G++)Y[G]=arguments[G+2];ne.children=Y}return B(L.type,Q,ne)},Ve.createContext=function(L){return L={$$typeof:f,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:u,_context:L},L},Ve.createElement=function(L,$,U){var ne,Q={},ee=null;if($!=null)for(ne in $.key!==void 0&&(ee=""+$.key),$)A.call($,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(Q[ne]=$[ne]);var Y=arguments.length-2;if(Y===1)Q.children=U;else if(1<Y){for(var G=Array(Y),oe=0;oe<Y;oe++)G[oe]=arguments[oe+2];Q.children=G}if(L&&L.defaultProps)for(ne in Y=L.defaultProps,Y)Q[ne]===void 0&&(Q[ne]=Y[ne]);return B(L,ee,Q)},Ve.createRef=function(){return{current:null}},Ve.forwardRef=function(L){return{$$typeof:l,render:L}},Ve.isValidElement=q,Ve.lazy=function(L){return{$$typeof:g,_payload:{_status:-1,_result:L},_init:Z}},Ve.memo=function(L,$){return{$$typeof:p,type:L,compare:$===void 0?null:$}},Ve.startTransition=function(L){var $=D.T,U={};D.T=U;try{var ne=L(),Q=D.S;Q!==null&&Q(U,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(N,z)}catch(ee){z(ee)}finally{$!==null&&U.types!==null&&($.types=U.types),D.T=$}},Ve.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},Ve.use=function(L){return D.H.use(L)},Ve.useActionState=function(L,$,U){return D.H.useActionState(L,$,U)},Ve.useCallback=function(L,$){return D.H.useCallback(L,$)},Ve.useContext=function(L){return D.H.useContext(L)},Ve.useDebugValue=function(){},Ve.useDeferredValue=function(L,$){return D.H.useDeferredValue(L,$)},Ve.useEffect=function(L,$){return D.H.useEffect(L,$)},Ve.useEffectEvent=function(L){return D.H.useEffectEvent(L)},Ve.useId=function(){return D.H.useId()},Ve.useImperativeHandle=function(L,$,U){return D.H.useImperativeHandle(L,$,U)},Ve.useInsertionEffect=function(L,$){return D.H.useInsertionEffect(L,$)},Ve.useLayoutEffect=function(L,$){return D.H.useLayoutEffect(L,$)},Ve.useMemo=function(L,$){return D.H.useMemo(L,$)},Ve.useOptimistic=function(L,$){return D.H.useOptimistic(L,$)},Ve.useReducer=function(L,$,U){return D.H.useReducer(L,$,U)},Ve.useRef=function(L){return D.H.useRef(L)},Ve.useState=function(L){return D.H.useState(L)},Ve.useSyncExternalStore=function(L,$,U){return D.H.useSyncExternalStore(L,$,U)},Ve.useTransition=function(){return D.H.useTransition()},Ve.version="19.2.4",Ve}var vx;function nc(){return vx||(vx=1,Dd.exports=ZS()),Dd.exports}var H=nc();const mn=tc(H),QS=KS({__proto__:null,default:mn},[H]);var Ld={exports:{}},Ba={},Rd={exports:{}},Od={};/**
|
|
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 bx;function JS(){return bx||(bx=1,(function(e){function r(P,X){var Z=P.length;P.push(X);e:for(;0<Z;){var z=Z-1>>>1,R=P[z];if(0<c(R,X))P[z]=X,P[Z]=R,Z=z;else break e}}function i(P){return P.length===0?null:P[0]}function s(P){if(P.length===0)return null;var X=P[0],Z=P.pop();if(Z!==X){P[0]=Z;e:for(var z=0,R=P.length,L=R>>>1;z<L;){var $=2*(z+1)-1,U=P[$],ne=$+1,Q=P[ne];if(0>c(U,Z))ne<R&&0>c(Q,U)?(P[z]=Q,P[ne]=Z,z=ne):(P[z]=U,P[$]=Z,z=$);else if(ne<R&&0>c(Q,Z))P[z]=Q,P[ne]=Z,z=ne;else break e}}return X}function c(P,X){var Z=P.sortIndex-X.sortIndex;return Z!==0?Z:P.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,k=!1,C=!1,y=!1,x=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;function j(P){for(var X=i(p);X!==null;){if(X.callback===null)s(p);else if(X.startTime<=P)s(p),X.sortIndex=X.expirationTime,r(d,X);else break;X=i(p)}}function T(P){if(C=!1,j(P),!k)if(i(d)!==null)k=!0,N||(N=!0,V());else{var X=i(p);X!==null&&F(T,X.startTime-P)}}var N=!1,D=-1,A=5,B=-1;function O(){return y?!0:!(e.unstable_now()-B<A)}function q(){if(y=!1,N){var P=e.unstable_now();B=P;var X=!0;try{e:{k=!1,C&&(C=!1,v(D),D=-1),_=!0;var Z=b;try{t:{for(j(P),m=i(d);m!==null&&!(m.expirationTime>P&&O());){var z=m.callback;if(typeof z=="function"){m.callback=null,b=m.priorityLevel;var R=z(m.expirationTime<=P);if(P=e.unstable_now(),typeof R=="function"){m.callback=R,j(P),X=!0;break t}m===i(d)&&s(d),j(P)}else s(d);m=i(d)}if(m!==null)X=!0;else{var L=i(p);L!==null&&F(T,L.startTime-P),X=!1}}break e}finally{m=null,b=Z,_=!1}X=void 0}}finally{X?V():N=!1}}}var V;if(typeof S=="function")V=function(){S(q)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,I=W.port2;W.port1.onmessage=q,V=function(){I.postMessage(null)}}else V=function(){x(q,0)};function F(P,X){D=x(function(){P(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(P){P.callback=null},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(P){switch(b){case 1:case 2:case 3:var X=3;break;default:X=b}var Z=b;b=X;try{return P()}finally{b=Z}},e.unstable_requestPaint=function(){y=!0},e.unstable_runWithPriority=function(P,X){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var Z=b;b=P;try{return X()}finally{b=Z}},e.unstable_scheduleCallback=function(P,X,Z){var z=e.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?z+Z:z):Z=z,P){case 1:var R=-1;break;case 2:R=250;break;case 5:R=1073741823;break;case 4:R=1e4;break;default:R=5e3}return R=Z+R,P={id:g++,callback:X,priorityLevel:P,startTime:Z,expirationTime:R,sortIndex:-1},Z>z?(P.sortIndex=Z,r(p,P),i(d)===null&&P===i(p)&&(C?(v(D),D=-1):C=!0,F(T,Z-z))):(P.sortIndex=R,r(d,P),k||_||(k=!0,N||(N=!0,V()))),P},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(P){var X=b;return function(){var Z=b;b=X;try{return P.apply(this,arguments)}finally{b=Z}}}})(Od)),Od}var yx;function e1(){return yx||(yx=1,Rd.exports=JS()),Rd.exports}var Md={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 _x;function t1(){if(_x)return fn;_x=1;var e=nc();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 i(){}var s={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},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=s,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=s.p;try{if(f.T=null,s.p=2,d)return d()}finally{f.T=p,s.p=g,s.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,s.d.C(d,p))},fn.prefetchDNS=function(d){typeof d=="string"&&s.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"?s.d.S(d,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:m,integrity:b,fetchPriority:_}):g==="script"&&s.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);s.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&&s.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);s.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);s.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 s.d.m(d)},fn.requestFormReset=function(d){s.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 Sx;function xb(){if(Sx)return Md.exports;Sx=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=t1(),Md.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 wx;function n1(){if(wx)return Ba;wx=1;var e=e1(),r=nc(),i=xb();function s(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(s(188))}function p(t){var n=t.alternate;if(!n){if(n=u(t),n===null)throw Error(s(188));return n!==t?null:t}for(var a=t,h=n;;){var w=a.return;if(w===null)break;var E=w.alternate;if(E===null){if(h=w.return,h!==null){a=h;continue}break}if(w.child===E.child){for(E=w.child;E;){if(E===a)return d(w),t;if(E===h)return d(w),n;E=E.sibling}throw Error(s(188))}if(a.return!==h.return)a=w,h=E;else{for(var M=!1,K=w.child;K;){if(K===a){M=!0,a=w,h=E;break}if(K===h){M=!0,h=w,a=E;break}K=K.sibling}if(!M){for(K=E.child;K;){if(K===a){M=!0,a=E,h=w;break}if(K===h){M=!0,h=E,a=w;break}K=K.sibling}if(!M)throw Error(s(189))}}if(a.alternate!==h)throw Error(s(190))}if(a.tag!==3)throw Error(s(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"),k=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),v=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"),B=Symbol.for("react.activity"),O=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function V(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 x:return"Profiler";case y:return"StrictMode";case T:return"Suspense";case N:return"SuspenseList";case B:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case k:return"Portal";case S:return t.displayName||"Context";case v: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 F=Array.isArray,P=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z={pending:!1,data:null,method:null,action:null},z=[],R=-1;function L(t){return{current:t}}function $(t){0>R||(t.current=z[R],z[R]=null,R--)}function U(t,n){R++,z[R]=t.current,t.current=n}var ne=L(null),Q=L(null),ee=L(null),Y=L(null);function G(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)?zg(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=zg(n),t=Hg(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}$(ne),U(ne,t)}function oe(){$(ne),$(Q),$(ee)}function re(t){t.memoizedState!==null&&U(Y,t);var n=ne.current,a=Hg(n,t.type);n!==a&&(U(Q,t),U(ne,a))}function ve(t){Q.current===t&&($(ne),$(Q)),Y.current===t&&($(Y),La._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 E=h.DetermineComponentFrameRoot(),M=E[0],K=E[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,_t=e.log,Ye=e.unstable_setDisableYieldValue,Dt=null,mt=null;function Kt(t){if(typeof _t=="function"&&Ye(t),mt&&typeof mt.setStrictMode=="function")try{mt.setStrictMode(Dt,t)}catch{}}var lt=Math.clz32?Math.clz32:Gs,Un=Math.log,sn=Math.LN2;function Gs(t){return t>>>=0,t===0?32:31-(Un(t)/sn|0)|0}var me=256,ye=262144,we=4194304;function Ge(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,E=t.suspendedLanes,M=t.pingedLanes;t=t.warmLanes;var K=h&134217727;return K!==0?(h=K&~E,h!==0?w=Ge(h):(M&=K,M!==0?w=Ge(M):a||(a=K&~t,a!==0&&(w=Ge(a))))):(K=h&~E,K!==0?w=Ge(K):M!==0?w=Ge(M):a||(a=h&~t,a!==0&&(w=Ge(a)))),w===0?0:n!==0&&n!==w&&(n&E)===0&&(E=w&-w,a=n&-n,E>=a||E===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 se(t,n,a,h,w,E){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),E!==0&&w===0&&t.tag!==0&&(t.suspendedLanes|=E&~(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 wt(t,n){var a=n&-n;return a=(a&42)!==0?1:Jt(a),(a&(t.suspendedLanes|n))!==0?0:a}function Jt(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:lx(t.type))}function Vi(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,Ki="__reactContainer$"+_n,_c="__reactEvents$"+_n,M0="__reactListeners$"+_n,I0="__reactHandles$"+_n,kf="__reactResources$"+_n,Vs="__reactMarker$"+_n;function Sc(t){delete t[an],delete t[Sn],delete t[_c],delete t[M0],delete t[I0]}function Yi(t){var n=t[an];if(n)return n;for(var a=t.parentNode;a;){if(n=a[Ki]||a[an]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(t=Gg(t);t!==null;){if(a=t[an])return a;t=Gg(t)}return n}t=a,a=t.parentNode}return null}function Xi(t){if(t=t[an]||t[Ki]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function Ks(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(s(33))}function Zi(t){var n=t[kf];return n||(n=t[kf]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function en(t){t[Vs]=!0}var Ef=new Set,jf={};function xi(t,n){Qi(t,n),Qi(t+"Capture",n)}function Qi(t,n){for(jf[t]=n,t=0;t<n.length;t++)Ef.add(n[t])}var B0=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]*$"),Nf={},Tf={};function z0(t){return je.call(Tf,t)?!0:je.call(Nf,t)?!1:B0.test(t)?Tf[t]=!0:(Nf[t]=!0,!1)}function bo(t,n,a){if(z0(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 yo(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 $n(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Af(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function H0(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,E=h.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return w.call(this)},set:function(M){a=""+M,E.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 wc(t){if(!t._valueTracker){var n=Af(t)?"checked":"value";t._valueTracker=H0(t,n,""+t[n])}}function Df(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var a=n.getValue(),h="";return t&&(h=Af(t)?t.checked?"true":"false":t.value),t=h,t!==a?(n.setValue(t),!0):!1}function _o(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 P0=/[\n"\\]/g;function qn(t){return t.replace(P0,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Cc(t,n,a,h,w,E,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=""+$n(n)):t.value!==""+$n(n)&&(t.value=""+$n(n)):M!=="submit"&&M!=="reset"||t.removeAttribute("value"),n!=null?kc(t,M,$n(n)):a!=null?kc(t,M,$n(a)):h!=null&&t.removeAttribute("value"),w==null&&E!=null&&(t.defaultChecked=!!E),w!=null&&(t.checked=w&&typeof w!="function"&&typeof w!="symbol"),K!=null&&typeof K!="function"&&typeof K!="symbol"&&typeof K!="boolean"?t.name=""+$n(K):t.removeAttribute("name")}function Lf(t,n,a,h,w,E,M,K){if(E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(t.type=E),n!=null||a!=null){if(!(E!=="submit"&&E!=="reset"||n!=null)){wc(t);return}a=a!=null?""+$n(a):"",n=n!=null?""+$n(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),wc(t)}function kc(t,n,a){n==="number"&&_o(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function Ji(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=""+$n(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 Rf(t,n,a){if(n!=null&&(n=""+$n(n),n!==t.value&&(t.value=n),a==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=a!=null?""+$n(a):""}function Of(t,n,a,h){if(n==null){if(h!=null){if(a!=null)throw Error(s(92));if(F(h)){if(1<h.length)throw Error(s(93));h=h[0]}a=h}a==null&&(a=""),n=a}a=$n(n),t.defaultValue=a,h=t.textContent,h===a&&h!==""&&h!==null&&(t.value=h),wc(t)}function es(t,n){if(n){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=n;return}}t.textContent=n}var F0=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 Mf(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||F0.has(n)?n==="float"?t.cssFloat=a:t[n]=(""+a).trim():t[n]=a+"px"}function If(t,n,a){if(n!=null&&typeof n!="object")throw Error(s(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&&Mf(t,w,h)}else for(var E in n)n.hasOwnProperty(E)&&Mf(t,E,n[E])}function Ec(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 U0=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"]]),$0=/^[\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 So(t){return $0.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function yr(){}var jc=null;function Nc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var ts=null,ns=null;function Bf(t){var n=Xi(t);if(n&&(t=n.stateNode)){var a=t[Sn]||null;e:switch(t=n.stateNode,n.type){case"input":if(Cc(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="'+qn(""+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(s(90));Cc(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&&Df(h)}break e;case"textarea":Rf(t,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Ji(t,!!a.multiple,n,!1)}}}var Tc=!1;function zf(t,n,a){if(Tc)return t(n,a);Tc=!0;try{var h=t(n);return h}finally{if(Tc=!1,(ts!==null||ns!==null)&&(cl(),ts&&(n=ts,t=ns,ns=ts=null,Bf(n),t)))for(n=0;n<t.length;n++)Bf(t[n])}}function Ys(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(s(231,n,typeof a));return a}var _r=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ac=!1;if(_r)try{var Xs={};Object.defineProperty(Xs,"passive",{get:function(){Ac=!0}}),window.addEventListener("test",Xs,Xs),window.removeEventListener("test",Xs,Xs)}catch{Ac=!1}var $r=null,Dc=null,wo=null;function Hf(){if(wo)return wo;var t,n=Dc,a=n.length,h,w="value"in $r?$r.value:$r.textContent,E=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[E-h];h++);return wo=w.slice(t,1<h?1-h:void 0)}function Co(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 ko(){return!0}function Pf(){return!1}function wn(t){function n(a,h,w,E,M){this._reactName=a,this._targetInst=w,this.type=h,this.nativeEvent=E,this.target=M,this.currentTarget=null;for(var K in t)t.hasOwnProperty(K)&&(a=t[K],this[K]=a?a(E):E[K]);return this.isDefaultPrevented=(E.defaultPrevented!=null?E.defaultPrevented:E.returnValue===!1)?ko:Pf,this.isPropagationStopped=Pf,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=ko)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=ko)},persist:function(){},isPersistent:ko}),n}var vi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Eo=wn(vi),Zs=m({},vi,{view:0,detail:0}),q0=wn(Zs),Lc,Rc,Qs,jo=m({},Zs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Mc,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!==Qs&&(Qs&&t.type==="mousemove"?(Lc=t.screenX-Qs.screenX,Rc=t.screenY-Qs.screenY):Rc=Lc=0,Qs=t),Lc)},movementY:function(t){return"movementY"in t?t.movementY:Rc}}),Ff=wn(jo),W0=m({},jo,{dataTransfer:0}),G0=wn(W0),V0=m({},Zs,{relatedTarget:0}),Oc=wn(V0),K0=m({},vi,{animationName:0,elapsedTime:0,pseudoElement:0}),Y0=wn(K0),X0=m({},vi,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Z0=wn(X0),Q0=m({},vi,{data:0}),Uf=wn(Q0),J0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},e_={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"},t_={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function n_(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=t_[t])?!!n[t]:!1}function Mc(){return n_}var r_=m({},Zs,{key:function(t){if(t.key){var n=J0[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=Co(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?e_[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Mc,charCode:function(t){return t.type==="keypress"?Co(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Co(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),i_=wn(r_),s_=m({},jo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$f=wn(s_),a_=m({},Zs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Mc}),o_=wn(a_),l_=m({},vi,{propertyName:0,elapsedTime:0,pseudoElement:0}),c_=wn(l_),u_=m({},jo,{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}),d_=wn(u_),h_=m({},vi,{newState:0,oldState:0}),f_=wn(h_),p_=[9,13,27,32],Ic=_r&&"CompositionEvent"in window,Js=null;_r&&"documentMode"in document&&(Js=document.documentMode);var m_=_r&&"TextEvent"in window&&!Js,qf=_r&&(!Ic||Js&&8<Js&&11>=Js),Wf=" ",Gf=!1;function Vf(t,n){switch(t){case"keyup":return p_.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Kf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var rs=!1;function g_(t,n){switch(t){case"compositionend":return Kf(n);case"keypress":return n.which!==32?null:(Gf=!0,Wf);case"textInput":return t=n.data,t===Wf&&Gf?null:t;default:return null}}function x_(t,n){if(rs)return t==="compositionend"||!Ic&&Vf(t,n)?(t=Hf(),wo=Dc=$r=null,rs=!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 qf&&n.locale!=="ko"?null:n.data;default:return null}}var v_={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 Yf(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!v_[t.type]:n==="textarea"}function Xf(t,n,a,h){ts?ns?ns.push(h):ns=[h]:ts=h,n=gl(n,"onChange"),0<n.length&&(a=new Eo("onChange","change",null,a,h),t.push({event:a,listeners:n}))}var ea=null,ta=null;function b_(t){Lg(t,0)}function No(t){var n=Ks(t);if(Df(n))return t}function Zf(t,n){if(t==="change")return n}var Qf=!1;if(_r){var Bc;if(_r){var zc="oninput"in document;if(!zc){var Jf=document.createElement("div");Jf.setAttribute("oninput","return;"),zc=typeof Jf.oninput=="function"}Bc=zc}else Bc=!1;Qf=Bc&&(!document.documentMode||9<document.documentMode)}function ep(){ea&&(ea.detachEvent("onpropertychange",tp),ta=ea=null)}function tp(t){if(t.propertyName==="value"&&No(ta)){var n=[];Xf(n,ta,t,Nc(t)),zf(b_,n)}}function y_(t,n,a){t==="focusin"?(ep(),ea=n,ta=a,ea.attachEvent("onpropertychange",tp)):t==="focusout"&&ep()}function __(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return No(ta)}function S_(t,n){if(t==="click")return No(n)}function w_(t,n){if(t==="input"||t==="change")return No(n)}function C_(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var Dn=typeof Object.is=="function"?Object.is:C_;function na(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 np(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function rp(t,n){var a=np(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=np(a)}}function ip(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?ip(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function sp(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=_o(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=_o(t.document)}return n}function Hc(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 k_=_r&&"documentMode"in document&&11>=document.documentMode,is=null,Pc=null,ra=null,Fc=!1;function ap(t,n,a){var h=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Fc||is==null||is!==_o(h)||(h=is,"selectionStart"in h&&Hc(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}),ra&&na(ra,h)||(ra=h,h=gl(Pc,"onSelect"),0<h.length&&(n=new Eo("onSelect","select",null,n,a),t.push({event:n,listeners:h}),n.target=is)))}function bi(t,n){var a={};return a[t.toLowerCase()]=n.toLowerCase(),a["Webkit"+t]="webkit"+n,a["Moz"+t]="moz"+n,a}var ss={animationend:bi("Animation","AnimationEnd"),animationiteration:bi("Animation","AnimationIteration"),animationstart:bi("Animation","AnimationStart"),transitionrun:bi("Transition","TransitionRun"),transitionstart:bi("Transition","TransitionStart"),transitioncancel:bi("Transition","TransitionCancel"),transitionend:bi("Transition","TransitionEnd")},Uc={},op={};_r&&(op=document.createElement("div").style,"AnimationEvent"in window||(delete ss.animationend.animation,delete ss.animationiteration.animation,delete ss.animationstart.animation),"TransitionEvent"in window||delete ss.transitionend.transition);function yi(t){if(Uc[t])return Uc[t];if(!ss[t])return t;var n=ss[t],a;for(a in n)if(n.hasOwnProperty(a)&&a in op)return Uc[t]=n[a];return t}var lp=yi("animationend"),cp=yi("animationiteration"),up=yi("animationstart"),E_=yi("transitionrun"),j_=yi("transitionstart"),N_=yi("transitioncancel"),dp=yi("transitionend"),hp=new Map,$c="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(" ");$c.push("scrollEnd");function tr(t,n){hp.set(t,n),xi(n,[t])}var To=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)},Wn=[],as=0,qc=0;function Ao(){for(var t=as,n=qc=as=0;n<t;){var a=Wn[n];Wn[n++]=null;var h=Wn[n];Wn[n++]=null;var w=Wn[n];Wn[n++]=null;var E=Wn[n];if(Wn[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}E!==0&&fp(a,w,E)}}function Do(t,n,a,h){Wn[as++]=t,Wn[as++]=n,Wn[as++]=a,Wn[as++]=h,qc|=h,t.lanes|=h,t=t.alternate,t!==null&&(t.lanes|=h)}function Wc(t,n,a,h){return Do(t,n,a,h),Lo(t)}function _i(t,n){return Do(t,null,null,n),Lo(t)}function fp(t,n,a){t.lanes|=a;var h=t.alternate;h!==null&&(h.lanes|=a);for(var w=!1,E=t.return;E!==null;)E.childLanes|=a,h=E.alternate,h!==null&&(h.childLanes|=a),E.tag===22&&(t=E.stateNode,t===null||t._visibility&1||(w=!0)),t=E,E=E.return;return t.tag===3?(E=t.stateNode,w&&n!==null&&(w=31-lt(a),t=E.hiddenUpdates,h=t[w],h===null?t[w]=[n]:h.push(n),n.lane=a|536870912),E):null}function Lo(t){if(50<ka)throw ka=0,ed=null,Error(s(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var os={};function T_(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 T_(t,n,a,h)}function Gc(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 pp(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 Ro(t,n,a,h,w,E){var M=0;if(h=t,typeof t=="function")Gc(t)&&(M=1);else if(typeof t=="string")M=OS(t,a,ne.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case B:return t=Ln(31,a,n,w),t.elementType=B,t.lanes=E,t;case C:return Si(a.children,w,E,n);case y:M=8,w|=24;break;case x:return t=Ln(12,a,n,w|2),t.elementType=x,t.lanes=E,t;case T:return t=Ln(13,a,n,w),t.elementType=T,t.lanes=E,t;case N:return t=Ln(19,a,n,w),t.elementType=N,t.lanes=E,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case S:M=10;break e;case v: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(s(130,t===null?"null":typeof t,"")),h=null}return n=Ln(M,a,n,w),n.elementType=t,n.type=h,n.lanes=E,n}function Si(t,n,a,h){return t=Ln(7,t,h,n),t.lanes=a,t}function Vc(t,n,a){return t=Ln(6,t,null,n),t.lanes=a,t}function mp(t){var n=Ln(18,null,null,0);return n.stateNode=t,n}function Kc(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 gp=new WeakMap;function Gn(t,n){if(typeof t=="object"&&t!==null){var a=gp.get(t);return a!==void 0?a:(n={value:t,source:n,stack:fe(n)},gp.set(t,n),n)}return{value:t,source:n,stack:fe(n)}}var ls=[],cs=0,Oo=null,ia=0,Vn=[],Kn=0,qr=null,or=1,lr="";function wr(t,n){ls[cs++]=ia,ls[cs++]=Oo,Oo=t,ia=n}function xp(t,n,a){Vn[Kn++]=or,Vn[Kn++]=lr,Vn[Kn++]=qr,qr=t;var h=or;t=lr;var w=32-lt(h)-1;h&=~(1<<w),a+=1;var E=32-lt(n)+w;if(30<E){var M=w-w%5;E=(h&(1<<M)-1).toString(32),h>>=M,w-=M,or=1<<32-lt(n)+w|a<<w|h,lr=E+t}else or=1<<E|a<<w|h,lr=t}function Yc(t){t.return!==null&&(wr(t,1),xp(t,1,0))}function Xc(t){for(;t===Oo;)Oo=ls[--cs],ls[cs]=null,ia=ls[--cs],ls[cs]=null;for(;t===qr;)qr=Vn[--Kn],Vn[Kn]=null,lr=Vn[--Kn],Vn[Kn]=null,or=Vn[--Kn],Vn[Kn]=null}function vp(t,n){Vn[Kn++]=or,Vn[Kn++]=lr,Vn[Kn++]=qr,or=n.id,lr=n.overflow,qr=t}var on=null,Ct=null,st=!1,Wr=null,Yn=!1,Zc=Error(s(519));function Gr(t){var n=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw sa(Gn(n,t)),Zc}function bp(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<ja.length;a++)et(ja[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),Lf(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),Of(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||Ig(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||Gr(t,!0)}function yp(t){for(on=t.return;on;)switch(on.tag){case 5:case 31:case 13:Yn=!1;return;case 27:case 3:Yn=!0;return;default:on=on.return}}function us(t){if(t!==on)return!1;if(!st)return yp(t),st=!0,!1;var n=t.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||md(t.type,t.memoizedProps)),a=!a),a&&Ct&&Gr(t),yp(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));Ct=Wg(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));Ct=Wg(t)}else n===27?(n=Ct,ai(t.type)?(t=yd,yd=null,Ct=t):Ct=n):Ct=on?Zn(t.stateNode.nextSibling):null;return!0}function wi(){Ct=on=null,st=!1}function Qc(){var t=Wr;return t!==null&&(jn===null?jn=t:jn.push.apply(jn,t),Wr=null),t}function sa(t){Wr===null?Wr=[t]:Wr.push(t)}var Jc=L(null),Ci=null,Cr=null;function Vr(t,n,a){U(Jc,n._currentValue),n._currentValue=a}function kr(t){t._currentValue=Jc.current,$(Jc)}function eu(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 tu(t,n,a,h){var w=t.child;for(w!==null&&(w.return=t);w!==null;){var E=w.dependencies;if(E!==null){var M=w.child;E=E.firstContext;e:for(;E!==null;){var K=E;E=w;for(var J=0;J<n.length;J++)if(K.context===n[J]){E.lanes|=a,K=E.alternate,K!==null&&(K.lanes|=a),eu(E.return,a,t),h||(M=null);break e}E=K.next}}else if(w.tag===18){if(M=w.return,M===null)throw Error(s(341));M.lanes|=a,E=M.alternate,E!==null&&(E.lanes|=a),eu(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 ds(t,n,a,h){t=null;for(var w=n,E=!1;w!==null;){if(!E){if((w.flags&524288)!==0)E=!0;else if((w.flags&262144)!==0)break}if(w.tag===10){var M=w.alternate;if(M===null)throw Error(s(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(s(387));M.memoizedState.memoizedState!==w.memoizedState.memoizedState&&(t!==null?t.push(La):t=[La])}w=w.return}t!==null&&tu(n,t,a,h),n.flags|=262144}function Mo(t){for(t=t.firstContext;t!==null;){if(!Dn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function ki(t){Ci=t,Cr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function ln(t){return _p(Ci,t)}function Io(t,n){return Ci===null&&ki(t),_p(t,n)}function _p(t,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Cr===null){if(t===null)throw Error(s(308));Cr=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else Cr=Cr.next=n;return a}var A_=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()})}},D_=e.unstable_scheduleCallback,L_=e.unstable_NormalPriority,Ft={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function nu(){return{controller:new A_,data:new Map,refCount:0}}function aa(t){t.refCount--,t.refCount===0&&D_(L_,function(){t.controller.abort()})}var oa=null,ru=0,hs=0,fs=null;function R_(t,n){if(oa===null){var a=oa=[];ru=0,hs=ad(),fs={status:"pending",value:void 0,then:function(h){a.push(h)}}}return ru++,n.then(Sp,Sp),n}function Sp(){if(--ru===0&&oa!==null){fs!==null&&(fs.status="fulfilled");var t=oa;oa=null,hs=0,fs=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function O_(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 wp=P.S;P.S=function(t,n){ag=Me(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&R_(t,n),wp!==null&&wp(t,n)};var Ei=L(null);function iu(){var t=Ei.current;return t!==null?t:bt.pooledCache}function Bo(t,n){n===null?U(Ei,Ei.current):U(Ei,n.pool)}function Cp(){var t=iu();return t===null?null:{parent:Ft._currentValue,pool:t}}var ps=Error(s(460)),su=Error(s(474)),zo=Error(s(542)),Ho={then:function(){}};function kp(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Ep(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,Np(t),t;default:if(typeof n.status=="string")n.then(yr,yr);else{if(t=bt,t!==null&&100<t.shellSuspendCounter)throw Error(s(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,Np(t),t}throw Ni=n,ps}}function ji(t){try{var n=t._init;return n(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Ni=a,ps):a}}var Ni=null;function jp(){if(Ni===null)throw Error(s(459));var t=Ni;return Ni=null,t}function Np(t){if(t===ps||t===zo)throw Error(s(483))}var ms=null,la=0;function Po(t){var n=la;return la+=1,ms===null&&(ms=[]),Ep(ms,t,n)}function ca(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function Fo(t,n){throw n.$$typeof===b?Error(s(525)):(t=Object.prototype.toString.call(n),Error(s(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function Tp(t){function n(ie,te){if(t){var ae=ie.deletions;ae===null?(ie.deletions=[te],ie.flags|=16):ae.push(te)}}function a(ie,te){if(!t)return null;for(;te!==null;)n(ie,te),te=te.sibling;return null}function h(ie){for(var te=new Map;ie!==null;)ie.key!==null?te.set(ie.key,ie):te.set(ie.index,ie),ie=ie.sibling;return te}function w(ie,te){return ie=Sr(ie,te),ie.index=0,ie.sibling=null,ie}function E(ie,te,ae){return ie.index=ae,t?(ae=ie.alternate,ae!==null?(ae=ae.index,ae<te?(ie.flags|=67108866,te):ae):(ie.flags|=67108866,te)):(ie.flags|=1048576,te)}function M(ie){return t&&ie.alternate===null&&(ie.flags|=67108866),ie}function K(ie,te,ae,ge){return te===null||te.tag!==6?(te=Vc(ae,ie.mode,ge),te.return=ie,te):(te=w(te,ae),te.return=ie,te)}function J(ie,te,ae,ge){var Be=ae.type;return Be===C?he(ie,te,ae.props.children,ge,ae.key):te!==null&&(te.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===A&&ji(Be)===te.type)?(te=w(te,ae.props),ca(te,ae),te.return=ie,te):(te=Ro(ae.type,ae.key,ae.props,null,ie.mode,ge),ca(te,ae),te.return=ie,te)}function le(ie,te,ae,ge){return te===null||te.tag!==4||te.stateNode.containerInfo!==ae.containerInfo||te.stateNode.implementation!==ae.implementation?(te=Kc(ae,ie.mode,ge),te.return=ie,te):(te=w(te,ae.children||[]),te.return=ie,te)}function he(ie,te,ae,ge,Be){return te===null||te.tag!==7?(te=Si(ae,ie.mode,ge,Be),te.return=ie,te):(te=w(te,ae),te.return=ie,te)}function xe(ie,te,ae){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return te=Vc(""+te,ie.mode,ae),te.return=ie,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case _:return ae=Ro(te.type,te.key,te.props,null,ie.mode,ae),ca(ae,te),ae.return=ie,ae;case k:return te=Kc(te,ie.mode,ae),te.return=ie,te;case A:return te=ji(te),xe(ie,te,ae)}if(F(te)||V(te))return te=Si(te,ie.mode,ae,null),te.return=ie,te;if(typeof te.then=="function")return xe(ie,Po(te),ae);if(te.$$typeof===S)return xe(ie,Io(ie,te),ae);Fo(ie,te)}return null}function ce(ie,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(ie,te,""+ae,ge);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case _:return ae.key===Be?J(ie,te,ae,ge):null;case k:return ae.key===Be?le(ie,te,ae,ge):null;case A:return ae=ji(ae),ce(ie,te,ae,ge)}if(F(ae)||V(ae))return Be!==null?null:he(ie,te,ae,ge,null);if(typeof ae.then=="function")return ce(ie,te,Po(ae),ge);if(ae.$$typeof===S)return ce(ie,te,Io(ie,ae),ge);Fo(ie,ae)}return null}function de(ie,te,ae,ge,Be){if(typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint")return ie=ie.get(ae)||null,K(te,ie,""+ge,Be);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case _:return ie=ie.get(ge.key===null?ae:ge.key)||null,J(te,ie,ge,Be);case k:return ie=ie.get(ge.key===null?ae:ge.key)||null,le(te,ie,ge,Be);case A:return ge=ji(ge),de(ie,te,ae,ge,Be)}if(F(ge)||V(ge))return ie=ie.get(ae)||null,he(te,ie,ge,Be,null);if(typeof ge.then=="function")return de(ie,te,ae,Po(ge),Be);if(ge.$$typeof===S)return de(ie,te,ae,Io(te,ge),Be);Fo(te,ge)}return null}function De(ie,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(ie,Re,ae[Xe],ge);if(ut===null){Re===null&&(Re=rt);break}t&&Re&&ut.alternate===null&&n(ie,Re),te=E(ut,te,Xe),ct===null?Be=ut:ct.sibling=ut,ct=ut,Re=rt}if(Xe===ae.length)return a(ie,Re),st&&wr(ie,Xe),Be;if(Re===null){for(;Xe<ae.length;Xe++)Re=xe(ie,ae[Xe],ge),Re!==null&&(te=E(Re,te,Xe),ct===null?Be=Re:ct.sibling=Re,ct=Re);return st&&wr(ie,Xe),Be}for(Re=h(Re);Xe<ae.length;Xe++)rt=de(Re,ie,Xe,ae[Xe],ge),rt!==null&&(t&&rt.alternate!==null&&Re.delete(rt.key===null?Xe:rt.key),te=E(rt,te,Xe),ct===null?Be=rt:ct.sibling=rt,ct=rt);return t&&Re.forEach(function(di){return n(ie,di)}),st&&wr(ie,Xe),Be}function Fe(ie,te,ae,ge){if(ae==null)throw Error(s(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 di=ce(ie,Re,ut.value,ge);if(di===null){Re===null&&(Re=rt);break}t&&Re&&di.alternate===null&&n(ie,Re),te=E(di,te,Xe),ct===null?Be=di:ct.sibling=di,ct=di,Re=rt}if(ut.done)return a(ie,Re),st&&wr(ie,Xe),Be;if(Re===null){for(;!ut.done;Xe++,ut=ae.next())ut=xe(ie,ut.value,ge),ut!==null&&(te=E(ut,te,Xe),ct===null?Be=ut:ct.sibling=ut,ct=ut);return st&&wr(ie,Xe),Be}for(Re=h(Re);!ut.done;Xe++,ut=ae.next())ut=de(Re,ie,Xe,ut.value,ge),ut!==null&&(t&&ut.alternate!==null&&Re.delete(ut.key===null?Xe:ut.key),te=E(ut,te,Xe),ct===null?Be=ut:ct.sibling=ut,ct=ut);return t&&Re.forEach(function(WS){return n(ie,WS)}),st&&wr(ie,Xe),Be}function vt(ie,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(ie,te.sibling),ge=w(te,ae.props.children),ge.return=ie,ie=ge;break e}}else if(te.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===A&&ji(Be)===te.type){a(ie,te.sibling),ge=w(te,ae.props),ca(ge,ae),ge.return=ie,ie=ge;break e}a(ie,te);break}else n(ie,te);te=te.sibling}ae.type===C?(ge=Si(ae.props.children,ie.mode,ge,ae.key),ge.return=ie,ie=ge):(ge=Ro(ae.type,ae.key,ae.props,null,ie.mode,ge),ca(ge,ae),ge.return=ie,ie=ge)}return M(ie);case k: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(ie,te.sibling),ge=w(te,ae.children||[]),ge.return=ie,ie=ge;break e}else{a(ie,te);break}else n(ie,te);te=te.sibling}ge=Kc(ae,ie.mode,ge),ge.return=ie,ie=ge}return M(ie);case A:return ae=ji(ae),vt(ie,te,ae,ge)}if(F(ae))return De(ie,te,ae,ge);if(V(ae)){if(Be=V(ae),typeof Be!="function")throw Error(s(150));return ae=Be.call(ae),Fe(ie,te,ae,ge)}if(typeof ae.then=="function")return vt(ie,te,Po(ae),ge);if(ae.$$typeof===S)return vt(ie,te,Io(ie,ae),ge);Fo(ie,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint"?(ae=""+ae,te!==null&&te.tag===6?(a(ie,te.sibling),ge=w(te,ae),ge.return=ie,ie=ge):(a(ie,te),ge=Vc(ae,ie.mode,ge),ge.return=ie,ie=ge),M(ie)):a(ie,te)}return function(ie,te,ae,ge){try{la=0;var Be=vt(ie,te,ae,ge);return ms=null,Be}catch(Re){if(Re===ps||Re===zo)throw Re;var ct=Ln(29,Re,null,ie.mode);return ct.lanes=ge,ct.return=ie,ct}finally{}}}var Ti=Tp(!0),Ap=Tp(!1),Kr=!1;function au(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ou(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=Lo(t),fp(t,null,a),n}return Do(t,h,n,a),Lo(t)}function ua(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 lu(t,n){var a=t.updateQueue,h=t.alternate;if(h!==null&&(h=h.updateQueue,a===h)){var w=null,E=null;if(a=a.firstBaseUpdate,a!==null){do{var M={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};E===null?w=E=M:E=E.next=M,a=a.next}while(a!==null);E===null?w=E=n:E=E.next=n}else w=E=n;a={baseState:h.baseState,firstBaseUpdate:w,lastBaseUpdate:E,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 cu=!1;function da(){if(cu){var t=fs;if(t!==null)throw t}}function ha(t,n,a,h){cu=!1;var w=t.updateQueue;Kr=!1;var E=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?E=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(E!==null){var xe=w.baseState;M=0,he=le=J=null,K=E;do{var ce=K.lane&-536870913,de=ce!==K.lane;if(de?(nt&ce)===ce:(h&ce)===ce){ce!==0&&ce===hs&&(cu=!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,E===null&&(w.shared.lanes=0),ti|=M,t.lanes=M,t.memoizedState=xe}}function Dp(t,n){if(typeof t!="function")throw Error(s(191,t));t.call(n)}function Lp(t,n){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)Dp(a[t],n)}var gs=L(null),Uo=L(0);function Rp(t,n){t=Or,U(Uo,t),U(gs,n),Or=t|n.baseLanes}function uu(){U(Uo,Or),U(gs,gs.current)}function du(){Or=Uo.current,$(gs),$(Uo)}var Rn=L(null),Xn=null;function Zr(t){var n=t.alternate;U(zt,zt.current&1),U(Rn,t),Xn===null&&(n===null||gs.current!==null||n.memoizedState!==null)&&(Xn=t)}function hu(t){U(zt,zt.current),U(Rn,t),Xn===null&&(Xn=t)}function Op(t){t.tag===22?(U(zt,zt.current),U(Rn,t),Xn===null&&(Xn=t)):Qr()}function Qr(){U(zt,zt.current),U(Rn,Rn.current)}function On(t){$(Rn),Xn===t&&(Xn=null),$(zt)}var zt=L(0);function $o(t){for(var n=t;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||vd(a)||bd(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,qo=!1,xs=!1,Ai=!1,Wo=0,fa=0,vs=null,M_=0;function Ot(){throw Error(s(321))}function fu(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 pu(t,n,a,h,w,E){return Er=E,Ke=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,P.H=t===null||t.memoizedState===null?xm:Tu,Ai=!1,E=a(h,w),Ai=!1,xs&&(E=Ip(n,a,h,w)),Mp(t),E}function Mp(t){P.H=ga;var n=gt!==null&>.next!==null;if(Er=0,Ut=gt=Ke=null,qo=!1,fa=0,vs=null,n)throw Error(s(300));t===null||$t||(t=t.dependencies,t!==null&&Mo(t)&&($t=!0))}function Ip(t,n,a,h){Ke=t;var w=0;do{if(xs&&(vs=null),fa=0,xs=!1,25<=w)throw Error(s(301));if(w+=1,Ut=gt=null,t.updateQueue!=null){var E=t.updateQueue;E.lastEffect=null,E.events=null,E.stores=null,E.memoCache!=null&&(E.memoCache.index=0)}P.H=vm,E=n(a,h)}while(xs);return E}function I_(){var t=P.H,n=t.useState()[0];return n=typeof n.then=="function"?pa(n):n,t=t.useState()[0],(gt!==null?gt.memoizedState:null)!==t&&(Ke.flags|=1024),n}function mu(){var t=Wo!==0;return Wo=0,t}function gu(t,n,a){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~a}function xu(t){if(qo){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}qo=!1}Er=0,Ut=gt=Ke=null,xs=!1,fa=Wo=0,vs=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(s(467)):Error(s(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 Go(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function pa(t){var n=fa;return fa+=1,vs===null&&(vs=[]),t=Ep(vs,t,n),n=Ke,(Ut===null?n.memoizedState:Ut.next)===null&&(n=n.alternate,P.H=n===null||n.memoizedState===null?xm:Tu),t}function Vo(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return pa(t);if(t.$$typeof===S)return ln(t)}throw Error(s(438,String(t)))}function vu(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=Go(),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 Ko(t){var n=Ht();return bu(n,gt,t)}function bu(t,n,a){var h=t.queue;if(h===null)throw Error(s(311));h.lastRenderedReducer=a;var w=t.baseQueue,E=h.pending;if(E!==null){if(w!==null){var M=w.next;w.next=E.next,E.next=M}n.baseQueue=w=E,h.pending=null}if(E=t.baseState,w===null)t.memoizedState=E;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===hs&&(he=!0);else if((Er&ce)===ce){le=le.next,ce===hs&&(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=E):J=J.next=xe,Ke.lanes|=ce,ti|=ce;xe=le.action,Ai&&a(E,xe),E=le.hasEagerState?le.eagerState:a(E,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=E):J=J.next=ce,Ke.lanes|=xe,ti|=xe;le=le.next}while(le!==null&&le!==n);if(J===null?M=E:J.next=K,!Dn(E,t.memoizedState)&&($t=!0,he&&(a=fs,a!==null)))throw a;t.memoizedState=E,t.baseState=M,t.baseQueue=J,h.lastRenderedState=E}return w===null&&(h.lanes=0),[t.memoizedState,h.dispatch]}function yu(t){var n=Ht(),a=n.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=t;var h=a.dispatch,w=a.pending,E=n.memoizedState;if(w!==null){a.pending=null;var M=w=w.next;do E=t(E,M.action),M=M.next;while(M!==w);Dn(E,n.memoizedState)||($t=!0),n.memoizedState=E,n.baseQueue===null&&(n.baseState=E),a.lastRenderedState=E}return[E,h]}function Bp(t,n,a){var h=Ke,w=Ht(),E=st;if(E){if(a===void 0)throw Error(s(407));a=a()}else a=n();var M=!Dn((gt||w).memoizedState,a);if(M&&(w.memoizedState=a,$t=!0),w=w.queue,wu(Pp.bind(null,h,w,t),[t]),w.getSnapshot!==n||M||Ut!==null&&Ut.memoizedState.tag&1){if(h.flags|=2048,bs(9,{destroy:void 0},Hp.bind(null,h,w,a,n),null),bt===null)throw Error(s(349));E||(Er&127)!==0||zp(h,n,a)}return a}function zp(t,n,a){t.flags|=16384,t={getSnapshot:n,value:a},n=Ke.updateQueue,n===null?(n=Go(),Ke.updateQueue=n,n.stores=[t]):(a=n.stores,a===null?n.stores=[t]:a.push(t))}function Hp(t,n,a,h){n.value=a,n.getSnapshot=h,Fp(n)&&Up(t)}function Pp(t,n,a){return a(function(){Fp(n)&&Up(t)})}function Fp(t){var n=t.getSnapshot;t=t.value;try{var a=n();return!Dn(t,a)}catch{return!0}}function Up(t){var n=_i(t,2);n!==null&&Nn(n,t,2)}function _u(t){var n=vn();if(typeof t=="function"){var a=t;if(t=a(),Ai){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 $p(t,n,a,h){return t.baseState=a,bu(t,gt,typeof h=="function"?h:jr)}function B_(t,n,a,h,w){if(Zo(t))throw Error(s(485));if(t=n.action,t!==null){var E={payload:w,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(M){E.listeners.push(M)}};P.T!==null?a(!0):E.isTransition=!1,h(E),a=n.pending,a===null?(E.next=n.pending=E,qp(n,E)):(E.next=a.next,n.pending=a.next=E)}}function qp(t,n){var a=n.action,h=n.payload,w=t.state;if(n.isTransition){var E=P.T,M={};P.T=M;try{var K=a(w,h),J=P.S;J!==null&&J(M,K),Wp(t,n,K)}catch(le){Su(t,n,le)}finally{E!==null&&M.types!==null&&(E.types=M.types),P.T=E}}else try{E=a(w,h),Wp(t,n,E)}catch(le){Su(t,n,le)}}function Wp(t,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(h){Gp(t,n,h)},function(h){return Su(t,n,h)}):Gp(t,n,a)}function Gp(t,n,a){n.status="fulfilled",n.value=a,Vp(n),t.state=a,n=t.pending,n!==null&&(a=n.next,a===n?t.pending=null:(a=a.next,n.next=a,qp(t,a)))}function Su(t,n,a){var h=t.pending;if(t.pending=null,h!==null){h=h.next;do n.status="rejected",n.reason=a,Vp(n),n=n.next;while(n!==h)}t.action=null}function Vp(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function Kp(t,n){return n}function Yp(t,n){if(st){var a=bt.formState;if(a!==null){e:{var h=Ke;if(st){if(Ct){t:{for(var w=Ct,E=Yn;w.nodeType!==8;){if(!E){w=null;break t}if(w=Zn(w.nextSibling),w===null){w=null;break t}}E=w.data,w=E==="F!"||E==="F"?w:null}if(w){Ct=Zn(w.nextSibling),h=w.data==="F!";break e}}Gr(h)}h=!1}h&&(n=a[0])}}return a=vn(),a.memoizedState=a.baseState=n,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kp,lastRenderedState:n},a.queue=h,a=pm.bind(null,Ke,h),h.dispatch=a,h=_u(!1),E=Nu.bind(null,Ke,!1,h.queue),h=vn(),w={state:n,dispatch:null,action:t,pending:null},h.queue=w,a=B_.bind(null,Ke,w,E,a),w.dispatch=a,h.memoizedState=t,[n,a,!1]}function Xp(t){var n=Ht();return Zp(n,gt,t)}function Zp(t,n,a){if(n=bu(t,n,Kp)[0],t=Ko(jr)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var h=pa(n)}catch(M){throw M===ps?zo:M}else h=n;n=Ht();var w=n.queue,E=w.dispatch;return a!==n.memoizedState&&(Ke.flags|=2048,bs(9,{destroy:void 0},z_.bind(null,w,a),null)),[h,E,t]}function z_(t,n){t.action=n}function Qp(t){var n=Ht(),a=gt;if(a!==null)return Zp(n,a,t);Ht(),n=n.memoizedState,a=Ht();var h=a.queue.dispatch;return a.memoizedState=t,[n,h,!1]}function bs(t,n,a,h){return t={tag:t,create:a,deps:h,inst:n,next:null},n=Ke.updateQueue,n===null&&(n=Go(),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 Jp(){return Ht().memoizedState}function Yo(t,n,a,h){var w=vn();Ke.flags|=t,w.memoizedState=bs(1|n,{destroy:void 0},a,h===void 0?null:h)}function Xo(t,n,a,h){var w=Ht();h=h===void 0?null:h;var E=w.memoizedState.inst;gt!==null&&h!==null&&fu(h,gt.memoizedState.deps)?w.memoizedState=bs(n,E,a,h):(Ke.flags|=t,w.memoizedState=bs(1|n,E,a,h))}function em(t,n){Yo(8390656,8,t,n)}function wu(t,n){Xo(2048,8,t,n)}function H_(t){Ke.flags|=4;var n=Ke.updateQueue;if(n===null)n=Go(),Ke.updateQueue=n,n.events=[t];else{var a=n.events;a===null?n.events=[t]:a.push(t)}}function tm(t){var n=Ht().memoizedState;return H_({ref:n,nextImpl:t}),function(){if((dt&2)!==0)throw Error(s(440));return n.impl.apply(void 0,arguments)}}function nm(t,n){return Xo(4,2,t,n)}function rm(t,n){return Xo(4,4,t,n)}function im(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 sm(t,n,a){a=a!=null?a.concat([t]):null,Xo(4,4,im.bind(null,n,t),a)}function Cu(){}function am(t,n){var a=Ht();n=n===void 0?null:n;var h=a.memoizedState;return n!==null&&fu(n,h[1])?h[0]:(a.memoizedState=[t,n],t)}function om(t,n){var a=Ht();n=n===void 0?null:n;var h=a.memoizedState;if(n!==null&&fu(n,h[1]))return h[0];if(h=t(),Ai){Kt(!0);try{t()}finally{Kt(!1)}}return a.memoizedState=[h,n],h}function ku(t,n,a){return a===void 0||(Er&1073741824)!==0&&(nt&261930)===0?t.memoizedState=n:(t.memoizedState=a,t=lg(),Ke.lanes|=t,ti|=t,a)}function lm(t,n,a,h){return Dn(a,n)?a:gs.current!==null?(t=ku(t,a,h),Dn(t,n)||($t=!0),t):(Er&42)===0||(Er&1073741824)!==0&&(nt&261930)===0?($t=!0,t.memoizedState=a):(t=lg(),Ke.lanes|=t,ti|=t,n)}function cm(t,n,a,h,w){var E=X.p;X.p=E!==0&&8>E?E:8;var M=P.T,K={};P.T=K,Nu(t,!1,n,a);try{var J=w(),le=P.S;if(le!==null&&le(K,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var he=O_(J,h);ma(t,n,he,Bn(t))}else ma(t,n,h,Bn(t))}catch(xe){ma(t,n,{then:function(){},status:"rejected",reason:xe},Bn())}finally{X.p=E,M!==null&&K.types!==null&&(M.types=K.types),P.T=M}}function P_(){}function Eu(t,n,a,h){if(t.tag!==5)throw Error(s(476));var w=um(t).queue;cm(t,w,n,Z,a===null?P_:function(){return dm(t),a(h)})}function um(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 dm(t){var n=um(t);n.next===null&&(n=t.alternate.memoizedState),ma(t,n.next.queue,{},Bn())}function ju(){return ln(La)}function hm(){return Ht().memoizedState}function fm(){return Ht().memoizedState}function F_(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),ua(h,n,a)),n={cache:nu()},t.payload=n;return}n=n.return}}function U_(t,n,a){var h=Bn();a={lane:h,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Zo(t)?mm(n,a):(a=Wc(t,n,a,h),a!==null&&(Nn(a,t,h),gm(a,n,h)))}function pm(t,n,a){var h=Bn();ma(t,n,a,h)}function ma(t,n,a,h){var w={lane:h,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Zo(t))mm(n,w);else{var E=t.alternate;if(t.lanes===0&&(E===null||E.lanes===0)&&(E=n.lastRenderedReducer,E!==null))try{var M=n.lastRenderedState,K=E(M,a);if(w.hasEagerState=!0,w.eagerState=K,Dn(K,M))return Do(t,n,w,0),bt===null&&Ao(),!1}catch{}finally{}if(a=Wc(t,n,w,h),a!==null)return Nn(a,t,h),gm(a,n,h),!0}return!1}function Nu(t,n,a,h){if(h={lane:2,revertLane:ad(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Zo(t)){if(n)throw Error(s(479))}else n=Wc(t,a,h,2),n!==null&&Nn(n,t,2)}function Zo(t){var n=t.alternate;return t===Ke||n!==null&&n===Ke}function mm(t,n){xs=qo=!0;var a=t.pending;a===null?n.next=n:(n.next=a.next,a.next=n),t.pending=n}function gm(t,n,a){if((a&4194048)!==0){var h=n.lanes;h&=t.pendingLanes,a|=h,n.lanes=a,qe(t,a)}}var ga={readContext:ln,use:Vo,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};ga.useEffectEvent=Ot;var xm={readContext:ln,use:Vo,useCallback:function(t,n){return vn().memoizedState=[t,n===void 0?null:n],t},useContext:ln,useEffect:em,useImperativeHandle:function(t,n,a){a=a!=null?a.concat([t]):null,Yo(4194308,4,im.bind(null,n,t),a)},useLayoutEffect:function(t,n){return Yo(4194308,4,t,n)},useInsertionEffect:function(t,n){Yo(4,2,t,n)},useMemo:function(t,n){var a=vn();n=n===void 0?null:n;var h=t();if(Ai){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(Ai){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=U_.bind(null,Ke,t),[h.memoizedState,t]},useRef:function(t){var n=vn();return t={current:t},n.memoizedState=t},useState:function(t){t=_u(t);var n=t.queue,a=pm.bind(null,Ke,n);return n.dispatch=a,[t.memoizedState,a]},useDebugValue:Cu,useDeferredValue:function(t,n){var a=vn();return ku(a,t,n)},useTransition:function(){var t=_u(!1);return t=cm.bind(null,Ke,t.queue,!0,!1),vn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,a){var h=Ke,w=vn();if(st){if(a===void 0)throw Error(s(407));a=a()}else{if(a=n(),bt===null)throw Error(s(349));(nt&127)!==0||zp(h,n,a)}w.memoizedState=a;var E={value:a,getSnapshot:n};return w.queue=E,em(Pp.bind(null,h,E,t),[t]),h.flags|=2048,bs(9,{destroy:void 0},Hp.bind(null,h,E,a,n),null),a},useId:function(){var t=vn(),n=bt.identifierPrefix;if(st){var a=lr,h=or;a=(h&~(1<<32-lt(h)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Wo++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=M_++,n="_"+n+"r_"+a.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:ju,useFormState:Yp,useActionState:Yp,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=Nu.bind(null,Ke,!0,a),a.dispatch=n,[t,n]},useMemoCache:vu,useCacheRefresh:function(){return vn().memoizedState=F_.bind(null,Ke)},useEffectEvent:function(t){var n=vn(),a={impl:t};return n.memoizedState=a,function(){if((dt&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},Tu={readContext:ln,use:Vo,useCallback:am,useContext:ln,useEffect:wu,useImperativeHandle:sm,useInsertionEffect:nm,useLayoutEffect:rm,useMemo:om,useReducer:Ko,useRef:Jp,useState:function(){return Ko(jr)},useDebugValue:Cu,useDeferredValue:function(t,n){var a=Ht();return lm(a,gt.memoizedState,t,n)},useTransition:function(){var t=Ko(jr)[0],n=Ht().memoizedState;return[typeof t=="boolean"?t:pa(t),n]},useSyncExternalStore:Bp,useId:hm,useHostTransitionStatus:ju,useFormState:Xp,useActionState:Xp,useOptimistic:function(t,n){var a=Ht();return $p(a,gt,t,n)},useMemoCache:vu,useCacheRefresh:fm};Tu.useEffectEvent=tm;var vm={readContext:ln,use:Vo,useCallback:am,useContext:ln,useEffect:wu,useImperativeHandle:sm,useInsertionEffect:nm,useLayoutEffect:rm,useMemo:om,useReducer:yu,useRef:Jp,useState:function(){return yu(jr)},useDebugValue:Cu,useDeferredValue:function(t,n){var a=Ht();return gt===null?ku(a,t,n):lm(a,gt.memoizedState,t,n)},useTransition:function(){var t=yu(jr)[0],n=Ht().memoizedState;return[typeof t=="boolean"?t:pa(t),n]},useSyncExternalStore:Bp,useId:hm,useHostTransitionStatus:ju,useFormState:Qp,useActionState:Qp,useOptimistic:function(t,n){var a=Ht();return gt!==null?$p(a,gt,t,n):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:vu,useCacheRefresh:fm};vm.useEffectEvent=tm;function Au(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 Du={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),ua(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),ua(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),ua(n,t,a))}};function bm(t,n,a,h,w,E,M){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(h,E,M):n.prototype&&n.prototype.isPureReactComponent?!na(a,h)||!na(w,E):!0}function ym(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&&Du.enqueueReplaceState(n,n.state,null)}function Di(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 _m(t){To(t)}function Sm(t){console.error(t)}function wm(t){To(t)}function Qo(t,n){try{var a=t.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(h){setTimeout(function(){throw h})}}function Cm(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 Lu(t,n,a){return a=Yr(a),a.tag=3,a.payload={element:null},a.callback=function(){Qo(t,n)},a}function km(t){return t=Yr(t),t.tag=3,t}function Em(t,n,a,h){var w=a.type.getDerivedStateFromError;if(typeof w=="function"){var E=h.value;t.payload=function(){return w(E)},t.callback=function(){Cm(n,a,h)}}var M=a.stateNode;M!==null&&typeof M.componentDidCatch=="function"&&(t.callback=function(){Cm(n,a,h),typeof w!="function"&&(ni===null?ni=new Set([this]):ni.add(this));var K=h.stack;this.componentDidCatch(h.value,{componentStack:K!==null?K:""})})}function $_(t,n,a,h,w){if(a.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(n=a.alternate,n!==null&&ds(n,a,w,!0),a=Rn.current,a!==null){switch(a.tag){case 31:case 13:return Xn===null?ul():a.alternate===null&&Mt===0&&(Mt=3),a.flags&=-257,a.flags|=65536,a.lanes=w,h===Ho?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([h]):n.add(h),rd(t,h,w)),!1;case 22:return a.flags|=65536,h===Ho?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)),rd(t,h,w)),!1}throw Error(s(435,a.tag))}return rd(t,h,w),ul(),!1}if(st)return n=Rn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=w,h!==Zc&&(t=Error(s(422),{cause:h}),sa(Gn(t,a)))):(h!==Zc&&(n=Error(s(423),{cause:h}),sa(Gn(n,a))),t=t.current.alternate,t.flags|=65536,w&=-w,t.lanes|=w,h=Gn(h,a),w=Lu(t.stateNode,h,w),lu(t,w),Mt!==4&&(Mt=2)),!1;var E=Error(s(520),{cause:h});if(E=Gn(E,a),Ca===null?Ca=[E]:Ca.push(E),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=Lu(a.stateNode,h,t),lu(a,t),!1;case 1:if(n=a.type,E=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||E!==null&&typeof E.componentDidCatch=="function"&&(ni===null||!ni.has(E))))return a.flags|=65536,w&=-w,a.lanes|=w,w=km(w),Em(w,t,a,h),lu(a,w),!1}a=a.return}while(a!==null);return!1}var Ru=Error(s(461)),$t=!1;function cn(t,n,a,h){n.child=t===null?Ap(n,null,a,h):Ti(n,t.child,a,h)}function jm(t,n,a,h,w){a=a.render;var E=n.ref;if("ref"in h){var M={};for(var K in h)K!=="ref"&&(M[K]=h[K])}else M=h;return ki(n),h=pu(t,n,a,M,E,w),K=mu(),t!==null&&!$t?(gu(t,n,w),Nr(t,n,w)):(st&&K&&Yc(n),n.flags|=1,cn(t,n,h,w),n.child)}function Nm(t,n,a,h,w){if(t===null){var E=a.type;return typeof E=="function"&&!Gc(E)&&E.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=E,Tm(t,n,E,h,w)):(t=Ro(a.type,null,h,n,n.mode,w),t.ref=n.ref,t.return=n,n.child=t)}if(E=t.child,!Fu(t,w)){var M=E.memoizedProps;if(a=a.compare,a=a!==null?a:na,a(M,h)&&t.ref===n.ref)return Nr(t,n,w)}return n.flags|=1,t=Sr(E,h),t.ref=n.ref,t.return=n,n.child=t}function Tm(t,n,a,h,w){if(t!==null){var E=t.memoizedProps;if(na(E,h)&&t.ref===n.ref)if($t=!1,n.pendingProps=h=E,Fu(t,w))(t.flags&131072)!==0&&($t=!0);else return n.lanes=t.lanes,Nr(t,n,w)}return Ou(t,n,a,h,w)}function Am(t,n,a,h){var w=h.children,E=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(E=E!==null?E.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&~E}else h=0,n.child=null;return Dm(t,n,E,a,h)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&Bo(n,E!==null?E.cachePool:null),E!==null?Rp(n,E):uu(),Op(n);else return h=n.lanes=536870912,Dm(t,n,E!==null?E.baseLanes|a:a,a,h)}else E!==null?(Bo(n,E.cachePool),Rp(n,E),Qr(),n.memoizedState=null):(t!==null&&Bo(n,null),uu(),Qr());return cn(t,n,w,a),n.child}function xa(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Dm(t,n,a,h,w){var E=iu();return E=E===null?null:{parent:Ft._currentValue,pool:E},n.memoizedState={baseLanes:a,cachePool:E},t!==null&&Bo(n,null),uu(),Op(n),t!==null&&ds(t,n,h,!0),n.childLanes=w,null}function Jo(t,n){return n=tl({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function Lm(t,n,a){return Ti(n,t.child,null,a),t=Jo(n,n.pendingProps),t.flags|=2,On(n),n.memoizedState=null,t}function q_(t,n,a){var h=n.pendingProps,w=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(st){if(h.mode==="hidden")return t=Jo(n,h),n.lanes=536870912,xa(null,t);if(hu(n),(t=Ct)?(t=qg(t,Yn),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=mp(t),a.return=n,n.child=a,on=n,Ct=null)):t=null,t===null)throw Gr(n);return n.lanes=536870912,null}return Jo(n,h)}var E=t.memoizedState;if(E!==null){var M=E.dehydrated;if(hu(n),w)if(n.flags&256)n.flags&=-257,n=Lm(t,n,a);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(s(558));else if($t||ds(t,n,a,!1),w=(a&t.childLanes)!==0,$t||w){if(h=bt,h!==null&&(M=wt(h,a),M!==0&&M!==E.retryLane))throw E.retryLane=M,_i(t,M),Nn(h,t,M),Ru;ul(),n=Lm(t,n,a)}else t=E.treeContext,Ct=Zn(M.nextSibling),on=n,st=!0,Wr=null,Yn=!1,t!==null&&vp(n,t),n=Jo(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 el(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(s(284));(t===null||t.ref!==a)&&(n.flags|=4194816)}}function Ou(t,n,a,h,w){return ki(n),a=pu(t,n,a,h,void 0,w),h=mu(),t!==null&&!$t?(gu(t,n,w),Nr(t,n,w)):(st&&h&&Yc(n),n.flags|=1,cn(t,n,a,w),n.child)}function Rm(t,n,a,h,w,E){return ki(n),n.updateQueue=null,a=Ip(n,h,a,w),Mp(t),h=mu(),t!==null&&!$t?(gu(t,n,E),Nr(t,n,E)):(st&&h&&Yc(n),n.flags|=1,cn(t,n,a,E),n.child)}function Om(t,n,a,h,w){if(ki(n),n.stateNode===null){var E=os,M=a.contextType;typeof M=="object"&&M!==null&&(E=ln(M)),E=new a(h,E),n.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,E.updater=Du,n.stateNode=E,E._reactInternals=n,E=n.stateNode,E.props=h,E.state=n.memoizedState,E.refs={},au(n),M=a.contextType,E.context=typeof M=="object"&&M!==null?ln(M):os,E.state=n.memoizedState,M=a.getDerivedStateFromProps,typeof M=="function"&&(Au(n,a,M,h),E.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(M=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),M!==E.state&&Du.enqueueReplaceState(E,E.state,null),ha(n,h,E,w),da(),E.state=n.memoizedState),typeof E.componentDidMount=="function"&&(n.flags|=4194308),h=!0}else if(t===null){E=n.stateNode;var K=n.memoizedProps,J=Di(a,K);E.props=J;var le=E.context,he=a.contextType;M=os,typeof he=="object"&&he!==null&&(M=ln(he));var xe=a.getDerivedStateFromProps;he=typeof xe=="function"||typeof E.getSnapshotBeforeUpdate=="function",K=n.pendingProps!==K,he||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(K||le!==M)&&ym(n,E,h,M),Kr=!1;var ce=n.memoizedState;E.state=ce,ha(n,h,E,w),da(),le=n.memoizedState,K||ce!==le||Kr?(typeof xe=="function"&&(Au(n,a,xe,h),le=n.memoizedState),(J=Kr||bm(n,a,J,h,ce,le,M))?(he||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount()),typeof E.componentDidMount=="function"&&(n.flags|=4194308)):(typeof E.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=h,n.memoizedState=le),E.props=h,E.state=le,E.context=M,h=J):(typeof E.componentDidMount=="function"&&(n.flags|=4194308),h=!1)}else{E=n.stateNode,ou(t,n),M=n.memoizedProps,he=Di(a,M),E.props=he,xe=n.pendingProps,ce=E.context,le=a.contextType,J=os,typeof le=="object"&&le!==null&&(J=ln(le)),K=a.getDerivedStateFromProps,(le=typeof K=="function"||typeof E.getSnapshotBeforeUpdate=="function")||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(M!==xe||ce!==J)&&ym(n,E,h,J),Kr=!1,ce=n.memoizedState,E.state=ce,ha(n,h,E,w),da();var de=n.memoizedState;M!==xe||ce!==de||Kr||t!==null&&t.dependencies!==null&&Mo(t.dependencies)?(typeof K=="function"&&(Au(n,a,K,h),de=n.memoizedState),(he=Kr||bm(n,a,he,h,ce,de,J)||t!==null&&t.dependencies!==null&&Mo(t.dependencies))?(le||typeof E.UNSAFE_componentWillUpdate!="function"&&typeof E.componentWillUpdate!="function"||(typeof E.componentWillUpdate=="function"&&E.componentWillUpdate(h,de,J),typeof E.UNSAFE_componentWillUpdate=="function"&&E.UNSAFE_componentWillUpdate(h,de,J)),typeof E.componentDidUpdate=="function"&&(n.flags|=4),typeof E.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof E.componentDidUpdate!="function"||M===t.memoizedProps&&ce===t.memoizedState||(n.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||M===t.memoizedProps&&ce===t.memoizedState||(n.flags|=1024),n.memoizedProps=h,n.memoizedState=de),E.props=h,E.state=de,E.context=J,h=he):(typeof E.componentDidUpdate!="function"||M===t.memoizedProps&&ce===t.memoizedState||(n.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||M===t.memoizedProps&&ce===t.memoizedState||(n.flags|=1024),h=!1)}return E=h,el(t,n),h=(n.flags&128)!==0,E||h?(E=n.stateNode,a=h&&typeof a.getDerivedStateFromError!="function"?null:E.render(),n.flags|=1,t!==null&&h?(n.child=Ti(n,t.child,null,w),n.child=Ti(n,null,a,w)):cn(t,n,a,w),n.memoizedState=E.state,t=n.child):t=Nr(t,n,w),t}function Mm(t,n,a,h){return wi(),n.flags|=256,cn(t,n,a,h),n.child}var Mu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Iu(t){return{baseLanes:t,cachePool:Cp()}}function Bu(t,n,a){return t=t!==null?t.childLanes&~a:0,n&&(t|=In),t}function Im(t,n,a){var h=n.pendingProps,w=!1,E=(n.flags&128)!==0,M;if((M=E)||(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(st){if(w?Zr(n):Qr(),(t=Ct)?(t=qg(t,Yn),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=mp(t),a.return=n,n.child=a,on=n,Ct=null)):t=null,t===null)throw Gr(n);return bd(t)?n.lanes=32:n.lanes=536870912,null}var K=h.children;return h=h.fallback,w?(Qr(),w=n.mode,K=tl({mode:"hidden",children:K},w),h=Si(h,w,a,null),K.return=n,h.return=n,K.sibling=h,n.child=K,h=n.child,h.memoizedState=Iu(a),h.childLanes=Bu(t,M,a),n.memoizedState=Mu,xa(null,h)):(Zr(n),zu(n,K))}var J=t.memoizedState;if(J!==null&&(K=J.dehydrated,K!==null)){if(E)n.flags&256?(Zr(n),n.flags&=-257,n=Hu(t,n,a)):n.memoizedState!==null?(Qr(),n.child=t.child,n.flags|=128,n=null):(Qr(),K=h.fallback,w=n.mode,h=tl({mode:"visible",children:h.children},w),K=Si(K,w,a,null),K.flags|=2,h.return=n,K.return=n,h.sibling=K,n.child=h,Ti(n,t.child,null,a),h=n.child,h.memoizedState=Iu(a),h.childLanes=Bu(t,M,a),n.memoizedState=Mu,n=xa(null,h));else if(Zr(n),bd(K)){if(M=K.nextSibling&&K.nextSibling.dataset,M)var le=M.dgst;M=le,h=Error(s(419)),h.stack="",h.digest=M,sa({value:h,source:null,stack:null}),n=Hu(t,n,a)}else if($t||ds(t,n,a,!1),M=(a&t.childLanes)!==0,$t||M){if(M=bt,M!==null&&(h=wt(M,a),h!==0&&h!==J.retryLane))throw J.retryLane=h,_i(t,h),Nn(M,t,h),Ru;vd(K)||ul(),n=Hu(t,n,a)}else vd(K)?(n.flags|=192,n.child=t.child,n=null):(t=J.treeContext,Ct=Zn(K.nextSibling),on=n,st=!0,Wr=null,Yn=!1,t!==null&&vp(n,t),n=zu(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=Si(K,w,a,null),K.flags|=2),K.return=n,h.return=n,h.sibling=K,n.child=h,xa(null,h),h=n.child,K=t.child.memoizedState,K===null?K=Iu(a):(w=K.cachePool,w!==null?(J=Ft._currentValue,w=w.parent!==J?{parent:J,pool:J}:w):w=Cp(),K={baseLanes:K.baseLanes|a,cachePool:w}),h.memoizedState=K,h.childLanes=Bu(t,M,a),n.memoizedState=Mu,xa(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 zu(t,n){return n=tl({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function tl(t,n){return t=Ln(22,t,null,n),t.lanes=0,t}function Hu(t,n,a){return Ti(n,t.child,null,a),t=zu(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function Bm(t,n,a){t.lanes|=n;var h=t.alternate;h!==null&&(h.lanes|=n),eu(t.return,n,a)}function Pu(t,n,a,h,w,E){var M=t.memoizedState;M===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:h,tail:a,tailMode:w,treeForkCount:E}:(M.isBackwards=n,M.rendering=null,M.renderingStartTime=0,M.last=h,M.tail=a,M.tailMode=w,M.treeForkCount=E)}function zm(t,n,a){var h=n.pendingProps,w=h.revealOrder,E=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=st?ia:0,!K&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Bm(t,a,n);else if(t.tag===19)Bm(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&&$o(t)===null&&(w=a),a=a.sibling;a=w,a===null?(w=n.child,n.child=null):(w=a.sibling,a.sibling=null),Pu(n,!1,w,a,E,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&&$o(t)===null){n.child=w;break}t=w.sibling,w.sibling=a,a=w,w=t}Pu(n,!0,a,null,E,h);break;case"together":Pu(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),ti|=n.lanes,(a&n.childLanes)===0)if(t!==null){if(ds(t,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(t!==null&&n.child!==t.child)throw Error(s(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 Fu(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&Mo(t)))}function W_(t,n,a){switch(n.tag){case 3:G(n,n.stateNode.containerInfo),Vr(n,Ft,t.memoizedState.cache),wi();break;case 27:case 5:re(n);break;case 4:G(n,n.stateNode.containerInfo);break;case 10:Vr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,hu(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?Im(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||(ds(t,n,a,!1),h=(a&n.childLanes)!==0),w){if(h)return zm(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,Am(t,n,a,n.pendingProps);case 24:Vr(n,Ft,t.memoizedState.cache)}return Nr(t,n,a)}function Hm(t,n,a){if(t!==null)if(t.memoizedProps!==n.pendingProps)$t=!0;else{if(!Fu(t,a)&&(n.flags&128)===0)return $t=!1,W_(t,n,a);$t=(t.flags&131072)!==0}else $t=!1,st&&(n.flags&1048576)!==0&&xp(n,ia,n.index);switch(n.lanes=0,n.tag){case 16:e:{var h=n.pendingProps;if(t=ji(n.elementType),n.type=t,typeof t=="function")Gc(t)?(h=Di(t,h),n.tag=1,n=Om(null,n,t,h,a)):(n.tag=0,n=Ou(null,n,t,h,a));else{if(t!=null){var w=t.$$typeof;if(w===j){n.tag=11,n=jm(null,n,t,h,a);break e}else if(w===D){n.tag=14,n=Nm(null,n,t,h,a);break e}}throw n=I(t)||t,Error(s(306,n,""))}}return n;case 0:return Ou(t,n,n.type,n.pendingProps,a);case 1:return h=n.type,w=Di(h,n.pendingProps),Om(t,n,h,w,a);case 3:e:{if(G(n,n.stateNode.containerInfo),t===null)throw Error(s(387));h=n.pendingProps;var E=n.memoizedState;w=E.element,ou(t,n),ha(n,h,null,a);var M=n.memoizedState;if(h=M.cache,Vr(n,Ft,h),h!==E.cache&&tu(n,[Ft],a,!0),da(),h=M.element,E.isDehydrated)if(E={element:h,isDehydrated:!1,cache:M.cache},n.updateQueue.baseState=E,n.memoizedState=E,n.flags&256){n=Mm(t,n,h,a);break e}else if(h!==w){w=Gn(Error(s(424)),n),sa(w),n=Mm(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(Ct=Zn(t.firstChild),on=n,st=!0,Wr=null,Yn=!0,a=Ap(n,null,h,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(wi(),h===w){n=Nr(t,n,a);break e}cn(t,n,h,a)}n=n.child}return n;case 26:return el(t,n),t===null?(a=Xg(n.type,null,n.pendingProps,null))?n.memoizedState=a:st||(a=n.type,t=n.pendingProps,h=xl(ee.current).createElement(a),h[an]=n,h[Sn]=t,un(h,a,t),en(h),n.stateNode=h):n.memoizedState=Xg(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return re(n),t===null&&st&&(h=n.stateNode=Vg(n.type,n.pendingProps,ee.current),on=n,Yn=!0,w=Ct,ai(n.type)?(yd=w,Ct=Zn(h.firstChild)):Ct=w),cn(t,n,n.pendingProps.children,a),el(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&st&&((w=h=Ct)&&(h=_S(h,n.type,n.pendingProps,Yn),h!==null?(n.stateNode=h,on=n,Ct=Zn(h.firstChild),Yn=!1,w=!0):w=!1),w||Gr(n)),re(n),w=n.type,E=n.pendingProps,M=t!==null?t.memoizedProps:null,h=E.children,md(w,E)?h=null:M!==null&&md(w,M)&&(n.flags|=32),n.memoizedState!==null&&(w=pu(t,n,I_,null,null,a),La._currentValue=w),el(t,n),cn(t,n,h,a),n.child;case 6:return t===null&&st&&((t=a=Ct)&&(a=SS(a,n.pendingProps,Yn),a!==null?(n.stateNode=a,on=n,Ct=null,t=!0):t=!1),t||Gr(n)),null;case 13:return Im(t,n,a);case 4:return G(n,n.stateNode.containerInfo),h=n.pendingProps,t===null?n.child=Ti(n,null,h,a):cn(t,n,h,a),n.child;case 11:return jm(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,Vr(n,n.type,h.value),cn(t,n,h.children,a),n.child;case 9:return w=n.type._context,h=n.pendingProps.children,ki(n),w=ln(w),h=h(w),n.flags|=1,cn(t,n,h,a),n.child;case 14:return Nm(t,n,n.type,n.pendingProps,a);case 15:return Tm(t,n,n.type,n.pendingProps,a);case 19:return zm(t,n,a);case 31:return q_(t,n,a);case 22:return Am(t,n,a,n.pendingProps);case 24:return ki(n),h=ln(Ft),t===null?(w=iu(),w===null&&(w=bt,E=nu(),w.pooledCache=E,E.refCount++,E!==null&&(w.pooledCacheLanes|=a),w=E),n.memoizedState={parent:h,cache:w},au(n),Vr(n,Ft,w)):((t.lanes&a)!==0&&(ou(t,n),ha(n,null,null,a),da()),w=t.memoizedState,E=n.memoizedState,w.parent!==h?(w={parent:h,cache:h},n.memoizedState=w,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=w),Vr(n,Ft,h)):(h=E.cache,Vr(n,Ft,h),h!==w.cache&&tu(n,[Ft],a,!0))),cn(t,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(s(156,n.tag))}function Tr(t){t.flags|=4}function Uu(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(hg())t.flags|=8192;else throw Ni=Ho,su}else t.flags&=-16777217}function Pm(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!tx(n))if(hg())t.flags|=8192;else throw Ni=Ho,su}function nl(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?Rt():536870912,t.lanes|=n,ws|=n)}function va(t,n){if(!st)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 kt(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 G_(t,n,a){var h=n.pendingProps;switch(Xc(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return kt(n),null;case 1:return kt(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)&&(us(n)?Tr(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Qc())),kt(n),null;case 26:var w=n.type,E=n.memoizedState;return t===null?(Tr(n),E!==null?(kt(n),Pm(n,E)):(kt(n),Uu(n,w,null,h,a))):E?E!==t.memoizedState?(Tr(n),kt(n),Pm(n,E)):(kt(n),n.flags&=-16777217):(t=t.memoizedProps,t!==h&&Tr(n),kt(n),Uu(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(s(166));return kt(n),null}t=ne.current,us(n)?bp(n):(t=Vg(w,h,a),n.stateNode=t,Tr(n))}return kt(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(s(166));return kt(n),null}if(E=ne.current,us(n))bp(n);else{var M=xl(ee.current);switch(E){case 1:E=M.createElementNS("http://www.w3.org/2000/svg",w);break;case 2:E=M.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;default:switch(w){case"svg":E=M.createElementNS("http://www.w3.org/2000/svg",w);break;case"math":E=M.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;case"script":E=M.createElement("div"),E.innerHTML="<script><\/script>",E=E.removeChild(E.firstChild);break;case"select":E=typeof h.is=="string"?M.createElement("select",{is:h.is}):M.createElement("select"),h.multiple?E.multiple=!0:h.size&&(E.size=h.size);break;default:E=typeof h.is=="string"?M.createElement(w,{is:h.is}):M.createElement(w)}}E[an]=n,E[Sn]=h;e:for(M=n.child;M!==null;){if(M.tag===5||M.tag===6)E.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=E;e:switch(un(E,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 kt(n),Uu(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(s(166));if(t=ee.current,us(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||Ig(t.nodeValue,a)),t||Gr(n,!0)}else t=xl(t).createTextNode(h),t[an]=n,n.stateNode=t}return kt(n),null;case 31:if(a=n.memoizedState,t===null||t.memoizedState!==null){if(h=us(n),a!==null){if(t===null){if(!h)throw Error(s(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(557));t[an]=n}else wi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;kt(n),t=!1}else a=Qc(),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(s(558))}return kt(n),null;case 13:if(h=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(w=us(n),h!==null&&h.dehydrated!==null){if(t===null){if(!w)throw Error(s(318));if(w=n.memoizedState,w=w!==null?w.dehydrated:null,!w)throw Error(s(317));w[an]=n}else wi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;kt(n),w=!1}else w=Qc(),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),E=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(E=h.memoizedState.cachePool.pool),E!==w&&(h.flags|=2048)),a!==t&&a&&(n.child.flags|=8192),nl(n,n.updateQueue),kt(n),null);case 4:return oe(),t===null&&ud(n.stateNode.containerInfo),kt(n),null;case 10:return kr(n.type),kt(n),null;case 19:if($(zt),h=n.memoizedState,h===null)return kt(n),null;if(w=(n.flags&128)!==0,E=h.rendering,E===null)if(w)va(h,!1);else{if(Mt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(E=$o(t),E!==null){for(n.flags|=128,va(h,!1),t=E.updateQueue,n.updateQueue=t,nl(n,t),n.subtreeFlags=0,t=a,a=n.child;a!==null;)pp(a,t),a=a.sibling;return U(zt,zt.current&1|2),st&&wr(n,h.treeForkCount),n.child}t=t.sibling}h.tail!==null&&Me()>ol&&(n.flags|=128,w=!0,va(h,!1),n.lanes=4194304)}else{if(!w)if(t=$o(E),t!==null){if(n.flags|=128,w=!0,t=t.updateQueue,n.updateQueue=t,nl(n,t),va(h,!0),h.tail===null&&h.tailMode==="hidden"&&!E.alternate&&!st)return kt(n),null}else 2*Me()-h.renderingStartTime>ol&&a!==536870912&&(n.flags|=128,w=!0,va(h,!1),n.lanes=4194304);h.isBackwards?(E.sibling=n.child,n.child=E):(t=h.last,t!==null?t.sibling=E:n.child=E,h.last=E)}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),st&&wr(n,h.treeForkCount),t):(kt(n),null);case 22:case 23:return On(n),du(),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&&(kt(n),n.subtreeFlags&6&&(n.flags|=8192)):kt(n),a=n.updateQueue,a!==null&&nl(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&&$(Ei),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),kr(Ft),kt(n),null;case 25:return null;case 30:return null}throw Error(s(156,n.tag))}function V_(t,n){switch(Xc(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(s(340));wi()}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(s(340));wi()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return $(zt),null;case 4:return oe(),null;case 10:return kr(n.type),null;case 22:case 23:return On(n),du(),t!==null&&$(Ei),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 Fm(t,n){switch(Xc(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:$(zt);break;case 10:kr(n.type);break;case 22:case 23:On(n),du(),t!==null&&$(Ei);break;case 24:kr(Ft)}}function ba(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 E=a.create,M=a.inst;h=E(),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 E=w.next;h=E;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!==E)}}catch(he){ft(n,n.return,he)}}function Um(t){var n=t.updateQueue;if(n!==null){var a=t.stateNode;try{Lp(n,a)}catch(h){ft(t,t.return,h)}}}function $m(t,n,a){a.props=Di(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(h){ft(t,n,h)}}function ya(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 qm(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 $u(t,n,a){try{var h=t.stateNode;mS(h,t.type,a,n),h[Sn]=n}catch(w){ft(t,t.return,w)}}function Wm(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ai(t.type)||t.tag===4}function qu(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Wm(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&&ai(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 Wu(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&&ai(t.type)&&(a=t.stateNode,n=null),t=t.child,t!==null))for(Wu(t,n,a),t=t.sibling;t!==null;)Wu(t,n,a),t=t.sibling}function rl(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&&ai(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(rl(t,n,a),t=t.sibling;t!==null;)rl(t,n,a),t=t.sibling}function Gm(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(E){ft(t,t.return,E)}}var Ar=!1,qt=!1,Gu=!1,Vm=typeof WeakSet=="function"?WeakSet:Set,tn=null;function K_(t,n){if(t=t.containerInfo,fd=Cl,t=sp(t),Hc(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,E=h.focusNode;h=h.focusOffset;try{a.nodeType,E.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!==E||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===E&&++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(pd={focusedElem:t,selectionRange:a},Cl=!1,tn=n;tn!==null;)if(n=tn,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,tn=t;else for(;tn!==null;){switch(n=tn,E=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&&E!==null){t=void 0,a=n,w=E.memoizedProps,E=E.memoizedState,h=a.stateNode;try{var De=Di(a.type,w);t=h.getSnapshotBeforeUpdate(De,E),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)xd(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":xd(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(s(163))}if(t=n.sibling,t!==null){t.return=n.return,tn=t;break}tn=n.return}}function Km(t,n,a){var h=a.flags;switch(a.tag){case 0:case 11:case 15:Lr(t,a),h&4&&ba(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=Di(a.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(w,n,t.__reactInternalSnapshotBeforeUpdate)}catch(M){ft(a,a.return,M)}}h&64&&Um(a),h&512&&ya(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{Lp(t,n)}catch(M){ft(a,a.return,M)}}break;case 27:n===null&&h&4&&Gm(a);case 26:case 5:Lr(t,a),n===null&&h&4&&qm(a),h&512&&ya(a,a.return);break;case 12:Lr(t,a);break;case 31:Lr(t,a),h&4&&Zm(t,a);break;case 13:Lr(t,a),h&4&&Qm(t,a),h&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=rS.bind(null,a),wS(t,a))));break;case 22:if(h=a.memoizedState!==null||Ar,!h){n=n!==null&&n.memoizedState!==null||qt,w=Ar;var E=qt;Ar=h,(qt=n)&&!E?Rr(t,a,(a.subtreeFlags&8772)!==0):Lr(t,a),Ar=w,qt=E}break;case 30:break;default:Lr(t,a)}}function Ym(t){var n=t.alternate;n!==null&&(t.alternate=null,Ym(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&Sc(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 Et=null,Cn=!1;function Dr(t,n,a){for(a=a.child;a!==null;)Xm(t,n,a),a=a.sibling}function Xm(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=Et,w=Cn;ai(a.type)&&(Et=a.stateNode,Cn=!1),Dr(t,n,a),Ta(a.stateNode),Et=h,Cn=w;break;case 5:qt||cr(a,n);case 6:if(h=Et,w=Cn,Et=null,Dr(t,n,a),Et=h,Cn=w,Et!==null)if(Cn)try{(Et.nodeType===9?Et.body:Et.nodeName==="HTML"?Et.ownerDocument.body:Et).removeChild(a.stateNode)}catch(E){ft(a,n,E)}else try{Et.removeChild(a.stateNode)}catch(E){ft(a,n,E)}break;case 18:Et!==null&&(Cn?(t=Et,Ug(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),Ds(t)):Ug(Et,a.stateNode));break;case 4:h=Et,w=Cn,Et=a.stateNode.containerInfo,Cn=!0,Dr(t,n,a),Et=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"&&$m(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 Zm(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Ds(t)}catch(a){ft(n,n.return,a)}}}function Qm(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Ds(t)}catch(a){ft(n,n.return,a)}}function Y_(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new Vm),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new Vm),n;default:throw Error(s(435,t.tag))}}function il(t,n){var a=Y_(t);n.forEach(function(h){if(!a.has(h)){a.add(h);var w=iS.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],E=t,M=n,K=M;e:for(;K!==null;){switch(K.tag){case 27:if(ai(K.type)){Et=K.stateNode,Cn=!1;break e}break;case 5:Et=K.stateNode,Cn=!1;break e;case 3:case 4:Et=K.stateNode.containerInfo,Cn=!0;break e}K=K.return}if(Et===null)throw Error(s(160));Xm(E,M,w),Et=null,Cn=!1,E=w.alternate,E!==null&&(E.return=null),w.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Jm(n,t),n=n.sibling}var nr=null;function Jm(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),ba(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 E=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":E=w.getElementsByTagName("title")[0],(!E||E[Vs]||E[an]||E.namespaceURI==="http://www.w3.org/2000/svg"||E.hasAttribute("itemprop"))&&(E=w.createElement(h),w.head.insertBefore(E,w.querySelector("head > title"))),un(E,h,a),E[an]=t,en(E),h=E;break e;case"link":var M=Jg("link","href",w).get(h+(a.href||""));if(M){for(var K=0;K<M.length;K++)if(E=M[K],E.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&E.getAttribute("rel")===(a.rel==null?null:a.rel)&&E.getAttribute("title")===(a.title==null?null:a.title)&&E.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){M.splice(K,1);break t}}E=w.createElement(h),un(E,h,a),w.head.appendChild(E);break;case"meta":if(M=Jg("meta","content",w).get(h+(a.content||""))){for(K=0;K<M.length;K++)if(E=M[K],E.getAttribute("content")===(a.content==null?null:""+a.content)&&E.getAttribute("name")===(a.name==null?null:a.name)&&E.getAttribute("property")===(a.property==null?null:a.property)&&E.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&E.getAttribute("charset")===(a.charSet==null?null:a.charSet)){M.splice(K,1);break t}}E=w.createElement(h),un(E,h,a),w.head.appendChild(E);break;default:throw Error(s(468,h))}E[an]=t,en(E),h=E}t.stateNode=h}else ex(w,t.type,t.stateNode);else t.stateNode=Qg(w,h,t.memoizedProps);else E!==h?(E===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):E.count--,h===null?ex(w,t.type,t.stateNode):Qg(w,h,t.memoizedProps)):h===null&&t.stateNode!==null&&$u(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&&$u(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{es(w,"")}catch(De){ft(t,t.return,De)}}h&4&&t.stateNode!=null&&(w=t.memoizedProps,$u(t,w,a!==null?a.memoizedProps:w)),h&1024&&(Gu=!0);break;case 6:if(kn(n,t),En(t),h&4){if(t.stateNode===null)throw Error(s(162));h=t.memoizedProps,a=t.stateNode;try{a.nodeValue=h}catch(De){ft(t,t.return,De)}}break;case 3:if(yl=null,w=nr,nr=vl(n.containerInfo),kn(n,t),nr=w,En(t),h&4&&a!==null&&a.memoizedState.isDehydrated)try{Ds(n.containerInfo)}catch(De){ft(t,t.return,De)}Gu&&(Gu=!1,eg(t));break;case 4:h=nr,nr=vl(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,il(t,h)));break;case 13:kn(n,t),En(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(al=Me()),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,il(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||Li(t)),a=null,n=t;;){if(n.tag===5||n.tag===26){if(a===null){J=a=n;try{if(E=J.stateNode,w)M=E.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?$g(de,!0):$g(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,il(t,a))));break;case 19:kn(n,t),En(t),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,il(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(Wm(h)){a=h;break}h=h.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var w=a.stateNode,E=qu(t);rl(t,E,w);break;case 5:var M=a.stateNode;a.flags&32&&(es(M,""),a.flags&=-33);var K=qu(t);rl(t,K,M);break;case 3:case 4:var J=a.stateNode.containerInfo,le=qu(t);Wu(t,le,J);break;default:throw Error(s(161))}}catch(he){ft(t,t.return,he)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function eg(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;eg(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;)Km(t,n.alternate,n),n=n.sibling}function Li(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),Li(n);break;case 1:cr(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&$m(n,n.return,a),Li(n);break;case 27:Ta(n.stateNode);case 26:case 5:cr(n,n.return),Li(n);break;case 22:n.memoizedState===null&&Li(n);break;case 30:Li(n);break;default:Li(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,E=n,M=E.flags;switch(E.tag){case 0:case 11:case 15:Rr(w,E,a),ba(4,E);break;case 1:if(Rr(w,E,a),h=E,w=h.stateNode,typeof w.componentDidMount=="function")try{w.componentDidMount()}catch(le){ft(h,h.return,le)}if(h=E,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++)Dp(J[w],K)}catch(le){ft(h,h.return,le)}}a&&M&64&&Um(E),ya(E,E.return);break;case 27:Gm(E);case 26:case 5:Rr(w,E,a),a&&h===null&&M&4&&qm(E),ya(E,E.return);break;case 12:Rr(w,E,a);break;case 31:Rr(w,E,a),a&&M&4&&Zm(w,E);break;case 13:Rr(w,E,a),a&&M&4&&Qm(w,E);break;case 22:E.memoizedState===null&&Rr(w,E,a),ya(E,E.return);break;case 30:break;default:Rr(w,E,a)}n=n.sibling}}function Vu(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&&aa(a))}function Ku(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&aa(t))}function rr(t,n,a,h){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)tg(t,n,a,h),n=n.sibling}function tg(t,n,a,h){var w=n.flags;switch(n.tag){case 0:case 11:case 15:rr(t,n,a,h),w&2048&&ba(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&&aa(t)));break;case 12:if(w&2048){rr(t,n,a,h),t=n.stateNode;try{var E=n.memoizedProps,M=E.id,K=E.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:E=n.stateNode,M=n.alternate,n.memoizedState!==null?E._visibility&2?rr(t,n,a,h):_a(t,n):E._visibility&2?rr(t,n,a,h):(E._visibility|=2,ys(t,n,a,h,(n.subtreeFlags&10256)!==0||!1)),w&2048&&Vu(M,n);break;case 24:rr(t,n,a,h),w&2048&&Ku(n.alternate,n);break;default:rr(t,n,a,h)}}function ys(t,n,a,h,w){for(w=w&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var E=t,M=n,K=a,J=h,le=M.flags;switch(M.tag){case 0:case 11:case 15:ys(E,M,K,J,w),ba(8,M);break;case 23:break;case 22:var he=M.stateNode;M.memoizedState!==null?he._visibility&2?ys(E,M,K,J,w):_a(E,M):(he._visibility|=2,ys(E,M,K,J,w)),w&&le&2048&&Vu(M.alternate,M);break;case 24:ys(E,M,K,J,w),w&&le&2048&&Ku(M.alternate,M);break;default:ys(E,M,K,J,w)}n=n.sibling}}function _a(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:_a(a,h),w&2048&&Vu(h.alternate,h);break;case 24:_a(a,h),w&2048&&Ku(h.alternate,h);break;default:_a(a,h)}n=n.sibling}}var Sa=8192;function _s(t,n,a){if(t.subtreeFlags&Sa)for(t=t.child;t!==null;)ng(t,n,a),t=t.sibling}function ng(t,n,a){switch(t.tag){case 26:_s(t,n,a),t.flags&Sa&&t.memoizedState!==null&&MS(a,nr,t.memoizedState,t.memoizedProps);break;case 5:_s(t,n,a);break;case 3:case 4:var h=nr;nr=vl(t.stateNode.containerInfo),_s(t,n,a),nr=h;break;case 22:t.memoizedState===null&&(h=t.alternate,h!==null&&h.memoizedState!==null?(h=Sa,Sa=16777216,_s(t,n,a),Sa=h):_s(t,n,a));break;default:_s(t,n,a)}}function rg(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 wa(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];tn=h,sg(h,t)}rg(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)ig(t),t=t.sibling}function ig(t){switch(t.tag){case 0:case 11:case 15:wa(t),t.flags&2048&&Jr(9,t,t.return);break;case 3:wa(t);break;case 12:wa(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,sl(t)):wa(t);break;default:wa(t)}}function sl(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];tn=h,sg(h,t)}rg(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:Jr(8,n,n.return),sl(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,sl(n));break;default:sl(n)}t=t.sibling}}function sg(t,n){for(;tn!==null;){var a=tn;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:aa(a.memoizedState.cache)}if(h=a.child,h!==null)h.return=a,tn=h;else e:for(a=t;tn!==null;){h=tn;var w=h.sibling,E=h.return;if(Ym(h),h===a){tn=null;break e}if(w!==null){w.return=E,tn=w;break e}tn=E}}}var X_={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}},Z_=typeof WeakMap=="function"?WeakMap:Map,dt=0,bt=null,Je=null,nt=0,ht=0,Mn=null,ei=!1,Ss=!1,Yu=!1,Or=0,Mt=0,ti=0,Ri=0,Xu=0,In=0,ws=0,Ca=null,jn=null,Zu=!1,al=0,ag=0,ol=1/0,ll=null,ni=null,Xt=0,ri=null,Cs=null,Mr=0,Qu=0,Ju=null,og=null,ka=0,ed=null;function Bn(){return(dt&2)!==0&&nt!==0?nt&-nt:P.T!==null?ad():vr()}function lg(){if(In===0)if((nt&536870912)===0||st){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)&&(ks(t,0),ii(t,nt,In,!1)),Ur(t,a),((dt&2)===0||t!==bt)&&(t===bt&&((dt&2)===0&&(Ri|=a),Mt===4&&ii(t,nt,In,!1)),ur(t))}function cg(t,n,a){if((dt&6)!==0)throw Error(s(327));var h=!a&&(n&127)===0&&(n&t.expiredLanes)===0||Pe(t,n),w=h?eS(t,n):nd(t,n,!0),E=h;do{if(w===0){Ss&&!h&&ii(t,n,0,!1);break}else{if(a=t.current.alternate,E&&!Q_(a)){w=nd(t,n,!1),E=!1;continue}if(w===2){if(E=n,t.errorRecoveryDisabledLanes&E)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=Ca;var J=K.current.memoizedState.isDehydrated;if(J&&(ks(K,M).flags|=256),M=nd(K,M,!1),M!==2){if(Yu&&!J){K.errorRecoveryDisabledLanes|=E,Ri|=E,w=4;break e}E=jn,jn=w,E!==null&&(jn===null?jn=E:jn.push.apply(jn,E))}w=M}if(E=!1,w!==2)continue}}if(w===1){ks(t,0),ii(t,n,0,!0);break}e:{switch(h=t,E=w,E){case 0:case 1:throw Error(s(345));case 4:if((n&4194048)!==n)break;case 6:ii(h,n,In,!ei);break e;case 2:jn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((n&62914560)===n&&(w=al+300-Me(),10<w)){if(ii(h,n,In,!ei),Qe(h,0,!0)!==0)break e;Mr=n,h.timeoutHandle=Pg(ug.bind(null,h,a,jn,ll,Zu,n,In,Ri,ws,ei,E,"Throttled",-0,0),w);break e}ug(h,a,jn,ll,Zu,n,In,Ri,ws,ei,E,null,-0,0)}}break}while(!0);ur(t)}function ug(t,n,a,h,w,E,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},ng(n,E,xe);var De=(E&62914560)===E?al-Me():(E&4194048)===E?ag-Me():0;if(De=IS(xe,De),De!==null){Mr=E,t.cancelPendingCommit=De(vg.bind(null,t,n,E,a,h,w,M,K,J,he,xe,null,ce,de)),ii(t,E,M,!le);return}}vg(t,n,E,a,h,w,M,K,J)}function Q_(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],E=w.getSnapshot;w=w.value;try{if(!Dn(E(),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 ii(t,n,a,h){n&=~Xu,n&=~Ri,t.suspendedLanes|=n,t.pingedLanes&=~n,h&&(t.warmLanes|=n),h=t.expirationTimes;for(var w=n;0<w;){var E=31-lt(w),M=1<<E;h[E]=-1,w&=~M}a!==0&&Ae(t,a,n)}function cl(){return(dt&6)===0?(Ea(0),!1):!0}function td(){if(Je!==null){if(ht===0)var t=Je.return;else t=Je,Cr=Ci=null,xu(t),ms=null,la=0,t=Je;for(;t!==null;)Fm(t.alternate,t),t=t.return;Je=null}}function ks(t,n){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,vS(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),Mr=0,td(),bt=t,Je=a=Sr(t.current,null),nt=n,ht=0,Mn=null,ei=!1,Ss=Pe(t,n),Yu=!1,ws=In=Xu=Ri=ti=Mt=0,jn=Ca=null,Zu=!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),E=1<<w;n|=t[w],h&=~E}return Or=n,Ao(),a}function dg(t,n){Ke=null,P.H=ga,n===ps||n===zo?(n=jp(),ht=3):n===su?(n=jp(),ht=4):ht=n===Ru?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Mn=n,Je===null&&(Mt=1,Qo(t,Gn(n,t.current)))}function hg(){var t=Rn.current;return t===null?!0:(nt&4194048)===nt?Xn===null:(nt&62914560)===nt||(nt&536870912)!==0?t===Xn:!1}function fg(){var t=P.H;return P.H=ga,t===null?ga:t}function pg(){var t=P.A;return P.A=X_,t}function ul(){Mt=4,ei||(nt&4194048)!==nt&&Rn.current!==null||(Ss=!0),(ti&134217727)===0&&(Ri&134217727)===0||bt===null||ii(bt,nt,In,!1)}function nd(t,n,a){var h=dt;dt|=2;var w=fg(),E=pg();(bt!==t||nt!==n)&&(ll=null,ks(t,n)),n=!1;var M=Mt;e:do try{if(ht!==0&&Je!==null){var K=Je,J=Mn;switch(ht){case 8:td(),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,Es(t,K,J,le),a&&Ss){M=0;break e}break;default:le=ht,ht=0,Mn=null,Es(t,K,J,le)}}J_(),M=Mt;break}catch(he){dg(t,he)}while(!0);return n&&t.shellSuspendCounter++,Cr=Ci=null,dt=h,P.H=w,P.A=E,Je===null&&(bt=null,nt=0,Ao()),M}function J_(){for(;Je!==null;)mg(Je)}function eS(t,n){var a=dt;dt|=2;var h=fg(),w=pg();bt!==t||nt!==n?(ll=null,ol=Me()+500,ks(t,n)):Ss=Pe(t,n);e:do try{if(ht!==0&&Je!==null){n=Je;var E=Mn;t:switch(ht){case 1:ht=0,Mn=null,Es(t,n,E,1);break;case 2:case 9:if(kp(E)){ht=0,Mn=null,gg(n);break}n=function(){ht!==2&&ht!==9||bt!==t||(ht=7),ur(t)},E.then(n,n);break e;case 3:ht=7;break e;case 4:ht=5;break e;case 7:kp(E)?(ht=0,Mn=null,gg(n)):(ht=0,Mn=null,Es(t,n,E,7));break;case 5:var M=null;switch(Je.tag){case 26:M=Je.memoizedState;case 5:case 27:var K=Je;if(M?tx(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,dl(le)):Je=null}break t}}ht=0,Mn=null,Es(t,n,E,5);break;case 6:ht=0,Mn=null,Es(t,n,E,6);break;case 8:td(),Mt=6;break e;default:throw Error(s(462))}}tS();break}catch(he){dg(t,he)}while(!0);return Cr=Ci=null,P.H=h,P.A=w,dt=a,Je!==null?0:(bt=null,nt=0,Ao(),Mt)}function tS(){for(;Je!==null&&!pe();)mg(Je)}function mg(t){var n=Hm(t.alternate,t,Or);t.memoizedProps=t.pendingProps,n===null?dl(t):Je=n}function gg(t){var n=t,a=n.alternate;switch(n.tag){case 15:case 0:n=Rm(a,n,n.pendingProps,n.type,void 0,nt);break;case 11:n=Rm(a,n,n.pendingProps,n.type.render,n.ref,nt);break;case 5:xu(n);default:Fm(a,n),n=Je=pp(n,Or),n=Hm(a,n,Or)}t.memoizedProps=t.pendingProps,n===null?dl(t):Je=n}function Es(t,n,a,h){Cr=Ci=null,xu(n),ms=null,la=0;var w=n.return;try{if($_(t,w,n,a,nt)){Mt=1,Qo(t,Gn(a,t.current)),Je=null;return}}catch(E){if(w!==null)throw Je=w,E;Mt=1,Qo(t,Gn(a,t.current)),Je=null;return}n.flags&32768?(st||h===1?t=!0:Ss||(nt&536870912)!==0?t=!1:(ei=t=!0,(h===2||h===9||h===3||h===6)&&(h=Rn.current,h!==null&&h.tag===13&&(h.flags|=16384))),xg(n,t)):dl(n)}function dl(t){var n=t;do{if((n.flags&32768)!==0){xg(n,ei);return}t=n.return;var a=G_(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 xg(t,n){do{var a=V_(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 vg(t,n,a,h,w,E,M,K,J){t.cancelPendingCommit=null;do hl();while(Xt!==0);if((dt&6)!==0)throw Error(s(327));if(n!==null){if(n===t.current)throw Error(s(177));if(E=n.lanes|n.childLanes,E|=qc,se(t,a,E,M,K,J),t===bt&&(Je=bt=null,nt=0),Cs=n,ri=t,Mr=a,Qu=E,Ju=w,og=h,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,sS(Te,function(){return wg(),null})):(t.callbackNode=null,t.callbackPriority=0),h=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||h){h=P.T,P.T=null,w=X.p,X.p=2,M=dt,dt|=4;try{K_(t,n,a)}finally{dt=M,X.p=w,P.T=h}}Xt=1,bg(),yg(),_g()}}function bg(){if(Xt===1){Xt=0;var t=ri,n=Cs,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=P.T,P.T=null;var h=X.p;X.p=2;var w=dt;dt|=4;try{Jm(n,t);var E=pd,M=sp(t.containerInfo),K=E.focusedElem,J=E.selectionRange;if(M!==K&&K&&K.ownerDocument&&ip(K.ownerDocument.documentElement,K)){if(J!==null&&Hc(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 ie=rp(K,Fe),te=rp(K,vt);if(ie&&te&&(de.rangeCount!==1||de.anchorNode!==ie.node||de.anchorOffset!==ie.offset||de.focusNode!==te.node||de.focusOffset!==te.offset)){var ae=xe.createRange();ae.setStart(ie.node,ie.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}}Cl=!!fd,pd=fd=null}finally{dt=w,X.p=h,P.T=a}}t.current=n,Xt=2}}function yg(){if(Xt===2){Xt=0;var t=ri,n=Cs,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=P.T,P.T=null;var h=X.p;X.p=2;var w=dt;dt|=4;try{Km(t,n.alternate,n)}finally{dt=w,X.p=h,P.T=a}}Xt=3}}function _g(){if(Xt===4||Xt===3){Xt=0,Ne();var t=ri,n=Cs,a=Mr,h=og;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Xt=5:(Xt=0,Cs=ri=null,Sg(t,t.pendingLanes));var w=t.pendingLanes;if(w===0&&(ni=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=P.T,w=X.p,X.p=2,P.T=null;try{for(var E=t.onRecoverableError,M=0;M<h.length;M++){var K=h[M];E(K.value,{componentStack:K.stack})}}finally{P.T=n,X.p=w}}(Mr&3)!==0&&hl(),ur(t),w=t.pendingLanes,(a&261930)!==0&&(w&42)!==0?t===ed?ka++:(ka=0,ed=t):ka=0,Ea(0)}}function Sg(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,aa(n)))}function hl(){return bg(),yg(),_g(),wg()}function wg(){if(Xt!==5)return!1;var t=ri,n=Qu;Qu=0;var a=yn(Mr),h=P.T,w=X.p;try{X.p=32>a?32:a,P.T=null,a=Ju,Ju=null;var E=ri,M=Mr;if(Xt=0,Cs=ri=null,Mr=0,(dt&6)!==0)throw Error(s(331));var K=dt;if(dt|=4,ig(E.current),tg(E,E.current,M,a),dt=K,Ea(0,!1),mt&&typeof mt.onPostCommitFiberRoot=="function")try{mt.onPostCommitFiberRoot(Dt,E)}catch{}return!0}finally{X.p=w,P.T=h,Sg(t,n)}}function Cg(t,n,a){n=Gn(a,n),n=Lu(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)Cg(t,t,a);else for(;n!==null;){if(n.tag===3){Cg(n,t,a);break}else if(n.tag===1){var h=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(ni===null||!ni.has(h))){t=Gn(a,t),a=km(2),h=Xr(n,a,2),h!==null&&(Em(a,h,n,t),Ur(h,2),ur(h));break}}n=n.return}}function rd(t,n,a){var h=t.pingCache;if(h===null){h=t.pingCache=new Z_;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)||(Yu=!0,w.add(a),t=nS.bind(null,t,n,a),n.then(t,t))}function nS(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()-al?(dt&2)===0&&ks(t,0):Xu|=a,ws===nt&&(ws=0)),ur(t)}function kg(t,n){n===0&&(n=Rt()),t=_i(t,n),t!==null&&(Ur(t,n),ur(t))}function rS(t){var n=t.memoizedState,a=0;n!==null&&(a=n.retryLane),kg(t,a)}function iS(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(s(314))}h!==null&&h.delete(n),kg(t,a)}function sS(t,n){return Ue(t,n)}var fl=null,js=null,id=!1,pl=!1,sd=!1,si=0;function ur(t){t!==js&&t.next===null&&(js===null?fl=js=t:js=js.next=t),pl=!0,id||(id=!0,oS())}function Ea(t,n){if(!sd&&pl){sd=!0;do for(var a=!1,h=fl;h!==null;){if(t!==0){var w=h.pendingLanes;if(w===0)var E=0;else{var M=h.suspendedLanes,K=h.pingedLanes;E=(1<<31-lt(42|t)+1)-1,E&=w&~(M&~K),E=E&201326741?E&201326741|1:E?E|2:0}E!==0&&(a=!0,Tg(h,E))}else E=nt,E=Qe(h,h===bt?E:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(E&3)===0||Pe(h,E)||(a=!0,Tg(h,E));h=h.next}while(a);sd=!1}}function aS(){Eg()}function Eg(){pl=id=!1;var t=0;si!==0&&xS()&&(t=si);for(var n=Me(),a=null,h=fl;h!==null;){var w=h.next,E=jg(h,n);E===0?(h.next=null,a===null?fl=w:a.next=w,w===null&&(js=a)):(a=h,(t!==0||(E&3)!==0)&&(pl=!0)),h=w}Xt!==0&&Xt!==5||Ea(t),si!==0&&(si=0)}function jg(t,n){for(var a=t.suspendedLanes,h=t.pingedLanes,w=t.expirationTimes,E=t.pendingLanes&-62914561;0<E;){var M=31-lt(E),K=1<<M,J=w[M];J===-1?((K&a)===0||(K&h)!==0)&&(w[M]=Yt(K,n)):J<=n&&(t.expiredLanes|=K),E&=~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=Ng.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 Ng(t,n){if(Xt!==0&&Xt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if(hl()&&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:(cg(t,h,n),jg(t,Me()),t.callbackNode!=null&&t.callbackNode===a?Ng.bind(null,t):null)}function Tg(t,n){if(hl())return null;cg(t,n,!0)}function oS(){bS(function(){(dt&6)!==0?Ue(ue,aS):Eg()})}function ad(){if(si===0){var t=hs;t===0&&(t=me,me<<=1,(me&261888)===0&&(me=256)),si=t}return si}function Ag(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:So(""+t)}function Dg(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 lS(t,n,a,h,w){if(n==="submit"&&a&&a.stateNode===w){var E=Ag((w[Sn]||null).action),M=h.submitter;M&&(n=(n=M[Sn]||null)?Ag(n.formAction):M.getAttribute("formAction"),n!==null&&(E=n,M=null));var K=new Eo("action","action",null,h,w);t.push({event:K,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(si!==0){var J=M?Dg(w,M):new FormData(w);Eu(a,{pending:!0,data:J,method:w.method,action:E},null,J)}}else typeof E=="function"&&(K.preventDefault(),J=M?Dg(w,M):new FormData(w),Eu(a,{pending:!0,data:J,method:w.method,action:E},E,J))},currentTarget:w}]})}}for(var od=0;od<$c.length;od++){var ld=$c[od],cS=ld.toLowerCase(),uS=ld[0].toUpperCase()+ld.slice(1);tr(cS,"on"+uS)}tr(lp,"onAnimationEnd"),tr(cp,"onAnimationIteration"),tr(up,"onAnimationStart"),tr("dblclick","onDoubleClick"),tr("focusin","onFocus"),tr("focusout","onBlur"),tr(E_,"onTransitionRun"),tr(j_,"onTransitionStart"),tr(N_,"onTransitionCancel"),tr(dp,"onTransitionEnd"),Qi("onMouseEnter",["mouseout","mouseover"]),Qi("onMouseLeave",["mouseout","mouseover"]),Qi("onPointerEnter",["pointerout","pointerover"]),Qi("onPointerLeave",["pointerout","pointerover"]),xi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),xi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),xi("onBeforeInput",["compositionend","keypress","textInput","paste"]),xi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),xi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),xi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ja="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(" "),dS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ja));function Lg(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 E=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!==E&&w.isPropagationStopped())break e;E=K,w.currentTarget=le;try{E(w)}catch(he){To(he)}w.currentTarget=null,E=J}else for(M=0;M<h.length;M++){if(K=h[M],J=K.instance,le=K.currentTarget,K=K.listener,J!==E&&w.isPropagationStopped())break e;E=K,w.currentTarget=le;try{E(w)}catch(he){To(he)}w.currentTarget=null,E=J}}}}function et(t,n){var a=n[_c];a===void 0&&(a=n[_c]=new Set);var h=t+"__bubble";a.has(h)||(Rg(n,t,2,!1),a.add(h))}function cd(t,n,a){var h=0;n&&(h|=4),Rg(a,t,h,n)}var ml="_reactListening"+Math.random().toString(36).slice(2);function ud(t){if(!t[ml]){t[ml]=!0,Ef.forEach(function(a){a!=="selectionchange"&&(dS.has(a)||cd(a,!1,t),cd(a,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[ml]||(n[ml]=!0,cd("selectionchange",!1,n))}}function Rg(t,n,a,h){switch(lx(n)){case 2:var w=HS;break;case 8:w=PS;break;default:w=kd}a=w.bind(null,n,a,t),w=void 0,!Ac||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 dd(t,n,a,h,w){var E=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=Yi(K),M===null)return;if(J=M.tag,J===5||J===6||J===26||J===27){h=E=M;continue e}K=K.parentNode}}h=h.return}zf(function(){var le=E,he=Nc(a),xe=[];e:{var ce=hp.get(t);if(ce!==void 0){var de=Eo,De=t;switch(t){case"keypress":if(Co(a)===0)break e;case"keydown":case"keyup":de=i_;break;case"focusin":De="focus",de=Oc;break;case"focusout":De="blur",de=Oc;break;case"beforeblur":case"afterblur":de=Oc;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=Ff;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":de=G0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":de=o_;break;case lp:case cp:case up:de=Y0;break;case dp:de=c_;break;case"scroll":case"scrollend":de=q0;break;case"wheel":de=d_;break;case"copy":case"cut":case"paste":de=Z0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":de=$f;break;case"toggle":case"beforetoggle":de=f_}var Fe=(n&4)!==0,vt=!Fe&&(t==="scroll"||t==="scrollend"),ie=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||ie===null||(ge=Ys(te,ie),ge!=null&&Fe.push(Na(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!==jc&&(De=a.relatedTarget||a.fromElement)&&(Yi(De)||De[Ki]))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?Yi(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=Ff,ge="onMouseLeave",ie="onMouseEnter",te="mouse",(t==="pointerout"||t==="pointerover")&&(Fe=$f,ge="onPointerLeave",ie="onPointerEnter",te="pointer"),vt=de==null?ce:Ks(de),ae=De==null?ce:Ks(De),ce=new Fe(ge,te+"leave",de,a,he),ce.target=vt,ce.relatedTarget=ae,ge=null,Yi(he)===le&&(Fe=new Fe(ie,te+"enter",De,a,he),Fe.target=ae,Fe.relatedTarget=vt,ge=Fe),vt=ge,de&&De)t:{for(Fe=hS,ie=de,te=De,ae=0,ge=ie;ge;ge=Fe(ge))ae++;ge=0;for(var Be=te;Be;Be=Fe(Be))ge++;for(;0<ae-ge;)ie=Fe(ie),ae--;for(;0<ge-ae;)te=Fe(te),ge--;for(;ae--;){if(ie===te||te!==null&&ie===te.alternate){Fe=ie;break t}ie=Fe(ie),te=Fe(te)}Fe=null}else Fe=null;de!==null&&Og(xe,ce,de,Fe,!1),De!==null&&vt!==null&&Og(xe,vt,De,Fe,!0)}}e:{if(ce=le?Ks(le):window,de=ce.nodeName&&ce.nodeName.toLowerCase(),de==="select"||de==="input"&&ce.type==="file")var ct=Zf;else if(Yf(ce))if(Qf)ct=w_;else{ct=__;var Re=y_}else de=ce.nodeName,!de||de.toLowerCase()!=="input"||ce.type!=="checkbox"&&ce.type!=="radio"?le&&Ec(le.elementType)&&(ct=Zf):ct=S_;if(ct&&(ct=ct(t,le))){Xf(xe,ct,a,he);break e}Re&&Re(t,ce,le),t==="focusout"&&le&&ce.type==="number"&&le.memoizedProps.value!=null&&kc(ce,"number",ce.value)}switch(Re=le?Ks(le):window,t){case"focusin":(Yf(Re)||Re.contentEditable==="true")&&(is=Re,Pc=le,ra=null);break;case"focusout":ra=Pc=is=null;break;case"mousedown":Fc=!0;break;case"contextmenu":case"mouseup":case"dragend":Fc=!1,ap(xe,a,he);break;case"selectionchange":if(k_)break;case"keydown":case"keyup":ap(xe,a,he)}var Xe;if(Ic)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 rs?Vf(t,a)&&(rt="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(rt="onCompositionStart");rt&&(qf&&a.locale!=="ko"&&(rs||rt!=="onCompositionStart"?rt==="onCompositionEnd"&&rs&&(Xe=Hf()):($r=he,Dc="value"in $r?$r.value:$r.textContent,rs=!0)),Re=gl(le,rt),0<Re.length&&(rt=new Uf(rt,t,null,a,he),xe.push({event:rt,listeners:Re}),Xe?rt.data=Xe:(Xe=Kf(a),Xe!==null&&(rt.data=Xe)))),(Xe=m_?g_(t,a):x_(t,a))&&(rt=gl(le,"onBeforeInput"),0<rt.length&&(Re=new Uf("onBeforeInput","beforeinput",null,a,he),xe.push({event:Re,listeners:rt}),Re.data=Xe)),lS(xe,t,le,a,he)}Lg(xe,n)})}function Na(t,n,a){return{instance:t,listener:n,currentTarget:a}}function gl(t,n){for(var a=n+"Capture",h=[];t!==null;){var w=t,E=w.stateNode;if(w=w.tag,w!==5&&w!==26&&w!==27||E===null||(w=Ys(t,a),w!=null&&h.unshift(Na(t,w,E)),w=Ys(t,n),w!=null&&h.push(Na(t,w,E))),t.tag===3)return h;t=t.return}return[]}function hS(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Og(t,n,a,h,w){for(var E=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=Ys(a,E),le!=null&&M.unshift(Na(a,le,J))):w||(le=Ys(a,E),le!=null&&M.push(Na(a,le,J)))),a=a.return}M.length!==0&&t.push({event:n,listeners:M})}var fS=/\r\n?/g,pS=/\u0000|\uFFFD/g;function Mg(t){return(typeof t=="string"?t:""+t).replace(fS,`
|
|
49
|
-
`).replace(pS,"")}function Ig(t,n){return n=Mg(n),Mg(t)===n}function xt(t,n,a,h,w,E){switch(a){case"children":typeof h=="string"?n==="body"||n==="textarea"&&h===""||es(t,h):(typeof h=="number"||typeof h=="bigint")&&n!=="body"&&es(t,""+h);break;case"className":yo(t,"class",h);break;case"tabIndex":yo(t,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":yo(t,a,h);break;case"style":If(t,h,E);break;case"data":if(n!=="object"){yo(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=So(""+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 E=="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=So(""+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(s(61));if(a=h.__html,a!=null){if(w.children!=null)throw Error(s(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=So(""+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),bo(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":bo(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=U0.get(a)||a,bo(t,a,h))}}function hd(t,n,a,h,w,E){switch(a){case"style":If(t,h,E);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(s(61));if(a=h.__html,a!=null){if(w.children!=null)throw Error(s(60));t.innerHTML=a}}break;case"children":typeof h=="string"?es(t,h):(typeof h=="number"||typeof h=="bigint")&&es(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(!jf.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(w=a.endsWith("Capture"),n=a.slice(2,w?a.length-7:void 0),E=t[Sn]||null,E=E!=null?E[a]:null,typeof E=="function"&&t.removeEventListener(n,E,w),typeof h=="function")){typeof E!="function"&&E!==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,""):bo(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,E;for(E in a)if(a.hasOwnProperty(E)){var M=a[E];if(M!=null)switch(E){case"src":h=!0;break;case"srcSet":w=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:xt(t,n,E,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=E=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":E=he;break;case"defaultValue":K=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(s(137,n));break;default:xt(t,n,h,he,a,null)}}Lf(t,E,K,J,le,M,w,!1);return;case"select":et("invalid",t),h=M=E=null;for(w in a)if(a.hasOwnProperty(w)&&(K=a[w],K!=null))switch(w){case"value":E=K;break;case"defaultValue":M=K;break;case"multiple":h=K;default:xt(t,n,w,K,a,null)}n=E,a=M,t.multiple=!!h,n!=null?Ji(t,!!h,n,!1):a!=null&&Ji(t,!!h,a,!0);return;case"textarea":et("invalid",t),E=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":E=K;break;case"dangerouslySetInnerHTML":if(K!=null)throw Error(s(91));break;default:xt(t,n,M,K,a,null)}Of(t,h,w,E);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<ja.length;h++)et(ja[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(s(137,n));default:xt(t,n,le,h,a,null)}return;default:if(Ec(n)){for(he in a)a.hasOwnProperty(he)&&(h=a[he],h!==void 0&&hd(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 mS(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,E=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":E=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(s(137,n));break;default:de!==xe&&xt(t,n,ce,de,h,xe)}}Cc(t,M,K,J,le,he,E,w);return;case"select":de=M=K=ce=null;for(E in a)if(J=a[E],a.hasOwnProperty(E)&&J!=null)switch(E){case"value":break;case"multiple":de=J;default:h.hasOwnProperty(E)||xt(t,n,E,null,h,J)}for(w in h)if(E=h[w],J=a[w],h.hasOwnProperty(w)&&(E!=null||J!=null))switch(w){case"value":ce=E;break;case"defaultValue":K=E;break;case"multiple":M=E;default:E!==J&&xt(t,n,w,E,h,J)}n=K,a=M,h=de,ce!=null?Ji(t,!!a,ce,!1):!!h!=!!a&&(n!=null?Ji(t,!!a,n,!0):Ji(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],E=a[M],h.hasOwnProperty(M)&&(w!=null||E!=null))switch(M){case"value":ce=w;break;case"defaultValue":de=w;break;case"children":break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(s(91));break;default:w!==E&&xt(t,n,M,w,h,E)}Rf(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(s(137,n));break;default:xt(t,n,le,ce,h,de)}return;default:if(Ec(n)){for(var vt in a)ce=a[vt],a.hasOwnProperty(vt)&&ce!==void 0&&!h.hasOwnProperty(vt)&&hd(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||hd(t,n,he,ce,h,de);return}}for(var ie in a)ce=a[ie],a.hasOwnProperty(ie)&&ce!=null&&!h.hasOwnProperty(ie)&&xt(t,n,ie,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 Bg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function gS(){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],E=w.transferSize,M=w.initiatorType,K=w.duration;if(E&&K&&Bg(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&&Bg(xe)&&(J=J.responseEnd,M+=he*(J<K?1:(K-le)/(J-le)))}if(--h,n+=8*(E+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 fd=null,pd=null;function xl(t){return t.nodeType===9?t:t.ownerDocument}function zg(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 Hg(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 md(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 gd=null;function xS(){var t=window.event;return t&&t.type==="popstate"?t===gd?!1:(gd=t,!0):(gd=null,!1)}var Pg=typeof setTimeout=="function"?setTimeout:void 0,vS=typeof clearTimeout=="function"?clearTimeout:void 0,Fg=typeof Promise=="function"?Promise:void 0,bS=typeof queueMicrotask=="function"?queueMicrotask:typeof Fg<"u"?function(t){return Fg.resolve(null).then(t).catch(yS)}:Pg;function yS(t){setTimeout(function(){throw t})}function ai(t){return t==="head"}function Ug(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),Ds(n);return}h--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")h++;else if(a==="html")Ta(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,Ta(a);for(var E=a.firstChild;E;){var M=E.nextSibling,K=E.nodeName;E[Vs]||K==="SCRIPT"||K==="STYLE"||K==="LINK"&&E.rel.toLowerCase()==="stylesheet"||a.removeChild(E),E=M}}else a==="body"&&Ta(t.ownerDocument.body);a=w}while(a);Ds(n)}function $g(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 xd(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":xd(a),Sc(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function _S(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[Vs])switch(n){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(E=t.getAttribute("rel"),E==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(E!==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(E=t.getAttribute("src"),(E!==(w.src==null?null:w.src)||t.getAttribute("type")!==(w.type==null?null:w.type)||t.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin))&&E&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(n==="input"&&t.type==="hidden"){var E=w.name==null?null:""+w.name;if(w.type==="hidden"&&t.getAttribute("name")===E)return t}else return t;if(t=Zn(t.nextSibling),t===null)break}return null}function SS(t,n,a){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Zn(t.nextSibling),t===null))return null;return t}function qg(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=Zn(t.nextSibling),t===null))return null;return t}function vd(t){return t.data==="$?"||t.data==="$~"}function bd(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function wS(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 Zn(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 yd=null;function Wg(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"||a==="/&"){if(n===0)return Zn(t.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}t=t.nextSibling}return null}function Gg(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 Vg(t,n,a){switch(n=xl(a),t){case"html":if(t=n.documentElement,!t)throw Error(s(452));return t;case"head":if(t=n.head,!t)throw Error(s(453));return t;case"body":if(t=n.body,!t)throw Error(s(454));return t;default:throw Error(s(451))}}function Ta(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);Sc(t)}var Qn=new Map,Kg=new Set;function vl(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Ir=X.d;X.d={f:CS,r:kS,D:ES,C:jS,L:NS,m:TS,X:DS,S:AS,M:LS};function CS(){var t=Ir.f(),n=cl();return t||n}function kS(t){var n=Xi(t);n!==null&&n.tag===5&&n.type==="form"?dm(n):Ir.r(t)}var Ns=typeof document>"u"?null:document;function Yg(t,n,a){var h=Ns;if(h&&typeof n=="string"&&n){var w=qn(n);w='link[rel="'+t+'"][href="'+w+'"]',typeof a=="string"&&(w+='[crossorigin="'+a+'"]'),Kg.has(w)||(Kg.add(w),t={rel:t,crossOrigin:a,href:n},h.querySelector(w)===null&&(n=h.createElement("link"),un(n,"link",t),en(n),h.head.appendChild(n)))}}function ES(t){Ir.D(t),Yg("dns-prefetch",t,null)}function jS(t,n){Ir.C(t,n),Yg("preconnect",t,n)}function NS(t,n,a){Ir.L(t,n,a);var h=Ns;if(h&&t&&n){var w='link[rel="preload"][as="'+qn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(w+='[imagesrcset="'+qn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(w+='[imagesizes="'+qn(a.imageSizes)+'"]')):w+='[href="'+qn(t)+'"]';var E=w;switch(n){case"style":E=Ts(t);break;case"script":E=As(t)}Qn.has(E)||(t=m({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:t,as:n},a),Qn.set(E,t),h.querySelector(w)!==null||n==="style"&&h.querySelector(Aa(E))||n==="script"&&h.querySelector(Da(E))||(n=h.createElement("link"),un(n,"link",t),en(n),h.head.appendChild(n)))}}function TS(t,n){Ir.m(t,n);var a=Ns;if(a&&t){var h=n&&typeof n.as=="string"?n.as:"script",w='link[rel="modulepreload"][as="'+qn(h)+'"][href="'+qn(t)+'"]',E=w;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":E=As(t)}if(!Qn.has(E)&&(t=m({rel:"modulepreload",href:t},n),Qn.set(E,t),a.querySelector(w)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Da(E)))return}h=a.createElement("link"),un(h,"link",t),en(h),a.head.appendChild(h)}}}function AS(t,n,a){Ir.S(t,n,a);var h=Ns;if(h&&t){var w=Zi(h).hoistableStyles,E=Ts(t);n=n||"default";var M=w.get(E);if(!M){var K={loading:0,preload:null};if(M=h.querySelector(Aa(E)))K.loading=5;else{t=m({rel:"stylesheet",href:t,"data-precedence":n},a),(a=Qn.get(E))&&_d(t,a);var J=M=h.createElement("link");en(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,bl(M,n,h)}M={type:"stylesheet",instance:M,count:1,state:K},w.set(E,M)}}}function DS(t,n){Ir.X(t,n);var a=Ns;if(a&&t){var h=Zi(a).hoistableScripts,w=As(t),E=h.get(w);E||(E=a.querySelector(Da(w)),E||(t=m({src:t,async:!0},n),(n=Qn.get(w))&&Sd(t,n),E=a.createElement("script"),en(E),un(E,"link",t),a.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},h.set(w,E))}}function LS(t,n){Ir.M(t,n);var a=Ns;if(a&&t){var h=Zi(a).hoistableScripts,w=As(t),E=h.get(w);E||(E=a.querySelector(Da(w)),E||(t=m({src:t,async:!0,type:"module"},n),(n=Qn.get(w))&&Sd(t,n),E=a.createElement("script"),en(E),un(E,"link",t),a.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},h.set(w,E))}}function Xg(t,n,a,h){var w=(w=ee.current)?vl(w):null;if(!w)throw Error(s(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=Ts(a.href),a=Zi(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=Ts(a.href);var E=Zi(w).hoistableStyles,M=E.get(t);if(M||(w=w.ownerDocument||w,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},E.set(t,M),(E=w.querySelector(Aa(t)))&&!E._p&&(M.instance=E,M.state.loading=5),Qn.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},Qn.set(t,a),E||RS(w,t,a,M.state))),n&&h===null)throw Error(s(528,""));return M}if(n&&h!==null)throw Error(s(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=As(a),a=Zi(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(s(444,t))}}function Ts(t){return'href="'+qn(t)+'"'}function Aa(t){return'link[rel="stylesheet"]['+t+"]"}function Zg(t){return m({},t,{"data-precedence":t.precedence,precedence:null})}function RS(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),en(n),t.head.appendChild(n))}function As(t){return'[src="'+qn(t)+'"]'}function Da(t){return"script[async]"+t}function Qg(t,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var h=t.querySelector('style[data-href~="'+qn(a.href)+'"]');if(h)return n.instance=h,en(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"),en(h),un(h,"style",w),bl(h,a.precedence,t),n.instance=h;case"stylesheet":w=Ts(a.href);var E=t.querySelector(Aa(w));if(E)return n.state.loading|=4,n.instance=E,en(E),E;h=Zg(a),(w=Qn.get(w))&&_d(h,w),E=(t.ownerDocument||t).createElement("link"),en(E);var M=E;return M._p=new Promise(function(K,J){M.onload=K,M.onerror=J}),un(E,"link",h),n.state.loading|=4,bl(E,a.precedence,t),n.instance=E;case"script":return E=As(a.src),(w=t.querySelector(Da(E)))?(n.instance=w,en(w),w):(h=a,(w=Qn.get(E))&&(h=m({},a),Sd(h,w)),t=t.ownerDocument||t,w=t.createElement("script"),en(w),un(w,"link",h),t.head.appendChild(w),n.instance=w);case"void":return null;default:throw Error(s(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(h=n.instance,n.state.loading|=4,bl(h,a.precedence,t));return n.instance}function bl(t,n,a){for(var h=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),w=h.length?h[h.length-1]:null,E=w,M=0;M<h.length;M++){var K=h[M];if(K.dataset.precedence===n)E=K;else if(E!==w)break}E?E.parentNode.insertBefore(t,E.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(t,n.firstChild))}function _d(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function Sd(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var yl=null;function Jg(t,n,a){if(yl===null){var h=new Map,w=yl=new Map;w.set(a,h)}else w=yl,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 E=a[w];if(!(E[Vs]||E[an]||t==="link"&&E.getAttribute("rel")==="stylesheet")&&E.namespaceURI!=="http://www.w3.org/2000/svg"){var M=E.getAttribute(n)||"";M=t+M;var K=h.get(M);K?K.push(E):h.set(M,[E])}}return h}function ex(t,n,a){t=t.ownerDocument||t,t.head.insertBefore(a,n==="title"?t.querySelector("head > title"):null)}function OS(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 tx(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function MS(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=Ts(h.href),E=n.querySelector(Aa(w));if(E){n=E._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=_l.bind(t),n.then(t,t)),a.state.loading|=4,a.instance=E,en(E);return}E=n.ownerDocument||n,h=Zg(h),(w=Qn.get(w))&&_d(h,w),E=E.createElement("link"),en(E);var M=E;M._p=new Promise(function(K,J){M.onload=K,M.onerror=J}),un(E,"link",h),a.instance=E}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=_l.bind(t),n.addEventListener("load",a),n.addEventListener("error",a))}}var wd=0;function IS(t,n){return t.stylesheets&&t.count===0&&wl(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var h=setTimeout(function(){if(t.stylesheets&&wl(t,t.stylesheets),t.unsuspend){var E=t.unsuspend;t.unsuspend=null,E()}},6e4+n);0<t.imgBytes&&wd===0&&(wd=62500*gS());var w=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&wl(t,t.stylesheets),t.unsuspend)){var E=t.unsuspend;t.unsuspend=null,E()}},(t.imgBytes>wd?50:800)+n);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(h),clearTimeout(w)}}:null}function _l(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)wl(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Sl=null;function wl(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Sl=new Map,n.forEach(BS,t),Sl=null,_l.call(t))}function BS(t,n){if(!(n.state.loading&4)){var a=Sl.get(t);if(a)var h=a.get(null);else{a=new Map,Sl.set(t,a);for(var w=t.querySelectorAll("link[data-precedence],style[data-precedence]"),E=0;E<w.length;E++){var M=w[E];(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"),E=a.get(M)||h,E===h&&a.set(null,w),a.set(M,w),this.count++,h=_l.bind(this),w.addEventListener("load",h),w.addEventListener("error",h),E?E.parentNode.insertBefore(w,E.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(w,t.firstChild)),n.state.loading|=4}}var La={$$typeof:S,Provider:null,Consumer:null,_currentValue:Z,_currentValue2:Z,_threadCount:0};function zS(t,n,a,h,w,E,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=E,this.onRecoverableError=M,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=J,this.incompleteTransitions=new Map}function nx(t,n,a,h,w,E,M,K,J,le,he,xe){return t=new zS(t,n,a,M,J,le,he,xe,K),n=1,E===!0&&(n|=24),E=Ln(3,null,null,n),t.current=E,E.stateNode=t,n=nu(),n.refCount++,t.pooledCache=n,n.refCount++,E.memoizedState={element:h,isDehydrated:a,cache:n},au(E),t}function rx(t){return t?(t=os,t):os}function ix(t,n,a,h,w,E){w=rx(w),h.context===null?h.context=w:h.pendingContext=w,h=Yr(n),h.payload={element:a},E=E===void 0?null:E,E!==null&&(h.callback=E),a=Xr(t,h,n),a!==null&&(Nn(a,t,n),ua(a,t,n))}function sx(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<n?a:n}}function Cd(t,n){sx(t,n),(t=t.alternate)&&sx(t,n)}function ax(t){if(t.tag===13||t.tag===31){var n=_i(t,67108864);n!==null&&Nn(n,t,67108864),Cd(t,67108864)}}function ox(t){if(t.tag===13||t.tag===31){var n=Bn();n=Jt(n);var a=_i(t,n);a!==null&&Nn(a,t,n),Cd(t,n)}}var Cl=!0;function HS(t,n,a,h){var w=P.T;P.T=null;var E=X.p;try{X.p=2,kd(t,n,a,h)}finally{X.p=E,P.T=w}}function PS(t,n,a,h){var w=P.T;P.T=null;var E=X.p;try{X.p=8,kd(t,n,a,h)}finally{X.p=E,P.T=w}}function kd(t,n,a,h){if(Cl){var w=Ed(h);if(w===null)dd(t,n,h,kl,a),cx(t,h);else if(US(w,t,n,a,h))h.stopPropagation();else if(cx(t,h),n&4&&-1<FS.indexOf(t)){for(;w!==null;){var E=Xi(w);if(E!==null)switch(E.tag){case 3:if(E=E.stateNode,E.current.memoizedState.isDehydrated){var M=Ge(E.pendingLanes);if(M!==0){var K=E;for(K.pendingLanes|=2,K.entangledLanes|=2;M;){var J=1<<31-lt(M);K.entanglements[1]|=J,M&=~J}ur(E),(dt&6)===0&&(ol=Me()+500,Ea(0))}}break;case 31:case 13:K=_i(E,2),K!==null&&Nn(K,E,2),cl(),Cd(E,2)}if(E=Ed(h),E===null&&dd(t,n,h,kl,a),E===w)break;w=E}w!==null&&h.stopPropagation()}else dd(t,n,h,null,a)}}function Ed(t){return t=Nc(t),jd(t)}var kl=null;function jd(t){if(kl=null,t=Yi(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 kl=t,null}function lx(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 Nd=!1,oi=null,li=null,ci=null,Ra=new Map,Oa=new Map,ui=[],FS="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 cx(t,n){switch(t){case"focusin":case"focusout":oi=null;break;case"dragenter":case"dragleave":li=null;break;case"mouseover":case"mouseout":ci=null;break;case"pointerover":case"pointerout":Ra.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Oa.delete(n.pointerId)}}function Ma(t,n,a,h,w,E){return t===null||t.nativeEvent!==E?(t={blockedOn:n,domEventName:a,eventSystemFlags:h,nativeEvent:E,targetContainers:[w]},n!==null&&(n=Xi(n),n!==null&&ax(n)),t):(t.eventSystemFlags|=h,n=t.targetContainers,w!==null&&n.indexOf(w)===-1&&n.push(w),t)}function US(t,n,a,h,w){switch(n){case"focusin":return oi=Ma(oi,t,n,a,h,w),!0;case"dragenter":return li=Ma(li,t,n,a,h,w),!0;case"mouseover":return ci=Ma(ci,t,n,a,h,w),!0;case"pointerover":var E=w.pointerId;return Ra.set(E,Ma(Ra.get(E)||null,t,n,a,h,w)),!0;case"gotpointercapture":return E=w.pointerId,Oa.set(E,Ma(Oa.get(E)||null,t,n,a,h,w)),!0}return!1}function ux(t){var n=Yi(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,Vi(t.priority,function(){ox(a)});return}}else if(n===31){if(n=l(a),n!==null){t.blockedOn=n,Vi(t.priority,function(){ox(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 El(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var a=Ed(t.nativeEvent);if(a===null){a=t.nativeEvent;var h=new a.constructor(a.type,a);jc=h,a.target.dispatchEvent(h),jc=null}else return n=Xi(a),n!==null&&ax(n),t.blockedOn=a,!1;n.shift()}return!0}function dx(t,n,a){El(t)&&a.delete(n)}function $S(){Nd=!1,oi!==null&&El(oi)&&(oi=null),li!==null&&El(li)&&(li=null),ci!==null&&El(ci)&&(ci=null),Ra.forEach(dx),Oa.forEach(dx)}function jl(t,n){t.blockedOn===n&&(t.blockedOn=null,Nd||(Nd=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,$S)))}var Nl=null;function hx(t){Nl!==t&&(Nl=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Nl===t&&(Nl=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(jd(h||a)===null)continue;break}var E=Xi(a);E!==null&&(t.splice(n,3),n-=3,Eu(E,{pending:!0,data:w,method:a.method,action:h},h,w))}}))}function Ds(t){function n(J){return jl(J,t)}oi!==null&&jl(oi,t),li!==null&&jl(li,t),ci!==null&&jl(ci,t),Ra.forEach(n),Oa.forEach(n);for(var a=0;a<ui.length;a++){var h=ui[a];h.blockedOn===t&&(h.blockedOn=null)}for(;0<ui.length&&(a=ui[0],a.blockedOn===null);)ux(a),a.blockedOn===null&&ui.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(h=0;h<a.length;h+=3){var w=a[h],E=a[h+1],M=w[Sn]||null;if(typeof E=="function")M||hx(a);else if(M){var K=null;if(E&&E.hasAttribute("formAction")){if(w=E,M=E[Sn]||null)K=M.formAction;else if(jd(w)!==null)continue}else K=M.action;typeof K=="function"?a[h+1]=K:(a.splice(h,3),h-=3),hx(a)}}}function fx(){function t(E){E.canIntercept&&E.info==="react-transition"&&E.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 E=navigation.currentEntry;E&&E.url!=null&&navigation.navigate(E.url,{state:E.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 Td(t){this._internalRoot=t}Tl.prototype.render=Td.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(s(409));var a=n.current,h=Bn();ix(a,h,t,n,null,null)},Tl.prototype.unmount=Td.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;ix(t.current,2,null,t,null,null),cl(),n[Ki]=null}};function Tl(t){this._internalRoot=t}Tl.prototype.unstable_scheduleHydration=function(t){if(t){var n=vr();t={blockedOn:null,target:t,priority:n};for(var a=0;a<ui.length&&n!==0&&n<ui[a].priority;a++);ui.splice(a,0,t),a===0&&ux(t)}};var px=r.version;if(px!=="19.2.4")throw Error(s(527,px,"19.2.4"));X.findDOMNode=function(t){var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(s(188)):(t=Object.keys(t).join(","),Error(s(268,t)));return t=p(n),t=t!==null?g(t):null,t=t===null?null:t.stateNode,t};var qS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:P,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Al=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Al.isDisabled&&Al.supportsFiber)try{Dt=Al.inject(qS),mt=Al}catch{}}return Ba.createRoot=function(t,n){if(!c(t))throw Error(s(299));var a=!1,h="",w=_m,E=Sm,M=wm;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&&(E=n.onCaughtError),n.onRecoverableError!==void 0&&(M=n.onRecoverableError)),n=nx(t,1,!1,null,null,a,h,null,w,E,M,fx),t[Ki]=n.current,ud(t),new Td(n)},Ba.hydrateRoot=function(t,n,a){if(!c(t))throw Error(s(299));var h=!1,w="",E=_m,M=Sm,K=wm,J=null;return a!=null&&(a.unstable_strictMode===!0&&(h=!0),a.identifierPrefix!==void 0&&(w=a.identifierPrefix),a.onUncaughtError!==void 0&&(E=a.onUncaughtError),a.onCaughtError!==void 0&&(M=a.onCaughtError),a.onRecoverableError!==void 0&&(K=a.onRecoverableError),a.formState!==void 0&&(J=a.formState)),n=nx(t,1,!0,n,a??null,h,w,J,E,M,K,fx),n.context=rx(null),a=n.current,h=Bn(),h=Jt(h),w=Yr(h),w.callback=null,Xr(a,w,h),a=h,n.current.lanes=a,Ur(n,a),ur(n),t[Ki]=n.current,ud(t),new Tl(n)},Ba.version="19.2.4",Ba}var Cx;function r1(){if(Cx)return Ld.exports;Cx=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(),Ld.exports=n1(),Ld.exports}var i1=r1();const s1=tc(i1);function a1(){const[e,r]=H.useState({offsetTop:0,height:window.innerHeight,keyboardVisible:!1}),i=H.useRef(window.innerHeight);return H.useEffect(()=>{const s=window.visualViewport;if(!s)return;const c=()=>{const u=s.offsetTop,f=s.height,l=i.current-f>100;r({offsetTop:u,height:f,keyboardVisible:l})};return c(),s.addEventListener("resize",c),s.addEventListener("scroll",c),()=>{s.removeEventListener("resize",c),s.removeEventListener("scroll",c)}},[]),e}function o1(e,r){if(e instanceof RegExp)return{keys:!1,pattern:e};var i,s,c,u,f=[],l="",d=e.split("/");for(d[0]||d.shift();c=d.shift();)i=c[0],i==="*"?(f.push(i),l+=c[1]==="?"?"(?:/(.*))?":"/(.*)"):i===":"?(s=c.indexOf("?",1),u=c.indexOf(".",1),f.push(c.substring(1,~s?s:~u?u:c.length)),l+=~s&&!~u?"(?:/([^/]+?))?":"/([^/]+?)",~u&&(l+=(~s?"?":"")+"\\"+c.substring(u))):l+="/"+c;return{keys:f,pattern:new RegExp("^"+l+(r?"(?=$|/)":"/?$"),"i")}}var Id={exports:{}},Bd={};/**
|
|
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 kx;function l1(){if(kx)return Bd;kx=1;var e=nc();function r(m,b){return m===b&&(m!==0||1/m===1/b)||m!==m&&b!==b}var i=typeof Object.is=="function"?Object.is:r,s=e.useState,c=e.useEffect,u=e.useLayoutEffect,f=e.useDebugValue;function l(m,b){var _=b(),k=s({inst:{value:_,getSnapshot:b}}),C=k[0].inst,y=k[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!i(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 Bd.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,Bd}var Ex;function c1(){return Ex||(Ex=1,Id.exports=l1()),Id.exports}var u1=c1();const d1=QS.useInsertionEffect,h1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",f1=h1?H.useLayoutEffect:H.useEffect,p1=d1||f1,vb=e=>{const r=H.useRef([e,(...i)=>r[0](...i)]).current;return p1(()=>{r[0]=e}),r[1]},m1="popstate",Th="pushState",Ah="replaceState",g1="hashchange",jx=[m1,Th,Ah,g1],x1=e=>{for(const r of jx)addEventListener(r,e);return()=>{for(const r of jx)removeEventListener(r,e)}},bb=(e,r)=>u1.useSyncExternalStore(x1,e,r),Nx=()=>location.search,v1=({ssrSearch:e}={})=>bb(Nx,e!=null?()=>e:Nx),Tx=()=>location.pathname,b1=({ssrPath:e}={})=>bb(Tx,e!=null?()=>e:Tx),y1=(e,{replace:r=!1,state:i=null}={})=>history[r?Ah:Th](i,"",e),_1=(e={})=>[b1(e),y1],Ax=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[Ax]>"u"){for(const e of[Th,Ah]){const r=history[e];history[e]=function(){const i=r.apply(this,arguments),s=new Event(e);return s.arguments=arguments,dispatchEvent(s),i}}Object.defineProperty(window,Ax,{value:!0})}const S1=(e,r)=>r.toLowerCase().indexOf(e.toLowerCase())?"~"+r:r.slice(e.length)||"/",yb=(e="")=>e==="/"?"":e,w1=(e,r)=>e[0]==="~"?e.slice(1):yb(r)+e,C1=(e="",r)=>S1(Dx(yb(e)),Dx(r)),Dx=e=>{try{return decodeURI(e)}catch{return e}},_b={hook:_1,searchHook:v1,parser:o1,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e,aroundNav:(e,r,i)=>e(r,i)},Sb=H.createContext(_b),$s=()=>H.useContext(Sb),wb={},Cb=H.createContext(wb),k1=()=>H.useContext(Cb),rc=e=>{const[r,i]=e.hook(e);return[C1(e.base,r),vb((s,c)=>e.aroundNav(i,w1(s,e.base),c))]},gr=()=>rc($s()),Dh=(e,r,i,s)=>{const{pattern:c,keys:u}=r instanceof RegExp?{keys:!1,pattern:r}:e(r||"*",s),f=c.exec(i)||[],[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})(),...s?[l]:[]]:[!1,null]},Lh=e=>Dh($s().parser,e,gr()[0]),E1=({children:e,...r})=>{var g,m,b;const i=$s(),s=r.hook?_b:i;let c=s;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=H.useRef({}),d=l.current,p=d;for(let _ in s){const k=_==="base"?s[_]+(r[_]??""):r[_]??s[_];d===p&&k!==p[_]&&(l.current=p={...p}),p[_]=k,(k!==s[_]||k!==c[_])&&(c=p)}return H.createElement(Sb.Provider,{value:c,children:e})},Lx=({children:e,component:r},i)=>r?H.createElement(r,{params:i}):typeof e=="function"?e(i):e,j1=e=>{let r=H.useRef(wb);const i=r.current;return r.current=Object.keys(e).length!==Object.keys(i).length||Object.entries(e).some(([s,c])=>c!==i[s])?e:i},za=({path:e,nest:r,match:i,...s})=>{const c=$s(),[u]=rc(c),[f,l,d]=i??Dh(c.parser,e,u,r),p=j1({...k1(),...l});if(!f)return null;const g=d?H.createElement(E1,{base:d},Lx(s,p)):Lx(s,p);return H.createElement(Cb.Provider,{value:p,children:g})},Pn=H.forwardRef((e,r)=>{const i=$s(),[s,c]=rc(i),{to:u="",href:f=u,onClick:l,asChild:d,children:p,className:g,replace:m,state:b,transition:_,...k}=e,C=vb(x=>{x.ctrlKey||x.metaKey||x.altKey||x.shiftKey||x.button!==0||(l==null||l(x),x.defaultPrevented||(x.preventDefault(),c(f,e)))}),y=i.hrefs(f[0]==="~"?f.slice(1):i.base+f,i);return d&&H.isValidElement(p)?H.cloneElement(p,{onClick:C,href:y}):H.createElement("a",{...k,onClick:C,href:y,className:g!=null&&g.call?g(s===f):g,children:p,ref:r})}),kb=e=>Array.isArray(e)?e.flatMap(r=>kb(r&&r.type===H.Fragment?r.props.children:r)):[e],N1=({children:e,location:r})=>{const i=$s(),[s]=rc(i);for(const c of kb(e)){let u=0;if(H.isValidElement(c)&&(u=Dh(i.parser,c.props.path,r||s,c.props.nest))[0])return H.cloneElement(c,{match:u})}return null},Rx=e=>{let r;const i=new Set,s=(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),i.forEach(_=>_(r,b))}},c=()=>r,l={setState:s,getState:c,getInitialState:()=>d,subscribe:p=>(i.add(p),()=>i.delete(p))},d=r=e(s,c,l);return l},T1=(e=>e?Rx(e):Rx),A1=e=>e;function D1(e,r=A1){const i=mn.useSyncExternalStore(e.subscribe,mn.useCallback(()=>r(e.getState()),[e,r]),mn.useCallback(()=>r(e.getInitialState()),[e,r]));return mn.useDebugValue(i),i}const Ox=e=>{const r=T1(e),i=s=>D1(r,s);return Object.assign(i,r),i},er=(e=>e?Ox(e):Ox);async function ke(e,r={}){const i=localStorage.getItem("openfox_token"),s={...r.headers instanceof Headers?Object.fromEntries(r.headers.entries()):r.headers,...i?{"x-session-token":i}:{}};return fetch(e,{...r,headers:s})}function L1(e){return typeof e=="object"&&e!==null&&"type"in e&&"payload"in e}function Eb(){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 R1{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 i=this.baseUrl.includes("?")?"&":"?";return`${this.baseUrl}${i}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,i;return((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN?Promise.resolve():(this.lastCloseCode=0,this.isReconnecting=!1,this.connectingPromise&&((i=this.ws)==null?void 0:i.readyState)===WebSocket.CONNECTING?this.connectingPromise:(this.connectingPromise=new Promise((s,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"),s()},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);L1(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 s=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(()=>{})},s)}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,i){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");const s=Eb(),c={id:s,type:r,payload:i};return this.ws.send(JSON.stringify(c)),s}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 O1=`ws://${window.location.hostname}:${window.location.port||"10469"}/ws`,Gt=new R1(O1),mi=async(e,r,i)=>{try{const s=await ke(r,{method:e,headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});return s.ok?{success:!0}:{success:!1,error:(await s.json()).error}}catch{return{success:!1,error:"Network error"}}};function jb(e){let r=null;function i(){r===null&&(r=requestAnimationFrame(()=>{r=null,e()}))}return i}let Dl=[];const pr=er()((e,r)=>{function i(){if(Dl.length===0)return;const c=Dl;Dl=[],e(u=>({logs:[...u.logs,...c]}))}const s=jb(i);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;Dl.push({stream:f.stream,content:f.content}),s();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 M1(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 Mx(e,r,i){const s=await ke(`/api/providers/${e}/models/${encodeURIComponent(r)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!s.ok){const c=await s.json();throw new Error(c.error??"Failed to update model")}return s.json()}function Ix(e,r,i,s){return e.map(c=>c.id===r?{...c,models:c.models.map(u=>u.id===i?{...u,...s,source:"user"}:u)}:c)}const I1=3e4;function B1(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=er((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 i=await ke("/api/config");if(!i.ok)throw new Error("Failed to fetch config");const s=await i.json();e({version:s.version,model:s.model,maxContext:s.maxContext,llmUrl:s.llmUrl,llmStatus:s.llmStatus,backend:s.backend,providers:s.providers??[],activeProviderId:s.activeProviderId??null,defaultModelSelection:s.defaultModelSelection??null,loading:!1})}catch(i){e({error:i instanceof Error?i.message:"Unknown error",loading:!1})}},refreshModel:async()=>{try{const i=await ke("/api/model/refresh",{method:"POST"});if(!i.ok)throw new Error("Failed to refresh model");const s=await i.json(),u=Ce.getState().currentSession;if(u!=null&&u.providerId&&u.providerModel){e({llmStatus:s.llmStatus,backend:s.backend});return}e({model:s.model,llmStatus:s.llmStatus,backend:s.backend})}catch(i){console.error("Failed to refresh model:",i)}},activateProvider:async i=>{const{activeProviderId:s,providers:c}=r();if(i===s)return!0;e({activating:!0,error:null});try{const u=await ke(`/api/providers/${i}/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:(i,s)=>{const{providers:c}=r();e({activeProviderId:i,model:s,defaultModelSelection:`${i}/${s}`,providers:c.map(u=>({...u,isActive:u.id===i}))})},updateModelContext:async(i,s,c)=>{e({activating:!0,error:null});try{const u=await Mx(i,s,{contextWindow:c}),{providers:f}=r();return e({providers:Ix(f,i,s,{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(i,s,c)=>{e({activating:!0,error:null});try{const u=await Mx(i,s,c),{providers:f}=r(),l={...c.contextWindow!==void 0&&{contextWindow:c.contextWindow},...M1({temperature:c.temperature??void 0,topP:c.topP??void 0,topK:c.topK??void 0,maxTokens:c.maxTokens??void 0})};return e({providers:Ix(f,i,s,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 i=>{e({activating:!0,error:null});try{const s=await ke(`/api/providers/${i}/refresh`,{method:"POST"});if(!s.ok){const f=await s.json();throw new Error(f.error??"Failed to refresh models")}const c=await s.json(),{providers:u}=r();return e({providers:u.map(f=>f.id===i?{...f,models:c.models}:f),activating:!1}),!0}catch(s){return e({error:s instanceof Error?s.message:"Failed to refresh models",activating:!1}),!1}},startAutoRefresh:()=>{const{autoRefreshInterval:i,refreshModel:s}=r();if(i)return;const c=setInterval(()=>{s()},I1);e({autoRefreshInterval:c})},stopAutoRefresh:()=>{const{autoRefreshInterval:i}=r();i&&(clearInterval(i),e({autoRefreshInterval:null}))},getActiveProvider:()=>{const{providers:i,activeProviderId:s}=r();return i.find(c=>c.id===s)},getModelContext:i=>{const{providers:s,activeProviderId:c}=r(),u=s.find(l=>l.id===c);if(!u)return 2e5;const f=u.models.find(l=>l.id===i);return(f==null?void 0:f.contextWindow)??2e5}})),Zt=er((e,r)=>({projects:[],currentProject:null,loading:!1,listProjects:async()=>{e({loading:!0});try{const s=await(await ke("/api/projects")).json();e({projects:s.projects??[],loading:!1})}catch{e({loading:!1})}},createProject:async(i,s)=>{try{const c=await ke("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,workdir:s})});if(!c.ok)return null;const u=await c.json();return await r().listProjects(),u.project}catch{return null}},loadProject:async i=>{try{const s=await ke(`/api/projects/${i}`);if(!s.ok)return null;const c=await s.json();return e({currentProject:c.project}),r().projects.length===0&&await r().listProjects(),c.project}catch{return null}},updateProject:async(i,s)=>{var c;try{const u=await ke(`/api/projects/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!u.ok)return null;const f=await u.json();return((c=r().currentProject)==null?void 0:c.id)===i&&e({currentProject:f.project}),await r().listProjects(),f.project}catch{return null}},deleteProject:async i=>{var s;try{return(await ke(`/api/projects/${i}`,{method:"DELETE"})).ok?(await r().listProjects(),((s=r().currentProject)==null?void 0:s.id)===i&&e({currentProject:null}),!0):!1}catch{return!1}},clearProject:()=>{e({currentProject:null})}}));let Ll=[];const Za=er()((e,r)=>{function i(){if(Ll.length===0)return;const c=Ll;Ll=[],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 s=jb(i);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)=>{Ll.push({processId:c,stream:u,content:f}),s()},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}}}}}),Tt={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"};function Rl(e,r){return i=>({loading:{...i.loading,[e]:r}})}function Bx(e,r){return i=>({settings:{...i.settings,[e]:r},loading:{...i.loading,[e]:!1}})}const z1=[Tt.DISPLAY_SHOW_THINKING,Tt.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT,Tt.DISPLAY_SHOW_STATS,Tt.DISPLAY_SHOW_AGENT_DEFINITIONS,Tt.DISPLAY_SHOW_WORKFLOW_BARS];function Nb(){return{showThinking:rn(e=>e.settings[Tt.DISPLAY_SHOW_THINKING]??"true")==="true",showVerboseToolOutput:rn(e=>e.settings[Tt.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT]??"true")==="true",showStats:rn(e=>e.settings[Tt.DISPLAY_SHOW_STATS]??"true")==="true",showAgentDefinitions:rn(e=>e.settings[Tt.DISPLAY_SHOW_AGENT_DEFINITIONS]??"true")==="true",showWorkflowBars:rn(e=>e.settings[Tt.DISPLAY_SHOW_WORKFLOW_BARS]??"true")==="true"}}const rn=er(e=>({settings:{},loading:{},getSetting:async r=>{e(Rl(r,!0));try{const s=await(await ke(`/api/settings/${r}`)).json();return e(Bx(r,s.value??"")),s.value}catch{return e(Rl(r,!1)),null}},setSetting:async(r,i)=>{e(Rl(r,!0));try{const c=await(await ke(`/api/settings/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:i})})).json();e(Bx(r,c.value??""))}catch{e(Rl(r,!1))}}})),H1=[{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"}],P1=[{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"}],Tb={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"},fi={soundEnabled:!0,browserNotification:!1,customSoundUrl:null},Ab={soundEnabled:!1,browserNotification:!1,customSoundUrl:null},dh={soundEnabled:!0,browserNotificationEnabled:!1,events:{complete:{...fi},waiting_for_user:{...fi},phase_done:{...fi},phase_blocked:{...fi},new_message:{...Ab}},agentOverrides:{}};function Db(e,r,i){var u;const s=e.events[r];if(!i)return s;const c=(u=e.agentOverrides[i])==null?void 0:u[r];return c?{soundEnabled:c.soundEnabled??s.soundEnabled,browserNotification:c.browserNotification??s.browserNotification,customSoundUrl:c.customSoundUrl!==void 0?c.customSoundUrl:s.customSoundUrl}:s}const zi=er((e,r)=>({settings:dh,loaded:!1,load:()=>{rn.getState().getSetting(Tt.NOTIFICATION_SETTINGS);const s=rn.subscribe(u=>{const f=u.settings[Tt.NOTIFICATION_SETTINGS];if(f!==void 0)try{const l=JSON.parse(f);e({settings:zx(l),loaded:!0})}catch{e({loaded:!0})}}),c=rn.getState().settings[Tt.NOTIFICATION_SETTINGS];if(c)try{const u=JSON.parse(c);e({settings:zx(u),loaded:!0})}catch{e({loaded:!0})}return s},update:i=>{e({settings:i}),zd(i)},updateEvent:(i,s)=>{const c=r().settings,u={...c,events:{...c.events,[i]:{...c.events[i],...s}}};e({settings:u}),zd(u)},updateAgentOverride:(i,s,c)=>{var d;const u=r().settings,f={...u.agentOverrides};if(c===null){if(f[i]){const p={...f[i]};delete p[s],Object.keys(p).length===0?delete f[i]:f[i]=p}}else f[i]={...f[i],[s]:{...((d=f[i])==null?void 0:d[s])??{},...c}};const l={...u,agentOverrides:f};e({settings:l}),zd(l)}}));function zd(e){rn.getState().setSetting(Tt.NOTIFICATION_SETTINGS,JSON.stringify(e))}function zx(e){var r,i,s,c,u;return{soundEnabled:e.soundEnabled??dh.soundEnabled,browserNotificationEnabled:e.browserNotificationEnabled??dh.browserNotificationEnabled,events:{complete:{...fi,...(r=e.events)==null?void 0:r.complete},waiting_for_user:{...fi,...(i=e.events)==null?void 0:i.waiting_for_user},phase_done:{...fi,...(s=e.events)==null?void 0:s.phase_done},phase_blocked:{...fi,...(c=e.events)==null?void 0:c.phase_blocked},new_message:{...Ab,...(u=e.events)==null?void 0:u.new_message}},agentOverrides:e.agentOverrides??{}}}const Hx=new Map;function F1(e){let r=Hx.get(e);return r||(r=new Audio(e),r.volume=.5,Hx.set(e,r)),r}let Lb=typeof Notification<"u"?Notification.permission:"denied";function U1(){return typeof Notification>"u"?Promise.resolve("denied"):Notification.requestPermission().then(e=>(Lb=e,e))}const $1={complete:"Task Complete",waiting_for_user:"Waiting for Input",phase_done:"Phase Complete",phase_blocked:"Phase Blocked",new_message:"New Message"},q1={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 W1(e){typeof Notification>"u"||Lb==="granted"&&(document.hasFocus()||new Notification($1[e],{body:q1[e],icon:"/fox.svg",tag:`openfox-${e}`}))}function ho(e,r){const{settings:i}=zi.getState(),s=Db(i,e,r);if(i.soundEnabled&&s.soundEnabled){const c=s.customSoundUrl??Tb[e],u=F1(c);u.currentTime=0,u.play().catch(()=>{})}i.browserNotificationEnabled&&s.browserNotification&&W1(e)}const G1=e=>ho("complete",e),V1=e=>ho("phase_done",e),K1=e=>ho("phase_blocked",e),Px=e=>ho("waiting_for_user",e),Y1=e=>ho("new_message",e);let Ha=!1,hr=null;const Hd=new Set,Wt={messageId:null,deltaContent:"",thinkingContent:"",toolOutput:[]};let Hs=null,pn=null;function Pd(){Hs===null&&(Hs=requestAnimationFrame(()=>{Hs=null,pn==null||pn()}))}function Oi(){Hs!==null&&(cancelAnimationFrame(Hs),Hs=null)}function Pt(e,r){return r!==null&&e.sessionId===r}function X1(e,r,i){return e.id!==void 0||Pt(e,r)||i===!0&&e.sessionId!==void 0}function Z1(e,r){return e.includes(r)?e:[...e,r]}function Pa(e,r){return e.filter(i=>i!==r)}function Q1(e,r){const i=e.find(c=>c.id===r.id),s=i?{...i,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 i?e.map(c=>c.id===r.id?s:c):[s,...e]}function J1(e,r,i){return e.map(s=>{const c=(i==null?void 0:i.id)===s.id?i:null,u=r.find(f=>f.id===s.id);return{...s,title:s.title??(u==null?void 0:u.title),mode:(c==null?void 0:c.mode)??(u==null?void 0:u.mode)??s.mode,phase:(c==null?void 0:c.phase)??(u==null?void 0:u.phase)??s.phase,isRunning:(c==null?void 0:c.isRunning)??(u==null?void 0:u.isRunning)??s.isRunning,messageCount:s.messageCount,recentUserPrompts:s.recentUserPrompts}})}const Fx=new Map;function Ya(e,r){var u;const i=r===((u=e.currentSession)==null?void 0:u.id)?e.currentSession:null,s=e.sessions.find(f=>f.id===r),c=(i==null?void 0:i.mode)??(s==null?void 0:s.mode);return c==="planner"?"planner":c==="builder"?"build":"planner"}function ew(e,r){if(e.type==="chat.done"){const i=e.payload,s=Ya(r,e.sessionId),c=i.agentType??s;i.reason==="complete"&&G1(c),i.reason==="waiting_for_user"&&Px(c);return}if(e.type==="chat.path_confirmation"){const i=Ya(r,e.sessionId);Px(i);return}if(e.type==="task.completed"){const i=Ya(r,e.sessionId);V1(i);return}if(e.type==="phase.changed"&&e.sessionId){const i=e.payload,s=Fx.get(e.sessionId)??null;if(Fx.set(e.sessionId,i.phase),s===i.phase)return;const c=Ya(r,e.sessionId);i.phase==="blocked"&&K1(c)}}const Ce=er((e,r)=>(pn=()=>{const i=Wt;if(!i.messageId)return;const s=i.deltaContent.length>0,c=i.thinkingContent.length>0,u=i.toolOutput.length>0;if(!s&&!c&&!u)return;const f=i.deltaContent,l=i.thinkingContent,d=i.toolOutput;i.deltaContent="",i.thinkingContent="",i.toolOutput=[],e(p=>{var m;const g=p.streamingMessage;if(g&&g.id===i.messageId){let b={...g};if(s&&(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(x=>x.callId===C.id);return y.length===0?C:(_.add(C.id),{...C,streamingOutput:[...C.streamingOutput??[],...y.map(x=>({stream:x.stream,content:x.content,timestamp:Date.now()}))]})});const k=d.filter(C=>!_.has(C.callId));k.length>0&&Wt.toolOutput.push(...k)}return{streamingMessage:b}}if(u){const b=new Set,_=p.messages.map(C=>{var x;if(C.id!==i.messageId)return C;const y=(x=C.toolCalls)==null?void 0:x.map(v=>{const S=d.filter(j=>j.callId===v.id);return S.length===0?v:(b.add(v.id),{...v,streamingOutput:[...v.streamingOutput??[],...S.map(j=>({stream:j.stream,content:j.content,timestamp:Date.now()}))]})});return{...C,toolCalls:y}}),k=d.filter(C=>!b.has(C.callId));return k.length>0&&Wt.toolOutput.push(...k),{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 s=!1;try{s=(await(await ke("/api/auth")).json()).requiresAuth}catch{}if(s&&!Gt.hasToken()){e({showPasswordModal:!0,passwordModalRetry:!1,connectionStatus:"reconnecting"});return}Gt.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 Gt.connect(),!Ha){Ha=!0;const c=r().handleServerMessage;hr=Gt.subscribe(c)}}catch(c){console.error("Failed to connect:",c);const u=Gt.getLastCloseCode();if(!Gt.hasToken()&&(u===1006||u===4e3)){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}hr&&(hr(),hr=null),Ha=!1,e({connectionStatus:"disconnected"})}},reconnect:()=>{Gt.disconnect(),hr&&(hr(),hr=null),Ha=!1,e({connectionStatus:"disconnected"}),r().connect()},disconnect:()=>{Gt.disconnect(),hr&&(hr(),hr=null),Ha=!1,e({connectionStatus:"disconnected",showPasswordModal:!1})},submitPassword:async i=>{try{const s=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:i})});if(!s.ok){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}const{token:c}=await s.json();Gt.setToken(c),e({showPasswordModal:!1}),r().connect();const{listProjects:u}=Zt.getState(),{fetchConfig:f}=Lt.getState();u(),f(),r().connect()}catch{e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"})}},cancelPassword:()=>{Gt.clearToken(),e({showPasswordModal:!1,connectionStatus:"disconnected"})},createSession:async(i,s)=>{try{e({pendingSessionCreate:!0});const c=await ke("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:i,title:s})});if(!c.ok)return e({pendingSessionCreate:!1}),null;const u=await c.json();return Gt.send("session.load",{sessionId:u.session.id}),u.session}catch{return e({pendingSessionCreate:!1}),null}},loadSession:async i=>{try{const s=r().currentSession;!s||s.id!==i?(Oi(),e({currentSession:null,unreadSessionIds:Pa(r().unreadSessionIds,i),subAgentContextStates:{},messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,pendingPathConfirmation:null,queuedMessages:[],abortInProgress:!1,error:null})):e({unreadSessionIds:Pa(r().unreadSessionIds,i)});const c=await ke(`/api/sessions/${i}`);if(!c.ok)return;const u=await c.json();e({currentSession:u.session,messages:u.messages??[],contextState:u.contextState,queuedMessages:u.queueState??[]}),Gt.send("session.load",{sessionId:i});try{const f=await ke(`/api/sessions/${i}/background-processes`);if(f.ok){const l=await f.json();Za.getState().setProcesses(l.processes??[])}}catch{}}catch{}},listSessions:async(i,s=20)=>{try{const c=new URLSearchParams;c.set("limit",String(s)),i&&c.set("projectId",i);const f=await(await ke(`/api/sessions?${c.toString()}`)).json();e({sessions:f.sessions??[],sessionsHasMore:i?f.hasMore??!1:!0})}catch{}},loadMoreSessions:async i=>{const s=r();if(!(s.sessionsPaginationLoading||!s.sessionsHasMore)){e({sessionsPaginationLoading:!0});try{const c=new URLSearchParams;c.set("limit","20"),c.set("offset",String(s.sessions.length)),c.set("projectId",i);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 i=>{var s;try{return(await ke(`/api/sessions/${i}`,{method:"DELETE"})).ok?(await r().listSessions(),((s=r().currentSession)==null?void 0:s.id)===i&&r().clearSession(),!0):!1}catch{return!1}},deleteAllSessions:async i=>{try{return(await ke(`/api/projects/${i}/sessions`,{method:"DELETE"})).ok?(await r().listSessions(),!0):!1}catch{return!1}},clearSession:()=>{Oi(),e(i=>({currentSession:null,messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,unreadSessionIds:i.currentSession?Pa(i.unreadSessionIds,i.currentSession.id):i.unreadSessionIds}))},sendMessage:async(i,s,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:i,attachments:s,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 s;const i=(s=r().currentSession)==null?void 0:s.id;if(i&&!r().abortInProgress){Oi(),pn==null||pn(),e({abortInProgress:!0});try{await ke(`/api/sessions/${i}/stop`,{method:"POST"})}catch(c){console.error("Error stopping generation:",c)}}},continueGeneration:async()=>{var s;const i=(s=r().currentSession)==null?void 0:s.id;if(i){e({streamingMessageId:null});try{await ke(`/api/sessions/${i}/continue`,{method:"POST"})}catch(c){console.error("Error continuing generation:",c)}}},launchRunner:(i,s,c)=>{e({streamingMessageId:null});const u={};i!=null&&i.trim()&&(u.content=i),s&&s.length>0&&(u.attachments=s),c&&(u.workflowId=c),Gt.send("runner.launch",u)},switchMode:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const u=await ke(`/api/sessions/${s}/mode`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:i})});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 i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const u=await ke(`/api/sessions/${s}/danger-level`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({dangerLevel:i})});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:(i,s,c)=>{e({streamingMessageId:null});const u={};i&&(u.workflowId=i),s!=null&&s.trim()&&(u.content=s),c&&c.length>0&&(u.attachments=c),Gt.send("mode.accept",u)},editCriteria:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const u=await ke(`/api/sessions/${s}/criteria`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({criteria:i})});u.ok||console.error("Failed to update criteria:",await u.json())}catch(u){console.error("Error updating criteria:",u)}},compactContext:()=>{Gt.send("context.compact",{})},setSessionProvider:async(i,s)=>{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:i,...s?{model:s}:{}})});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:i=>{e({contextState:i})},updateSubAgentContextState:(i,s)=>{e(c=>({subAgentContextStates:{...c.subAgentContextStates,[i]:s}}))},clearSubAgentContextState:i=>{e(s=>{const c={...s.subAgentContextStates};return delete c[i],{subAgentContextStates:c}})},confirmPath:async(i,s,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:i,approved:s,alwaysAllow:c})})}catch(l){console.error("Error confirming path:",l)}},answerQuestion:async(i,s)=>{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:i,answer:s})})}catch(f){console.error("Error answering question:",f)}e({pendingQuestion:null})}},queueAsap:async(i,s,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:i,attachments:s,messageKind:c})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(l){console.error("Error queueing ASAP message:",l)}},queueCompletion:async(i,s,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:i,attachments:s,messageKind:c})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(l){console.error("Error queueing completion message:",l)}},cancelQueued:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const f=await(await ke(`/api/sessions/${s}/queue/${i}`,{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:i=>{var f,l,d,p,g,m,b,_,k,C,y,x,v,S,j,T,N,D,A,B,O,q,V,W;const s=r();ew(i,s);const c=((f=s.currentSession)==null?void 0:f.id)??null,u=()=>{const I=i.sessionId;!I||I===c||e(F=>({unreadSessionIds:Z1(F.unreadSessionIds,I)}))};switch(i.type){case"session.state":{const I=i.payload;if(!X1(i,c,s.pendingSessionCreate))break;Oi();const F=I.messages.find(R=>R.isStreaming)??null,P=r().pendingSessionCreate===!0,X=I.pendingConfirmations??[],z=s.pendingPathConfirmation??(X.length>0?X[0]??null:null);if(e({currentSession:I.session,sessions:Q1(r().sessions,I.session),unreadSessionIds:Pa(r().unreadSessionIds,I.session.id),messages:I.messages,streamingMessageId:(F==null?void 0:F.id)??null,streamingMessage:F,currentTodos:[],pendingPathConfirmation:z,error:null,...P?{pendingSessionCreate:I.session.id}:{}}),I.session.providerId&&I.session.providerModel){const R=Lt.getState();R.providers.find($=>$.id===I.session.providerId)&&R.syncFromSession(I.session.providerId,I.session.providerModel)}break}case"session.list":{const I=i.payload;e(F=>({sessions:J1(I.sessions,F.sessions,F.currentSession)}));break}case"session.deleted":{const I=i.payload;e(F=>({unreadSessionIds:Pa(F.unreadSessionIds,I.sessionId)})),r().listSessions();break}case"session.deletedAll":{r().listSessions();break}case"session.running":{const I=i.payload,F=i.sessionId,P=(l=r().currentSession)==null?void 0:l.id,X=F&&F!==P;e(Z=>({sessions:Z.sessions.map(z=>z.id===F?{...z,isRunning:I.isRunning}:z)})),X||e(Z=>({currentSession:Z.currentSession?{...Z.currentSession,isRunning:I.isRunning}:null,...I.isRunning?{}:{abortInProgress:!1,queuedMessages:[]}}));break}case"chat.message":{if(!Pt(i,((d=r().currentSession)==null?void 0:d.id)??null)){u();break}const I=i.payload;e(F=>F.messages.some(P=>P.id===I.message.id)?F:{messages:[...F.messages,I.message],streamingMessageId:I.message.isStreaming?I.message.id:F.streamingMessageId,streamingMessage:I.message.isStreaming?I.message:F.streamingMessage});break}case"chat.message_updated":{if(!Pt(i,((p=r().currentSession)==null?void 0:p.id)??null)){u();break}const I=i.payload,F=I.updates.isStreaming===!1&&r().streamingMessageId===I.messageId;F&&(Oi(),pn==null||pn()),e(P=>{const X=P.streamingMessage,Z=F;if(X&&X.id===I.messageId){const z={...X,...I.updates};return{messages:P.messages.map(R=>R.id===I.messageId?z:R),streamingMessageId:Z?null:P.streamingMessageId,streamingMessage:Z?null:{...X,...I.updates}}}return{messages:P.messages.map(z=>z.id===I.messageId?{...z,...I.updates}:z),streamingMessageId:Z?null:P.streamingMessageId}});break}case"chat.delta":{if(!Pt(i,((g=r().currentSession)==null?void 0:g.id)??null)){u();break}const I=i.payload;if(!Hd.has(I.messageId)){Hd.add(I.messageId);const F=Ya(r(),i.sessionId);Y1(F)}Wt.messageId=I.messageId,Wt.deltaContent+=I.content,Pd();break}case"chat.thinking":{if(!Pt(i,((m=r().currentSession)==null?void 0:m.id)??null)){u();break}const I=i.payload;Wt.messageId=I.messageId,Wt.thinkingContent+=I.content,Pd();break}case"chat.tool_preparing":{if(!Pt(i,((b=r().currentSession)==null?void 0:b.id)??null)){u();break}const I=i.payload;e(F=>{const P=F.streamingMessage;return P&&P.id===I.messageId?{streamingMessage:{...P,preparingToolCalls:[...P.preparingToolCalls??[],{index:I.index,name:I.name}]}}:{messages:F.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(i,((_=r().currentSession)==null?void 0:_.id)??null)){u();break}const I=i.payload,F=P=>{var z;const X=(z=P.preparingToolCalls)==null?void 0:z.filter((R,L)=>{var $;return R.name===I.tool?($=P.preparingToolCalls)==null?void 0:$.slice(0,L).some(ne=>ne.name===I.tool):!0}),Z=Wt.toolOutput.filter(R=>R.callId===I.callId);return Z.length>0&&(Wt.toolOutput=Wt.toolOutput.filter(R=>R.callId!==I.callId)),{...P,toolCalls:[...P.toolCalls??[],{id:I.callId,name:I.tool,arguments:I.args,startedAt:Date.now(),...Z.length>0?{streamingOutput:Z.map(R=>({stream:R.stream,content:R.content,timestamp:Date.now()}))}:{}}],...X&&X.length>0?{preparingToolCalls:X}:{preparingToolCalls:void 0}}};e(P=>{const X=P.streamingMessage;return X&&X.id===I.messageId?{streamingMessage:F(X)}:{messages:P.messages.map(Z=>Z.id===I.messageId?F(Z):Z)}});break}case"chat.tool_output":{if(!Pt(i,((k=r().currentSession)==null?void 0:k.id)??null)){u();break}const I=i.payload;Wt.messageId=I.messageId,Wt.toolOutput.push({messageId:I.messageId,callId:I.callId,stream:I.stream,content:I.output}),Pd();break}case"chat.tool_result":{if(!Pt(i,((C=r().currentSession)==null?void 0:C.id)??null)){u();break}const I=i.payload,F=P=>{var Z;const X=(Z=P.toolCalls)==null?void 0:Z.map(z=>z.id===I.callId?{...z,result:I.result}:z);return{...P,toolCalls:X}};e(P=>{const X=P.streamingMessage;return X&&X.id===I.messageId?{streamingMessage:F(X)}:{messages:P.messages.map(Z=>Z.id===I.messageId?F(Z):Z)}});break}case"chat.vision_fallback":{if(!Pt(i,((y=r().currentSession)==null?void 0:y.id)??null)){u();break}const I=i.payload;e(F=>{const P=`${I.messageId}-${I.attachmentId}`,X={...F.visionFallbackByMessage};return X[P]={type:I.type,attachmentId:I.attachmentId,filename:I.filename,description:I.description},{visionFallbackByMessage:X}});break}case"chat.todo":{if(!Pt(i,((x=r().currentSession)==null?void 0:x.id)??null)){u();break}const I=i.payload;e({currentTodos:I.todos});break}case"chat.summary":{if(!Pt(i,((v=r().currentSession)==null?void 0:v.id)??null)){u();break}const I=i.payload;e(F=>({currentSession:F.currentSession?{...F.currentSession,summary:I.summary}:null}));break}case"chat.progress":{if(!Pt(i,((S=r().currentSession)==null?void 0:S.id)??null)){u();break}const I=i.payload;console.log("Progress:",I.message,I.phase);break}case"chat.format_retry":{if(!Pt(i,((j=r().currentSession)==null?void 0:j.id)??null)){u();break}const I=i.payload;console.log("Format retry:",I.attempt,"/",I.maxAttempts);break}case"chat.done":{if(!Pt(i,((T=r().currentSession)==null?void 0:T.id)??null)){u();break}Oi(),pn==null||pn();const I=i.payload,F=I.stats;Wt.messageId=null,Wt.deltaContent="",Wt.thinkingContent="",Wt.toolOutput=[],Hd.delete(I.messageId),e(P=>{const X=P.streamingMessage,Z=X&&X.id===I.messageId?{...X,isStreaming:!1,stats:F??X.stats}:null;return{messages:P.messages.map(z=>z.id===I.messageId?Z??{...z,isStreaming:!1,stats:F??z.stats}:z),streamingMessageId:null,streamingMessage:null,visionFallbackByMessage:{}}});break}case"chat.error":{if(!Pt(i,((N=r().currentSession)==null?void 0:N.id)??null)){u();break}Oi(),pn==null||pn();const I=i.payload;console.error("Chat error:",I.error,"recoverable:",I.recoverable),I.recoverable||(Wt.messageId=null,Wt.deltaContent="",Wt.thinkingContent="",Wt.toolOutput=[]),e(F=>({error:{code:"CHAT_ERROR",message:I.error},streamingMessageId:I.recoverable?F.streamingMessageId:null,...I.recoverable?{}:{messages:F.streamingMessage?F.messages.map(P=>P.id===F.streamingMessage.id?F.streamingMessage:P):F.messages,streamingMessage:null}}));break}case"chat.path_confirmation":{if(!Pt(i,((D=r().currentSession)==null?void 0:D.id)??null)){u();break}const I=i.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(i,((A=r().currentSession)==null?void 0:A.id)??null)){u();return}const I=i.payload;e({pendingQuestion:{callId:I.callId,question:I.question}});break}case"mode.changed":{if(!Pt(i,((B=r().currentSession)==null?void 0:B.id)??null)){u();break}const I=i.payload;e(F=>({currentSession:F.currentSession?{...F.currentSession,mode:I.mode}:null}));break}case"phase.changed":{const I=i.payload,F=i.sessionId,P=(O=r().currentSession)==null?void 0:O.id,X=F&&F!==P;e(Z=>({sessions:Z.sessions.map(z=>z.id===F?{...z,phase:I.phase}:z)})),X||e(Z=>({currentSession:Z.currentSession?{...Z.currentSession,phase:I.phase}:null}));break}case"criteria.updated":{if(!Pt(i,((q=r().currentSession)==null?void 0:q.id)??null)){u();break}const I=i.payload;e(F=>({currentSession:F.currentSession?{...F.currentSession,criteria:I.criteria}:null}));break}case"context.state":{const I=i.payload,F=Pt(i,((V=r().currentSession)==null?void 0:V.id)??null);I.subAgentId?F&&r().updateSubAgentContextState(I.subAgentId,I.context):F?e({contextState:I.context}):u();break}case"session.name_generated":{const I=i.payload,F=i.sessionId,P=(W=r().currentSession)==null?void 0:W.id;e(X=>{const Z=X.sessions.map(R=>R.id===F?{...R,title:I.name,updatedAt:new Date().toISOString()}:R),z=P===F?X.currentSession?{...X.currentSession,title:I.name,updatedAt:new Date().toISOString()}:null:X.currentSession;return{sessions:Z,currentSession:z}});break}case"queue.state":{const I=i.payload;e({queuedMessages:I.messages});break}case"devServer.output":case"devServer.state":{pr.getState().handleMessage(i);break}case"backgroundProcess.started":case"backgroundProcess.output":case"backgroundProcess.exited":case"backgroundProcess.removed":{Za.getState().handleMessage(i.type,i.payload);break}case"error":{const I=i.payload;console.error("Server error:",I),e({error:{code:I.code,message:I.message},streamingMessageId:null});break}}}}));function Rb(){return Ce(e=>{var r;return((r=e.currentSession)==null?void 0:r.isRunning)??!1})}function tw(){return Ce(e=>e.queuedMessages)}function nw(){return Ce(e=>e.abortInProgress)}function rw(){const e=Ce(s=>s.connect),r=Ce(s=>s.connectionStatus),i=zi(s=>s.load);return H.useEffect(()=>{e()},[e]),H.useEffect(()=>{r==="connected"&&i()},[r,i]),{connectionStatus:r}}function iw({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 Ob({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 sw({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 aw({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 ow({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 lw({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 ic({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 cw({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 Rh({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 sc({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 Gl({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 uw({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 dw({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 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:"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 fw({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 pw({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 Ux({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 Mb({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 mw({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 gw({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 Ib({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 Bb({className:e="",size:r="md"}){const i=r==="sm"?"w-4 h-4":"w-6 h-6";return o.jsxs("svg",{className:`animate-spin ${i} ${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 zb=Bb,Hb=Bb;function xw({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 vw({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 bw({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 yw({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 _w({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 Sw({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 ww({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 Pb({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 Fb(){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 Cw({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 Ub({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 $b({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 kw({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 hh(){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 $x(e,r){const i=Gt.ws;!i||i.readyState!==WebSocket.OPEN||i.send(JSON.stringify({id:hh(),type:e,payload:r}))}const ir=er((e,r)=>({isOpen:!1,sessions:[],workdir:null,setOpen:i=>e({isOpen:i}),toggleOpen:()=>e(i=>({isOpen:!i.isOpen})),setWorkdir:i=>e({workdir:i}),fetchSessions:async()=>{try{const i=await ke("/api/terminals");if(i.ok){const s=await i.json();e({sessions:s});const c=Gt.ws;if(c&&c.readyState===WebSocket.OPEN)for(const u of s)c.send(JSON.stringify({id:hh(),type:"terminal.subscribe",payload:{sessionId:u.id}}))}}catch(i){console.error("Failed to fetch terminals:",i)}},createSession:async i=>{try{const s=await ke("/api/terminals",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:i??r().workdir??void 0})});if(s.ok){const c=await s.json();e(f=>({sessions:[...f.sessions,c]}));const u=Gt.ws;u&&u.readyState===WebSocket.OPEN&&u.send(JSON.stringify({id:hh(),type:"terminal.subscribe",payload:{sessionId:c.id}}))}}catch(s){console.error("Failed to create terminal:",s)}},writeSession:(i,s)=>{$x("terminal.write",{sessionId:i,data:s})},resizeSession:(i,s,c)=>{$x("terminal.resize",{sessionId:i,cols:s,rows:c})},killSession:async i=>{try{(await ke(`/api/terminals/${i}`,{method:"DELETE"})).ok&&e(c=>({sessions:c.sessions.filter(u=>u.id!==i)}))}catch(s){console.error("Failed to kill terminal:",s)}},handleMessage:i=>{switch(i.type){case"terminal.exit":{const{sessionId:s}=i.payload||{};s&&e(c=>{const u=c.sessions.filter(f=>f.id!==s);return u.length===0&&c.isOpen?{sessions:[],isOpen:!1}:{sessions:u}});break}}}}));Gt.subscribe(e=>{var r;(r=e.type)!=null&&r.startsWith("terminal.")&&ir.getState().handleMessage(e)});var fo=xb();const ac=H.forwardRef(({icon:e,iconSize:r="w-3.5 h-3.5",className:i="",...s},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 ${i}`,...s,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})})}));ac.displayName="IconButton";const Ew="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",Fs=H.forwardRef((e,r)=>o.jsx(ac,{ref:r,icon:Ew,title:"Edit",...e}));Fs.displayName="EditButton";const jw="M6 18L18 6M6 6l12 12",Oh=H.forwardRef((e,r)=>o.jsx(ac,{ref:r,icon:jw,...e}));Oh.displayName="CloseButton";const Nw={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:i="md",minHeight:s,children:c,footer:u,className:f,onClose:l,isOpen:d,closeOnBackdropClick:p=!0,closeOnEscape:g=!0,showCloseButton:m=!0}){const[b,_]=H.useState(!1),k=d!==void 0,C=k?d:b,y=H.useCallback(()=>{k||_(!0)},[k]),x=H.useCallback(()=>{k||_(!1),l==null||l()},[k,l]);H.useEffect(()=>{if(!C||!g)return;const S=j=>{j.key==="Escape"&&x()};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[C,x,g]);const v=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:[v,C&&(typeof document<"u"?fo.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?x:void 0}),o.jsxs("div",{className:`relative w-full ${Nw[i]} 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(Oh,{onClick:x,className:"ml-auto","aria-label":"Close"})]}),o.jsx("div",{className:"p-4 overflow-y-auto flex-1 min-h-0",style:s?{minHeight:s}:void 0,children:c}),u&&o.jsx("div",{className:"px-4 py-3 border-t border-border",children:u})]})]}),document.body):null)]})}const it=H.forwardRef(({variant:e="secondary",size:r="md",className:i="",children:s,...c},u)=>{const f="rounded font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",l={primary:"bg-accent-primary/25 text-white 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]} ${i}`,...c,children:s})});it.displayName="Button";function Tw({value:e,defaultUrl:r,disabled:i,onChange:s}){const c=e??r;return o.jsxs("div",{className:"relative",children:[o.jsx("select",{value:c,disabled:i,onChange:u=>{const f=u.target.value;s(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:P1.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 qx=[{key:"general",label:"General"},{key:"build",label:"Agent"},{key:"sub-agent",label:"Sub-agent"}];function Aw(){const e=zi(d=>d.settings),r=zi(d=>d.update),i=zi(d=>d.updateEvent),s=zi(d=>d.updateAgentOverride),c=zi(d=>d.load);H.useEffect(()=>{c()},[c]);const u=async()=>{await U1()==="granted"&&r({...e,browserNotificationEnabled:!0})},f=(d,p,g,m)=>{d==="general"?i(p,{[g]:m}):s(d,p,{[g]:m})},l=(d,p,g)=>{d==="general"?i(p,{customSoundUrl:g}):s(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(Wx,{label:"Sound notifications",description:"Play sounds when events occur",checked:e.soundEnabled,onChange:d=>r({...e,soundEnabled:d})}),o.jsx(Wx,{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"}),qx.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:H1.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})}),qx.map(p=>{const g=Db(e,d.key,p.key==="general"?void 0:p.key),m=Tb[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(Tw,{value:g.customSoundUrl,defaultUrl:m,disabled:!e.soundEnabled,onChange:b=>l(p.key,d.key,b)})]})},p.key)})]},d.key))})]})})]})]})}function Wx({label:e,description:r,checked:i,onChange:s}){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 ${i?"bg-accent-primary":"bg-bg-tertiary border border-border"}`,onClick:c=>{c.preventDefault(),s(!i)},children:o.jsx("div",{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white shadow transition-transform ${i?"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 Mh(e,r){r({loading:!0});try{const s=await(await ke(e)).json();r({defaults:s.defaults??[],userItems:s.userItems??[],loading:!1})}catch{r({loading:!1})}}const Br=er((e,r)=>({defaults:[],userItems:[],loading:!1,fetchSkills:async()=>{await Mh("/api/skills",e)},toggleSkill:async i=>{try{const c=await(await ke(`/api/skills/${i}/toggle`,{method:"POST"})).json();e(u=>({defaults:u.defaults.map(f=>f.id===i?{...f,enabled:c.enabled}:f),userItems:u.userItems.map(f=>f.id===i?{...f,enabled:c.enabled}:f)}))}catch{}},fetchSkill:async i=>{try{const s=await ke(`/api/skills/${i}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async i=>{try{const s=await ke(`/api/skills/defaults/${i}`);return s.ok?await s.json():null}catch{return null}},createSkill:async i=>{const s=await mi("POST","/api/skills",i);return s.success&&await r().fetchSkills(),s},updateSkill:async(i,s)=>{const c=await mi("PUT",`/api/skills/${i}`,s);return c.success&&await r().fetchSkills(),c},deleteSkill:async i=>{try{const s=await ke(`/api/skills/${i}`,{method:"DELETE"}),c=await s.json();return s.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==i)})),{success:!0}):{success:!1,error:c.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateSkill:async i=>{try{const s=await ke(`/api/skills/${i}/duplicate`,{method:"POST"}),c=await s.json();return s.ok?(await r().fetchSkills(),{success:!0}):{success:!1,error:c.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}));function Ih(){const[e,r]=H.useState({id:null,type:null}),i=H.useCallback(u=>r({id:u,type:"delete"}),[]),s=H.useCallback(()=>r({id:null,type:null}),[]),c=H.useCallback((u,f)=>e.id===u&&e.type===f,[e.id,e.type]);return{requestDelete:i,clearConfirm:s,isConfirming:c}}function Bh({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 zh({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(Pb,{})})}function no({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(ic,{})})}function Hi({label:e,value:r,onChange:i,placeholder:s,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=>i(l.target.value),readOnly:c,placeholder:s,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 Dw({onCancel:e,onSave:r,saving:i,saveDisabled:s}){return o.jsxs("div",{className:"flex justify-end gap-2 pt-2 border-t border-border",children:[o.jsx(it,{variant:"secondary",onClick:e,children:"Cancel"}),o.jsx(it,{variant:"primary",onClick:r,disabled:i||s,children:i?"Saving...":"Save"})]})}function Hh({message:e}){return o.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded",children:e})}function qb({description:e,onNew:r,newLabel:i="+ 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(it,{variant:"primary",size:"sm",onClick:r,children:i})})]})}function Wb({isBuiltIn:e,isConfirmingDelete:r,onView:i,onEdit:s,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&&i&&o.jsx("button",{onClick:i,className:"p-1.5 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors",title:"View",children:o.jsx(sc,{})}),o.jsx(no,{onClick:c}),!e&&s&&o.jsx(Fs,{onClick:s}),!e&&(r?o.jsx(Bh,{onConfirm:()=>{u==null||u()},onCancel:()=>{}}):o.jsx(zh,{onClick:()=>u==null?void 0:u()}))]})]})}function Lw({id:e,name:r,description:i,isBuiltIn:s,isConfirmingDelete:c,onView:u,onEdit:f,onDuplicate:l,onDelete:d}){return o.jsxs(Wb,{isBuiltIn:s,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})]}),i&&o.jsx("p",{className:"text-text-muted text-xs truncate",children:i})]})}function Gb({loading:e,hasItems:r,loadingLabel:i,emptyLabel:s,children:c}){return e&&!r?o.jsx("div",{className:"text-text-muted text-sm",children:i}):r?o.jsx("div",{className:"space-y-4",children:c}):s?o.jsx("div",{className:"text-text-muted text-sm",children:s}):null}function Vb({name:e,id:r,nameLabel:i="Name",idLabel:s="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(Hi,{label:i,value:e,onChange:p,placeholder:c,hint:f}),o.jsx(Hi,{label:s,value:r,onChange:g,readOnly:l,placeholder:u,hint:l?d:void 0,mono:!0})]})}function Kb(e={}){const{initialData:r={}}=e,[i,s]=H.useState("list"),[c,u]=H.useState(null),[f,l]=H.useState(""),[d,p]=H.useState(!1),[g,m]=H.useState(r),b=H.useCallback(()=>{m(r),l(""),u(null)},[r]),_=H.useCallback(x=>{s(x),x==="list"&&b()},[b]),k=H.useCallback(x=>{m(v=>typeof x=="function"?x(v):x)},[]),C=H.useCallback((x,v={})=>{u(x),s("edit"),m({...v}),l("")},[]),y=H.useCallback(()=>{u(null),s("edit"),m(r),l("")},[r]);return{view:i,editingId:c,formError:f,saving:d,formData:g,setView:_,setEditingId:u,setFormError:l,setFormData:k,setSaving:p,resetForm:b,startEditing:C,startNew:y}}function Ph(){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 Gx({skill:e,isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:c,onDuplicate:u,onDelete:f}){return o.jsx(Lw,{id:e.id,name:e.name,description:e.description,isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:c,onDuplicate:u,onDelete:f})}function Rw({isOpen:e}){const r=Br(I=>I.defaults),i=Br(I=>I.userItems),s=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:k,setView:C,setEditingId:y,setFormError:x,setFormData:v,setSaving:S}=Kb(),{clearConfirm:j}=Ih();H.useEffect(()=>{e&&(c(),C("list"),y(null),j())},[e,c,j]);const T=(I,F,P,X)=>{v({name:X??I.metadata.name,id:P??I.metadata.id,description:I.metadata.description??"",version:I.metadata.version??"1.0.0",prompt:I.prompt,isReadOnly:F})},N=async I=>{if(r.some(P=>P.id===I)){const P=await f(I);if(!P)return;T(P,!0),y(I),x(""),C("edit")}else{const P=await u(I);if(!P)return;T(P,!0),y(I),x(""),C("edit")}},D=async I=>{const P=r.some(Z=>Z.id===I)?await f(I):await u(I);if(!P)return;const X=`${I}-copy-${Date.now()}`;T(P,!1,X,`${P.metadata.name} (copy)`),y(null),x(""),C("edit")},A=()=>{v({name:"",id:"",description:"",version:"1.0.0",prompt:"",isReadOnly:!1}),C("edit")},B=async I=>{const F=await u(I);F&&(T(F,!1),y(I),x(""),C("edit"))},O=async I=>{await p(I),j()},q=async()=>{const I=m??k.id;if(!I||!k.name||!k.prompt){x("Name, ID, and prompt are required.");return}S(!0),x("");const F={metadata:{id:I,name:k.name,description:k.description,version:k.version},prompt:k.prompt},P=m?await d(m,F):await l(F);if(S(!1),!P.success){x(P.error??"Failed to save skill.");return}C("list")},V=I=>{v(F=>({...F,name:I})),m||v(F=>({...F,id:I.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}))},W=k.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?k.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(Hh,{message:b}),o.jsxs("div",{className:"space-y-3 mb-3",children:[o.jsx(Vb,{name:k.name,id:k.id,nameLabel:"Name",idLabel:"ID",namePlaceholder:"My Skill",idPlaceholder:"my-skill",readOnlyId:!0,onNameChange:V,onIdChange:()=>{}}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Hi,{label:"Description",value:k.description,onChange:I=>v(F=>({...F,description:I})),placeholder:"What this skill does...",readOnly:W}),o.jsx(Hi,{label:"Version",value:k.version,onChange:I=>v(F=>({...F,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:k.prompt,onChange:I=>v(F=>({...F,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(Ph,{}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-border flex-shrink-0",children:[o.jsx(it,{variant:"secondary",onClick:()=>C("list"),children:"Cancel"}),W?o.jsx(it,{variant:"primary",onClick:()=>{v(I=>({...I,name:I.name+" (copy)",id:`${m}-copy-${Date.now()}`,isReadOnly:!1})),y(null)},children:"Duplicate & Customize"}):o.jsx(it,{variant:"primary",onClick:q,disabled:_||!k.name||!k.id||!k.prompt,children:_?"Saving...":"Save"})]})]}):o.jsxs("div",{children:[o.jsx(qb,{description:"Skills provide domain-specific knowledge that agents can load on demand.",onNew:A}),o.jsxs(Gb,{loading:s,hasItems:r.length>0||i.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(Gx,{skill:I,isBuiltIn:!0,isConfirmingDelete:!1,onView:()=>N(I.id),onDuplicate:()=>D(I.id)},I.id))})]}),i.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:i.map(I=>o.jsx(Gx,{skill:I,isBuiltIn:!1,isConfirmingDelete:!1,onView:()=>N(I.id),onEdit:()=>B(I.id),onDuplicate:()=>D(I.id),onDelete:()=>O(I.id)},I.id))})]})]})]})}function Ow({isOpen:e,onClose:r}){const[i,s]=H.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(Fa,{label:"Instructions",active:i==="instructions",onClick:()=>s("instructions")}),o.jsx(Fa,{label:"Skills",active:i==="skills",onClick:()=>s("skills")}),o.jsx(Fa,{label:"Notifications",active:i==="notifications",onClick:()=>s("notifications")}),o.jsx(Fa,{label:"Display",active:i==="display",onClick:()=>s("display")}),o.jsx(Fa,{label:"Advanced",active:i==="advanced",onClick:()=>s("advanced")})]}),i==="instructions"&&o.jsx(Bw,{isOpen:e}),i==="skills"&&o.jsx(Rw,{isOpen:e}),i==="notifications"&&o.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:o.jsx(Aw,{})}),i==="display"&&o.jsx(Iw,{}),i==="advanced"&&o.jsx(Mw,{onClose:r})]})})}function Mw({onClose:e}){const[,r]=gr();function i(){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(it,{variant:"secondary",onClick:i,children:"Launch Onboarding"})]})})}function Iw(){const e=rn(g=>g.settings),r=rn(g=>g.loading),i=rn(g=>g.getSetting),s=rn(g=>g.setSetting),c=r[Tt.DISPLAY_SHOW_THINKING]??!1,u=[{key:Tt.DISPLAY_SHOW_THINKING,label:"Show thinking blocks",description:"Display AI reasoning content in the feed"},{key:Tt.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT,label:"Show expanded tool output",description:"Always show full tool call details instead of compact view"},{key:Tt.DISPLAY_SHOW_STATS,label:"Show stats bar",description:"Display model, tokens, and timing information"},{key:Tt.DISPLAY_SHOW_AGENT_DEFINITIONS,label:"Show agent definitions",description:"Display agent definition injections in the feed"},{key:Tt.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]=H.useState(()=>Object.fromEntries(u.map(g=>[g.key,f[g.key]==="true"])));H.useEffect(()=>{u.forEach(g=>i(g.key))},[i]),H.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 s(g,m)};return c?o.jsx("div",{className:"text-sm text-text-muted",children:"Loading..."}):o.jsx("div",{className:"space-y-6",children: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 Fa({label:e,active:r,onClick:i}){return o.jsx("button",{onClick:i,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 Bw({isOpen:e}){const r=rn(y=>y.settings),i=rn(y=>y.loading),s=rn(y=>y.getSetting),c=rn(y=>y.setSetting),u=r[Tt.GLOBAL_INSTRUCTIONS]??"",f=i[Tt.GLOBAL_INSTRUCTIONS]??!1,[l,d]=H.useState(u),[p,g]=H.useState(!1),[m,b]=H.useState(!1);H.useEffect(()=>{e&&s(Tt.GLOBAL_INSTRUCTIONS)},[e,s]),H.useEffect(()=>{d(u),g(!1)},[u]);const _=async()=>{b(!0),c(Tt.GLOBAL_INSTRUCTIONS,l),b(!1),g(!1)},k=()=>{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(Ph,{}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(it,{variant:"secondary",onClick:k,disabled:!p,children:"Discard"}),o.jsx(it,{variant:"primary",onClick:_,disabled:!p||C,children:m?"Saving...":"Save"})]})]})}var Fd={exports:{}},Vx;function zw(){return Vx||(Vx=1,(function(e,r){(function(i,s){e.exports=s()})(globalThis,(()=>(()=>{var i={4567:function(f,l,d){var p=this&&this.__decorate||function(v,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(v,S,j,T);else for(var B=v.length-1;B>=0;B--)(N=v[B])&&(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(v,S){return function(j,T){S(j,T,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.AccessibilityManager=void 0;const m=d(9042),b=d(9924),_=d(844),k=d(4725),C=d(2585),y=d(3656);let x=l.AccessibilityManager=class extends _.Disposable{constructor(v,S,j,T){super(),this._terminal=v,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(v){for(let S=0;S<v;S++)this._handleChar(" ")}_handleChar(v){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==v&&(this._charsToAnnounce+=v):this._charsToAnnounce+=v,v===`
|
|
59
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=m.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(v){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(v)||this._charsToConsume.push(v)}_refreshRows(v,S){this._liveRegionDebouncer.refresh(v,S,this._terminal.rows)}_renderRows(v,S){const j=this._terminal.buffer,T=j.lines.length.toString();for(let N=v;N<=S;N++){const D=j.lines.get(j.ydisp+N),A=[],B=(D==null?void 0:D.translateToString(!0,void 0,void 0,A))||"",O=(j.ydisp+N+1).toString(),q=this._rowElements[N];q&&(B.length===0?(q.innerText=" ",this._rowColumns.set(q,[0,1])):(q.textContent=B,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(v,S){const j=v.target,T=this._rowElements[S===0?1:this._rowElements.length-2];if(j.getAttribute("aria-posinset")===(S===0?"1":`${this._terminal.buffer.lines.length}`)||v.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(),v.preventDefault(),v.stopImmediatePropagation()}_handleSelectionChange(){var B;if(this._rowElements.length===0)return;const v=document.getSelection();if(!v)return;if(v.isCollapsed)return void(this._rowContainer.contains(v.anchorNode)&&this._terminal.clearSelection());if(!v.anchorNode||!v.focusNode)return void console.error("anchorNode and/or focusNode are null");let S={node:v.anchorNode,offset:v.anchorOffset},j={node:v.focusNode,offset:v.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:((B=T.textContent)==null?void 0:B.length)??0}),!this._rowContainer.contains(j.node))return;const N=({node:O,offset:q})=>{const V=O instanceof Text?O.parentNode:O;let W=parseInt(V==null?void 0:V.getAttribute("aria-posinset"),10)-1;if(isNaN(W))return console.warn("row is invalid. Race condition?"),null;const I=this._rowColumns.get(V);if(!I)return console.warn("columns is null. Race condition?"),null;let F=q<I.length?I[q]:I.slice(-1)[0]+1;return F>=this._terminal.cols&&(++W,F=0),{row:W,column:F}},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(v){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>v;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const v=this._coreBrowserService.mainDocument.createElement("div");return v.setAttribute("role","listitem"),v.tabIndex=-1,this._refreshRowDimensions(v),v}_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 v=0;v<this._terminal.rows;v++)this._refreshRowDimensions(this._rowElements[v])}}_refreshRowDimensions(v){v.style.height=`${this._renderService.dimensions.css.cell.height}px`}};l.AccessibilityManager=x=p([g(1,C.IInstantiationService),g(2,k.ICoreBrowserService),g(3,k.IRenderService)],x)},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,_,k,C){b=p(b=d(b),k.decPrivateModes.bracketedPasteMode&&C.rawOptions.ignoreBracketedPasteMode!==!0),k.triggerDataEvent(b,!0),_.value=""}function m(b,_,k){const C=k.getBoundingClientRect(),y=b.clientX-C.left-10,x=b.clientY-C.top-10;_.style.width="20px",_.style.height="20px",_.style.left=`${y}px`,_.style.top=`${x}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,_,k,C){b.stopPropagation(),b.clipboardData&&g(b.clipboardData.getData("text/plain"),_,k,C)},l.paste=g,l.moveTextAreaUnderMouseCursor=m,l.rightClickHandler=function(b,_,k,C,y){m(b,_,k),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(x,v,S,j){var T,N=arguments.length,D=N<3?v:j===null?j=Object.getOwnPropertyDescriptor(v,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(x,v,S,j);else for(var A=x.length-1;A>=0;A--)(T=x[A])&&(D=(N<3?T(D):N>3?T(v,S,D):T(v,S))||D);return N>3&&D&&Object.defineProperty(v,S,D),D},g=this&&this.__param||function(x,v){return function(S,j){v(S,j,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Linkifier=void 0;const m=d(3656),b=d(8460),_=d(844),k=d(2585),C=d(4725);let y=l.Linkifier=class extends _.Disposable{get currentLink(){return this._currentLink}constructor(x,v,S,j,T){super(),this._element=x,this._mouseService=v,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(x){this._lastMouseEvent=x;const v=this._positionFromMouseEvent(x,this._element,this._mouseService);if(!v)return;this._isMouseOut=!1;const S=x.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&&v.x===this._lastBufferCell.x&&v.y===this._lastBufferCell.y||(this._handleHover(v),this._lastBufferCell=v)}_handleHover(x){if(this._activeLine!==x.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(x,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,x)||(this._clearCurrentLink(),this._askForLink(x,!0))}_askForLink(x,v){var j,T;this._activeProviderReplies&&v||((j=this._activeProviderReplies)==null||j.forEach((N=>{N==null||N.forEach((D=>{D.link.dispose&&D.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=x.y);let S=!1;for(const[N,D]of this._linkProviderService.linkProviders.entries())v?(T=this._activeProviderReplies)!=null&&T.get(N)&&(S=this._checkLinkProviderResult(N,x,S)):D.provideLinks(x.y,(A=>{var O,q;if(this._isMouseOut)return;const B=A==null?void 0:A.map((V=>({link:V})));(O=this._activeProviderReplies)==null||O.set(N,B),S=this._checkLinkProviderResult(N,x,S),((q=this._activeProviderReplies)==null?void 0:q.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(x.y,this._activeProviderReplies)}))}_removeIntersectingLinks(x,v){const S=new Set;for(let j=0;j<v.size;j++){const T=v.get(j);if(T)for(let N=0;N<T.length;N++){const D=T[N],A=D.link.range.start.y<x?0:D.link.range.start.x,B=D.link.range.end.y>x?this._bufferService.cols:D.link.range.end.x;for(let O=A;O<=B;O++){if(S.has(O)){T.splice(N--,1);break}S.add(O)}}}}_checkLinkProviderResult(x,v,S){var N;if(!this._activeProviderReplies)return S;const j=this._activeProviderReplies.get(x);let T=!1;for(let D=0;D<x;D++)this._activeProviderReplies.has(D)&&!this._activeProviderReplies.get(D)||(T=!0);if(!T&&j){const D=j.find((A=>this._linkAtPosition(A.link,v)));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((B=>this._linkAtPosition(B.link,v)));if(A){S=!0,this._handleNewLink(A);break}}return S}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(x){if(!this._currentLink)return;const v=this._positionFromMouseEvent(x,this._element,this._mouseService);v&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,v)&&this._currentLink.link.activate(x,this._currentLink.link.text)}_clearCurrentLink(x,v){this._currentLink&&this._lastMouseEvent&&(!x||!v||this._currentLink.link.range.start.y>=x&&this._currentLink.link.range.end.y<=v)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,_.disposeArray)(this._linkCacheDisposables))}_handleNewLink(x){if(!this._lastMouseEvent)return;const v=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);v&&this._linkAtPosition(x.link,v)&&(this._currentLink=x,this._currentLink.state={decorations:{underline:x.link.decorations===void 0||x.link.decorations.underline,pointerCursor:x.link.decorations===void 0||x.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,x.link,this._lastMouseEvent),x.link.decorations={},Object.defineProperties(x.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(x.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(x,v,S){var j;(j=this._currentLink)!=null&&j.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(v,!0),this._currentLink.state.decorations.pointerCursor&&x.classList.add("xterm-cursor-pointer")),v.hover&&v.hover(S,v.text)}_fireUnderlineEvent(x,v){const S=x.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);(v?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(T)}_linkLeave(x,v,S){var j;(j=this._currentLink)!=null&&j.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(v,!1),this._currentLink.state.decorations.pointerCursor&&x.classList.remove("xterm-cursor-pointer")),v.leave&&v.leave(S,v.text)}_linkAtPosition(x,v){const S=x.range.start.y*this._bufferService.cols+x.range.start.x,j=x.range.end.y*this._bufferService.cols+x.range.end.x,T=v.y*this._bufferService.cols+v.x;return S<=T&&T<=j}_positionFromMouseEvent(x,v,S){const j=S.getCoords(x,v,this._bufferService.cols,this._bufferService.rows);if(j)return{x:j[0],y:j[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(x,v,S,j,T){return{x1:x,y1:v,x2:S,y2:j,cols:this._bufferService.cols,fg:T}}};l.Linkifier=y=p([g(1,C.IMouseService),g(2,C.IRenderService),g(3,k.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,x,v){var S,j=arguments.length,T=j<3?y:v===null?v=Object.getOwnPropertyDescriptor(y,x):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(C,y,x,v);else for(var N=C.length-1;N>=0;N--)(S=C[N])&&(T=(j<3?S(T):j>3?S(y,x,T):S(y,x))||T);return j>3&&T&&Object.defineProperty(y,x,T),T},g=this&&this.__param||function(C,y){return function(x,v){y(x,v,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,x){this._bufferService=C,this._optionsService=y,this._oscLinkService=x}provideLinks(C,y){var B;const x=this._bufferService.buffer.lines.get(C-1);if(!x)return void y(void 0);const v=[],S=this._optionsService.rawOptions.linkHandler,j=new m.CellData,T=x.getTrimmedLength();let N=-1,D=-1,A=!1;for(let O=0;O<T;O++)if(D!==-1||x.hasContent(O)){if(x.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=(B=this._oscLinkService.getLinkData(N))==null?void 0:B.uri;if(q){const V={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||v.push({text:q,range:V,activate:(I,F)=>S?S.activate(I,F,V):k(0,F),hover:(I,F)=>{var P;return(P=S==null?void 0:S.hover)==null?void 0:P.call(S,I,F,V)},leave:(I,F)=>{var P;return(P=S==null?void 0:S.leave)==null?void 0:P.call(S,I,F,V)}})}A=!1,j.hasExtendedAttrs()&&j.extended.urlId?(D=O,N=j.extended.urlId):(D=-1,N=-1)}}y(v)}};function k(C,y){if(confirm(`Do you want to navigate to ${y}?
|
|
60
|
-
|
|
61
|
-
WARNING: This link could potentially be dangerous`)){const x=window.open();if(x){try{x.opener=null}catch{}x.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),k=d(1680),C=d(3107),y=d(5744),x=d(2950),v=d(1296),S=d(428),j=d(4269),T=d(5114),N=d(8934),D=d(3230),A=d(9312),B=d(4725),O=d(6731),q=d(8055),V=d(8969),W=d(8460),I=d(844),F=d(6114),P=d(8437),X=d(2584),Z=d(7399),z=d(5941),R=d(9074),L=d(2585),$=d(5435),U=d(4567),ne=d(779);class Q extends V.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=F,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(R.DecorationService),this._instantiationService.setService(L.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ne.LinkProviderService),this._instantiationService.setService(B.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(_.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((G,oe)=>this.refresh(G,oe)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((G=>this._reportWindowsOptions(G)))),this.register(this._inputHandler.onColor((G=>this._handleColorEvent(G)))),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((G=>this._afterResize(G.cols,G.rows)))),this.register((0,I.toDisposable)((()=>{var G,oe;this._customKeyEventHandler=void 0,(oe=(G=this.element)==null?void 0:G.parentNode)==null||oe.removeChild(this.element)})))}_handleColorEvent(Y){if(this._themeService)for(const G of Y){let oe,re="";switch(G.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;"+G.index}switch(G.type){case 0:const ve=q.color.toColorRGB(oe==="ansi"?this._themeService.colors.ansi[G.index]:this._themeService.colors[oe]);this.coreService.triggerDataEvent(`${X.C0.ESC}]${re};${(0,z.toRgbString)(ve)}${X.C1_ESCAPED.ST}`);break;case 1:if(oe==="ansi")this._themeService.modifyColors((be=>be.ansi[G.index]=q.channels.toColor(...G.color)));else{const be=oe;this._themeService.modifyColors((Le=>Le[be]=q.channels.toColor(...G.color)))}break;case 2:this._themeService.restoreColor(G.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,G=this.buffer.lines.get(Y);if(!G)return;const oe=Math.min(this.buffer.x,this.cols-1),re=this._renderService.dimensions.css.cell.height,ve=G.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",(G=>{this.hasSelection()&&(0,p.copyHandler)(G,this._selectionService)})));const Y=G=>(0,p.handlePasteEvent)(G,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",Y)),this.register((0,g.addDisposableDomListener)(this.element,"paste",Y)),F.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(G=>{G.button===2&&(0,p.rightClickHandler)(G,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",(G=>{(0,p.rightClickHandler)(G,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),F.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",(G=>{G.button===1&&(0,p.moveTextAreaUnderMouseCursor)(G,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 G=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),G.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),G.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",b.promptLabel),F.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(B.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(B.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(O.ThemeService),this._instantiationService.setService(B.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(j.CharacterJoinerService),this._instantiationService.setService(B.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(D.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(B.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(x.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(N.MouseService),this._instantiationService.setService(B.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(m.Linkifier,this.screenElement)),this.element.appendChild(G);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(k.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(B.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(v.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const Y=this,G=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||(G.addEventListener("mousemove",ve.mousemove),re.mousemove=ve.mousemove):(G.removeEventListener("mousemove",re.mousemove),re.mousemove=null),16&be?re.wheel||(G.addEventListener("wheel",ve.wheel,{passive:!1}),re.wheel=ve.wheel):(G.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)(G,"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)(G,"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)(G,"touchstart",(be=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(be),this.cancel(be)}),{passive:!0})),this.register((0,g.addDisposableDomListener)(G,"touchmove",(be=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(be)?void 0:this.cancel(be)}),{passive:!1}))}refresh(Y,G){var oe;(oe=this._renderService)==null||oe.refreshRows(Y,G)}updateCursorStyle(Y){var G;(G=this._selectionService)!=null&&G.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,G,oe=0){var re;oe===1?(super.scrollLines(Y,G,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 G=this._characterJoinerService.register(Y);return this.refresh(0,this.rows-1),G}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,G,oe){this._selectionService.setSelection(Y,G,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,G){var oe;(oe=this._selectionService)==null||oe.selectLines(Y,G)}_keyDown(Y){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(Y)===!1)return!1;const G=this.browser.isMac&&this.options.macOptionIsMeta&&Y.altKey;if(!G&&!this._compositionHelper.keydown(Y))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;G||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,G){const oe=Y.isMac&&!this.options.macOptionIsMeta&&G.altKey&&!G.ctrlKey&&!G.metaKey||Y.isWindows&&G.altKey&&G.ctrlKey&&!G.metaKey||Y.isWindows&&G.getModifierState("AltGraph");return G.type==="keypress"?oe:oe&&(!G.keyCode||G.keyCode>47)}_keyUp(Y){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(Y)===!1||((function(G){return G.keyCode===16||G.keyCode===17||G.keyCode===18})(Y)||this.focus(),this.updateCursorStyle(Y),this._keyPressHandled=!1)}_keyPress(Y){let G;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(Y)===!1)return!1;if(this.cancel(Y),Y.charCode)G=Y.charCode;else if(Y.which===null||Y.which===void 0)G=Y.keyCode;else{if(Y.which===0||Y.charCode===0)return!1;G=Y.which}return!(!G||(Y.altKey||Y.ctrlKey||Y.metaKey)&&!this._isThirdLevelShift(this.browser,Y)||(G=String.fromCharCode(G),this._onKey.fire({key:G,domEvent:Y}),this._showCursor(),this.coreService.triggerDataEvent(G,!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 G=Y.data;return this.coreService.triggerDataEvent(G,!0),this.cancel(Y),!0}return!1}resize(Y,G){Y!==this.cols||G!==this.rows?super.resize(Y,G):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(Y,G){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 G=1;G<this.rows;G++)this.buffer.lines.push(this.buffer.getBlankLine(P.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 G,oe;this.options.rows=this.rows,this.options.cols=this.cols;const Y=this._customKeyEventHandler;this._setup(),super.reset(),(G=this._selectionService)==null||G.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 $.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const G=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};${G}t`);break;case $.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,G){if(this.options.cancelEvents||G)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(x,v,S,j){var T,N=arguments.length,D=N<3?v:j===null?j=Object.getOwnPropertyDescriptor(v,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(x,v,S,j);else for(var A=x.length-1;A>=0;A--)(T=x[A])&&(D=(N<3?T(D):N>3?T(v,S,D):T(v,S))||D);return N>3&&D&&Object.defineProperty(v,S,D),D},g=this&&this.__param||function(x,v){return function(S,j){v(S,j,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Viewport=void 0;const m=d(3656),b=d(4725),_=d(8460),k=d(844),C=d(2585);let y=l.Viewport=class extends k.Disposable{constructor(x,v,S,j,T,N,D,A){super(),this._viewportElement=x,this._scrollArea=v,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((B=>this._activeBuffer=B.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((B=>this._renderDimensions=B))),this._handleThemeChange(A.colors),this.register(A.onChangeColors((B=>this._handleThemeChange(B)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(x){this._viewportElement.style.backgroundColor=x.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(x){if(x)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 v=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==v&&(this._lastRecordedBufferHeight=v,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const x=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==x&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=x),this._refreshAnimationFrame=null}syncScrollArea(x=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(x);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(x)}_handleScroll(x){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 v=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:v,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const x=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(x*(this._smoothScrollState.target-this._smoothScrollState.origin)),x<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(x,v){const S=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(v<0&&this._viewportElement.scrollTop!==0||v>0&&S<this._lastRecordedBufferHeight)||(x.cancelable&&x.preventDefault(),!1)}handleWheel(x){const v=this._getPixelsScrolled(x);return v!==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+v:this._smoothScrollState.target+=v,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=v,this._bubbleScroll(x,v))}scrollLines(x){if(x!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const v=x*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+v,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:x,suppressScrollEvent:!1})}_getPixelsScrolled(x){if(x.deltaY===0||x.shiftKey)return 0;let v=this._applyScrollModifier(x.deltaY,x);return x.deltaMode===WheelEvent.DOM_DELTA_LINE?v*=this._currentRowHeight:x.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(v*=this._currentRowHeight*this._bufferService.rows),v}getBufferElements(x,v){var A;let S,j="";const T=[],N=v??this._bufferService.buffer.lines.length,D=this._bufferService.buffer.lines;for(let B=x;B<N;B++){const O=D.get(B);if(!O)continue;const q=(A=D.get(B+1))==null?void 0:A.isWrapped;if(j+=O.translateToString(!q),!q||B===D.length-1){const V=document.createElement("div");V.textContent=j,T.push(V),j.length>0&&(S=V),j=""}}return{bufferElements:T,cursorElement:S}}getLinesScrolled(x){if(x.deltaY===0||x.shiftKey)return 0;let v=this._applyScrollModifier(x.deltaY,x);return x.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(v/=this._currentRowHeight+0,this._wheelPartialScroll+=v,v=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):x.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(v*=this._bufferService.rows),v}_applyScrollModifier(x,v){const S=this._optionsService.rawOptions.fastScrollModifier;return S==="alt"&&v.altKey||S==="ctrl"&&v.ctrlKey||S==="shift"&&v.shiftKey?x*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:x*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(x){this._lastTouchY=x.touches[0].pageY}handleTouchMove(x){const v=this._lastTouchY-x.touches[0].pageY;return this._lastTouchY=x.touches[0].pageY,v!==0&&(this._viewportElement.scrollTop+=v,this._bubbleScroll(x,v))}};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,x,v){var S,j=arguments.length,T=j<3?y:v===null?v=Object.getOwnPropertyDescriptor(y,x):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(C,y,x,v);else for(var N=C.length-1;N>=0;N--)(S=C[N])&&(T=(j<3?S(T):j>3?S(y,x,T):S(y,x))||T);return j>3&&T&&Object.defineProperty(y,x,T),T},g=this&&this.__param||function(C,y){return function(x,v){y(x,v,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferDecorationRenderer=void 0;const m=d(4725),b=d(844),_=d(2585);let k=l.BufferDecorationRenderer=class extends b.Disposable{constructor(C,y,x,v,S){super(),this._screenElement=C,this._bufferService=y,this._coreBrowserService=x,this._decorationService=v,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 v;const y=this._coreBrowserService.mainDocument.createElement("div");y.classList.add("xterm-decoration"),y.classList.toggle("xterm-decoration-top-layer",((v=C==null?void 0:C.options)==null?void 0:v.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 x=C.options.x??0;return x&&x>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 x=this._decorationElements.get(C);x||(x=this._createElement(C),C.element=x,this._decorationElements.set(C,x),this._container.appendChild(x),C.onDispose((()=>{this._decorationElements.delete(C),x.remove()}))),x.style.top=y*this._renderService.dimensions.css.cell.height+"px",x.style.display=this._altBufferIsActive?"none":"block",C.onRenderEmitter.fire(x)}}_refreshXPosition(C,y=C.element){if(!y)return;const x=C.options.x??0;(C.options.anchor||"left")==="right"?y.style.right=x?x*this._renderService.dimensions.css.cell.width+"px":"":y.style.left=x?x*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=k=p([g(1,_.IBufferService),g(2,m.ICoreBrowserService),g(3,_.IDecorationService),g(4,m.IRenderService)],k)},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,B=A<3?j:N===null?N=Object.getOwnPropertyDescriptor(j,T):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(S,j,T,N);else for(var O=S.length-1;O>=0;O--)(D=S[O])&&(B=(A<3?D(B):A>3?D(j,T,B):D(j,T))||B);return A>3&&B&&Object.defineProperty(j,T,B),B},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),k=d(2585),C={full:0,left:0,center:0,right:0},y={full:0,left:0,center:0,right:0},x={full:0,left:0,center:0,right:0};let v=l.OverviewRulerRenderer=class extends _.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(S,j,T,N,D,A,B){var q;super(),this._viewportElement=S,this._screenElement=j,this._bufferService=T,this._decorationService=N,this._renderService=D,this._optionsService=A,this._coreBrowserService=B,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 V;(V=this._canvas)==null||V.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(),x.full=0,x.left=0,x.center=y.left,x.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(x[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=v=p([g(2,k.IBufferService),g(3,k.IDecorationService),g(4,b.IRenderService),g(5,k.IOptionsService),g(6,b.ICoreBrowserService)],v)},2950:function(f,l,d){var p=this&&this.__decorate||function(C,y,x,v){var S,j=arguments.length,T=j<3?y:v===null?v=Object.getOwnPropertyDescriptor(y,x):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(C,y,x,v);else for(var N=C.length-1;N>=0;N--)(S=C[N])&&(T=(j<3?S(T):j>3?S(y,x,T):S(y,x))||T);return j>3&&T&&Object.defineProperty(y,x,T),T},g=this&&this.__param||function(C,y){return function(x,v){y(x,v,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CompositionHelper=void 0;const m=d(4725),b=d(2585),_=d(2584);let k=l.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(C,y,x,v,S,j){this._textarea=C,this._compositionView=y,this._bufferService=x,this._optionsService=v,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 x;this._isSendingComposition=!1,y.start+=this._dataAlreadySent.length,x=this._isComposing?this._textarea.value.substring(y.start,y.end):this._textarea.value.substring(y.start),x.length>0&&this._coreService.triggerDataEvent(x,!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,x=y.replace(C,"");this._dataAlreadySent=x,y.length>C.length?this._coreService.triggerDataEvent(x,!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),x=this._renderService.dimensions.css.cell.height,v=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=v+"px",this._compositionView.style.height=x+"px",this._compositionView.style.lineHeight=x+"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=v+"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=k=p([g(2,b.IBufferService),g(3,b.IOptionsService),g(4,b.ICoreService),g(5,m.IRenderService)],k)},9806:(f,l)=>{function d(p,g,m){const b=m.getBoundingClientRect(),_=p.getComputedStyle(m),k=parseInt(_.getPropertyValue("padding-left")),C=parseInt(_.getPropertyValue("padding-top"));return[g.clientX-b.left-k,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,_,k,C,y,x){if(!k)return;const v=d(p,g,m);return v?(v[0]=Math.ceil((v[0]+(x?C/2:0))/C),v[1]=Math.ceil(v[1]/y),v[0]=Math.min(Math.max(v[0],1),b+(x?1:0)),v[1]=Math.min(Math.max(v[1],1),_),v):void 0}},9504:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.moveToCellSequence=void 0;const p=d(2584);function g(y,x,v,S){const j=y-m(y,v),T=x-m(x,v),N=Math.abs(j-T)-(function(D,A,B){let O=0;const q=D-m(D,B),V=A-m(A,B);for(let W=0;W<Math.abs(q-V);W++){const I=b(D,A)==="A"?-1:1,F=B.buffer.lines.get(q+I*W);F!=null&&F.isWrapped&&O++}return O})(y,x,v);return C(N,k(b(y,x),S))}function m(y,x){let v=0,S=x.buffer.lines.get(y),j=S==null?void 0:S.isWrapped;for(;j&&y>=0&&y<x.rows;)v++,S=x.buffer.lines.get(--y),j=S==null?void 0:S.isWrapped;return v}function b(y,x){return y>x?"A":"B"}function _(y,x,v,S,j,T){let N=y,D=x,A="";for(;N!==v||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 k(y,x){const v=x?"O":"[";return p.C0.ESC+v+y}function C(y,x){y=Math.floor(y);let v="";for(let S=0;S<y;S++)v+=x;return v}l.moveToCellSequence=function(y,x,v,S){const j=v.buffer.x,T=v.buffer.y;if(!v.buffer.hasScrollback)return(function(A,B,O,q,V,W){return g(B,q,V,W).length===0?"":C(_(A,B,A,B-m(B,V),!1,V).length,k("D",W))})(j,T,0,x,v,S)+g(T,x,v,S)+(function(A,B,O,q,V,W){let I;I=g(B,q,V,W).length>0?q-m(q,V):B;const F=q,P=(function(X,Z,z,R,L,$){let U;return U=g(z,R,L,$).length>0?R-m(R,L):Z,X<z&&U<=R||X>=z&&U<R?"C":"D"})(A,B,O,q,V,W);return C(_(A,I,O,F,P==="C",V).length,k(P,W))})(j,T,y,x,v,S);let N;if(T===x)return N=j>y?"D":"C",C(Math.abs(j-y),k(N,S));N=T>x?"D":"C";const D=Math.abs(T-x);return C((function(A,B){return B.cols-A})(T>x?y:j,v)+(D-1)*v.cols+1+((T>x?j:y)-1),k(N,S))}},1296:function(f,l,d){var p=this&&this.__decorate||function(W,I,F,P){var X,Z=arguments.length,z=Z<3?I:P===null?P=Object.getOwnPropertyDescriptor(I,F):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(W,I,F,P);else for(var R=W.length-1;R>=0;R--)(X=W[R])&&(z=(Z<3?X(z):Z>3?X(I,F,z):X(I,F))||z);return Z>3&&z&&Object.defineProperty(I,F,z),z},g=this&&this.__param||function(W,I){return function(F,P){I(F,P,W)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRenderer=void 0;const m=d(3787),b=d(2550),_=d(2223),k=d(6171),C=d(6052),y=d(4725),x=d(8055),v=d(8460),S=d(844),j=d(2585),T="xterm-dom-renderer-owner-",N="xterm-rows",D="xterm-fg-",A="xterm-bg-",B="xterm-focus",O="xterm-selection";let q=1,V=l.DomRenderer=class extends S.Disposable{constructor(W,I,F,P,X,Z,z,R,L,$,U,ne,Q){super(),this._terminal=W,this._document=I,this._element=F,this._screenElement=P,this._viewportElement=X,this._helperContainer=Z,this._linkifier2=z,this._charSizeService=L,this._optionsService=$,this._bufferService=U,this._coreBrowserService=ne,this._themeService=Q,this._terminalClass=q++,this._rowElements=[],this._selectionRenderModel=(0,C.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new v.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,k.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=R.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 F of this._rowElements)F.style.width=`${this.dimensions.css.canvas.width}px`,F.style.height=`${this.dimensions.css.cell.height}px`,F.style.lineHeight=`${this.dimensions.css.cell.height}px`,F.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: ${x.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 F=`blink_underline_${this._terminalClass}`,P=`blink_bar_${this._terminalClass}`,X=`blink_block_${this._terminalClass}`;I+=`@keyframes ${F} { 50% { border-bottom-style: hidden; }}`,I+=`@keyframes ${P} { 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}.${B} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${F} 1s step-end infinite;}${this._terminalSelector} .${N}.${B} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${P} 1s step-end infinite;}${this._terminalSelector} .${N}.${B} .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,z]of W.ansi.entries())I+=`${this._terminalSelector} .${D}${Z} { color: ${z.css}; }${this._terminalSelector} .${D}${Z}.xterm-dim { color: ${x.color.multiplyOpacity(z,.5).css}; }${this._terminalSelector} .${A}${Z} { background-color: ${z.css}; }`;I+=`${this._terminalSelector} .${D}${_.INVERTED_DEFAULT_COLOR} { color: ${x.color.opaque(W.background).css}; }${this._terminalSelector} .${D}${_.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${x.color.multiplyOpacity(x.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 F=this._rowElements.length;F<=I;F++){const P=this._document.createElement("div");this._rowContainer.appendChild(P),this._rowElements.push(P)}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(B),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(B),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(W,I,F){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(W,I,F),this.renderRows(0,this._bufferService.rows-1),!W||!I)return;this._selectionRenderModel.update(this._terminal,W,I,F);const P=this._selectionRenderModel.viewportStartRow,X=this._selectionRenderModel.viewportEndRow,Z=this._selectionRenderModel.viewportCappedStartRow,z=this._selectionRenderModel.viewportCappedEndRow;if(Z>=this._bufferService.rows||z<0)return;const R=this._document.createDocumentFragment();if(F){const L=W[0]>I[0];R.appendChild(this._createSelectionElement(Z,L?I[0]:W[0],L?W[0]:I[0],z-Z+1))}else{const L=P===Z?W[0]:0,$=Z===X?I[0]:this._bufferService.cols;R.appendChild(this._createSelectionElement(Z,L,$));const U=z-Z-1;if(R.appendChild(this._createSelectionElement(Z+1,0,this._bufferService.cols,U)),Z!==z){const ne=X===z?I[0]:this._bufferService.cols;R.appendChild(this._createSelectionElement(z,0,ne))}}this._selectionContainer.appendChild(R)}_createSelectionElement(W,I,F,P=1){const X=this._document.createElement("div"),Z=I*this.dimensions.css.cell.width;let z=this.dimensions.css.cell.width*(F-I);return Z+z>this.dimensions.css.canvas.width&&(z=this.dimensions.css.canvas.width-Z),X.style.height=P*this.dimensions.css.cell.height+"px",X.style.top=W*this.dimensions.css.cell.height+"px",X.style.left=`${Z}px`,X.style.width=`${z}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 F=this._bufferService.buffer,P=F.ybase+F.y,X=Math.min(F.x,this._bufferService.cols-1),Z=this._optionsService.rawOptions.cursorBlink,z=this._optionsService.rawOptions.cursorStyle,R=this._optionsService.rawOptions.cursorInactiveStyle;for(let L=W;L<=I;L++){const $=L+F.ydisp,U=this._rowElements[L],ne=F.lines.get($);if(!U||!ne)break;U.replaceChildren(...this._rowFactory.createRow(ne,$,$===P,z,R,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,F,P,X,Z){F<0&&(W=0),P<0&&(I=0);const z=this._bufferService.rows-1;F=Math.max(Math.min(F,z),0),P=Math.max(Math.min(P,z),0),X=Math.min(X,this._bufferService.cols);const R=this._bufferService.buffer,L=R.ybase+R.y,$=Math.min(R.x,X-1),U=this._optionsService.rawOptions.cursorBlink,ne=this._optionsService.rawOptions.cursorStyle,Q=this._optionsService.rawOptions.cursorInactiveStyle;for(let ee=F;ee<=P;++ee){const Y=ee+R.ydisp,G=this._rowElements[ee],oe=R.lines.get(Y);if(!G||!oe)break;G.replaceChildren(...this._rowFactory.createRow(oe,Y,Y===L,ne,Q,$,U,this.dimensions.css.cell.width,this._widthCache,Z?ee===F?W:0:-1,Z?(ee===P?I:X)-1:-1))}}};l.DomRenderer=V=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)],V)},3787:function(f,l,d){var p=this&&this.__decorate||function(N,D,A,B){var O,q=arguments.length,V=q<3?D:B===null?B=Object.getOwnPropertyDescriptor(D,A):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")V=Reflect.decorate(N,D,A,B);else for(var W=N.length-1;W>=0;W--)(O=N[W])&&(V=(q<3?O(V):q>3?O(D,A,V):O(D,A))||V);return q>3&&V&&Object.defineProperty(D,A,V),V},g=this&&this.__param||function(N,D){return function(A,B){D(A,B,N)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRendererRowFactory=void 0;const m=d(2223),b=d(643),_=d(511),k=d(2585),C=d(8055),y=d(4725),x=d(4269),v=d(6171),S=d(3734);let j=l.DomRendererRowFactory=class{constructor(N,D,A,B,O,q,V){this._document=N,this._characterJoinerService=D,this._optionsService=A,this._coreBrowserService=B,this._coreService=O,this._decorationService=q,this._themeService=V,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,B,O,q,V,W,I,F,P){const X=[],Z=this._characterJoinerService.getJoinedCharacters(D),z=this._themeService.colors;let R,L=N.getNoBgTrimmedLength();A&&L<q+1&&(L=q+1);let $=0,U="",ne=0,Q=0,ee=0,Y=!1,G=0,oe=!1,re=0;const ve=[],be=F!==-1&&P!==-1;for(let Le=0;Le<L;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 x.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>=F&&Le<=P;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()),R){if($&&(fe&&oe||!fe&&!oe&&Ee.bg===ne)&&(fe&&oe&&z.selectionForeground||Ee.fg===Q)&&Ee.extended.ext===ee&&Ue===Y&&re===G&&!je&&!ze&&!It){Ee.isInvisible()?U+=b.WHITESPACE_CELL_CHAR:U+=pe,$++;continue}$&&(R.textContent=U),R=this._document.createElement("span"),$=0,U=""}else R=this._document.createElement("span");if(ne=Ee.bg,Q=Ee.fg,ee=Ee.extended.ext,Y=Ue,G=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)V&&ve.push("xterm-cursor-blink"),ve.push(B==="bar"?"xterm-cursor-bar":B==="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())R.style.textDecorationColor=`rgb(${S.AttributeData.toColorRGB(Ee.getUnderlineColor()).join(",")})`;else{let Ye=Ee.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Ee.isBold()&&Ye<8&&(Ye+=8),R.style.textDecorationColor=z.ansi[Ye].css}Ee.isOverline()&&(ve.push("xterm-overline"),U===" "&&(U=" ")),Ee.isStrikethrough()&&ve.push("xterm-strikethrough"),Ue&&(R.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,_t=!1;switch(this._decorationService.forEachDecorationAtCell(Le,D,void 0,(Ye=>{Ye.options.layer!=="top"&&_t||(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),_t=Ye.options.layer==="top")})),!_t&&fe&&(Te=this._coreBrowserService.isFocused?z.selectionBackgroundOpaque:z.selectionInactiveBackgroundOpaque,ot=Te.rgba>>8&16777215,ue=50331648,_t=!0,z.selectionForeground&&(Me=50331648,Ne=z.selectionForeground.rgba>>8&16777215,Ie=z.selectionForeground)),_t&&ve.push("xterm-decoration-top"),ue){case 16777216:case 33554432:$e=z.ansi[ot],ve.push(`xterm-bg-${ot}`);break;case 50331648:$e=C.channels.toColor(ot>>16,ot>>8&255,255&ot),this._addStyle(R,`background-color:#${T((ot>>>0).toString(16),"0",6)}`);break;default:_e?($e=z.foreground,ve.push(`xterm-bg-${m.INVERTED_DEFAULT_COLOR}`)):$e=z.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(R,$e,z.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(R,$e,Ye,Ee,Te,Ie)||this._addStyle(R,`color:#${T(Ne.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(R,$e,z.foreground,Ee,Te,Ie)||_e&&ve.push(`xterm-fg-${m.INVERTED_DEFAULT_COLOR}`)}ve.length&&(R.className=ve.join(" "),ve.length=0),je||ze||It?R.textContent=U:$++,re!==this.defaultSpacing&&(R.style.letterSpacing=`${re}px`),X.push(R),Le=We}return R&&$&&(R.textContent=U),X}_applyMinimumContrast(N,D,A,B,O,q){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,v.treatGlyphAsBackgroundColor)(B.getCode()))return!1;const V=this._getContrastCache(B);let W;if(O||q||(W=V.getColor(D.rgba,A.rgba)),W===void 0){const I=this._optionsService.rawOptions.minimumContrastRatio/(B.isDim()?2:1);W=C.color.ensureContrastRatio(O||D,q||A,I),V.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,B=this._selectionEnd;return!(!A||!B)&&(this._columnSelectMode?A[0]<=B[0]?N>=A[0]&&D>=A[1]&&N<B[0]&&D<=B[1]:N<A[0]&&D>=A[1]&&N>=B[0]&&D<=B[1]:D>A[1]&&D<B[1]||A[1]===B[1]&&D===A[1]&&N>=A[0]&&N<B[0]||A[1]<B[1]&&D===B[1]&&N<B[0]||A[1]<B[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,k.IOptionsService),g(3,y.ICoreBrowserService),g(4,k.ICoreService),g(5,k.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 k=this._measure(d,0);return k>0&&(this._flat[m]=k),k}let b=d;p&&(b+="B"),g&&(b+="I");let _=this._holey.get(b);if(_===void 0){let k=0;p&&(k|=1),g&&(k|=2),_=this._measure(d,k),_>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(k){return 57344<=k&&k<=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 k=g.buffers.active.ydisp,C=m[1]-k,y=b[1]-k,x=Math.max(C,0),v=Math.min(y,g.rows-1);x>=g.rows||v<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=_,this.viewportStartRow=C,this.viewportEndRow=y,this.viewportCappedStartRow=x,this.viewportCappedEndRow=v,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(v,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(v,S,j,T);else for(var B=v.length-1;B>=0;B--)(N=v[B])&&(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(v,S){return function(j,T){S(j,T,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharSizeService=void 0;const m=d(2585),b=d(8460),_=d(844);let k=l.CharSizeService=class extends _.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(v,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 x(this._optionsService))}catch{this._measureStrategy=this.register(new y(v,S,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const v=this._measureStrategy.measure();v.width===this.width&&v.height===this.height||(this.width=v.width,this.height=v.height,this._onCharSizeChange.fire())}};l.CharSizeService=k=p([g(2,m.IOptionsService)],k);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 x 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(x,v,S,j){var T,N=arguments.length,D=N<3?v:j===null?j=Object.getOwnPropertyDescriptor(v,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(x,v,S,j);else for(var A=x.length-1;A>=0;A--)(T=x[A])&&(D=(N<3?T(D):N>3?T(v,S,D):T(v,S))||D);return N>3&&D&&Object.defineProperty(v,S,D),D},g=this&&this.__param||function(x,v){return function(S,j){v(S,j,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharacterJoinerService=l.JoinedCellData=void 0;const m=d(3734),b=d(643),_=d(511),k=d(2585);class C extends m.AttributeData{constructor(v,S,j){super(),this.content=0,this.combinedData="",this.fg=v.fg,this.bg=v.bg,this.combinedData=S,this._width=j}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(v){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.JoinedCellData=C;let y=l.CharacterJoinerService=class Yb{constructor(v){this._bufferService=v,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _.CellData}register(v){const S={id:this._nextCharacterJoinerId++,handler:v};return this._characterJoiners.push(S),S.id}deregister(v){for(let S=0;S<this._characterJoiners.length;S++)if(this._characterJoiners[S].id===v)return this._characterJoiners.splice(S,1),!0;return!1}getJoinedCharacters(v){if(this._characterJoiners.length===0)return[];const S=this._bufferService.buffer.lines.get(v);if(!S||S.length===0)return[];const j=[],T=S.translateToString(!0);let N=0,D=0,A=0,B=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!==B||this._workCell.bg!==O){if(q-N>1){const V=this._getJoinedRanges(T,A,D,S,N);for(let W=0;W<V.length;W++)j.push(V[W])}N=q,A=D,B=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 V=0;V<q.length;V++)j.push(q[V])}return j}_getJoinedRanges(v,S,j,T,N){const D=v.substring(S,j);let A=[];try{A=this._characterJoiners[0].handler(D)}catch(B){console.error(B)}for(let B=1;B<this._characterJoiners.length;B++)try{const O=this._characterJoiners[B].handler(D);for(let q=0;q<O.length;q++)Yb._mergeRanges(A,O[q])}catch(O){console.error(O)}return this._stringRangesToCellRanges(A,T,N),A}_stringRangesToCellRanges(v,S,j){let T=0,N=!1,D=0,A=v[T];if(A){for(let B=j;B<this._bufferService.cols;B++){const O=S.getWidth(B),q=S.getString(B).length||b.WHITESPACE_CELL_CHAR.length;if(O!==0){if(!N&&A[0]<=D&&(A[0]=B,N=!0),A[1]<=D){if(A[1]=B,A=v[++T],!A)break;A[0]<=D?(A[0]=B,N=!0):N=!1}D+=q}}A&&(A[1]=this._bufferService.cols)}}static _mergeRanges(v,S){let j=!1;for(let T=0;T<v.length;T++){const N=v[T];if(j){if(S[1]<=N[0])return v[T-1][1]=S[1],v;if(S[1]<=N[1])return v[T-1][1]=Math.max(S[1],N[1]),v.splice(T,1),v;v.splice(T,1),T--}else{if(S[1]<=N[0])return v.splice(T,0,S),v;if(S[1]<=N[1])return N[0]=Math.min(S[0],N[0]),v;S[0]<N[1]&&(N[0]=Math.min(S[0],N[0]),j=!0)}}return j?v[v.length-1][1]=S[1]:v.push(S),v}};l.CharacterJoinerService=y=p([g(0,k.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,x){super(),this._textarea=C,this._window=y,this.mainDocument=x,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((v=>this._screenDprMonitor.setWindow(v)))),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(k,C,y,x){var v,S=arguments.length,j=S<3?C:x===null?x=Object.getOwnPropertyDescriptor(C,y):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(k,C,y,x);else for(var T=k.length-1;T>=0;T--)(v=k[T])&&(j=(S<3?v(j):S>3?v(C,y,j):v(C,y))||j);return S>3&&j&&Object.defineProperty(C,y,j),j},g=this&&this.__param||function(k,C){return function(y,x){C(y,x,k)}};Object.defineProperty(l,"__esModule",{value:!0}),l.MouseService=void 0;const m=d(4725),b=d(9806);let _=l.MouseService=class{constructor(k,C){this._renderService=k,this._charSizeService=C}getCoords(k,C,y,x,v){return(0,b.getCoords)(window,k,C,y,x,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,v)}getMouseReportCoords(k,C){const y=(0,b.getCoordsRelativeToElement)(window,k,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(v,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(v,S,j,T);else for(var B=v.length-1;B>=0;B--)(N=v[B])&&(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(v,S){return function(j,T){S(j,T,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.RenderService=void 0;const m=d(6193),b=d(4725),_=d(8460),k=d(844),C=d(7226),y=d(2585);let x=l.RenderService=class extends k.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(v,S,j,T,N,D,A,B){super(),this._rowCount=v,this._charSizeService=T,this._renderer=this.register(new k.MutableDisposable),this._pausedResizeTask=new C.DebouncedIdleTask,this._observerDisposable=this.register(new k.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(B.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(A.window,S),this.register(A.onWindowChange((O=>this._registerIntersectionObserver(O,S))))}_registerIntersectionObserver(v,S){if("IntersectionObserver"in v){const j=new v.IntersectionObserver((T=>this._handleIntersectionChange(T[T.length-1])),{threshold:0});j.observe(S),this._observerDisposable.value=(0,k.toDisposable)((()=>j.disconnect()))}}_handleIntersectionChange(v){this._isPaused=v.isIntersecting===void 0?v.intersectionRatio===0:!v.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(v,S,j=!1){this._isPaused?this._needsFullRefresh=!0:(j||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(v,S,this._rowCount))}_renderRows(v,S){this._renderer.value&&(v=Math.min(v,this._rowCount-1),S=Math.min(S,this._rowCount-1),this._renderer.value.renderRows(v,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:v,end:S}),this._onRender.fire({start:v,end:S}),this._isNextRenderRedrawOnly=!0)}resize(v,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(v){this._renderer.value=v,this._renderer.value&&(this._renderer.value.onRequestRedraw((S=>this.refreshRows(S.start,S.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(v){return this._renderDebouncer.addRefreshCallback(v)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var v,S;this._renderer.value&&((S=(v=this._renderer.value).clearTextureAtlas)==null||S.call(v),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(v,S){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var j;return(j=this._renderer.value)==null?void 0:j.handleResize(v,S)})):this._renderer.value.handleResize(v,S),this._fullRefresh())}handleCharSizeChanged(){var v;(v=this._renderer.value)==null||v.handleCharSizeChanged()}handleBlur(){var v;(v=this._renderer.value)==null||v.handleBlur()}handleFocus(){var v;(v=this._renderer.value)==null||v.handleFocus()}handleSelectionChanged(v,S,j){var T;this._selectionState.start=v,this._selectionState.end=S,this._selectionState.columnSelectMode=j,(T=this._renderer.value)==null||T.handleSelectionChanged(v,S,j)}handleCursorMove(){var v;(v=this._renderer.value)==null||v.handleCursorMove()}clear(){var v;(v=this._renderer.value)==null||v.clear()}};l.RenderService=x=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)],x)},9312:function(f,l,d){var p=this&&this.__decorate||function(A,B,O,q){var V,W=arguments.length,I=W<3?B:q===null?q=Object.getOwnPropertyDescriptor(B,O):q;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(A,B,O,q);else for(var F=A.length-1;F>=0;F--)(V=A[F])&&(I=(W<3?V(I):W>3?V(B,O,I):V(B,O))||I);return W>3&&I&&Object.defineProperty(B,O,I),I},g=this&&this.__param||function(A,B){return function(O,q){B(O,q,A)}};Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionService=void 0;const m=d(9806),b=d(9504),_=d(456),k=d(4725),C=d(8460),y=d(844),x=d(6114),v=d(4841),S=d(511),j=d(2585),T=" ",N=new RegExp(T,"g");let D=l.SelectionService=class extends y.Disposable{constructor(A,B,O,q,V,W,I,F,P){super(),this._element=A,this._screenElement=B,this._linkifier=O,this._bufferService=q,this._coreService=V,this._mouseService=W,this._optionsService=I,this._renderService=F,this._coreBrowserService=P,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,B=this._model.finalSelectionEnd;return!(!A||!B||A[0]===B[0]&&A[1]===B[1])}get selectionText(){const A=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;if(!A||!B)return"";const O=this._bufferService.buffer,q=[];if(this._activeSelectionMode===3){if(A[0]===B[0])return"";const V=A[0]<B[0]?A[0]:B[0],W=A[0]<B[0]?B[0]:A[0];for(let I=A[1];I<=B[1];I++){const F=O.translateBufferLineToString(I,!0,V,W);q.push(F)}}else{const V=A[1]===B[1]?B[0]:void 0;q.push(O.translateBufferLineToString(A[1],!0,A[0],V));for(let W=A[1]+1;W<=B[1]-1;W++){const I=O.lines.get(W),F=O.translateBufferLineToString(W,!0);I!=null&&I.isWrapped?q[q.length-1]+=F:q.push(F)}if(A[1]!==B[1]){const W=O.lines.get(B[1]),I=O.translateBufferLineToString(B[1],!0,0,B[0]);W&&W.isWrapped?q[q.length-1]+=I:q.push(I)}}return q.map((V=>V.replace(N," "))).join(x.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()))),x.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 B=this._getMouseBufferCoords(A),O=this._model.finalSelectionStart,q=this._model.finalSelectionEnd;return!!(O&&q&&B)&&this._areCoordsInSelection(B,O,q)}isCellInSelection(A,B){const O=this._model.finalSelectionStart,q=this._model.finalSelectionEnd;return!(!O||!q)&&this._areCoordsInSelection([A,B],O,q)}_areCoordsInSelection(A,B,O){return A[1]>B[1]&&A[1]<O[1]||B[1]===O[1]&&A[1]===B[1]&&A[0]>=B[0]&&A[0]<O[0]||B[1]<O[1]&&A[1]===O[1]&&A[0]<O[0]||B[1]<O[1]&&A[1]===B[1]&&A[0]>=B[0]}_selectWordAtCursor(A,B){var V,W;const O=(W=(V=this._linkifier.currentLink)==null?void 0:V.link)==null?void 0:W.range;if(O)return this._model.selectionStart=[O.start.x-1,O.start.y-1],this._model.selectionStartLength=(0,v.getRangeLength)(O,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const q=this._getMouseBufferCoords(A);return!!q&&(this._selectWordAt(q,B),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(A,B){this._model.clearSelection(),A=Math.max(A,0),B=Math.min(B,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,A],this._model.selectionEnd=[this._bufferService.cols,B],this.refresh(),this._onSelectionChange.fire()}_handleTrim(A){this._model.handleTrim(A)&&this.refresh()}_getMouseBufferCoords(A){const B=this._mouseService.getCoords(A,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(B)return B[0]--,B[1]--,B[1]+=this._bufferService.buffer.ydisp,B}_getMouseEventScrollAmount(A){let B=(0,m.getCoordsRelativeToElement)(this._coreBrowserService.window,A,this._screenElement)[1];const O=this._renderService.dimensions.css.canvas.height;return B>=0&&B<=O?0:(B>O&&(B-=O),B=Math.min(Math.max(B,-50),50),B/=50,B/Math.abs(B)+Math.round(14*B))}shouldForceSelection(A){return x.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 B=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);B&&B.length!==this._model.selectionStart[0]&&B.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(A){this._selectWordAtCursor(A,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(A){const B=this._getMouseBufferCoords(A);B&&(this._activeSelectionMode=2,this._selectLineAt(B[1]))}shouldColumnSelect(A){return A.altKey&&!(x.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(A){if(A.stopImmediatePropagation(),!this._model.selectionStart)return;const B=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]++}B&&B[0]===this._model.selectionEnd[0]&&B[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 B=A.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&B<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,B=this._model.finalSelectionEnd,O=!(!A||!B||A[0]===B[0]&&A[1]===B[1]);O?A&&B&&(this._oldSelectionStart&&this._oldSelectionEnd&&A[0]===this._oldSelectionStart[0]&&A[1]===this._oldSelectionStart[1]&&B[0]===this._oldSelectionEnd[0]&&B[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(A,B,O)):this._oldHasSelection&&this._fireOnSelectionChange(A,B,O)}_fireOnSelectionChange(A,B,O){this._oldSelectionStart=A,this._oldSelectionEnd=B,this._oldHasSelection=O,this._onSelectionChange.fire()}_handleBufferActivate(A){this.clearSelection(),this._trimListener.dispose(),this._trimListener=A.activeBuffer.lines.onTrim((B=>this._handleTrim(B)))}_convertViewportColToCharacterIndex(A,B){let O=B;for(let q=0;B>=q;q++){const V=A.loadCell(q,this._workCell).getChars().length;this._workCell.getWidth()===0?O--:V>1&&B!==q&&(O+=V-1)}return O}setSelection(A,B,O){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[A,B],this._model.selectionStartLength=O,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(A){this._isClickInSelection(A)||(this._selectWordAtCursor(A,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(A,B,O=!0,q=!0){if(A[0]>=this._bufferService.cols)return;const V=this._bufferService.buffer,W=V.lines.get(A[1]);if(!W)return;const I=V.translateBufferLineToString(A[1],!1);let F=this._convertViewportColToCharacterIndex(W,A[0]),P=F;const X=A[0]-F;let Z=0,z=0,R=0,L=0;if(I.charAt(F)===" "){for(;F>0&&I.charAt(F-1)===" ";)F--;for(;P<I.length&&I.charAt(P+1)===" ";)P++}else{let ne=A[0],Q=A[0];W.getWidth(ne)===0&&(Z++,ne--),W.getWidth(Q)===2&&(z++,Q++);const ee=W.getString(Q).length;for(ee>1&&(L+=ee-1,P+=ee-1);ne>0&&F>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&&(R+=Y-1,F-=Y-1),F--,ne--}for(;Q<W.length&&P+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?(z++,Q++):Y>1&&(L+=Y-1,P+=Y-1),P++,Q++}}P++;let $=F+X-Z+R,U=Math.min(this._bufferService.cols,P-F+Z+z-R-L);if(B||I.slice(F,P).trim()!==""){if(O&&$===0&&W.getCodePoint(0)!==32){const ne=V.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;$-=ee,U+=ee}}}if(q&&$+U===this._bufferService.cols&&W.getCodePoint(this._bufferService.cols-1)!==32){const ne=V.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:$,length:U}}}_selectWordAt(A,B){const O=this._getWordAt(A,B);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 B=this._getWordAt(A,!0);if(B){let O=A[1];for(;B.start<0;)B.start+=this._bufferService.cols,O--;if(!this._model.areSelectionValuesReversed())for(;B.start+B.length>this._bufferService.cols;)B.length-=this._bufferService.cols,O++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?B.start:B.start+B.length,O]}}_isCharWordSeparator(A){return A.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(A.getChars())>=0}_selectLineAt(A){const B=this._bufferService.buffer.getWrappedRangeForLine(A),O={start:{x:0,y:B.first},end:{x:this._bufferService.cols-1,y:B.last}};this._model.selectionStart=[0,B.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,v.getRangeLength)(O,this._bufferService.cols)}};l.SelectionService=D=p([g(3,j.IBufferService),g(4,j.ICoreService),g(5,k.IMouseService),g(6,j.IOptionsService),g(7,k.IRenderService),g(8,k.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,B,O){var q,V=arguments.length,W=V<3?A:O===null?O=Object.getOwnPropertyDescriptor(A,B):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(D,A,B,O);else for(var I=D.length-1;I>=0;I--)(q=D[I])&&(W=(V<3?q(W):V>3?q(A,B,W):q(A,B))||W);return V>3&&W&&Object.defineProperty(A,B,W),W},g=this&&this.__param||function(D,A){return function(B,O){A(B,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),k=d(844),C=d(2585),y=b.css.toColor("#ffffff"),x=b.css.toColor("#000000"),v=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 B=0;B<216;B++){const O=A[B/36%6|0],q=A[B/6%6|0],V=A[B%6];D.push({css:b.channels.toCss(O,q,V),rgba:b.channels.toRgba(O,q,V)})}for(let B=0;B<24;B++){const O=8+10*B;D.push({css:b.channels.toCss(O,O,O),rgba:b.channels.toRgba(O,O,O)})}return D})());let T=l.ThemeService=class extends k.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:x,cursor:v,cursorAccent:S,selectionForeground:void 0,selectionBackgroundTransparent:j,selectionBackgroundOpaque:b.color.blend(x,j),selectionInactiveBackgroundTransparent:j,selectionInactiveBackgroundOpaque:b.color.blend(x,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,x),A.cursor=N(D.cursor,v),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 B=Math.min(A.ansi.length-16,D.extendedAnsi.length);for(let O=0;O<B;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 k=new Array(_);for(let C=0;C<Math.min(_,this.length);C++)k[C]=this._array[this._getCyclicIndex(C)];this._array=k,this._maxLength=_,this._startIndex=0}get length(){return this._length}set length(_){if(_>this._length)for(let k=this._length;k<_;k++)this._array[k]=void 0;this._length=_}get(_){return this._array[this._getCyclicIndex(_)]}set(_,k){this._array[this._getCyclicIndex(_)]=k}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(_,k,...C){if(k){for(let y=_;y<this._length-k;y++)this._array[this._getCyclicIndex(y)]=this._array[this._getCyclicIndex(y+k)];this._length-=k,this.onDeleteEmitter.fire({index:_,amount:k})}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(_,k,C){if(!(k<=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 x=k-1;x>=0;x--)this.set(_+x+C,this.get(_+x));const y=_+k+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<k;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,_,k,C,y;function x(S){const j=S.toString(16);return j.length<2?"0"+j:j}function v(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?`#${x(j)}${x(T)}${x(N)}${x(D)}`:`#${x(j)}${x(T)}${x(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,B=N.rgba>>8&255,O=T.rgba>>24&255,q=T.rgba>>16&255,V=T.rgba>>8&255;return d=O+Math.round((D-O)*m),p=q+Math.round((A-q)*m),g=V+Math.round((B-V)*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}}})(k||(l.css=k={})),(function(S){function j(T,N,D){const A=T/255,B=N/255,O=D/255;return .2126*(A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4))+.7152*(B<=.03928?B/12.92:Math.pow((B+.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 B=N>>24&255,O=N>>16&255,q=N>>8&255;let V=D>>24&255,W=D>>16&255,I=D>>8&255,F=v(C.relativeLuminance2(V,W,I),C.relativeLuminance2(B,O,q));for(;F<A&&(V>0||W>0||I>0);)V-=Math.max(0,Math.ceil(.1*V)),W-=Math.max(0,Math.ceil(.1*W)),I-=Math.max(0,Math.ceil(.1*I)),F=v(C.relativeLuminance2(V,W,I),C.relativeLuminance2(B,O,q));return(V<<24|W<<16|I<<8|255)>>>0}function T(N,D,A){const B=N>>24&255,O=N>>16&255,q=N>>8&255;let V=D>>24&255,W=D>>16&255,I=D>>8&255,F=v(C.relativeLuminance2(V,W,I),C.relativeLuminance2(B,O,q));for(;F<A&&(V<255||W<255||I<255);)V=Math.min(255,V+Math.ceil(.1*(255-V))),W=Math.min(255,W+Math.ceil(.1*(255-W))),I=Math.min(255,I+Math.ceil(.1*(255-I))),F=v(C.relativeLuminance2(V,W,I),C.relativeLuminance2(B,O,q));return(V<<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,B=D>>16&255,O=D>>8&255,q=N>>24&255,V=N>>16&255,W=N>>8&255;return d=q+Math.round((A-q)*m),p=V+Math.round((B-V)*m),g=W+Math.round((O-W)*m),b.toRgba(d,p,g)},S.ensureContrastRatio=function(N,D,A){const B=C.relativeLuminance(N>>8),O=C.relativeLuminance(D>>8);if(v(B,O)<A){if(O<B){const W=j(N,D,A),I=v(B,C.relativeLuminance(W>>8));if(I<A){const F=T(N,D,A);return I>v(B,C.relativeLuminance(F>>8))?W:F}return W}const q=T(N,D,A),V=v(B,C.relativeLuminance(q>>8));if(V<A){const W=j(N,D,A);return V>v(B,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=x,l.contrastRatio=v},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),k=d(7302),C=d(6975),y=d(8460),x=d(1753),v=d(1480),S=d(7994),j=d(9282),T=d(5435),N=d(5981),D=d(2660);let A=!1;class B extends p.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new y.EventEmitter),this._onScroll.event((q=>{var V;(V=this._onScrollApi)==null||V.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 V in q)this.optionsService.options[V]=q[V]}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 k.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(x.CoreMouseService)),this._instantiationService.setService(g.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(v.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((V=>{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((V=>{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(((V,W)=>this._inputHandler.parse(V,W)))),this.register((0,y.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(q,V){this._writeBuffer.write(q,V)}writeSync(q,V){this._logService.logLevel<=g.LogLevelEnum.WARN&&!A&&(this._logService.warn("writeSync is unreliable and will be removed soon."),A=!0),this._writeBuffer.writeSync(q,V)}input(q,V=!0){this.coreService.triggerDataEvent(q,V)}resize(q,V){isNaN(q)||isNaN(V)||(q=Math.max(q,_.MINIMUM_COLS),V=Math.max(V,_.MINIMUM_ROWS),this._bufferService.resize(q,V))}scroll(q,V=!1){this._bufferService.scroll(q,V)}scrollLines(q,V,W){this._bufferService.scrollLines(q,V,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 V=q-this._bufferService.buffer.ydisp;V!==0&&this.scrollLines(V)}registerEscHandler(q,V){return this._inputHandler.registerEscHandler(q,V)}registerDcsHandler(q,V){return this._inputHandler.registerDcsHandler(q,V)}registerCsiHandler(q,V){return this._inputHandler.registerCsiHandler(q,V)}registerOscHandler(q,V){return this._inputHandler.registerOscHandler(q,V)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let q=!1;const V=this.optionsService.rawOptions.windowsPty;V&&V.buildNumber!==void 0&&V.buildNumber!==void 0?q=V.backend==="conpty"&&V.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 V of q)V.dispose()}))}}}l.CoreTerminal=B},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,z,R,L){var $,U=arguments.length,ne=U<3?z:L===null?L=Object.getOwnPropertyDescriptor(z,R):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ne=Reflect.decorate(Z,z,R,L);else for(var Q=Z.length-1;Q>=0;Q--)($=Z[Q])&&(ne=(U<3?$(ne):U>3?$(z,R,ne):$(z,R))||ne);return U>3&&ne&&Object.defineProperty(z,R,ne),ne},g=this&&this.__param||function(Z,z){return function(R,L){z(R,L,Z)}};Object.defineProperty(l,"__esModule",{value:!0}),l.InputHandler=l.WindowsOptionsReportType=void 0;const m=d(2584),b=d(7116),_=d(2015),k=d(844),C=d(482),y=d(8437),x=d(8460),v=d(643),S=d(511),j=d(3734),T=d(2585),N=d(1480),D=d(6242),A=d(6351),B=d(5941),O={"(":0,")":1,"*":2,"+":3,"-":1,".":2},q=131072;function V(Z,z){if(Z>24)return z.setWinLines||!1;switch(Z){case 1:return!!z.restoreWin;case 2:return!!z.minimizeWin;case 3:return!!z.setWinPosition;case 4:return!!z.setWinSizePixels;case 5:return!!z.raiseWin;case 6:return!!z.lowerWin;case 7:return!!z.refreshWin;case 8:return!!z.setWinSizeChars;case 9:return!!z.maximizeWin;case 10:return!!z.fullscreenWin;case 11:return!!z.getWinState;case 13:return!!z.getWinPosition;case 14:return!!z.getWinSizePixels;case 15:return!!z.getScreenSizePixels;case 16:return!!z.getCellSizePixels;case 18:return!!z.getWinSizeChars;case 19:return!!z.getScreenSizeChars;case 20:return!!z.getIconTitle;case 21:return!!z.getWinTitle;case 22:return!!z.pushTitle;case 23:return!!z.popTitle;case 24:return!!z.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 F extends k.Disposable{getAttrData(){return this._curAttrData}constructor(z,R,L,$,U,ne,Q,ee,Y=new _.EscapeSequenceParser){super(),this._bufferService=z,this._charsetService=R,this._coreService=L,this._logService=$,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 x.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new x.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new x.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new x.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new x.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new x.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new x.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new x.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new x.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new x.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new x.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new x.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new x.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 P(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((G=>this._activeBuffer=G.activeBuffer))),this._parser.setCsiHandlerFallback(((G,oe)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(G),params:oe.toArray()})})),this._parser.setEscHandlerFallback((G=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(G)})})),this._parser.setExecuteHandlerFallback((G=>{this._logService.debug("Unknown EXECUTE code: ",{code:G})})),this._parser.setOscHandlerFallback(((G,oe,re)=>{this._logService.debug("Unknown OSC code: ",{identifier:G,action:oe,data:re})})),this._parser.setDcsHandlerFallback(((G,oe,re)=>{oe==="HOOK"&&(re=re.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(G),action:oe,payload:re})})),this._parser.setPrintHandler(((G,oe,re)=>this.print(G,oe,re))),this._parser.registerCsiHandler({final:"@"},(G=>this.insertChars(G))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(G=>this.scrollLeft(G))),this._parser.registerCsiHandler({final:"A"},(G=>this.cursorUp(G))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(G=>this.scrollRight(G))),this._parser.registerCsiHandler({final:"B"},(G=>this.cursorDown(G))),this._parser.registerCsiHandler({final:"C"},(G=>this.cursorForward(G))),this._parser.registerCsiHandler({final:"D"},(G=>this.cursorBackward(G))),this._parser.registerCsiHandler({final:"E"},(G=>this.cursorNextLine(G))),this._parser.registerCsiHandler({final:"F"},(G=>this.cursorPrecedingLine(G))),this._parser.registerCsiHandler({final:"G"},(G=>this.cursorCharAbsolute(G))),this._parser.registerCsiHandler({final:"H"},(G=>this.cursorPosition(G))),this._parser.registerCsiHandler({final:"I"},(G=>this.cursorForwardTab(G))),this._parser.registerCsiHandler({final:"J"},(G=>this.eraseInDisplay(G,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(G=>this.eraseInDisplay(G,!0))),this._parser.registerCsiHandler({final:"K"},(G=>this.eraseInLine(G,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(G=>this.eraseInLine(G,!0))),this._parser.registerCsiHandler({final:"L"},(G=>this.insertLines(G))),this._parser.registerCsiHandler({final:"M"},(G=>this.deleteLines(G))),this._parser.registerCsiHandler({final:"P"},(G=>this.deleteChars(G))),this._parser.registerCsiHandler({final:"S"},(G=>this.scrollUp(G))),this._parser.registerCsiHandler({final:"T"},(G=>this.scrollDown(G))),this._parser.registerCsiHandler({final:"X"},(G=>this.eraseChars(G))),this._parser.registerCsiHandler({final:"Z"},(G=>this.cursorBackwardTab(G))),this._parser.registerCsiHandler({final:"`"},(G=>this.charPosAbsolute(G))),this._parser.registerCsiHandler({final:"a"},(G=>this.hPositionRelative(G))),this._parser.registerCsiHandler({final:"b"},(G=>this.repeatPrecedingCharacter(G))),this._parser.registerCsiHandler({final:"c"},(G=>this.sendDeviceAttributesPrimary(G))),this._parser.registerCsiHandler({prefix:">",final:"c"},(G=>this.sendDeviceAttributesSecondary(G))),this._parser.registerCsiHandler({final:"d"},(G=>this.linePosAbsolute(G))),this._parser.registerCsiHandler({final:"e"},(G=>this.vPositionRelative(G))),this._parser.registerCsiHandler({final:"f"},(G=>this.hVPosition(G))),this._parser.registerCsiHandler({final:"g"},(G=>this.tabClear(G))),this._parser.registerCsiHandler({final:"h"},(G=>this.setMode(G))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(G=>this.setModePrivate(G))),this._parser.registerCsiHandler({final:"l"},(G=>this.resetMode(G))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(G=>this.resetModePrivate(G))),this._parser.registerCsiHandler({final:"m"},(G=>this.charAttributes(G))),this._parser.registerCsiHandler({final:"n"},(G=>this.deviceStatus(G))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(G=>this.deviceStatusPrivate(G))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(G=>this.softReset(G))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(G=>this.setCursorStyle(G))),this._parser.registerCsiHandler({final:"r"},(G=>this.setScrollRegion(G))),this._parser.registerCsiHandler({final:"s"},(G=>this.saveCursor(G))),this._parser.registerCsiHandler({final:"t"},(G=>this.windowOptions(G))),this._parser.registerCsiHandler({final:"u"},(G=>this.restoreCursor(G))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(G=>this.insertColumns(G))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(G=>this.deleteColumns(G))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(G=>this.selectProtected(G))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(G=>this.requestMode(G,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(G=>this.requestMode(G,!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((G=>(this.setTitle(G),this.setIconName(G),!0)))),this._parser.registerOscHandler(1,new D.OscHandler((G=>this.setIconName(G)))),this._parser.registerOscHandler(2,new D.OscHandler((G=>this.setTitle(G)))),this._parser.registerOscHandler(4,new D.OscHandler((G=>this.setOrReportIndexedColor(G)))),this._parser.registerOscHandler(8,new D.OscHandler((G=>this.setHyperlink(G)))),this._parser.registerOscHandler(10,new D.OscHandler((G=>this.setOrReportFgColor(G)))),this._parser.registerOscHandler(11,new D.OscHandler((G=>this.setOrReportBgColor(G)))),this._parser.registerOscHandler(12,new D.OscHandler((G=>this.setOrReportCursorColor(G)))),this._parser.registerOscHandler(104,new D.OscHandler((G=>this.restoreIndexedColor(G)))),this._parser.registerOscHandler(110,new D.OscHandler((G=>this.restoreFgColor(G)))),this._parser.registerOscHandler(111,new D.OscHandler((G=>this.restoreBgColor(G)))),this._parser.registerOscHandler(112,new D.OscHandler((G=>this.restoreCursorColor(G)))),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 G in b.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:G},(()=>this.selectCharset("("+G))),this._parser.registerEscHandler({intermediates:")",final:G},(()=>this.selectCharset(")"+G))),this._parser.registerEscHandler({intermediates:"*",final:G},(()=>this.selectCharset("*"+G))),this._parser.registerEscHandler({intermediates:"+",final:G},(()=>this.selectCharset("+"+G))),this._parser.registerEscHandler({intermediates:"-",final:G},(()=>this.selectCharset("-"+G))),this._parser.registerEscHandler({intermediates:".",final:G},(()=>this.selectCharset("."+G))),this._parser.registerEscHandler({intermediates:"/",final:G},(()=>this.selectCharset("/"+G)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((G=>(this._logService.error("Parsing error: ",G),G))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new A.DcsHandler(((G,oe)=>this.requestStatusString(G,oe))))}_preserveStack(z,R,L,$){this._parseStack.paused=!0,this._parseStack.cursorStartX=z,this._parseStack.cursorStartY=R,this._parseStack.decodedLength=L,this._parseStack.position=$}_logSlowResolvingAsync(z){this._logService.logLevel<=T.LogLevelEnum.WARN&&Promise.race([z,new Promise(((R,L)=>setTimeout((()=>L("#SLOW_TIMEOUT")),5e3)))]).catch((R=>{if(R!=="#SLOW_TIMEOUT")throw R;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(z,R){let L,$=this._activeBuffer.x,U=this._activeBuffer.y,ne=0;const Q=this._parseStack.paused;if(Q){if(L=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,R))return this._logSlowResolvingAsync(L),L;$=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,z.length>q&&(ne=this._parseStack.position+q)}if(this._logService.logLevel<=T.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof z=="string"?` "${z}"`:` "${Array.prototype.map.call(z,(G=>String.fromCharCode(G))).join("")}"`),typeof z=="string"?z.split("").map((G=>G.charCodeAt(0))):z),this._parseBuffer.length<z.length&&this._parseBuffer.length<q&&(this._parseBuffer=new Uint32Array(Math.min(z.length,q))),Q||this._dirtyRowTracker.clearRange(),z.length>q)for(let G=ne;G<z.length;G+=q){const oe=G+q<z.length?G+q:z.length,re=typeof z=="string"?this._stringDecoder.decode(z.substring(G,oe),this._parseBuffer):this._utf8Decoder.decode(z.subarray(G,oe),this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,re))return this._preserveStack($,U,re,G),this._logSlowResolvingAsync(L),L}else if(!Q){const G=typeof z=="string"?this._stringDecoder.decode(z,this._parseBuffer):this._utf8Decoder.decode(z,this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,G))return this._preserveStack($,U,G,0),this._logSlowResolvingAsync(L),L}this._activeBuffer.x===$&&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(z,R,L){let $,U;const ne=this._charsetService.charset,Q=this._optionsService.rawOptions.screenReaderMode,ee=this._bufferService.cols,Y=this._coreService.decPrivateModes.wraparound,G=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&&L-R>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=R;be<L;++be){if($=z[be],$<127&&ne){const We=ne[String.fromCharCode($)];We&&($=We.charCodeAt(0))}const Le=this._unicodeService.charProperties($,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)($)),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,$,U);for(let Ee=U-ze;--Ee>=0;)re.setCellFromCodepoint(this._activeBuffer.x++,0,0,oe)}else if(G&&(re.insertCells(this._activeBuffer.x,U-ze,this._activeBuffer.getNullCell(oe)),re.getWidth(ee-1)===2&&re.setCellFromCodepoint(ee-1,v.NULL_CELL_CODE,v.NULL_CELL_WIDTH,oe)),re.setCellFromCodepoint(this._activeBuffer.x++,$,U,oe),U>0)for(;--U;)re.setCellFromCodepoint(this._activeBuffer.x++,0,0,oe)}this._parser.precedingJoinState=ve,this._activeBuffer.x<ee&&L-R>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(z,R){return z.final!=="t"||z.prefix||z.intermediates?this._parser.registerCsiHandler(z,R):this._parser.registerCsiHandler(z,(L=>!V(L.params[0],this._optionsService.rawOptions.windowOptions)||R(L)))}registerDcsHandler(z,R){return this._parser.registerDcsHandler(z,new A.DcsHandler(R))}registerEscHandler(z,R){return this._parser.registerEscHandler(z,R)}registerOscHandler(z,R){return this._parser.registerOscHandler(z,new D.OscHandler(R))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var z;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&&((z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&z.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);R.hasWidth(this._activeBuffer.x)&&!R.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const z=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-z),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(z=this._bufferService.cols-1){this._activeBuffer.x=Math.min(z,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(z,R){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=z,this._activeBuffer.y=this._activeBuffer.scrollTop+R):(this._activeBuffer.x=z,this._activeBuffer.y=R),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(z,R){this._restrictCursor(),this._setCursor(this._activeBuffer.x+z,this._activeBuffer.y+R)}cursorUp(z){const R=this._activeBuffer.y-this._activeBuffer.scrollTop;return R>=0?this._moveCursor(0,-Math.min(R,z.params[0]||1)):this._moveCursor(0,-(z.params[0]||1)),!0}cursorDown(z){const R=this._activeBuffer.scrollBottom-this._activeBuffer.y;return R>=0?this._moveCursor(0,Math.min(R,z.params[0]||1)):this._moveCursor(0,z.params[0]||1),!0}cursorForward(z){return this._moveCursor(z.params[0]||1,0),!0}cursorBackward(z){return this._moveCursor(-(z.params[0]||1),0),!0}cursorNextLine(z){return this.cursorDown(z),this._activeBuffer.x=0,!0}cursorPrecedingLine(z){return this.cursorUp(z),this._activeBuffer.x=0,!0}cursorCharAbsolute(z){return this._setCursor((z.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(z){return this._setCursor(z.length>=2?(z.params[1]||1)-1:0,(z.params[0]||1)-1),!0}charPosAbsolute(z){return this._setCursor((z.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(z){return this._moveCursor(z.params[0]||1,0),!0}linePosAbsolute(z){return this._setCursor(this._activeBuffer.x,(z.params[0]||1)-1),!0}vPositionRelative(z){return this._moveCursor(0,z.params[0]||1),!0}hVPosition(z){return this.cursorPosition(z),!0}tabClear(z){const R=z.params[0];return R===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:R===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(z){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let R=z.params[0]||1;for(;R--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(z){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let R=z.params[0]||1;for(;R--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(z){const R=z.params[0];return R===1&&(this._curAttrData.bg|=536870912),R!==2&&R!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(z,R,L,$=!1,U=!1){const ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+z);ne.replaceCells(R,L,this._activeBuffer.getNullCell(this._eraseAttrData()),U),$&&(ne.isWrapped=!1)}_resetBufferLine(z,R=!1){const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+z);L&&(L.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),R),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+z),L.isWrapped=!1)}eraseInDisplay(z,R=!1){let L;switch(this._restrictCursor(this._bufferService.cols),z.params[0]){case 0:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,R);L<this._bufferService.rows;L++)this._resetBufferLine(L,R);this._dirtyRowTracker.markDirty(L);break;case 1:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L,0,this._activeBuffer.x+1,!0,R),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(L+1).isWrapped=!1);L--;)this._resetBufferLine(L,R);this._dirtyRowTracker.markDirty(0);break;case 2:for(L=this._bufferService.rows,this._dirtyRowTracker.markDirty(L-1);L--;)this._resetBufferLine(L,R);this._dirtyRowTracker.markDirty(0);break;case 3:const $=this._activeBuffer.lines.length-this._bufferService.rows;$>0&&(this._activeBuffer.lines.trimStart($),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-$,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-$,0),this._onScroll.fire(0))}return!0}eraseInLine(z,R=!1){switch(this._restrictCursor(this._bufferService.cols),z.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,R);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,R);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,R)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(z){this._restrictCursor();let R=z.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=this._activeBuffer.ybase+this._activeBuffer.y,$=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-$+1;for(;R--;)this._activeBuffer.lines.splice(U-1,1),this._activeBuffer.lines.splice(L,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(z){this._restrictCursor();let R=z.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=this._activeBuffer.ybase+this._activeBuffer.y;let $;for($=this._bufferService.rows-1-this._activeBuffer.scrollBottom,$=this._bufferService.rows-1+this._activeBuffer.ybase-$;R--;)this._activeBuffer.lines.splice(L,1),this._activeBuffer.lines.splice($,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(z){this._restrictCursor();const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return R&&(R.insertCells(this._activeBuffer.x,z.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(z){this._restrictCursor();const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return R&&(R.deleteCells(this._activeBuffer.x,z.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(z){let R=z.params[0]||1;for(;R--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(z){let R=z.params[0]||1;for(;R--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(y.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(z){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=z.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);$.deleteCells(0,R,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(z){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=z.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);$.insertCells(0,R,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(z){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=z.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);$.insertCells(this._activeBuffer.x,R,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(z){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=z.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);$.deleteCells(this._activeBuffer.x,R,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(z){this._restrictCursor();const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return R&&(R.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(z.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(z){const R=this._parser.precedingJoinState;if(!R)return!0;const L=z.params[0]||1,$=N.UnicodeService.extractWidth(R),U=this._activeBuffer.x-$,ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(U),Q=new Uint32Array(ne.length*L);let ee=0;for(let G=0;G<ne.length;){const oe=ne.codePointAt(G)||0;Q[ee++]=oe,G+=oe>65535?2:1}let Y=ee;for(let G=1;G<L;++G)Q.copyWithin(Y,0,ee),Y+=ee;return this.print(Q,0,Y),!0}sendDeviceAttributesPrimary(z){return z.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(z){return z.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(z.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(m.C0.ESC+"[>83;40003;0c")),!0}_is(z){return(this._optionsService.rawOptions.termName+"").indexOf(z)===0}setMode(z){for(let R=0;R<z.length;R++)switch(z.params[R]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(z){for(let R=0;R<z.length;R++)switch(z.params[R]){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(z){for(let R=0;R<z.length;R++)switch(z.params[R]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(z){for(let R=0;R<z.length;R++)switch(z.params[R]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),z.params[R]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(z,R){const L=this._coreService.decPrivateModes,{activeProtocol:$,activeEncoding:U}=this._coreMouseService,ne=this._coreService,{buffers:Q,cols:ee}=this._bufferService,{active:Y,alt:G}=Q,oe=this._optionsService.rawOptions,re=Oe=>Oe?1:2,ve=z.params[0];return be=ve,Le=R?ve===2?4:ve===4?re(ne.modes.insertMode):ve===12?3:ve===20?re(oe.convertEol):0:ve===1?re(L.applicationCursorKeys):ve===3?oe.windowOptions.setWinLines?ee===80?2:ee===132?1:0:0:ve===6?re(L.origin):ve===7?re(L.wraparound):ve===8?3:ve===9?re($==="X10"):ve===12?re(oe.cursorBlink):ve===25?re(!ne.isCursorHidden):ve===45?re(L.reverseWraparound):ve===66?re(L.applicationKeypad):ve===67?4:ve===1e3?re($==="VT200"):ve===1002?re($==="DRAG"):ve===1003?re($==="ANY"):ve===1004?re(L.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===G):ve===2004?re(L.bracketedPasteMode):0,ne.triggerDataEvent(`${m.C0.ESC}[${R?"":"?"}${be};${Le}$y`),!0;var be,Le}_updateAttrColor(z,R,L,$,U){return R===2?(z|=50331648,z&=-16777216,z|=j.AttributeData.fromColorRGB([L,$,U])):R===5&&(z&=-50331904,z|=33554432|255&L),z}_extractColor(z,R,L){const $=[0,0,-1,0,0,0];let U=0,ne=0;do{if($[ne+U]=z.params[R+ne],z.hasSubParams(R+ne)){const Q=z.getSubParams(R+ne);let ee=0;do $[1]===5&&(U=1),$[ne+ee+1+U]=Q[ee];while(++ee<Q.length&&ee+ne+1+U<$.length);break}if($[1]===5&&ne+U>=2||$[1]===2&&ne+U>=5)break;$[1]&&(U=1)}while(++ne+R<z.length&&ne+U<$.length);for(let Q=2;Q<$.length;++Q)$[Q]===-1&&($[Q]=0);switch($[0]){case 38:L.fg=this._updateAttrColor(L.fg,$[1],$[3],$[4],$[5]);break;case 48:L.bg=this._updateAttrColor(L.bg,$[1],$[3],$[4],$[5]);break;case 58:L.extended=L.extended.clone(),L.extended.underlineColor=this._updateAttrColor(L.extended.underlineColor,$[1],$[3],$[4],$[5])}return ne}_processUnderline(z,R){R.extended=R.extended.clone(),(!~z||z>5)&&(z=1),R.extended.underlineStyle=z,R.fg|=268435456,z===0&&(R.fg&=-268435457),R.updateExtended()}_processSGR0(z){z.fg=y.DEFAULT_ATTR_DATA.fg,z.bg=y.DEFAULT_ATTR_DATA.bg,z.extended=z.extended.clone(),z.extended.underlineStyle=0,z.extended.underlineColor&=-67108864,z.updateExtended()}charAttributes(z){if(z.length===1&&z.params[0]===0)return this._processSGR0(this._curAttrData),!0;const R=z.length;let L;const $=this._curAttrData;for(let U=0;U<R;U++)L=z.params[U],L>=30&&L<=37?($.fg&=-50331904,$.fg|=16777216|L-30):L>=40&&L<=47?($.bg&=-50331904,$.bg|=16777216|L-40):L>=90&&L<=97?($.fg&=-50331904,$.fg|=16777224|L-90):L>=100&&L<=107?($.bg&=-50331904,$.bg|=16777224|L-100):L===0?this._processSGR0($):L===1?$.fg|=134217728:L===3?$.bg|=67108864:L===4?($.fg|=268435456,this._processUnderline(z.hasSubParams(U)?z.getSubParams(U)[0]:1,$)):L===5?$.fg|=536870912:L===7?$.fg|=67108864:L===8?$.fg|=1073741824:L===9?$.fg|=2147483648:L===2?$.bg|=134217728:L===21?this._processUnderline(2,$):L===22?($.fg&=-134217729,$.bg&=-134217729):L===23?$.bg&=-67108865:L===24?($.fg&=-268435457,this._processUnderline(0,$)):L===25?$.fg&=-536870913:L===27?$.fg&=-67108865:L===28?$.fg&=-1073741825:L===29?$.fg&=2147483647:L===39?($.fg&=-67108864,$.fg|=16777215&y.DEFAULT_ATTR_DATA.fg):L===49?($.bg&=-67108864,$.bg|=16777215&y.DEFAULT_ATTR_DATA.bg):L===38||L===48||L===58?U+=this._extractColor(z,U,$):L===53?$.bg|=1073741824:L===55?$.bg&=-1073741825:L===59?($.extended=$.extended.clone(),$.extended.underlineColor=-1,$.updateExtended()):L===100?($.fg&=-67108864,$.fg|=16777215&y.DEFAULT_ATTR_DATA.fg,$.bg&=-67108864,$.bg|=16777215&y.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",L);return!0}deviceStatus(z){switch(z.params[0]){case 5:this._coreService.triggerDataEvent(`${m.C0.ESC}[0n`);break;case 6:const R=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[${R};${L}R`)}return!0}deviceStatusPrivate(z){if(z.params[0]===6){const R=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[?${R};${L}R`)}return!0}softReset(z){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(z){const R=z.params[0]||1;switch(R){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const L=R%2==1;return this._optionsService.options.cursorBlink=L,!0}setScrollRegion(z){const R=z.params[0]||1;let L;return(z.length<2||(L=z.params[1])>this._bufferService.rows||L===0)&&(L=this._bufferService.rows),L>R&&(this._activeBuffer.scrollTop=R-1,this._activeBuffer.scrollBottom=L-1,this._setCursor(0,0)),!0}windowOptions(z){if(!V(z.params[0],this._optionsService.rawOptions.windowOptions))return!0;const R=z.length>1?z.params[1]:0;switch(z.params[0]){case 14:R!==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:R!==0&&R!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),R!==0&&R!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:R!==0&&R!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),R!==0&&R!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(z){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(z){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(z){return this._windowTitle=z,this._onTitleChange.fire(z),!0}setIconName(z){return this._iconName=z,!0}setOrReportIndexedColor(z){const R=[],L=z.split(";");for(;L.length>1;){const $=L.shift(),U=L.shift();if(/^\d+$/.exec($)){const ne=parseInt($);if(X(ne))if(U==="?")R.push({type:0,index:ne});else{const Q=(0,B.parseColor)(U);Q&&R.push({type:1,index:ne,color:Q})}}}return R.length&&this._onColor.fire(R),!0}setHyperlink(z){const R=z.split(";");return!(R.length<2)&&(R[1]?this._createHyperlink(R[0],R[1]):!R[0]&&this._finishHyperlink())}_createHyperlink(z,R){this._getCurrentLinkId()&&this._finishHyperlink();const L=z.split(":");let $;const U=L.findIndex((ne=>ne.startsWith("id=")));return U!==-1&&($=L[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:$,uri:R}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(z,R){const L=z.split(";");for(let $=0;$<L.length&&!(R>=this._specialColors.length);++$,++R)if(L[$]==="?")this._onColor.fire([{type:0,index:this._specialColors[R]}]);else{const U=(0,B.parseColor)(L[$]);U&&this._onColor.fire([{type:1,index:this._specialColors[R],color:U}])}return!0}setOrReportFgColor(z){return this._setOrReportSpecialColor(z,0)}setOrReportBgColor(z){return this._setOrReportSpecialColor(z,1)}setOrReportCursorColor(z){return this._setOrReportSpecialColor(z,2)}restoreIndexedColor(z){if(!z)return this._onColor.fire([{type:2}]),!0;const R=[],L=z.split(";");for(let $=0;$<L.length;++$)if(/^\d+$/.exec(L[$])){const U=parseInt(L[$]);X(U)&&R.push({type:2,index:U})}return R.length&&this._onColor.fire(R),!0}restoreFgColor(z){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(z){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(z){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(z){return z.length!==2?(this.selectDefaultCharset(),!0):(z[0]==="/"||this._charsetService.setgCharset(O[z[0]],b.CHARSETS[z[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 z=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,z,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(z){return this._charsetService.setgLevel(z),!0}screenAlignmentPattern(){const z=new S.CellData;z.content=4194373,z.fg=this._curAttrData.fg,z.bg=this._curAttrData.bg,this._setCursor(0,0);for(let R=0;R<this._bufferService.rows;++R){const L=this._activeBuffer.ybase+this._activeBuffer.y+R,$=this._activeBuffer.lines.get(L);$&&($.fill(z),$.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(z,R){const L=this._bufferService.buffer,$=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${m.C0.ESC}${U}${m.C0.ESC}\\`),!0))(z==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:z==='"p'?'P1$r61;1"p':z==="r"?`P1$r${L.scrollTop+1};${L.scrollBottom+1}r`:z==="m"?"P1$r0m":z===" q"?`P1$r${{block:2,underline:4,bar:6}[$.cursorStyle]-($.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(z,R){this._dirtyRowTracker.markRangeDirty(z,R)}}l.InputHandler=F;let P=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,z){Z>z&&(I=Z,Z=z,z=I),Z<this.start&&(this.start=Z),z>this.end&&(this.end=z)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function X(Z){return 0<=Z&&Z<256}P=p([g(0,T.IBufferService)],P)},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 k=0,C=0,y=_.timeRemaining(),x=0;for(;this._i<this._tasks.length;){if(k=Date.now(),this._tasks[this._i]()||this._i++,k=Math.max(1,Date.now()-k),C=Math.max(k,C),x=_.timeRemaining(),1.5*C>x)return y-k<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(y-k))}ms`),void this._start();y=x}this.clear()}}class m extends g{_requestCallback(_){return setTimeout((()=>_(this._createDeadline(16))))}_cancelCallback(_){clearTimeout(_)}_createDeadline(_){const k=Date.now()+_;return{timeRemaining:()=>Math.max(0,k-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),k=d(511),C=d(643),y=d(4863),x=d(7116);l.MAX_BUFFER_SIZE=4294967295,l.Buffer=class{constructor(v,S,j){this._hasScrollback=v,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=x.DEFAULT_CHARSET,this.markers=[],this._nullCell=k.CellData.fromCharData([0,C.NULL_CELL_CHAR,C.NULL_CELL_WIDTH,C.NULL_CELL_CODE]),this._whitespaceCell=k.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(v){return v?(this._nullCell.fg=v.fg,this._nullCell.bg=v.bg,this._nullCell.extended=v.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new m.ExtendedAttrs),this._nullCell}getWhitespaceCell(v){return v?(this._whitespaceCell.fg=v.fg,this._whitespaceCell.bg=v.bg,this._whitespaceCell.extended=v.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new m.ExtendedAttrs),this._whitespaceCell}getBlankLine(v,S){return new b.BufferLine(this._bufferService.cols,this.getNullCell(v),S)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const v=this.ybase+this.y-this.ydisp;return v>=0&&v<this._rows}_getCorrectBufferLength(v){if(!this._hasScrollback)return v;const S=v+this._optionsService.rawOptions.scrollback;return S>l.MAX_BUFFER_SIZE?l.MAX_BUFFER_SIZE:S}fillViewportRows(v){if(this.lines.length===0){v===void 0&&(v=b.DEFAULT_ATTR_DATA);let S=this._rows;for(;S--;)this.lines.push(this.getBlankLine(v))}}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(v,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<v)for(let A=0;A<this.lines.length;A++)T+=+this.lines.get(A).resize(v,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(v,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(v,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,v-1),this.y=Math.min(this.y,S-1),D&&(this.y+=D),this.savedX=Math.min(this.savedX,v-1),this.scrollTop=0}if(this.scrollBottom=S-1,this._isReflowEnabled&&(this._reflow(v,S),this._cols>v))for(let D=0;D<this.lines.length;D++)T+=+this.lines.get(D).resize(v,j);this._cols=v,this._rows=S,this._memoryCleanupQueue.clear(),T>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let v=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,v=!1);let S=0;for(;this._memoryCleanupPosition<this.lines.length;)if(S+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),S>100)return!0;return v}get _isReflowEnabled(){const v=this._optionsService.rawOptions.windowsPty;return v&&v.buildNumber?this._hasScrollback&&v.backend==="conpty"&&v.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(v,S){this._cols!==v&&(v>this._cols?this._reflowLarger(v,S):this._reflowSmaller(v,S))}_reflowLarger(v,S){const j=(0,_.reflowLargerGetLinesToRemove)(this.lines,this._cols,v,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(v,S,T.countRemoved)}}_reflowLargerAdjustViewport(v,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(v,T))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-j,0)}_reflowSmaller(v,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()<=v)continue;const B=[A];for(;A.isWrapped&&D>0;)A=this.lines.get(--D),B.unshift(A);const O=this.ybase+this.y;if(O>=D&&O<D+B.length)continue;const q=B[B.length-1].getTrimmedLength(),V=(0,_.reflowSmallerGetNewLineLengths)(B,this._cols,v),W=V.length-B.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 F=[];for(let L=0;L<W;L++){const $=this.getBlankLine(b.DEFAULT_ATTR_DATA,!0);F.push($)}F.length>0&&(T.push({start:D+B.length+N,newLines:F}),N+=F.length),B.push(...F);let P=V.length-1,X=V[P];X===0&&(P--,X=V[P]);let Z=B.length-W-1,z=q;for(;Z>=0;){const L=Math.min(z,X);if(B[P]===void 0)break;if(B[P].copyCellsFrom(B[Z],z-L,X-L,L,!0),X-=L,X===0&&(P--,X=V[P]),z-=L,z===0){Z--;const $=Math.max(Z,0);z=(0,_.getWrappedLineTrimmedLength)(B,$,this._cols)}}for(let L=0;L<B.length;L++)V[L]<v&&B[L].setCell(V[L],j);let R=W-I;for(;R-- >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 P=0;P<this.lines.length;P++)A.push(this.lines.get(P));const B=this.lines.length;let O=B-1,q=0,V=T[q];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+N);let W=0;for(let P=Math.min(this.lines.maxLength-1,B+N-1);P>=0;P--)if(V&&V.start>O+W){for(let X=V.newLines.length-1;X>=0;X--)this.lines.set(P--,V.newLines[X]);P++,D.push({index:O+1,amount:V.newLines.length}),W+=V.newLines.length,V=T[++q]}else this.lines.set(P,A[O--]);let I=0;for(let P=D.length-1;P>=0;P--)D[P].index+=I,this.lines.onInsertEmitter.fire(D[P]),I+=D[P].amount;const F=Math.max(0,B+N-this.lines.maxLength);F>0&&this.lines.onTrimEmitter.fire(F)}}translateBufferLineToString(v,S,j=0,T){const N=this.lines.get(v);return N?N.translateToString(S,j,T):""}getWrappedRangeForLine(v){let S=v,j=v;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(v){for(v!=null?this.tabs[v]||(v=this.prevStop(v)):(this.tabs={},v=0);v<this._cols;v+=this._optionsService.rawOptions.tabStopWidth)this.tabs[v]=!0}prevStop(v){for(v==null&&(v=this.x);!this.tabs[--v]&&v>0;);return v>=this._cols?this._cols-1:v<0?0:v}nextStop(v){for(v==null&&(v=this.x);!this.tabs[++v]&&v<this._cols;);return v>=this._cols?this._cols-1:v<0?0:v}clearMarkers(v){this._isClearing=!0;for(let S=0;S<this.markers.length;S++)this.markers[S].line===v&&(this.markers[S].dispose(),this.markers.splice(S--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let v=0;v<this.markers.length;v++)this.markers[v].dispose(),this.markers.splice(v--,1);this._isClearing=!1}addMarker(v){const S=new y.Marker(v);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(v){this._isClearing||this.markers.splice(this.markers.indexOf(v),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 k{constructor(y,x,v=!1){this.isWrapped=v,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*y);const S=x||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 x=this._data[3*y+0],v=2097151&x;return[this._data[3*y+1],2097152&x?this._combined[y]:v?(0,b.stringFromCodePoint)(v):"",x>>22,2097152&x?this._combined[y].charCodeAt(this._combined[y].length-1):v]}set(y,x){this._data[3*y+1]=x[m.CHAR_DATA_ATTR_INDEX],x[m.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[y]=x[1],this._data[3*y+0]=2097152|y|x[m.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*y+0]=x[m.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|x[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 x=this._data[3*y+0];return 2097152&x?this._combined[y].charCodeAt(this._combined[y].length-1):2097151&x}isCombined(y){return 2097152&this._data[3*y+0]}getString(y){const x=this._data[3*y+0];return 2097152&x?this._combined[y]:2097151&x?(0,b.stringFromCodePoint)(2097151&x):""}isProtected(y){return 536870912&this._data[3*y+2]}loadCell(y,x){return _=3*y,x.content=this._data[_+0],x.fg=this._data[_+1],x.bg=this._data[_+2],2097152&x.content&&(x.combinedData=this._combined[y]),268435456&x.bg&&(x.extended=this._extendedAttrs[y]),x}setCell(y,x){2097152&x.content&&(this._combined[y]=x.combinedData),268435456&x.bg&&(this._extendedAttrs[y]=x.extended),this._data[3*y+0]=x.content,this._data[3*y+1]=x.fg,this._data[3*y+2]=x.bg}setCellFromCodepoint(y,x,v,S){268435456&S.bg&&(this._extendedAttrs[y]=S.extended),this._data[3*y+0]=x|v<<22,this._data[3*y+1]=S.fg,this._data[3*y+2]=S.bg}addCodepointToCell(y,x,v){let S=this._data[3*y+0];2097152&S?this._combined[y]+=(0,b.stringFromCodePoint)(x):2097151&S?(this._combined[y]=(0,b.stringFromCodePoint)(2097151&S)+(0,b.stringFromCodePoint)(x),S&=-2097152,S|=2097152):S=x|4194304,v&&(S&=-12582913,S|=v<<22),this._data[3*y+0]=S}insertCells(y,x,v){if((y%=this.length)&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y-1,0,1,v),x<this.length-y){const S=new g.CellData;for(let j=this.length-y-x-1;j>=0;--j)this.setCell(y+x+j,this.loadCell(y+j,S));for(let j=0;j<x;++j)this.setCell(y+j,v)}else for(let S=y;S<this.length;++S)this.setCell(S,v);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,v)}deleteCells(y,x,v){if(y%=this.length,x<this.length-y){const S=new g.CellData;for(let j=0;j<this.length-y-x;++j)this.setCell(y+j,this.loadCell(y+x+j,S));for(let j=this.length-x;j<this.length;++j)this.setCell(j,v)}else for(let S=y;S<this.length;++S)this.setCell(S,v);y&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y-1,0,1,v),this.getWidth(y)!==0||this.hasContent(y)||this.setCellFromCodepoint(y,0,1,v)}replaceCells(y,x,v,S=!1){if(S)for(y&&this.getWidth(y-1)===2&&!this.isProtected(y-1)&&this.setCellFromCodepoint(y-1,0,1,v),x<this.length&&this.getWidth(x-1)===2&&!this.isProtected(x)&&this.setCellFromCodepoint(x,0,1,v);y<x&&y<this.length;)this.isProtected(y)||this.setCell(y,v),y++;else for(y&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y-1,0,1,v),x<this.length&&this.getWidth(x-1)===2&&this.setCellFromCodepoint(x,0,1,v);y<x&&y<this.length;)this.setCell(y++,v)}resize(y,x){if(y===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const v=3*y;if(y>this.length){if(this._data.buffer.byteLength>=4*v)this._data=new Uint32Array(this._data.buffer,0,v);else{const S=new Uint32Array(v);S.set(this._data),this._data=S}for(let S=this.length;S<y;++S)this.setCell(S,x)}else{this._data=this._data.subarray(0,v);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*v*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,x=!1){if(x)for(let v=0;v<this.length;++v)this.isProtected(v)||this.setCell(v,y);else{this._combined={},this._extendedAttrs={};for(let v=0;v<this.length;++v)this.setCell(v,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 x in y._combined)this._combined[x]=y._combined[x];this._extendedAttrs={};for(const x in y._extendedAttrs)this._extendedAttrs[x]=y._extendedAttrs[x];this.isWrapped=y.isWrapped}clone(){const y=new k(0);y._data=new Uint32Array(this._data),y.length=this.length;for(const x in this._combined)y._combined[x]=this._combined[x];for(const x in this._extendedAttrs)y._extendedAttrs[x]=this._extendedAttrs[x];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,x,v,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*(v+D)+A]=T[3*(x+D)+A];268435456&T[3*(x+D)+2]&&(this._extendedAttrs[v+D]=y._extendedAttrs[x+D])}else for(let D=0;D<S;D++){for(let A=0;A<3;A++)this._data[3*(v+D)+A]=T[3*(x+D)+A];268435456&T[3*(x+D)+2]&&(this._extendedAttrs[v+D]=y._extendedAttrs[x+D])}const N=Object.keys(y._combined);for(let D=0;D<N.length;D++){const A=parseInt(N[D],10);A>=x&&(this._combined[A-x+v]=y._combined[A])}}translateToString(y,x,v,S){x=x??0,v=v??this.length,y&&(v=Math.min(v,this.getTrimmedLength())),S&&(S.length=0);let j="";for(;x<v;){const T=this._data[3*x+0],N=2097151&T,D=2097152&T?this._combined[x]:N?(0,b.stringFromCodePoint)(N):m.WHITESPACE_CELL_CHAR;if(j+=D,S)for(let A=0;A<D.length;++A)S.push(x);x+=T>>22||1}return S&&S.push(x),j}}l.BufferLine=k},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 k=[];for(let C=0;C<p.length-1;C++){let y=C,x=p.get(++y);if(!x.isWrapped)continue;const v=[p.get(C)];for(;y<p.length&&x.isWrapped;)v.push(x),x=p.get(++y);if(b>=C&&b<y){C+=v.length-1;continue}let S=0,j=d(v,S,g),T=1,N=0;for(;T<v.length;){const A=d(v,T,g),B=A-N,O=m-j,q=Math.min(B,O);v[S].copyCellsFrom(v[T],N,j,q,!1),j+=q,j===m&&(S++,j=0),N+=q,N===A&&(T++,N=0),j===0&&S!==0&&v[S-1].getWidth(m-1)===2&&(v[S].copyCellsFrom(v[S-1],m-1,j++,1,!1),v[S-1].setCell(m-1,_))}v[S].replaceCells(j,m,_);let D=0;for(let A=v.length-1;A>0&&(A>S||v[A].getTrimmedLength()===0);A--)D++;D>0&&(k.push(C+v.length-D),k.push(D)),C+=v.length-1}return k},l.reflowLargerCreateNewLayout=function(p,g){const m=[];let b=0,_=g[b],k=0;for(let C=0;C<p.length;C++)if(_===C){const y=g[++b];p.onDeleteEmitter.fire({index:C-k,amount:y}),C+=y-1,k+=y,_=g[++b]}else m.push(C);return{layout:m,countRemoved:k}},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(((x,v)=>d(p,v,g))).reduce(((x,v)=>x+v));let k=0,C=0,y=0;for(;y<_;){if(_-y<m){b.push(_-y);break}k+=m;const x=d(p,C,g);k>x&&(k-=x,C++);const v=p[C].getWidth(k-1)===2;v&&k--;const S=v?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(k,C){super(),this._optionsService=k,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(k){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(k),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(k,C){this._normal.resize(k,C),this._alt.resize(k,C),this.setupTabStops(k)}setupTabStops(k){this._normal.setupTabStops(k),this._alt.setupTabStops(k)}}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(k){const C=new b;return C.setFromCharData(k),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(k){this.fg=k[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let C=!1;if(k[g.CHAR_DATA_CHAR_INDEX].length>2)C=!0;else if(k[g.CHAR_DATA_CHAR_INDEX].length===2){const y=k[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=y&&y<=56319){const x=k[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=x&&x<=57343?this.content=1024*(y-55296)+x-56320+65536|k[g.CHAR_DATA_WIDTH_INDEX]<<22:C=!0}else C=!0}else this.content=k[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|k[g.CHAR_DATA_WIDTH_INDEX]<<22;C&&(this.combinedData=k[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|k[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,_,k){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(_&&!k||!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 x=g[m.keyCode],v=x==null?void 0:x[m.shiftKey?1:0];if(v)C.key=p.C0.ESC+v;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 k=d.charCodeAt(_);if(55296<=k&&k<=56319){if(++_>=g)return this._interim=k,m;const C=d.charCodeAt(_);56320<=C&&C<=57343?p[m++]=1024*(k-55296)+C-56320+65536:(p[m++]=k,p[m++]=C)}else k!==65279&&(p[m++]=k)}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,_,k,C=0,y=0,x=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,B=A-D;for(;x<B;){if(x>=g)return 0;if(N=d[x++],(192&N)!=128){x--,j=!0;break}this.interim[D++]=N,T<<=6,T|=63&N}j||(A===2?T<128?x--: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 v=g-4;let S=x;for(;S<g;){for(;!(!(S<v)||128&(m=d[S])||128&(b=d[S+1])||128&(_=d[S+2])||128&(k=d[S+3]));)p[C++]=m,p[C++]=b,p[C++]=_,p[C++]=k,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(k=d[S++],(192&k)!=128){S--;continue}if(y=(7&m)<<18|(63&b)<<12|(63&_)<<6|63&k,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(k,C){let y,x=0,v=C.length-1;if(k<C[0][0]||k>C[v][1])return!1;for(;v>=x;)if(y=x+v>>1,k>C[y][1])x=y+1;else{if(!(k<C[y][0]))return!0;v=y-1}return!1})(_,m)?0:_>=131072&&_<=196605||_>=196608&&_<=262141?2:1}charProperties(_,k){let C=this.wcwidth(_),y=C===0&&k!==0;if(y){const x=p.UnicodeService.extractWidth(k);x===0?y=!1:x>C&&(C=x)}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(_,k){if(k!==void 0&&this._syncCalls>k)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(_,k){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(k),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(k)}_innerWrite(_=0,k=!0){const C=_||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const y=this._writeBuffer[this._bufferOffset],x=this._action(y,k);if(x){const S=j=>Date.now()-C>=12?setTimeout((()=>this._innerWrite(0,j))):this._innerWrite(C,j);return void x.catch((j=>(queueMicrotask((()=>{throw j})),Promise.resolve(!1)))).then(S)}const v=this._callbacks[this._bufferOffset];if(v&&v(),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),k=_.length<2?"0"+_:_;switch(b){case 4:return _[0];case 8:return k;case 12:return(k+k).slice(0,3);default:return k+k}}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 k=_[1]?15:_[4]?255:_[7]?4095:65535;return[Math.round(parseInt(_[1]||_[4]||_[7]||_[10],16)/k*255),Math.round(parseInt(_[2]||_[5]||_[8]||_[11],16)/k*255),Math.round(parseInt(_[3]||_[6]||_[9]||_[12],16)/k*255)]}}else if(b.indexOf("#")===0&&(b=b.slice(1),p.exec(b)&&[3,6,9,12].includes(b.length))){const _=b.length/3,k=[0,0,0];for(let C=0;C<3;++C){const y=parseInt(b.slice(_*C,_*C+_),16);k[C]=_===1?y<<4:_===2?y:_===3?y>>4:y>>8}return k}},l.toRgbString=function(m,b=16){const[_,k,C]=m;return`rgb:${g(_,b)}/${g(k,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(k,C){this._handlers[k]===void 0&&(this._handlers[k]=[]);const y=this._handlers[k];return y.push(C),{dispose:()=>{const x=y.indexOf(C);x!==-1&&y.splice(x,1)}}}clearHandler(k){this._handlers[k]&&delete this._handlers[k]}setHandlerFallback(k){this._handlerFb=k}reset(){if(this._active.length)for(let k=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;k>=0;--k)this._active[k].unhook(!1);this._stack.paused=!1,this._active=b,this._ident=0}hook(k,C){if(this.reset(),this._ident=k,this._active=this._handlers[k]||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(k,C,y){if(this._active.length)for(let x=this._active.length-1;x>=0;x--)this._active[x].put(k,C,y);else this._handlerFb(this._ident,"PUT",(0,p.utf32ToString)(k,C,y))}unhook(k,C=!0){if(this._active.length){let y=!1,x=this._active.length-1,v=!1;if(this._stack.paused&&(x=this._stack.loopPosition-1,y=C,v=this._stack.fallThrough,this._stack.paused=!1),!v&&y===!1){for(;x>=0&&(y=this._active[x].unhook(k),y!==!0);x--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=x,this._stack.fallThrough=!1,y;x--}for(;x>=0;x--)if(y=this._active[x].unhook(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=x,this._stack.fallThrough=!0,y}else this._handlerFb(this._ident,"UNHOOK",k);this._active=b,this._ident=0}};const _=new g.Params;_.addParam(0),l.DcsHandler=class{constructor(k){this._handler=k,this._data="",this._params=_,this._hitLimit=!1}hook(k){this._params=k.length>1||k.params[0]?k.clone():_,this._data="",this._hitLimit=!1}put(k,C,y){this._hitLimit||(this._data+=(0,p.utf32ToString)(k,C,y),this._data.length>m.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(k){let C=!1;if(this._hitLimit)C=!1;else if(k&&(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(x){this.table=new Uint8Array(x)}setDefault(x,v){this.table.fill(x<<4|v)}add(x,v,S,j){this.table[v<<8|x]=S<<4|j}addMany(x,v,S,j){for(let T=0;T<x.length;T++)this.table[v<<8|x[T]]=S<<4|j}}l.TransitionTable=_;const k=160;l.VT500_TRANSITION_TABLE=(function(){const y=new _(4095),x=Array.apply(null,Array(256)).map(((D,A)=>A)),v=(D,A)=>x.slice(D,A),S=v(32,127),j=v(0,24);j.push(25),j.push.apply(j,v(28,32));const T=v(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(v(128,144),N,3,0),y.addMany(v(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(v(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(v(64,127),3,7,0),y.addMany(v(48,60),3,8,4),y.addMany([60,61,62,63],3,9,4),y.addMany(v(48,60),4,8,4),y.addMany(v(64,127),4,7,0),y.addMany([60,61,62,63],4,0,6),y.addMany(v(32,64),6,0,6),y.add(127,6,0,6),y.addMany(v(64,127),6,0,0),y.addMany(v(32,48),3,9,5),y.addMany(v(32,48),5,9,5),y.addMany(v(48,64),5,0,6),y.addMany(v(64,127),5,7,0),y.addMany(v(32,48),4,9,5),y.addMany(v(32,48),1,9,2),y.addMany(v(32,48),2,9,2),y.addMany(v(48,127),2,10,0),y.addMany(v(48,80),1,10,0),y.addMany(v(81,88),1,10,0),y.addMany([89,90,92],1,10,0),y.addMany(v(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(v(28,32),9,0,9),y.addMany(v(32,48),9,9,12),y.addMany(v(48,60),9,8,10),y.addMany([60,61,62,63],9,9,10),y.addMany(j,11,0,11),y.addMany(v(32,128),11,0,11),y.addMany(v(28,32),11,0,11),y.addMany(j,10,0,10),y.add(127,10,0,10),y.addMany(v(28,32),10,0,10),y.addMany(v(48,60),10,8,10),y.addMany([60,61,62,63],10,0,11),y.addMany(v(32,48),10,9,12),y.addMany(j,12,0,12),y.add(127,12,0,12),y.addMany(v(28,32),12,0,12),y.addMany(v(32,48),12,9,12),y.addMany(v(48,64),12,0,11),y.addMany(v(64,127),12,12,13),y.addMany(v(64,127),10,12,13),y.addMany(v(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(k,0,2,0),y.add(k,8,5,8),y.add(k,6,0,6),y.add(k,11,0,11),y.add(k,13,13,13),y})();class C extends p.Disposable{constructor(x=l.VT500_TRANSITION_TABLE){super(),this._transitions=x,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=(v,S,j)=>{},this._executeHandlerFb=v=>{},this._csiHandlerFb=(v,S)=>{},this._escHandlerFb=v=>{},this._errorHandlerFb=v=>v,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(x,v=[64,126]){let S=0;if(x.prefix){if(x.prefix.length>1)throw new Error("only one byte as prefix supported");if(S=x.prefix.charCodeAt(0),S&&60>S||S>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(x.intermediates){if(x.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let T=0;T<x.intermediates.length;++T){const N=x.intermediates.charCodeAt(T);if(32>N||N>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");S<<=8,S|=N}}if(x.final.length!==1)throw new Error("final must be a single byte");const j=x.final.charCodeAt(0);if(v[0]>j||j>v[1])throw new Error(`final must be in range ${v[0]} .. ${v[1]}`);return S<<=8,S|=j,S}identToString(x){const v=[];for(;x;)v.push(String.fromCharCode(255&x)),x>>=8;return v.reverse().join("")}setPrintHandler(x){this._printHandler=x}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(x,v){const S=this._identifier(x,[48,126]);this._escHandlers[S]===void 0&&(this._escHandlers[S]=[]);const j=this._escHandlers[S];return j.push(v),{dispose:()=>{const T=j.indexOf(v);T!==-1&&j.splice(T,1)}}}clearEscHandler(x){this._escHandlers[this._identifier(x,[48,126])]&&delete this._escHandlers[this._identifier(x,[48,126])]}setEscHandlerFallback(x){this._escHandlerFb=x}setExecuteHandler(x,v){this._executeHandlers[x.charCodeAt(0)]=v}clearExecuteHandler(x){this._executeHandlers[x.charCodeAt(0)]&&delete this._executeHandlers[x.charCodeAt(0)]}setExecuteHandlerFallback(x){this._executeHandlerFb=x}registerCsiHandler(x,v){const S=this._identifier(x);this._csiHandlers[S]===void 0&&(this._csiHandlers[S]=[]);const j=this._csiHandlers[S];return j.push(v),{dispose:()=>{const T=j.indexOf(v);T!==-1&&j.splice(T,1)}}}clearCsiHandler(x){this._csiHandlers[this._identifier(x)]&&delete this._csiHandlers[this._identifier(x)]}setCsiHandlerFallback(x){this._csiHandlerFb=x}registerDcsHandler(x,v){return this._dcsParser.registerHandler(this._identifier(x),v)}clearDcsHandler(x){this._dcsParser.clearHandler(this._identifier(x))}setDcsHandlerFallback(x){this._dcsParser.setHandlerFallback(x)}registerOscHandler(x,v){return this._oscParser.registerHandler(x,v)}clearOscHandler(x){this._oscParser.clearHandler(x)}setOscHandlerFallback(x){this._oscParser.setHandlerFallback(x)}setErrorHandler(x){this._errorHandler=x}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(x,v,S,j,T){this._parseStack.state=x,this._parseStack.handlers=v,this._parseStack.handlerPos=S,this._parseStack.transition=j,this._parseStack.chunkPos=T}parse(x,v,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 B=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(S===!1&&B>-1){for(;B>=0&&(j=A[B](this._params),j!==!0);B--)if(j instanceof Promise)return this._parseStack.handlerPos=B,j}this._parseStack.handlers=[];break;case 4:if(S===!1&&B>-1){for(;B>=0&&(j=A[B](),j!==!0);B--)if(j instanceof Promise)return this._parseStack.handlerPos=B,j}this._parseStack.handlers=[];break;case 6:if(T=x[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=x[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<v;++A){switch(T=x[A],N=this._transitions.table[this.currentState<<8|(T<160?T:k)],N>>4){case 2:for(let W=A+1;;++W){if(W>=v||(T=x[W])<32||T>126&&T<k){this._printHandler(x,A,W),A=W-1;break}if(++W>=v||(T=x[W])<32||T>126&&T<k){this._printHandler(x,A,W),A=W-1;break}if(++W>=v||(T=x[W])<32||T>126&&T<k){this._printHandler(x,A,W),A=W-1;break}if(++W>=v||(T=x[W])<32||T>126&&T<k){this._printHandler(x,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 B=this._csiHandlers[this._collect<<8|T];let O=B?B.length-1:-1;for(;O>=0&&(j=B[O](this._params),j!==!0);O--)if(j instanceof Promise)return this._preserveStack(3,B,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<v&&(T=x[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 V=q?q.length-1:-1;for(;V>=0&&(j=q[V](),j!==!0);V--)if(j instanceof Promise)return this._preserveStack(4,q,V,N,A),j;V<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>=v||(T=x[W])===24||T===26||T===27||T>127&&T<k){this._dcsParser.put(x,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>=v||(T=x[W])<32||T>127&&T<k){this._oscParser.put(x,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 k=this._handlers[b];return k.push(_),{dispose:()=>{const C=k.indexOf(_);C!==-1&&k.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,_,k){if(this._active.length)for(let C=this._active.length-1;C>=0;C--)this._active[C].put(b,_,k);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(b,_,k))}start(){this.reset(),this._state=1}put(b,_,k){if(this._state!==3){if(this._state===1)for(;_<k;){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&&k-_>0&&this._put(b,_,k)}}end(b,_=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let k=!1,C=this._active.length-1,y=!1;if(this._stack.paused&&(C=this._stack.loopPosition-1,k=_,y=this._stack.fallThrough,this._stack.paused=!1),!y&&k===!1){for(;C>=0&&(k=this._active[C].end(b),k!==!0);C--)if(k instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!1,k;C--}for(;C>=0;C--)if(k=this._active[C].end(!1),k instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!0,k}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,_,k){this._hitLimit||(this._data+=(0,g.utf32ToString)(b,_,k),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((k=>(this._data="",this._hitLimit=!1,k)));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 k=m[_];if(Array.isArray(k))for(let C=0;C<k.length;++C)b.addSubParam(k[C]);else b.addParam(k)}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,k=255&this._subParamsIdx[b];k-_>0&&m.push(Array.prototype.slice.call(this._subParams,_,k))}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,k=255&this._subParamsIdx[b];k-_>0&&(m[b]=this._subParams.slice(_,k))}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,k=_[b-1];_[b-1]=~k?Math.min(10*k+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(k){super(),this._core=k,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,x,v,S){var j,T=arguments.length,N=T<3?x:S===null?S=Object.getOwnPropertyDescriptor(x,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(y,x,v,S);else for(var D=y.length-1;D>=0;D--)(j=y[D])&&(N=(T<3?j(N):T>3?j(x,v,N):j(x,v))||N);return T>3&&N&&Object.defineProperty(x,v,N),N},g=this&&this.__param||function(y,x){return function(v,S){x(v,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),k=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,x){this.cols=y,this.rows=x,this.buffers.resize(y,x),this._onResize.fire({cols:y,rows:x})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(y,x=!1){const v=this.buffer;let S;S=this._cachedBlankLine,S&&S.length===this.cols&&S.getFg(0)===y.fg&&S.getBg(0)===y.bg||(S=v.getBlankLine(y,x),this._cachedBlankLine=S),S.isWrapped=x;const j=v.ybase+v.scrollTop,T=v.ybase+v.scrollBottom;if(v.scrollTop===0){const N=v.lines.isFull;T===v.lines.length-1?N?v.lines.recycle().copyFrom(S):v.lines.push(S.clone()):v.lines.splice(T+1,0,S.clone()),N?this.isUserScrolling&&(v.ydisp=Math.max(v.ydisp-1,0)):(v.ybase++,this.isUserScrolling||v.ydisp++)}else{const N=T-j+1;v.lines.shiftElements(j+1,N-1,-1),v.lines.set(T,S.clone())}this.isUserScrolling||(v.ydisp=v.ybase),this._onScroll.fire(v.ydisp)}scrollLines(y,x,v){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&&(x||this._onScroll.fire(S.ydisp))}};l.BufferService=C=p([g(0,k.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,B=A<3?j:N===null?N=Object.getOwnPropertyDescriptor(j,T):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(S,j,T,N);else for(var O=S.length-1;O>=0;O--)(D=S[O])&&(B=(A<3?D(B):A>3?D(j,T,B):D(j,T))||B);return A>3&&B&&Object.defineProperty(j,T,B),B},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),k={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,x={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 v=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(k))this.addProtocol(T,k[T]);for(const T of Object.keys(x))this.addEncoding(T,x[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=v=p([g(0,m.IBufferService),g(1,m.ICoreService)],v)},6975:function(f,l,d){var p=this&&this.__decorate||function(v,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(v,S,j,T);else for(var B=v.length-1;B>=0;B--)(N=v[B])&&(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(v,S){return function(j,T){S(j,T,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreService=void 0;const m=d(1439),b=d(8460),_=d(844),k=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 x=l.CoreService=class extends _.Disposable{constructor(v,S,j){super(),this._bufferService=v,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(v,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 "${v}"`,(()=>v.split("").map((T=>T.charCodeAt(0))))),this._onData.fire(v)}triggerBinaryEvent(v){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${v}"`,(()=>v.split("").map((S=>S.charCodeAt(0))))),this._onBinary.fire(v))}};l.CoreService=x=p([g(0,k.IBufferService),g(1,k.ILogService),g(2,k.IOptionsService)],x)},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,k=0;class C extends m.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new b.SortedList((v=>v==null?void 0:v.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(v){if(v.marker.isDisposed)return;const S=new y(v);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 v of this._decorations.values())v.dispose();this._decorations.clear()}*getDecorationsAtCell(v,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),v>=T&&v<N&&(!j||(D.options.layer??"bottom")===j)&&(yield D)}forEachDecorationAtCell(v,S,j,T){this._decorations.forEachByKey(S,(N=>{_=N.options.x??0,k=_+(N.options.width??1),v>=_&&v<k&&(!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(v){super(),this.options=v,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=v.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[k,C]of _)this.set(k,C)}set(_,k){const C=this._entries.get(_);return this._entries.set(_,k),C}forEach(_){for(const[k,C]of this._entries.entries())_(k,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 k=(0,g.getServiceDependencies)(b).sort(((x,v)=>x.index-v.index)),C=[];for(const x of k){const v=this._services.get(x.id);if(!v)throw new Error(`[createInstance] ${b.name} depends on UNKNOWN service ${x.id}.`);C.push(v)}const y=k.length>0?k[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,x,v,S){var j,T=arguments.length,N=T<3?x:S===null?S=Object.getOwnPropertyDescriptor(x,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(y,x,v,S);else for(var D=y.length-1;D>=0;D--)(j=y[D])&&(N=(T<3?j(N):T>3?j(x,v,N):j(x,v))||N);return T>3&&N&&Object.defineProperty(x,v,N),N},g=this&&this.__param||function(y,x){return function(v,S){x(v,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 k,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()))),k=this}_updateLogLevel(){this._logLevel=_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(y){for(let x=0;x<y.length;x++)typeof y[x]=="function"&&(y[x]=y[x]())}_log(y,x,v){this._evalLazyOptionalParams(v),y.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+x,...v)}trace(y,...x){var v;this._logLevel<=b.LogLevelEnum.TRACE&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.trace.bind(this._optionsService.options.logger))??console.log,y,x)}debug(y,...x){var v;this._logLevel<=b.LogLevelEnum.DEBUG&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.debug.bind(this._optionsService.options.logger))??console.log,y,x)}info(y,...x){var v;this._logLevel<=b.LogLevelEnum.INFO&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.info.bind(this._optionsService.options.logger))??console.info,y,x)}warn(y,...x){var v;this._logLevel<=b.LogLevelEnum.WARN&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.warn.bind(this._optionsService.options.logger))??console.warn,y,x)}error(y,...x){var v;this._logLevel<=b.LogLevelEnum.ERROR&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.error.bind(this._optionsService.options.logger))??console.error,y,x)}};l.LogService=C=p([g(0,b.IOptionsService)],C),l.setTraceLogger=function(y){k=y},l.traceCall=function(y,x,v){if(typeof v.value!="function")throw new Error("not supported");const S=v.value;v.value=function(...j){if(k.logLevel!==b.LogLevelEnum.TRACE)return S.apply(this,j);k.trace(`GlyphRenderer#${S.name}(${j.map((N=>JSON.stringify(N))).join(", ")})`);const T=S.apply(this,j);return k.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 x in C)if(x in y)try{const v=C[x];y[x]=this._sanitizeAndValidateOption(x,v)}catch(v){console.error(v)}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((x=>{x===C&&y(this.rawOptions[C])}))}onMultipleOptionChange(C,y){return this.onOptionChange((x=>{C.indexOf(x)!==-1&&y()}))}_setupOptions(){const C=x=>{if(!(x in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${x}"`);return this.rawOptions[x]},y=(x,v)=>{if(!(x in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${x}"`);v=this._sanitizeAndValidateOption(x,v),this.rawOptions[x]!==v&&(this.rawOptions[x]=v,this._onOptionChange.fire(x))};for(const x in this.rawOptions){const v={get:C.bind(this,x),set:y.bind(this,x)};Object.defineProperty(this.options,x,v)}}_sanitizeAndValidateOption(C,y){switch(C){case"cursorStyle":if(y||(y=l.DEFAULT_OPTIONS[C]),!(function(x){return x==="block"||x==="underline"||x==="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(_,k,C,y){var x,v=arguments.length,S=v<3?k:y===null?y=Object.getOwnPropertyDescriptor(k,C):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(_,k,C,y);else for(var j=_.length-1;j>=0;j--)(x=_[j])&&(S=(v<3?x(S):v>3?x(k,C,S):x(k,C))||S);return v>3&&S&&Object.defineProperty(k,C,S),S},g=this&&this.__param||function(_,k){return function(C,y){k(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 k=this._bufferService.buffer;if(_.id===void 0){const j=k.addMarker(k.ybase+k.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),x=this._entriesWithId.get(y);if(x)return this.addLineToLink(x.id,k.ybase+k.y),x.id;const v=k.addMarker(k.ybase+k.y),S={id:this._nextId++,key:this._getEntryIdKey(C),data:C,lines:[v]};return v.onDispose((()=>this._removeMarkerFromLink(S,v))),this._entriesWithId.set(S.key,S),this._dataByLinkId.set(S.id,S),S.id}addLineToLink(_,k){const C=this._dataByLinkId.get(_);if(C&&C.lines.every((y=>y.line!==k))){const y=this._bufferService.buffer.addMarker(k);C.lines.push(y),y.onDispose((()=>this._removeMarkerFromLink(C,y)))}}getLinkData(_){var k;return(k=this._dataByLinkId.get(_))==null?void 0:k.data}_getEntryIdKey(_){return`${_.id};;${_.uri}`}_removeMarkerFromLink(_,k){const C=_.lines.indexOf(k);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,_,k){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(C,y,x){y[d]===y?y[p].push({id:C,index:x}):(y[p]=[{id:C,index:x}],y[d]=y)})(m,b,k)};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(_,k,C=!1){return(16777215&_)<<3|(3&k)<<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 k=0,C=0;const y=_.length;for(let x=0;x<y;++x){let v=_.charCodeAt(x);if(55296<=v&&v<=56319){if(++x>=y)return k+this.wcwidth(v);const T=_.charCodeAt(x);56320<=T&&T<=57343?v=1024*(v-55296)+T-56320+65536:k+=this.wcwidth(T)}const S=this.charProperties(v,C);let j=m.extractWidth(S);m.extractShouldJoin(S)&&(j-=m.extractWidth(C)),k+=j,C=S}return k}charProperties(_,k){return this._activeProvider.charProperties(_,k)}}l.UnicodeService=m}},s={};function c(f){var l=s[f];if(l!==void 0)return l.exports;var d=s[f]={exports:{}};return i[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),k=["cols","rows"];class C extends p.Disposable{constructor(x){super(),this._core=this.register(new d.Terminal(x)),this._addonManager=this.register(new g.AddonManager),this._publicOptions={...this._core.options};const v=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:v.bind(this,j),set:S.bind(this,j)};Object.defineProperty(this._publicOptions,j,T)}}_checkReadonlyOptions(x){if(k.includes(x))throw new Error(`Option "${x}" 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 x=this._core.coreService.decPrivateModes;let v="none";switch(this._core.coreMouseService.activeProtocol){case"X10":v="x10";break;case"VT200":v="vt200";break;case"DRAG":v="drag";break;case"ANY":v="any"}return{applicationCursorKeysMode:x.applicationCursorKeys,applicationKeypadMode:x.applicationKeypad,bracketedPasteMode:x.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:v,originMode:x.origin,reverseWraparoundMode:x.reverseWraparound,sendFocusMode:x.sendFocus,wraparoundMode:x.wraparound}}get options(){return this._publicOptions}set options(x){for(const v in x)this._publicOptions[v]=x[v]}blur(){this._core.blur()}focus(){this._core.focus()}input(x,v=!0){this._core.input(x,v)}resize(x,v){this._verifyIntegers(x,v),this._core.resize(x,v)}open(x){this._core.open(x)}attachCustomKeyEventHandler(x){this._core.attachCustomKeyEventHandler(x)}attachCustomWheelEventHandler(x){this._core.attachCustomWheelEventHandler(x)}registerLinkProvider(x){return this._core.registerLinkProvider(x)}registerCharacterJoiner(x){return this._checkProposedApi(),this._core.registerCharacterJoiner(x)}deregisterCharacterJoiner(x){this._checkProposedApi(),this._core.deregisterCharacterJoiner(x)}registerMarker(x=0){return this._verifyIntegers(x),this._core.registerMarker(x)}registerDecoration(x){return this._checkProposedApi(),this._verifyPositiveIntegers(x.x??0,x.width??0,x.height??0),this._core.registerDecoration(x)}hasSelection(){return this._core.hasSelection()}select(x,v,S){this._verifyIntegers(x,v,S),this._core.select(x,v,S)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(x,v){this._verifyIntegers(x,v),this._core.selectLines(x,v)}dispose(){super.dispose()}scrollLines(x){this._verifyIntegers(x),this._core.scrollLines(x)}scrollPages(x){this._verifyIntegers(x),this._core.scrollPages(x)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(x){this._verifyIntegers(x),this._core.scrollToLine(x)}clear(){this._core.clear()}write(x,v){this._core.write(x,v)}writeln(x,v){this._core.write(x),this._core.write(`\r
|
|
65
|
-
`,v)}paste(x){this._core.paste(x)}refresh(x,v){this._verifyIntegers(x,v),this._core.refresh(x,v)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(x){this._addonManager.loadAddon(this,x)}static get strings(){return l}_verifyIntegers(...x){for(const v of x)if(v===1/0||isNaN(v)||v%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...x){for(const v of x)if(v&&(v===1/0||isNaN(v)||v%1!=0||v<0))throw new Error("This API only accepts positive integers")}}f.Terminal=C})(),u})()))})(Fd)),Fd.exports}var Hw=zw();/**
|
|
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 Pw=2,Fw=1,Uw=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,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),c=Math.max(0,parseInt(i.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=s-l,g=c-d-r;return{cols:Math.max(Pw,Math.floor(g/e.css.cell.width)),rows:Math.max(Fw,Math.floor(p/e.css.cell.height))}}};function $w({sessionId:e,onClose:r,onEscape:i,autoFocus:s}){const c=H.useRef(null),u=H.useRef(e),f=H.useRef(null),l=H.useRef(null),d=ir(g=>g.writeSession),p=ir(g=>g.resizeSession);return H.useEffect(()=>{u.current=e},[e]),H.useEffect(()=>{if(!i)return;const g=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),i())};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[i]),H.useEffect(()=>{if(!c.current)return;const g=new Hw.Terminal({fontFamily:'"JetBrains Mono", monospace',fontSize:13,theme:{background:"#1a1a1a",foreground:"#e0e0e0",cursor:"#ffffff",cursorAccent:"#1a1a1a"},cursorBlink:!0,cursorStyle:"bar",convertEol:!0}),m=new Uw;g.loadAddon(m),f.current={term:g,fitAddon:m},c.current.addEventListener("keydown",C=>{C.key==="Escape"&&i&&(C.preventDefault(),C.stopPropagation(),i())}),g.open(c.current);const b=c.current.querySelector(".xterm");b&&(b.style.padding="8px"),m.fit(),s&&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"&&i){i();return}d(u.current,C)}),g.onKey(C=>{C.key==="\x1B"&&i&&(C.domEvent.stopPropagation(),i())});const k=Gt.subscribe(C=>{var y,x;if(C.type==="terminal.output"&&((y=C.payload)==null?void 0:y.sessionId)===u.current){const v=(x=C.payload)==null?void 0:x.data;v&&g.write(v)}});return()=>{k(),_.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(kw,{})})]}),o.jsx("div",{ref:c,className:"flex-1 relative overflow-hidden",tabIndex:0,onKeyDown:g=>{g.key==="Escape"&&i&&(g.preventDefault(),g.stopPropagation(),i())}})]})}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 Ww({isOpen:e,onClose:r,onFocusChat:i}){const s=ir(C=>C.createSession),c=ir(C=>C.killSession),u=ir(C=>C.sessions),f=ir(C=>C.setWorkdir),l=ir(C=>C.fetchSessions),d=Zt(C=>C.currentProject),[p,g]=H.useState(!0),m=H.useRef(null),b=H.useRef(!1),_=H.useRef(!1),k=H.useCallback(()=>{r(),i()},[r,i]);return H.useEffect(()=>{d!=null&&d.workdir&&f(d.workdir)},[d==null?void 0:d.workdir,f]),H.useEffect(()=>{e&&(g(!0),l().finally(()=>g(!1)))},[e,l]),H.useEffect(()=>{e&&u.length===0&&!p&&!_.current&&(_.current=!0,s())},[e,u.length,p,s]),H.useEffect(()=>{e?(b.current=!0,setTimeout(()=>{var C;(C=m.current)==null||C.focus(),setTimeout(()=>{b.current=!1},200)},100)):_.current=!1},[e]),H.useEffect(()=>{if(!e)return;const C=y=>{b.current||y.key==="Escape"&&(y.preventDefault(),r(),i())};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[e,r,i]),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:k}),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(),k())},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:()=>s(),className:"p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"New terminal",children:o.jsx(xw,{})}),o.jsx("button",{onClick:()=>{r(),i()},className:"p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Close (Esc)",children:o.jsx($b,{})})]})]}),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:()=>s(),className:"px-4 py-2 bg-accent-primary/25 text-white 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($w,{sessionId:C.id,onClose:()=>c(C.id),onEscape:k,autoFocus:u.length===1},C.id))})})]})]}):null}function po({items:e,trigger:r,minWidth:i="120px",isOpen:s,onOpenChange:c}){const[u,f]=H.useState(!1),l=s!==void 0,d=l?s:u,p=O=>{if(l){const q=typeof O=="function"?O(u):O;c==null||c(q)}else f(O)},[g,m]=H.useState(null),b=H.useRef(null),_=H.useRef(null),[k,C]=H.useState(0),y=H.useRef(0),x=H.useRef(e),v=H.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})},[]);H.useEffect(()=>{x.current=e},[e]),H.useEffect(()=>{function O(q){_.current&&!_.current.contains(q.target)&&p(!1)}return d&&document.addEventListener("mousedown",O),()=>{document.removeEventListener("mousedown",O)}},[d]),H.useEffect(()=>{d&&v()},[d,v]),H.useEffect(()=>{if(!d)return;setTimeout(()=>{var q;(q=_.current)==null||q.focus()},0);function O(q){const V=x.current,W=V.filter(F=>!S(F)),I=j(y.current,V);switch(q.key){case"ArrowDown":if(q.preventDefault(),q.stopPropagation(),I<W.length-1){const F=T(y.current+1,V);y.current=F,C(F)}break;case"ArrowUp":if(q.preventDefault(),q.stopPropagation(),I>0){const F=N(y.current-1,V);y.current=F,C(F)}break;case"Enter":q.preventDefault(),q.stopPropagation(),D(y.current,V);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 V=0;for(let W=0;W<O;W++){const I=q[W];I&&!S(I)&&V++}return V}function T(O,q){for(let V=O;V<q.length;V++){const W=q[V];if(W&&!S(W))return V}return O}function N(O,q){for(let V=O;V>=0;V--){const W=q[V];if(W&&!S(W))return V}return O}function D(O,q){var W;const V=q[O];!V||S(V)||((W=V.onClick)==null||W.call(V),V.href&&(window.history.pushState(null,"",V.href),window.dispatchEvent(new PopStateEvent("popstate"))),p(!1))}H.useEffect(()=>{d&&(C(e.findIndex(O=>!S(O))),y.current=e.findIndex(O=>!S(O)))},[d,e]);const A=O=>{O.stopPropagation(),d||v(),p(!d)},B=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:i},tabIndex:-1,children:e.map((O,q)=>{const W=!S(O)&&q===k,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:F=>{var P;(P=O.onClick)==null||P.call(O,F),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:F=>{var P;(P=O.onClick)==null||P.call(O,F),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&&fo.createPortal(B,document.body)]})}function Xb(e){const r=new Date(e),s=["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`${s} ${c}/${u}/${f}`}function oc(e){const r=new Date(e),i=String(r.getHours()).padStart(2,"0"),s=String(r.getMinutes()).padStart(2,"0");return`${i}:${s}`}function Gw(e){const r=new Date(e),i=new Date,s=new Date(i.getFullYear(),i.getMonth(),i.getDate()),c=new Date(r.getFullYear(),r.getMonth(),r.getDate()),u=Math.floor((s.getTime()-c.getTime())/(1e3*60*60*24)),f=oc(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 Zb(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 Vw(e){const{year:r,month:i,day:s}=Zb(e);return`${r}-${i}-${s}`}function Qb(e){const r=new Map;for(const c of e){const u=Vw(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 i=Array.from(r.keys()).sort((c,u)=>u.localeCompare(c)),s=new Map;for(const c of i)s.set(c,r.get(c));return s}function Kw({items:e,trigger:r,isActive:i=!1}){const[s,c]=H.useState(!1),u=H.useRef(null);return H.useEffect(()=>{function f(l){u.current&&!u.current.contains(l.target)&&c(!1)}if(s)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]),o.jsxs("div",{className:"relative",ref:u,children:[o.jsxs("button",{type:"button",onClick:()=>c(!s),className:`flex items-center gap-1 px-1.5 py-0.5 rounded transition-colors ${i?"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:s?180:0})]}),s&&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 Yw({projects:e,currentProject:r}){const i=Zt(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:()=>{i(u.id)}}));return o.jsx(po,{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 Xw({currentProject:e,sessions:r,currentSession:i,projectIdFromUrl:s}){if(!(e!=null&&e.id)||e.id!==s)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(Ib,{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===(i==null?void 0:i.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(aw,{className:"w-3 h-3"}),o.jsx("span",{className:"text-sm",children:"Projects"})]})}];return o.jsx(Kw,{items:u,trigger:o.jsx("span",{className:"text-sm text-text-secondary font-medium",children:e.name})})}function Zw({sessions:e,currentProject:r,currentSession:i,isOpen:s,onOpenChange:c}){var g;const u=Ce(m=>m.loadSession),f=e.filter(m=>m.projectId===r.id).slice(0,15),l=Qb(f),d=H.useMemo(()=>{const m=[];m.push({label:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ib,{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 k=_[0];if(k){m.push({label:o.jsx("div",{className:"px-3 py-2 text-text-muted text-xs font-medium cursor-default",children:Xb(k.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:oc(C.updatedAt)})]}),icon:C.id===(i==null?void 0:i.id)?o.jsx(Pr,{}):void 0,href:`/p/${r.id}/s/${C.id}`,onClick:()=>{u(C.id)}})}}return m},[r.id,l,i==null?void 0:i.id]),p=i?((g=i.metadata)==null?void 0:g.title)??i.id.slice(0,8):"No session selected";return o.jsx(po,{items:d,isOpen:s,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 Qw({onMenuClick:e,onCriteriaToggle:r}){const[i,s]=H.useState(!1),[c,u]=H.useState(!1),[f,l]=H.useState(!!document.fullscreenElement);H.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),_=Zt(T=>T.currentProject),k=Zt(T=>T.projects),C=Lt(T=>T.startAutoRefresh),y=Lt(T=>T.stopAutoRefresh),x=ir(T=>T.setOpen),v=ir(T=>T.isOpen);H.useEffect(()=>{const T=()=>u(!0);return window.addEventListener("open-session-dropdown",T),()=>window.removeEventListener("open-session-dropdown",T)},[]);const S=H.useCallback(()=>{const T=document.querySelector('textarea[placeholder*="What would you like to build"], textarea[placeholder*="Send a message"]');T&&T.focus()},[]),j=H.useRef(0);return H.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(),ir.getState().toggleOpen(),j.current=0):j.current=D}};return window.addEventListener("keydown",T,!0),()=>window.removeEventListener("keydown",T,!0)},[]),H.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(Ux,{})}),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(Yw,{projects:k,currentProject:_})}),o.jsx("span",{className:"md:hidden",children:o.jsx(Xw,{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(Zw,{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(uw,{}):o.jsx(dw,{})}),p&&o.jsx("button",{onClick:()=>x(!v),className:`p-2.5 rounded hover:bg-bg-tertiary transition-colors ${v?"text-accent-primary":"text-text-muted hover:text-text-primary"}`,title:"Toggle terminal (double Ctrl)",children:o.jsx(ww,{})}),o.jsx("button",{onClick:()=>s(!0),className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Settings",children:o.jsx(bw,{})}),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(pw,{})}),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(Ux,{})})]}),o.jsx(Ow,{isOpen:i,onClose:()=>s(!1)}),o.jsx(Ww,{isOpen:v,onClose:()=>x(!1),onFocusChat:S})]})}function Jw({isOpen:e,onClose:r,title:i,label:s,description:c,placeholder:u,value:f,isLoading:l=!1,onSave:d}){const[p,g]=H.useState(f),[m,b]=H.useState(!1),[_,k]=H.useState(!1);H.useEffect(()=>{g(f),b(!1)},[f]);const C=S=>{g(S.target.value),b(!0)},y=async()=>{k(!0),await d(p),k(!1),b(!1),r()},x=()=>{g(f),b(!1),r()},v=l||_;return o.jsx(At,{isOpen:e,onClose:x,title:i,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:s}),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:v})}),m&&o.jsx(Ph,{}),o.jsxs("div",{className:"flex justify-end gap-2 pt-2 border-t border-border flex-shrink-0",children:[o.jsx(it,{variant:"secondary",onClick:x,children:"Cancel"}),o.jsx(it,{variant:"primary",onClick:y,disabled:!m||v,children:_?"Saving...":"Save"})]})]})})}function eC({isOpen:e,onClose:r,project:i}){const s=Zt(u=>u.updateProject),c=async u=>{s(i.id,{customInstructions:u||null}),await new Promise(f=>setTimeout(f,100))};return o.jsx(Jw,{isOpen:e,onClose:r,title:`${i.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:i.customInstructions??"",onSave:c})}const tC={sm:"w-3 h-3",md:"w-4 h-4",lg:"w-5 h-5",xl:"w-6 h-6"},nC="M6 18L18 6M6 6l12 12";function ro({onClick:e,className:r="",size:i="md",variant:s="default"}){const c=s==="overlay"?"bg-accent-error text-white rounded-full flex items-center justify-center hover:bg-accent-error/80 transition-colors":s==="sidebar"?"flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors":s==="modal"?"text-text-muted hover:text-text-primary transition-colors":"hover:text-white transition-colors";return o.jsx(ac,{onClick:e,icon:nC,iconSize:tC[i],className:`${c} ${r}`,title:"Close"})}function Jb({projectId:e,isOpen:r=!0,onClose:i}){const[,s]=gr(),[c,u]=H.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),k=Zt(j=>j.currentProject),C=H.useRef(null),y=H.useCallback(()=>{b&&!_&&k&&m(k.id)},[b,_,k,m]);H.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 x=f.filter(j=>j.projectId===(k==null?void 0:k.id)),v=(j,T)=>{T==null||T.stopPropagation(),confirm("Delete this session?")&&(p(j),(l==null?void 0:l.id)===j&&s(`/p/${e}`))},S=()=>{confirm("Delete all sessions in this project? This cannot be undone.")&&(g(e),s(`/p/${e}`))};return o.jsxs(o.Fragment,{children:[r&&i&&o.jsx("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:i}),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-white hover:bg-accent-primary/40 px-3 py-1.5 text-sm","data-testid":"sidebar-new-session-button",children:"+ New Session"}),o.jsx(po,{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(Rh,{})})}),i&&o.jsx(ro,{onClick:i,className:"md:hidden",variant:"sidebar",size:"md"})]}),k&&o.jsx(eC,{isOpen:c,onClose:()=>u(!1),project:k}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:x.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:rC(x,l,d,v,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 rC(e,r,i,s,c){const u=Qb(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:Xb(d.updatedAt)}),l.map(p=>{const g=(r==null?void 0:r.id)===p.id,m=i.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(po,{items:[{label:"Delete session",onClick:_=>s(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(Rh,{})})})]}),o.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[b?o.jsx(yw,{}):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:oc(p.updatedAt)}),o.jsxs("span",{className:"text-text-muted text-xs flex-shrink-0",children:[p.messageCount," messages"]})]})]})},p.id)})]},f):null})}const Kx=["⠋","⠙","⠹","⠸","⠼","⠴"];function iC(){var l;const e=Zt(d=>d.currentProject),r=Ce(d=>d.currentSession),i=Rb(),s=!1,c=H.useRef(0),u=H.useRef(null);H.useEffect(()=>(i?(u.current=window.setInterval(()=>{c.current=(c.current+1)%Kx.length,f()},150),f()):(u.current&&(clearInterval(u.current),u.current=null),f()),()=>{u.current&&(clearInterval(u.current),u.current=null)}),[i,e,r,s]);const f=()=>{var m;const p=(m=r==null?void 0:r.metadata)==null?void 0:m.title,g=i?`${Kx[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 lc=H.forwardRef(({className:e="",...r},i)=>o.jsx("input",{ref:i,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}));lc.displayName="Input";function sC({isOpen:e,onClose:r,projectName:i,onConfirm:s}){const c=()=>{s(),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:i})," 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(it,{variant:"secondary",onClick:r,children:"Cancel"}),o.jsx(it,{variant:"danger",onClick:c,children:"Delete"})]})]})})}function aC(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 oC({isOpen:e,onClose:r}){const[,i]=gr(),[s,c]=H.useState(""),[u,f]=H.useState(null),[l,d]=H.useState(!1),[p,g]=H.useState(""),m=H.useRef(null);H.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=H.useCallback(async C=>{C.preventDefault();const y=aC(s);if(!y.valid){f(y.error);return}d(!0),f(null);const x=`${p}/${s}`;try{const v=await ke("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,workdir:x})});if(!v.ok){const T=await v.json().catch(()=>({}));throw new Error(T.error||"Failed to create project")}const j=(await v.json()).project;r(),i(`/p/${j.id}`)}catch(v){f(v instanceof Error?v.message:"Failed to create project"),d(!1)}},[s,i,r,p]),_=H.useCallback(()=>{c(""),f(null),r()},[r]),k=s?`${p}/${s}`:"";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(lc,{ref:m,id:"project-name",value:s,onChange:C=>{c(C.target.value),f(null)},placeholder:"my-project",disabled:l,className:"w-full"}),s&&o.jsxs("div",{className:"mt-2 text-xs text-text-muted",children:["Full path: ",o.jsx("span",{className:"font-mono",children:k})]}),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(it,{type:"button",variant:"secondary",onClick:_,disabled:l,children:"Cancel"}),o.jsx(it,{type:"submit",variant:"primary",disabled:l||!s.trim(),className:"min-w-[100px]",children:l?o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx(Hb,{className:"h-4 w-4"}),"Creating..."]}):"Create"})]})]})})}const lC={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};function cc({size:e="md",className:r=""}){return o.jsx("div",{className:`animate-spin border-2 border-accent-primary border-t-transparent rounded-full ${lC[e]} ${r}`})}function cC({text:e,...r}){return o.jsxs("div",{className:"text-center",children:[o.jsx(cc,{...r,className:"mx-auto mb-4"}),e&&o.jsx("div",{className:"text-text-secondary",children:e})]})}function ey({onSelect:e,onClose:r,initialPath:i}){const[s,c]=H.useState(null),[u,f]=H.useState(!0),l=H.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)}},[]);H.useEffect(()=>{l(i)},[i,l]);const d=((s==null?void 0:s.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:[s&&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(cc,{size:"sm"})}):o.jsxs("div",{className:"divide-y divide-border",children:[(s==null?void 0:s.parent)&&o.jsxs("button",{onClick:()=>l(s.parent),className:"w-full p-3 flex items-center gap-3 hover:bg-bg-tertiary/50 text-text-muted",children:[o.jsx(iw,{className:"w-5 h-5"}),o.jsx("span",{children:".."})]}),s==null?void 0:s.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(Gl,{}),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)),(s==null?void 0:s.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:[(s==null?void 0:s.current)&&o.jsx("button",{onClick:()=>e(s.current),className:"w-full px-4 py-2 bg-accent-primary text-white 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 Ud(e,r){let i="/api/directories";return e?i=`/api/directories?path=${encodeURIComponent(e)}`:r&&(i=`/api/directories?path=${encodeURIComponent(r)}`),(await ke(i)).json()}function uC({isOpen:e,onClose:r}){const[,i]=gr(),[s,c]=H.useState(!1),[u,f]=H.useState(""),[l,d]=H.useState(null),[p,g]=H.useState(!1),[m,b]=H.useState(null),_=Zt(Z=>Z.projects),k=Zt(Z=>Z.createProject),C=Zt(Z=>Z.listProjects),y=Zt(Z=>Z.deleteProject),[x,v]=H.useState(null),[S,j]=H.useState(-1),[T,N]=H.useState(null),[D,A]=H.useState(!1),B=H.useRef([]);H.useEffect(()=>{ke("/api/config").then(Z=>Z.json()).then(Z=>{Z.workdir&&b(Z.workdir)})},[]);const O=H.useCallback(async Z=>{g(!0);try{const z=await Ud(Z,m??void 0);d(z)}catch(z){console.error("Failed to load directories:",z)}finally{g(!1)}},[m]);H.useEffect(()=>{e&&m&&(Ud(m),C())},[e,m,O,C]);const q=(l==null?void 0:l.directories.filter(Z=>u===""||Z.name.toLowerCase().includes(u.toLowerCase())))??[],V=[...l!=null&&l.parent&&!u?[{type:"parent",path:l.parent,name:".."}]:[],...q.map(Z=>({type:"directory",path:Z.path,name:Z.name}))],W=Z=>{i(`/p/${Z}`),r()},I=(Z,z)=>{z.stopPropagation(),N(Z)},F=()=>{T&&(y(T.id),N(null))},P=Z=>{const z=Z.split("/").filter(Boolean).pop()??"";k(z,Z),C(),v(Z)};H.useEffect(()=>{if(x){const Z=_.find(z=>z.workdir===x);Z&&(i(`/p/${Z.id}`),r(),v(null))}},[_,x,i,r]),H.useEffect(()=>{j(V.length>0?0:-1)},[u,V.length]);const X=Z=>{f(""),Ud(Z)};return H.useEffect(()=>{S>=0&&B.current[S]&&B.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(it,{variant:"secondary",onClick:()=>c(!0),children:"Create Project"}),o.jsx(it,{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(Gl,{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:z=>I(Z,z),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(ic,{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(lc,{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"})}):V.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:V.map((Z,z)=>o.jsxs("button",{ref:R=>{R&&(B.current[z]=R)},onClick:()=>Z.type==="parent"?X(Z.path):P(Z.path),className:`w-full p-3 flex items-center gap-3 text-left transition-colors ${z===S?"bg-accent-primary/20 text-accent-primary":"hover:bg-bg-tertiary/50"}`,children:[o.jsx(Gl,{className:"w-5 h-5"}),o.jsx("span",{className:"flex-1",children:Z.name})]},Z.path))})})]})]}),s&&o.jsx(oC,{isOpen:s,onClose:()=>c(!1)}),T&&o.jsx(sC,{isOpen:!0,onClose:()=>N(null),projectName:T.name,onConfirm:F}),D&&o.jsx(ey,{initialPath:m??void 0,onSelect:Z=>{P(Z),A(!1)},onClose:()=>A(!1)})]}):null}function dC(){const[e,r]=H.useState(!1),i=Ce(g=>g.sessions),s=Zt(g=>g.projects),c=Zt(g=>g.listProjects),u=Ce(g=>g.listSessions),f=Ce(g=>g.connectionStatus);H.useEffect(()=>{f==="connected"&&(c(),u())},[f,c,u]);const l=[...s].sort((g,m)=>{const b=i.filter(y=>y.workdir.startsWith(g.workdir)),_=i.filter(y=>y.workdir.startsWith(m.workdir)),k=b.length>0?new Date(b.reduce((y,x)=>new Date(x.updatedAt)>new Date(y.updatedAt)?x:y).updatedAt).getTime():new Date(g.updatedAt).getTime();return(_.length>0?new Date(_.reduce((y,x)=>new Date(x.updatedAt)>new Date(y.updatedAt)?x:y).updatedAt).getTime():new Date(m.updatedAt).getTime())-k}),d=g=>{const m=s.find(b=>b.id===g);return m?i.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(it,{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(Gl,{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-white 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 _=s.find(C=>b.workdir.startsWith(C.workdir)),k=_?`/p/${_.id}/s/${b.id}`:"#";return o.jsx(Pn,{href:k,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:Gw(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(uC,{isOpen:e,onClose:()=>r(!1)})]})}function hC(){const[,e]=Lh("/p/:projectId/new"),[,r]=gr(),i=e==null?void 0:e.projectId,s=Ce(c=>c.createSession);return H.useEffect(()=>{i&&(async()=>{const u=await s(i);r(u?`/p/${i}/s/${u.id}`:`/p/${i}`)})()},[i,s,r]),o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(cc,{})})}function fC(){const e=Zt(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-white 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 Ua=e=>Math.round(e*10)/10;function fh(e){return{providerId:e.providerId,providerName:e.providerName,backend:e.backend,model:e.model}}function pC(e){return`${e.providerId}::${e.model}`}function mC(e){return`${e.providerName} > ${e.model}`}function Yx(e){let r=0,i=0,s=0,c=0,u=0,f=0;const l=[],d=[];let p=0;for(const[b,_]of e.entries()){const k=_.stats,C=fh(k);r+=k.totalTime,i+=k.toolTime,s+=k.prefillTokens,c+=k.generationTokens;const y=k.prefillSpeed>0?k.prefillTokens/k.prefillSpeed:0,x=k.generationSpeed>0?k.generationTokens/k.generationSpeed:0;u+=y,f+=x,l.push({messageId:_.id,timestamp:_.timestamp,...C,mode:k.mode,responseIndex:b+1,prefillTokens:k.prefillTokens,generationTokens:k.generationTokens,prefillSpeed:k.prefillSpeed,generationSpeed:k.generationSpeed,totalTime:k.totalTime,aiTime:k.totalTime-k.toolTime,toolTime:k.toolTime});const v=k.llmCalls??[];for(const S of v)p+=1,d.push({messageId:_.id,timestamp:S.timestamp??_.timestamp,providerId:S.providerId,providerName:S.providerName,backend:S.backend,model:S.model,mode:k.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?Ua(s/u):0,m=f>0?Ua(c/f):0;return{totalTime:Ua(r),aiTime:Ua(r-i),toolTime:Ua(i),prefillTokens:s,generationTokens:c,avgPrefillSpeed:g,avgGenerationSpeed:m,responseCount:e.length,llmCallCount:d.length,dataPoints:l,callDataPoints:d}}function gC(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 i=new Map;for(const c of r){const u=pC(fh(c.stats)),f=i.get(u)??[];i.set(u,[...f,c])}const s=Array.from(i.entries()).map(([c,u])=>{const f=fh(u[0].stats),l=Yx(u);return{...f,key:c,label:mC(f),...l}});return{...Yx(r),modelGroups:s}}function xC(e){return H.useMemo(()=>gC(e),[e])}function vC(e){const[r,i]=H.useState(null),[s,c]=H.useState(!0),[u,f]=H.useState(null),l=e||"";return H.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&&(i(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:s,error:u}}function Vl(e){return e.toLocaleString("en-US").replace(/,/g," ")}function Xx(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function bC(e){if(e<60)return`${e.toFixed(1)}s`;const r=Math.floor(e/60),i=Math.round(e%60);return`${r}m${i}s`}const yC="modulepreload",_C=function(e){return"/"+e},Zx={},SC=function(r,i,s){let c=Promise.resolve();if(i&&i.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(i.map(p=>{if(p=_C(p),p in Zx)return;Zx[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":yC,g||(b.as="script"),b.crossOrigin="",b.href=p,d&&b.setAttribute("nonce",d),document.head.appendChild(b),g)return new Promise((_,k)=>{b.addEventListener("load",_),b.addEventListener("error",()=>k(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)})},Qx=["▁","▂","▃","▄","▅","▆","▇","█"];function wC(e,r,i){if(i===r)return 4;const s=(e-r)/(i-r);return Math.min(7,Math.max(0,Math.round(s*7)))}function CC(e,r){if(e===r){const c=Math.max(Math.abs(e)*.05,1);return{minY:e-c,maxY:r+c}}const i=r-e,s=Math.max(i*.1,.1);return{minY:e-s,maxY:r+s}}function kC(e,r){if(e.length===0||r<=0)return{blocks:"",minX:0,maxX:0,minY:0,maxY:0};const i=[...e].sort((m,b)=>m.x-b.x),s=i[0].x,c=i[i.length-1].x,u=Math.min(...i.map(m=>m.y)),f=Math.max(...i.map(m=>m.y)),{minY:l,maxY:d}=CC(u,f),p=Array.from({length:r},()=>" "),g=new Map;for(const m of i){const b=c===s?0:Math.round((m.x-s)/(c-s)*(r-1)),_=g.get(b)??[];g.set(b,[..._,m.y])}for(const[m,b]of g){const _=Math.max(...b);p[m]=Qx[wC(_,l,d)]??Qx[0]}return{blocks:p.join(""),minX:s,maxX:c,minY:l,maxY:d}}function Jx(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function ev({data:e,width:r=60,height:i=78,label:s,xLabel:c,yLabel:u,showAxes:f=!0,formatY:l=Jx,formatX:d=Jx}){const p=H.useMemo(()=>{const g=kC(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?i/2:_+(g.maxY-S.y)/(g.maxY-g.minY)*(i-_*2);return{...S,cx:j,cy:T,leftPercent:j/m*100,topPercent:T/i*100}}),y=C.map((S,j)=>`${j===0?"M":"L"} ${S.cx.toFixed(1)} ${S.cy.toFixed(1)}`).join(" "),v=[g.maxY,(g.maxY+g.minY)/2,g.minY].map(S=>({value:S,y:g.maxY===g.minY?i/2:_+(g.maxY-S)/(g.maxY-g.minY)*(i-_*2)}));return{...g,chartWidth:m,points:C,path:y,gridLines:v}},[e,i,r]);return e.length===0?o.jsxs("div",{className:"font-mono text-text-muted text-xs",children:[s&&o.jsx("div",{className:"mb-1",children:s}),o.jsx("div",{children:"No data"})]}):o.jsxs("div",{className:"font-mono text-xs",children:[s&&o.jsx("div",{className:"text-text-secondary mb-2",children:s}),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} ${i}`,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:i-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 EC({data:e,prefillLabel:r="Prefill Speed (tok/s) by Response",generationLabel:i="Generation Speed (tok/s) by Response",xLabel:s="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(ev,{data:u,width:c,label:r,xLabel:s}),o.jsx(ev,{data:f,width:c,label:i,xLabel:s})]})}function jC(e){const r=new Map;for(const i of e.callDataPoints){const s=r.get(i.messageId)??[];r.set(i.messageId,[...s,i])}return e.dataPoints.map(i=>{const s=[...r.get(i.messageId)??[]].sort((c,u)=>c.callIndex-u.callIndex);return{...i,callCount:s.length,calls:s,isExpandable:s.length>1}})}function NC(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 TC(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 AC(e){return e.callDataPoints.length>0?TC(e):NC(e)}function $d(e){if(e<60)return`${e.toFixed(1)}s`;const r=Math.floor(e/60),i=e%60;return`${r}m ${i.toFixed(0)}s`}function Pi(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toString()}function Xa(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function DC(e){if(e.length===0)return"0 ctx";const r=Math.min(...e),i=Math.max(...e);return r===i?`${Pi(r)} ctx`:`${Pi(r)}-${Pi(i)} ctx`}function Kl(e){return`${Xa(e)} t/s`}function ty(e){try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}catch{return e}}function LC(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 RC({isOpen:e,onClose:r,stats:i}){const s=H.useRef(null),[c,u]=H.useState({}),[f,l]=H.useState(()=>{var k;return((k=i.modelGroups[0])==null?void 0:k.key)??""});H.useEffect(()=>{var k;i.modelGroups.some(C=>C.key===f)||l(((k=i.modelGroups[0])==null?void 0:k.key)??"")},[f,i.modelGroups]);const d=H.useMemo(()=>i.modelGroups.find(k=>k.key===f)??i.modelGroups[0],[f,i.modelGroups]),p=H.useMemo(()=>d?jC(d):[],[d]),g=H.useMemo(()=>d?AC(d):{mode:"responses",xLabel:"response",prefillLabel:"",generationLabel:"",points:[]},[d]),m=H.useCallback(k=>{u(C=>({...C,[k]:!C[k]}))},[]),b=H.useCallback(()=>{if(!d)return;const k=LC(d);navigator.clipboard.writeText(JSON.stringify(k,null,2)).catch(C=>console.error("Failed to copy:",C))},[d]),_=H.useCallback(async()=>{if(s.current)try{const k=(await SC(async()=>{const{default:x}=await import("./html2canvas.esm-QH1iLAAe.js");return{default:x}},[])).default,C=await k(s.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(k){console.error("Failed to export PNG:",k),b()}},[b]);return o.jsx(At,{isOpen:e,onClose:r,title:"Session Stats",size:"lg",children:o.jsxs("div",{ref:s,className:"space-y-6",children:[o.jsx("section",{children:o.jsx("div",{className:"flex flex-wrap gap-2",children:i.modelGroups.map(k=>o.jsx("button",{onClick:()=>l(k.key),className:`px-3 py-1.5 rounded border text-xs transition-colors ${k.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:k.label,children:k.label},k.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:$d(d.aiTime)}),o.jsx(zr,{label:"Total Time",value:$d(d.totalTime)}),o.jsx(zr,{label:"Tool Time",value:$d(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:Pi(d.prefillTokens),subValue:`@ ${Xa(d.avgPrefillSpeed)} tok/s`}),o.jsx(zr,{label:"Gen Tokens",value:Pi(d.generationTokens),subValue:`@ ${Xa(d.avgGenerationSpeed)} tok/s`}),o.jsx(zr,{label:"Avg PP Speed",value:`${Xa(d.avgPrefillSpeed)}`,subValue:"tok/s"}),o.jsx(zr,{label:"Avg TG Speed",value:`${Xa(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(EC,{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((k,C)=>o.jsxs(H.Fragment,{children:[o.jsx(OC,{row:k,index:C,isExpanded:c[k.messageId]??!1,onToggle:k.isExpandable?()=>m(k.messageId):void 0}),(c[k.messageId]??!1)&&k.calls.map((y,x)=>o.jsx(MC,{dataPoint:y,index:x},`${y.messageId}-${y.callIndex}`))]},k.messageId))})]})})]})]})})}function zr({label:e,value:r,subValue:i}){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}),i&&o.jsx("div",{className:"text-text-muted text-xs",children:i})]})}function OC({row:e,index:r,isExpanded:i,onToggle:s}){const c=e.calls.length>0?DC(e.calls.map(u=>u.promptTokens)):`${Pi(e.prefillTokens)} ctx`;return o.jsxs("tr",{onClick:s,className:`${r%2===0?"bg-bg-tertiary/20":""} ${s?"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:ty(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:Kl(e.prefillSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Kl(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?i?"v":">":""})]})}function MC({dataPoint:e,index:r}){const i=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:ty(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:Pi(e.promptTokens)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Kl(e.prefillSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Kl(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"})]}),i&&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 IC={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"}},BC=H.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 i={pending:0,in_progress:0,completed:0,passed:0,failed:0};for(const c of r){const u=c.status.type;u in i&&i[u]++}const s=Object.keys(i).filter(c=>i[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:s.map(c=>{const u=IC[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:i[c]})]},c)})})]})});function zC({isOpen:e,onClose:r}){const i=pr(_=>_.config),s=pr(_=>_.saveConfig),[c,u]=H.useState(""),[f,l]=H.useState(""),[d,p]=H.useState(!1),[g,m]=H.useState(!1);H.useEffect(()=>{e&&(u((i==null?void 0:i.command)??""),l((i==null?void 0:i.url)??""),p((i==null?void 0:i.hotReload)??!1))},[e,i]);const b=async()=>{!c.trim()||!f.trim()||(m(!0),await s({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 tv={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"},HC={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"},nv={1:"font-bold",2:"opacity-75",4:"underline",7:"bg-bg-secondary"},PC="text-text-primary";function FC(e){const r=[],i=/\x1b\[([0-9;]+)m/g;let s=0,c="text-text-primary",u;try{for(;(u=i.exec(e))!==null;){if(u.index>s){const p=e.slice(s,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=tv[p];g&&d.push(g)}else if(p>=40&&p<=47){const g=HC[p];g&&d.push(g)}else if(p>=90&&p<=97){const g=tv[p];g&&d.push(g)}else if(p in nv){const g=nv[p];g&&d.push(g)}else p===39?d.push(PC):p===49&&(c=c.split(" ").filter(g=>!g.startsWith("bg-")).join(" "));d.length>0&&(c=d.join(" ")),s=i.lastIndex}if(s<e.length){const f=e.slice(s);f&&r.push({text:f,className:c})}return r}catch(f){return console.warn("ANSI parsing failed, stripping codes:",f),[{text:UC(e),className:"text-text-primary"}]}}function UC(e){return e.replace(/\x1b\[([0-9;]+)m/g,"")}function io(e){const r=FC(e),i=[];return r.forEach((s,c)=>{const u=s.text.split(`
|
|
85
|
-
`);u.forEach((f,l)=>{i.push(mn.createElement("span",{key:`${c}-${l}`,className:s.className,style:{display:"inline-block",whiteSpace:"pre-wrap"}},f)),l<u.length-1&&i.push(mn.createElement("br",{key:`${c}-${l}-br`}))})}),i.length===1?i[0]:i}const $C=H.memo(function({title:r,logs:i,onClose:s,preClassName:c}){const u=H.useRef(null);return H.useEffect(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[i]),o.jsx(At,{isOpen:!0,onClose:s,title:r,size:"full",children:o.jsx("pre",{ref:u,className:c,children:i.length===0?o.jsx("span",{className:"text-text-muted",children:"No output yet"}):i.map((f,l)=>o.jsx("span",{className:f.stream==="stderr"?"text-accent-warning":"",children:io(f.content)},l))})})}),qC=H.memo(function({logs:r,anchorRef:i,isHiding:s,onExpand:c,onClose:u}){const[f,l]=H.useState(null),d=H.useRef(null);return H.useEffect(()=>{var g;const p=(g=i.current)==null?void 0:g.getBoundingClientRect();p&&l({bottom:window.innerHeight-p.bottom,right:window.innerWidth-p.right,width:p.width,height:p.height})},[i]),H.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:s?"scale(0.01)":"scale(1)",opacity:s?0:1},children:r.map((p,g)=>o.jsx("span",{className:p.stream==="stderr"?"text-accent-warning":"",children:io(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-white hover:bg-accent-primary/50 transition-colors duration-150",style:{bottom:f.bottom+8,right:f.right+8},children:"Expand"})]}):null}),WC=H.memo(function({workdir:r}){const i=pr(B=>B.setWorkdir),s=pr(B=>B.status),c=pr(B=>B.config),u=pr(B=>B.logs),f=pr(B=>B.start),l=pr(B=>B.stop),d=pr(B=>B.fetchLogs),[p,g]=H.useState(!1),[m,b]=H.useState(!1),[_,k]=H.useState(!1),[C,y]=H.useState(!1),x=H.useRef(null),v=H.useRef(null),S=H.useRef(null),j=H.useRef(null),T=(s==null?void 0:s.state)??"off",N=c!==null,D=T==="running"||T==="warning";H.useEffect(()=>{i(r??null)},[r,i]),H.useEffect(()=>{D&&d()},[D,d]),H.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(hw,{})})]}),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(_w,{}),"Stop"]}),(s==null?void 0:s.url)&&o.jsxs("a",{href:s.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-white hover:bg-accent-primary/40 transition-colors",title:s.url,children:[o.jsx(mw,{}),"Open"]})]}):o.jsx("button",{onClick:A,className:"w-full rounded font-medium text-sm px-3 py-1.5 bg-accent-primary/25 text-white hover:bg-accent-primary/40 transition-colors",children:"Start"}),D&&o.jsxs("div",{ref:j,className:"relative",onMouseEnter:()=>{v.current&&clearTimeout(v.current),x.current=setTimeout(()=>{k(!0),y(!1)},500)},onMouseLeave:()=>{x.current&&clearTimeout(x.current),y(!0),v.current=setTimeout(()=>k(!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((B,O)=>o.jsx("span",{className:B.stream==="stderr"?"text-accent-warning":"",children:io(B.content)},O))}),(_||C)&&j.current&&fo.createPortal(o.jsx(qC,{logs:u,anchorRef:j,isHiding:C,onExpand:()=>b(!0),onClose:()=>k(!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(zC,{isOpen:p,onClose:()=>g(!1)}),m&&o.jsx($C,{title:"Dev Server Logs",logs:u,onClose:()=>b(!1)})]})});function GC({isOpen:e,onClose:r,processName:i,logs:s}){return e?o.jsx(At,{isOpen:e,onClose:r,title:i,size:"lg",children:o.jsx("pre",{className:"flex-1 overflow-auto text-sm font-mono text-text-primary whitespace-pre-wrap",children:s.map((c,u)=>o.jsx("span",{className:c.stream==="stderr"?"text-accent-error":"",children:c.content},u))})}):null}const VC=H.memo(function({sessionId:r}){var _;const i=Za(k=>k.processes),s=Za(k=>k.stopProcess),[c,u]=H.useState(null),[f,l]=H.useState([]),d=i.filter(k=>k.status!=="exited"),p=d.filter(k=>k.status==="running").length;if(i.length===0)return null;const g=k=>{switch(k){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=k=>{const C=Za.getState().logs[k]??[];l(C.map(y=>({content:y.content,stream:y.stream}))),u(k)},b=k=>{r&&s(k,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(k=>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(k.status)}`}),o.jsx("span",{className:"text-sm text-text-primary truncate",title:k.name,children:k.name}),o.jsxs("span",{className:"text-xs text-text-muted",children:["[",k.status,"]"]})]}),o.jsxs("div",{className:"flex gap-1 ml-2",children:[o.jsx("button",{onClick:()=>m(k.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(k.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"})]})]})},k.id))}),c&&o.jsx(GC,{isOpen:!!c,onClose:()=>{u(null),l([])},processName:((_=d.find(k=>k.id===c))==null?void 0:_.name)??"",logs:f})]})});function rv({summary:e,messages:r,workdir:i}){const[s,c]=H.useState(!1),u=xC(r),{branch:f}=vC(i),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:bC(u.aiTime)}),o.jsx("span",{className:"w-px h-3 bg-border"}),o.jsx("span",{className:"text-text-secondary",children:Xx(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:Xx(u.avgGenerationSpeed)}),o.jsx("span",{children:"tg"})]})}),o.jsx(RC,{isOpen:s,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(BC,{criteria:(d==null?void 0:d.criteria)??[]})]})]}),f&&o.jsxs("div",{className:"mt-4 flex items-center gap-2 text-sm",children:[o.jsx(ow,{}),o.jsx("span",{className:"truncate text-text-secondary",title:f,children:f})]}),o.jsx(WC,{workdir:i}),o.jsx(VC,{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 KC({children:e,criteriaSidebarOpen:r=!0,onCriteriaSidebarToggle:i,messages:s}){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:i}),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(rv,{summary:(c==null?void 0:c.summary)??null,messages:s,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(rv,{summary:(c==null?void 0:c.summary)??null,messages:s,workdir:c==null?void 0:c.workdir})})]})]})}function YC(e,r){return r||e>85?"bg-accent-error":e>60?"bg-accent-warning":"bg-accent-success"}function ny({percent:e,dangerZone:r=!1,size:i="md",className:s=""}){const c=i==="sm"?"w-12":"w-20",u=i==="sm"?"h-1":"h-1.5";return o.jsx("div",{className:`${u} bg-bg-tertiary rounded-full overflow-hidden ${c} ${s}`,children:o.jsx("div",{className:`h-full transition-all duration-300 ${YC(e,r)}`,style:{width:`${Math.min(e,100)}%`}})})}function XC({dangerZone:e,size:r="md"}){return e?o.jsx("span",{className:"text-accent-error animate-pulse text-[10px] font-medium",children:"Low!"}):null}function iv(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function ZC(){const e=Ce(m=>m.contextState),r=Ce(m=>m.currentSession),i=Ce(m=>m.compactContext),[s,c]=H.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:iv(p,d),children:[Vl(u)," / ",Vl(f)]}),o.jsxs("span",{className:iv(p,d),children:["(",p,"%)"]}),o.jsx(ny,{percent:p,dangerZone:d}),o.jsx(XC,{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(!s),className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"More options",children:o.jsx(Mb,{})}),s&&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||i(),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 sv(e){const r=[],i=String(e||"");let s=i.indexOf(","),c=0,u=!1;for(;!u;){s===-1&&(s=i.length,u=!0);const f=i.slice(c,s).trim();(f||!u)&&r.push(f),c=s+1,s=i.indexOf(",",c)}return r}function QC(e,r){const i={};return(e[e.length-1]===""?[...e,""]:e).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const JC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,e2=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,t2={};function av(e,r){return(t2.jsx?e2:JC).test(e)}const n2=/[ \t\n\f\r]/g;function r2(e){return typeof e=="object"?e.type==="text"?ov(e.value):!1:ov(e)}function ov(e){return e.replace(n2,"")===""}class mo{constructor(r,i,s){this.normal=i,this.property=r,s&&(this.space=s)}}mo.prototype.normal={};mo.prototype.property={};mo.prototype.space=void 0;function ry(e,r){const i={},s={};for(const c of e)Object.assign(i,c.property),Object.assign(s,c.normal);return new mo(i,s,r)}function so(e){return e.toLowerCase()}class An{constructor(r,i){this.attribute=i,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 i2=0;const Ze=$i(),Vt=$i(),ph=$i(),Se=$i(),St=$i(),Ps=$i(),Hn=$i();function $i(){return 2**++i2}const mh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ze,booleanish:Vt,commaOrSpaceSeparated:Hn,commaSeparated:Ps,number:Se,overloadedBoolean:ph,spaceSeparated:St},Symbol.toStringTag,{value:"Module"})),qd=Object.keys(mh);class Fh extends An{constructor(r,i,s,c){let u=-1;if(super(r,i),lv(this,"space",c),typeof s=="number")for(;++u<qd.length;){const f=qd[u];lv(this,qd[u],(s&mh[f])===mh[f])}}}Fh.prototype.defined=!0;function lv(e,r,i){i&&(e[r]=i)}function qs(e){const r={},i={};for(const[s,c]of Object.entries(e.properties)){const u=new Fh(s,e.transform(e.attributes||{},s),c,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(u.mustUseProperty=!0),r[s]=u,i[so(s)]=s,i[so(u.attribute)]=s}return new mo(r,i,e.space)}const iy=qs({properties:{ariaActiveDescendant:null,ariaAtomic:Vt,ariaAutoComplete:null,ariaBusy:Vt,ariaChecked:Vt,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:St,ariaCurrent:null,ariaDescribedBy:St,ariaDetails:null,ariaDisabled:Vt,ariaDropEffect:St,ariaErrorMessage:null,ariaExpanded:Vt,ariaFlowTo:St,ariaGrabbed:Vt,ariaHasPopup:null,ariaHidden:Vt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:St,ariaLevel:Se,ariaLive:null,ariaModal:Vt,ariaMultiLine:Vt,ariaMultiSelectable:Vt,ariaOrientation:null,ariaOwns:St,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:Vt,ariaReadOnly:Vt,ariaRelevant:null,ariaRequired:Vt,ariaRoleDescription:St,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:Vt,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 sy(e,r){return r in e?e[r]:r}function ay(e,r){return sy(e,r.toLowerCase())}const s2=qs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ps,acceptCharset:St,accessKey:St,action:null,allow:null,allowFullScreen:Ze,allowPaymentRequest:Ze,allowUserMedia:Ze,alt:null,as:null,async:Ze,autoCapitalize:null,autoComplete:St,autoFocus:Ze,autoPlay:Ze,blocking:St,capture:null,charSet:null,checked:Ze,cite:null,className:St,cols:Se,colSpan:null,content:null,contentEditable:Vt,controls:Ze,controlsList:St,coords:Se|Ps,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ze,defer:Ze,dir:null,dirName:null,disabled:Ze,download:ph,draggable:Vt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ze,formTarget:null,headers:St,height:Se,hidden:ph,high:Se,href:null,hrefLang:null,htmlFor:St,httpEquiv:St,id:null,imageSizes:null,imageSrcSet:null,inert:Ze,inputMode:null,integrity:null,is:null,isMap:Ze,itemId:null,itemProp:St,itemRef:St,itemScope:Ze,itemType:St,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:St,placeholder:null,playsInline:Ze,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ze,referrerPolicy:null,rel:St,required:Ze,reversed:Ze,rows:Se,rowSpan:Se,sandbox:St,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:Vt,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:Vt,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:St,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:Vt,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:ay}),a2=qs({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:St,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:Ps,g2:Ps,glyphName:Ps,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:St,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:sy}),oy=qs({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()}}),ly=qs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ay}),cy=qs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,r){return"xml:"+r.slice(3).toLowerCase()}}),o2={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"},l2=/[A-Z]/g,cv=/-[a-z]/g,c2=/^data[-\w.:]+$/i;function uy(e,r){const i=so(r);let s=r,c=An;if(i in e.normal)return e.property[e.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&c2.test(r)){if(r.charAt(4)==="-"){const u=r.slice(5).replace(cv,d2);s="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=r.slice(4);if(!cv.test(u)){let f=u.replace(l2,u2);f.charAt(0)!=="-"&&(f="-"+f),r="data"+f}}c=Fh}return new c(s,r)}function u2(e){return"-"+e.toLowerCase()}function d2(e){return e.charAt(1).toUpperCase()}const dy=ry([iy,s2,oy,ly,cy],"html"),uc=ry([iy,a2,oy,ly,cy],"svg");function uv(e){const r=String(e||"").trim();return r?r.split(/[ \t\n\r\f]+/g):[]}function h2(e){return e.join(" ").trim()}var Ls={},Wd,dv;function f2(){if(dv)return Wd;dv=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,c=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,f=/^[;\s]*/,l=/^\s+|\s+$/g,d=`
|
|
92
|
-
`,p="/",g="*",m="",b="comment",_="declaration";function k(y,x){if(typeof y!="string")throw new TypeError("First argument must be a string");if(!y)return[];x=x||{};var v=1,S=1;function j(I){var F=I.match(r);F&&(v+=F.length);var P=I.lastIndexOf(d);S=~P?I.length-P:S+I.length}function T(){var I={line:v,column:S};return function(F){return F.position=new N(I),B(),F}}function N(I){this.start=I,this.end={line:v,column:S},this.source=x.source}N.prototype.content=y;function D(I){var F=new Error(x.source+":"+v+":"+S+": "+I);if(F.reason=I,F.filename=x.source,F.line=v,F.column=S,F.source=y,!x.silent)throw F}function A(I){var F=I.exec(y);if(F){var P=F[0];return j(P),y=y.slice(P.length),F}}function B(){A(i)}function O(I){var F;for(I=I||[];F=q();)F!==!1&&I.push(F);return I}function q(){var I=T();if(!(p!=y.charAt(0)||g!=y.charAt(1))){for(var F=2;m!=y.charAt(F)&&(g!=y.charAt(F)||p!=y.charAt(F+1));)++F;if(F+=2,m===y.charAt(F-1))return D("End of comment missing");var P=y.slice(2,F-2);return S+=2,j(P),y=y.slice(F),S+=2,I({type:b,comment:P})}}function V(){var I=T(),F=A(s);if(F){if(q(),!A(c))return D("property missing ':'");var P=A(u),X=I({type:_,property:C(F[0].replace(e,m)),value:P?C(P[0].replace(e,m)):m});return A(f),X}}function W(){var I=[];O(I);for(var F;F=V();)F!==!1&&(I.push(F),O(I));return I}return B(),W()}function C(y){return y?y.replace(l,m):m}return Wd=k,Wd}var hv;function p2(){if(hv)return Ls;hv=1;var e=Ls&&Ls.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Ls,"__esModule",{value:!0}),Ls.default=i;const r=e(f2());function i(s,c){let u=null;if(!s||typeof s!="string")return u;const f=(0,r.default)(s),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 Ls}var $a={},fv;function m2(){if(fv)return $a;fv=1,Object.defineProperty($a,"__esModule",{value:!0}),$a.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,i=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,c=/^-(ms)-/,u=function(p){return!p||i.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(s,l),p.replace(r,f))};return $a.camelCase=d,$a}var qa,pv;function g2(){if(pv)return qa;pv=1;var e=qa&&qa.__importDefault||function(c){return c&&c.__esModule?c:{default:c}},r=e(p2()),i=m2();function s(c,u){var f={};return!c||typeof c!="string"||(0,r.default)(c,function(l,d){l&&d&&(f[(0,i.camelCase)(l,u)]=d)}),f}return s.default=s,qa=s,qa}var x2=g2();const v2=tc(x2),hy=fy("end"),Uh=fy("start");function fy(e){return r;function r(i){const s=i&&i.position&&i.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function b2(e){const r=Uh(e),i=hy(e);if(r&&i)return{start:r,end:i}}function Qa(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?mv(e.position):"start"in e||"end"in e?mv(e):"line"in e||"column"in e?gh(e):""}function gh(e){return gv(e&&e.line)+":"+gv(e&&e.column)}function mv(e){return gh(e&&e.start)+"-"+gh(e&&e.end)}function gv(e){return e&&typeof e=="number"?e:1}class xn extends Error{constructor(r,i,s){super(),typeof i=="string"&&(s=i,i=void 0);let c="",u={},f=!1;if(i&&("line"in i&&"column"in i?u={place:i}:"start"in i&&"end"in i?u={place:i}:"type"in i?u={ancestors:[i],place:i.position}:u={...i}),typeof r=="string"?c=r:!u.cause&&r&&(f=!0,c=r.message,u.cause=r),!u.ruleId&&!u.source&&typeof s=="string"){const d=s.indexOf(":");d===-1?u.ruleId=s:(u.source=s.slice(0,d),u.ruleId=s.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=Qa(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 $h={}.hasOwnProperty,y2=new Map,_2=/[A-Z]/g,S2=new Set(["table","tbody","thead","tfoot","tr"]),w2=new Set(["td","th"]),py="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function C2(e,r){if(!r||r.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const i=r.filePath||void 0;let s;if(r.development){if(typeof r.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=L2(i,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");s=D2(i,r.jsx,r.jsxs)}const c={Fragment:r.Fragment,ancestors:[],components:r.components||{},create:s,elementAttributeNameCase:r.elementAttributeNameCase||"react",evaluater:r.createEvaluater?r.createEvaluater():void 0,filePath:i,ignoreInvalidStyle:r.ignoreInvalidStyle||!1,passKeys:r.passKeys!==!1,passNode:r.passNode||!1,schema:r.space==="svg"?uc:dy,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},u=my(c,e,void 0);return u&&typeof u!="string"?u:c.create(e,c.Fragment,{children:u||void 0},void 0)}function my(e,r,i){if(r.type==="element")return k2(e,r,i);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return E2(e,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return N2(e,r,i);if(r.type==="mdxjsEsm")return j2(e,r);if(r.type==="root")return T2(e,r,i);if(r.type==="text")return A2(e,r)}function k2(e,r,i){const s=e.schema;let c=s;r.tagName.toLowerCase()==="svg"&&s.space==="html"&&(c=uc,e.schema=c),e.ancestors.push(r);const u=xy(e,r.tagName,!1),f=R2(e,r);let l=Wh(e,r);return S2.has(r.tagName)&&(l=l.filter(function(d){return typeof d=="string"?!r2(d):!0})),gy(e,f,u,r),qh(f,l),e.ancestors.pop(),e.schema=s,e.create(r,u,f,i)}function E2(e,r){if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}ao(e,r.position)}function j2(e,r){if(r.data&&r.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(r.data.estree);ao(e,r.position)}function N2(e,r,i){const s=e.schema;let c=s;r.name==="svg"&&s.space==="html"&&(c=uc,e.schema=c),e.ancestors.push(r);const u=r.name===null?e.Fragment:xy(e,r.name,!0),f=O2(e,r),l=Wh(e,r);return gy(e,f,u,r),qh(f,l),e.ancestors.pop(),e.schema=s,e.create(r,u,f,i)}function T2(e,r,i){const s={};return qh(s,Wh(e,r)),e.create(r,e.Fragment,s,i)}function A2(e,r){return r.value}function gy(e,r,i,s){typeof i!="string"&&i!==e.Fragment&&e.passNode&&(r.node=s)}function qh(e,r){if(r.length>0){const i=r.length>1?r:r[0];i&&(e.children=i)}}function D2(e,r,i){return s;function s(c,u,f,l){const p=Array.isArray(f.children)?i:r;return l?p(u,f,l):p(u,f)}}function L2(e,r){return i;function i(s,c,u,f){const l=Array.isArray(u.children),d=Uh(s);return r(c,u,f,l,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function R2(e,r){const i={};let s,c;for(c in r.properties)if(c!=="children"&&$h.call(r.properties,c)){const u=M2(e,c,r.properties[c]);if(u){const[f,l]=u;e.tableCellAlignToStyle&&f==="align"&&typeof l=="string"&&w2.has(r.tagName)?s=l:i[f]=l}}if(s){const u=i.style||(i.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return i}function O2(e,r){const i={};for(const s of r.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const u=s.data.estree.body[0];u.type;const f=u.expression;f.type;const l=f.properties[0];l.type,Object.assign(i,e.evaluater.evaluateExpression(l.argument))}else ao(e,r.position);else{const c=s.name;let u;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const l=s.value.data.estree.body[0];l.type,u=e.evaluater.evaluateExpression(l.expression)}else ao(e,r.position);else u=s.value===null?!0:s.value;i[c]=u}return i}function Wh(e,r){const i=[];let s=-1;const c=e.passKeys?new Map:y2;for(;++s<r.children.length;){const u=r.children[s];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=my(e,u,f);l!==void 0&&i.push(l)}return i}function M2(e,r,i){const s=uy(e.schema,r);if(!(i==null||typeof i=="number"&&Number.isNaN(i))){if(Array.isArray(i)&&(i=s.commaSeparated?QC(i):h2(i)),s.property==="style"){let c=typeof i=="object"?i:I2(e,String(i));return e.stylePropertyNameCase==="css"&&(c=B2(c)),["style",c]}return[e.elementAttributeNameCase==="react"&&s.space?o2[s.property]||s.property:s.attribute,i]}}function I2(e,r){try{return v2(r,{reactCompat:!0})}catch(i){if(e.ignoreInvalidStyle)return{};const s=i,c=new xn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=e.filePath||void 0,c.url=py+"#cannot-parse-style-attribute",c}}function xy(e,r,i){let s;if(!i)s={type:"Literal",value:r};else if(r.includes(".")){const c=r.split(".");let u=-1,f;for(;++u<c.length;){const l=av(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}s=f}else s=av(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(s.type==="Literal"){const c=s.value;return $h.call(e.components,c)?e.components[c]:c}if(e.evaluater)return e.evaluater.evaluateExpression(s);ao(e)}function ao(e,r){const i=new xn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:r,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=py+"#cannot-handle-mdx-estrees-without-createevaluater",i}function B2(e){const r={};let i;for(i in e)$h.call(e,i)&&(r[z2(i)]=e[i]);return r}function z2(e){let r=e.replace(_2,H2);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function H2(e){return"-"+e.toLowerCase()}const Gd={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"]},P2={};function Gh(e,r){const i=P2,s=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,c=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return vy(e,s,c)}function vy(e,r,i){if(F2(e)){if("value"in e)return e.type==="html"&&!i?"":e.value;if(r&&"alt"in e&&e.alt)return e.alt;if("children"in e)return xv(e.children,r,i)}return Array.isArray(e)?xv(e,r,i):""}function xv(e,r,i){const s=[];let c=-1;for(;++c<e.length;)s[c]=vy(e[c],r,i);return s.join("")}function F2(e){return!!(e&&typeof e=="object")}const vv=document.createElement("i");function oo(e){const r="&"+e+";";vv.innerHTML=r;const i=vv.textContent;return i.charCodeAt(i.length-1)===59&&e!=="semi"||i===r?!1:i}function Fn(e,r,i,s){const c=e.length;let u=0,f;if(r<0?r=-r>c?0:c+r:r=r>c?c:r,i=i>0?i:0,s.length<1e4)f=Array.from(s),f.unshift(r,i),e.splice(...f);else for(i&&e.splice(r,i);u<s.length;)f=s.slice(u,u+1e4),f.unshift(r,0),e.splice(...f),u+=1e4,r+=1e4}function Jn(e,r){return e.length>0?(Fn(e,e.length,0,r),e):r}const bv={}.hasOwnProperty;function by(e){const r={};let i=-1;for(;++i<e.length;)U2(r,e[i]);return r}function U2(e,r){let i;for(i in r){const c=(bv.call(e,i)?e[i]:void 0)||(e[i]={}),u=r[i];let f;if(u)for(f in u){bv.call(c,f)||(c[f]=[]);const l=u[f];$2(c[f],Array.isArray(l)?l:l?[l]:[])}}}function $2(e,r){let i=-1;const s=[];for(;++i<r.length;)(r[i].add==="after"?e:s).push(r[i]);Fn(e,0,0,s)}function yy(e,r){const i=Number.parseInt(e,r);return i<9||i===11||i>13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||(i&65535)===65535||(i&65535)===65534||i>1114111?"�":String.fromCodePoint(i)}function ar(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const bn=gi(/[A-Za-z]/),gn=gi(/[\dA-Za-z]/),q2=gi(/[#-'*+\--9=?A-Z^-~]/);function Yl(e){return e!==null&&(e<32||e===127)}const xh=gi(/\d/),W2=gi(/[\dA-Fa-f]/),G2=gi(/[!-/:-@[-`{-~]/);function He(e){return e!==null&&e<-2}function yt(e){return e!==null&&(e<0||e===32)}function tt(e){return e===-2||e===-1||e===32}const dc=gi(new RegExp("\\p{P}|\\p{S}","u")),Ui=gi(/\s/);function gi(e){return r;function r(i){return i!==null&&i>-1&&e.test(String.fromCharCode(i))}}function Ws(e){const r=[];let i=-1,s=0,c=0;for(;++i<e.length;){const u=e.charCodeAt(i);let f="";if(u===37&&gn(e.charCodeAt(i+1))&&gn(e.charCodeAt(i+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(i+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(s,i),encodeURIComponent(f)),s=i+c+1,f=""),c&&(i+=c,c=0)}return r.join("")+e.slice(s)}function at(e,r,i,s){const c=s?s-1:Number.POSITIVE_INFINITY;let u=0;return f;function f(d){return tt(d)?(e.enter(i),l(d)):r(d)}function l(d){return tt(d)&&u++<c?(e.consume(d),l):(e.exit(i),r(d))}}const V2={tokenize:K2};function K2(e){const r=e.attempt(this.parser.constructs.contentInitial,s,c);let i;return r;function s(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:i});return i&&(i.next=d),i=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 Y2={tokenize:X2},yv={tokenize:Z2};function X2(e){const r=this,i=[];let s=0,c,u,f;return l;function l(S){if(s<i.length){const j=i[s];return r.containerState=j[1],e.attempt(j[0].continuation,d,p)(S)}return p(S)}function d(S){if(s++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,c&&v();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}x(s);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(s===i.length){if(!c)return b(S);if(c.currentConstruct&&c.currentConstruct.concrete)return k(S);r.interrupt=!!(c.currentConstruct&&!c._gfmTableDynamicInterruptHack)}return r.containerState={},e.check(yv,g,m)(S)}function g(S){return c&&v(),x(s),b(S)}function m(S){return r.parser.lazy[r.now().line]=s!==i.length,f=r.now().offset,k(S)}function b(S){return r.containerState={},e.attempt(yv,_,k)(S)}function _(S){return s++,i.push([r.currentConstruct,r.containerState]),b(S)}function k(S){if(S===null){c&&v(),x(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),x(0),e.consume(S);return}return He(S)?(e.consume(S),y(e.exit("chunkFlow")),s=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,B,O;for(;A--;)if(r.events[A][0]==="exit"&&r.events[A][1].type==="chunkFlow"){if(B){O=r.events[A][1].end;break}B=!0}for(x(s),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 x(S){let j=i.length;for(;j-- >S;){const T=i[j];r.containerState=T[1],T[0].exit.call(r,e)}i.length=S}function v(){c.write([null]),u=void 0,c=void 0,r.containerState._closeFlow=void 0}}function Z2(e,r,i){return at(e,e.attempt(this.parser.constructs.document,r,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Us(e){if(e===null||yt(e)||Ui(e))return 1;if(dc(e))return 2}function hc(e,r,i){const s=[];let c=-1;for(;++c<e.length;){const u=e[c].resolveAll;u&&!s.includes(u)&&(r=u(r,i),s.push(u))}return r}const vh={name:"attention",resolveAll:Q2,tokenize:J2};function Q2(e,r){let i=-1,s,c,u,f,l,d,p,g;for(;++i<e.length;)if(e[i][0]==="enter"&&e[i][1].type==="attentionSequence"&&e[i][1]._close){for(s=i;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&r.sliceSerialize(e[s][1]).charCodeAt(0)===r.sliceSerialize(e[i][1]).charCodeAt(0)){if((e[s][1]._close||e[i][1]._open)&&(e[i][1].end.offset-e[i][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[i][1].end.offset-e[i][1].start.offset)%3))continue;d=e[s][1].end.offset-e[s][1].start.offset>1&&e[i][1].end.offset-e[i][1].start.offset>1?2:1;const m={...e[s][1].end},b={...e[i][1].start};_v(m,-d),_v(b,d),f={type:d>1?"strongSequence":"emphasisSequence",start:m,end:{...e[s][1].end}},l={type:d>1?"strongSequence":"emphasisSequence",start:{...e[i][1].start},end:b},u={type:d>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[i][1].start}},c={type:d>1?"strong":"emphasis",start:{...f.start},end:{...l.end}},e[s][1].end={...f.start},e[i][1].start={...l.end},p=[],e[s][1].end.offset-e[s][1].start.offset&&(p=Jn(p,[["enter",e[s][1],r],["exit",e[s][1],r]])),p=Jn(p,[["enter",c,r],["enter",f,r],["exit",f,r],["enter",u,r]]),p=Jn(p,hc(r.parser.constructs.insideSpan.null,e.slice(s+1,i),r)),p=Jn(p,[["exit",u,r],["enter",l,r],["exit",l,r],["exit",c,r]]),e[i][1].end.offset-e[i][1].start.offset?(g=2,p=Jn(p,[["enter",e[i][1],r],["exit",e[i][1],r]])):g=0,Fn(e,s-1,i-s+3,p),i=s+p.length-g-2;break}}for(i=-1;++i<e.length;)e[i][1].type==="attentionSequence"&&(e[i][1].type="data");return e}function J2(e,r){const i=this.parser.constructs.attentionMarkers.null,s=this.previous,c=Us(s);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=Us(d),m=!g||g===2&&c||i.includes(d),b=!c||c===2&&g||i.includes(s);return p._open=!!(u===42?m:m&&(c||!b)),p._close=!!(u===42?b:b&&(g||!m)),r(d)}}function _v(e,r){e.column+=r,e.offset+=r,e._bufferIndex+=r}const ek={name:"autolink",tokenize:tk};function tk(e,r,i){let s=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?i(_):p(_)}function f(_){return _===43||_===45||_===46||gn(_)?(s=1,l(_)):p(_)}function l(_){return _===58?(e.consume(_),s=0,d):(_===43||_===45||_===46||gn(_))&&s++<32?(e.consume(_),l):(s=0,p(_))}function d(_){return _===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.exit("autolink"),r):_===null||_===32||_===60||Yl(_)?i(_):(e.consume(_),d)}function p(_){return _===64?(e.consume(_),g):q2(_)?(e.consume(_),p):i(_)}function g(_){return gn(_)?m(_):i(_)}function m(_){return _===46?(e.consume(_),s=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(_))&&s++<63){const k=_===45?b:m;return e.consume(_),k}return i(_)}}const go={partial:!0,tokenize:nk};function nk(e,r,i){return s;function s(u){return tt(u)?at(e,c,"linePrefix")(u):c(u)}function c(u){return u===null||He(u)?r(u):i(u)}}const _y={continuation:{tokenize:ik},exit:sk,name:"blockQuote",tokenize:rk};function rk(e,r,i){const s=this;return c;function c(f){if(f===62){const l=s.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 i(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 ik(e,r,i){const s=this;return c;function c(f){return tt(f)?at(e,u,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f):u(f)}function u(f){return e.attempt(_y,r,i)(f)}}function sk(e){e.exit("blockQuote")}const Sy={name:"characterEscape",tokenize:ak};function ak(e,r,i){return s;function s(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),c}function c(u){return G2(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),r):i(u)}}const wy={name:"characterReference",tokenize:ok};function ok(e,r,i){const s=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=W2,g):(e.enter("characterReferenceValue"),u=7,f=xh,g(m))}function g(m){if(m===59&&c){const b=e.exit("characterReferenceValue");return f===gn&&!oo(s.sliceSerialize(b))?i(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),r)}return f(m)&&c++<u?(e.consume(m),g):i(m)}}const Sv={partial:!0,tokenize:ck},wv={concrete:!0,name:"codeFenced",tokenize:lk};function lk(e,r,i){const s=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=s.events[s.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?i(N):(e.exit("codeFencedFenceSequence"),tt(N)?at(e,m,"whitespace")(N):m(N))}function m(N){return N===null||He(N)?(e.exit("codeFencedFence"),s.interrupt?r(N):e.check(Sv,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?i(N):(e.consume(N),b)}function _(N){return N===null||He(N)?m(N):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(N))}function k(N){return N===null||He(N)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(N)):N===96&&N===l?i(N):(e.consume(N),k)}function C(N){return e.attempt(c,j,y)(N)}function y(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),x}function x(N){return u>0&&tt(N)?at(e,v,"linePrefix",u+1)(N):v(N)}function v(N){return N===null||He(N)?e.check(Sv,C,j)(N):(e.enter("codeFlowValue"),S(N))}function S(N){return N===null||He(N)?(e.exit("codeFlowValue"),v(N)):(e.consume(N),S)}function j(N){return e.exit("codeFenced"),r(N)}function T(N,D,A){let B=0;return O;function O(F){return N.enter("lineEnding"),N.consume(F),N.exit("lineEnding"),q}function q(F){return N.enter("codeFencedFence"),tt(F)?at(N,V,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):V(F)}function V(F){return F===l?(N.enter("codeFencedFenceSequence"),W(F)):A(F)}function W(F){return F===l?(B++,N.consume(F),W):B>=f?(N.exit("codeFencedFenceSequence"),tt(F)?at(N,I,"whitespace")(F):I(F)):A(F)}function I(F){return F===null||He(F)?(N.exit("codeFencedFence"),D(F)):A(F)}}}function ck(e,r,i){const s=this;return c;function c(f){return f===null?i(f):(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),u)}function u(f){return s.parser.lazy[s.now().line]?i(f):r(f)}}const Vd={name:"codeIndented",tokenize:dk},uk={partial:!0,tokenize:hk};function dk(e,r,i){const s=this;return c;function c(p){return e.enter("codeIndented"),at(e,u,"linePrefix",5)(p)}function u(p){const g=s.events[s.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?f(p):i(p)}function f(p){return p===null?d(p):He(p)?e.attempt(uk,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 hk(e,r,i){const s=this;return c;function c(f){return s.parser.lazy[s.now().line]?i(f):He(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):at(e,u,"linePrefix",5)(f)}function u(f){const l=s.events[s.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?r(f):He(f)?c(f):i(f)}}const fk={name:"codeText",previous:mk,resolve:pk,tokenize:gk};function pk(e){let r=e.length-4,i=3,s,c;if((e[i][1].type==="lineEnding"||e[i][1].type==="space")&&(e[r][1].type==="lineEnding"||e[r][1].type==="space")){for(s=i;++s<r;)if(e[s][1].type==="codeTextData"){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}}for(s=i-1,r++;++s<=r;)c===void 0?s!==r&&e[s][1].type!=="lineEnding"&&(c=s):(s===r||e[s][1].type==="lineEnding")&&(e[c][1].type="codeTextData",s!==c+2&&(e[c][1].end=e[s-1][1].end,e.splice(c+2,s-c-2),r-=s-c-2,s=c+2),c=void 0);return e}function mk(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function gk(e,r,i){let s=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),s++,l):(e.exit("codeTextSequence"),d(m))}function d(m){return m===null?i(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===s?(e.exit("codeTextSequence"),e.exit("codeText"),r(m)):(u.type="codeTextData",p(m))}}class xk{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,i){const s=i??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(r,s):r>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-r+this.left.length).reverse():this.left.slice(r).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(r,i,s){const c=i||0;this.setCursor(Math.trunc(r));const u=this.right.splice(this.right.length-c,Number.POSITIVE_INFINITY);return s&&Wa(this.left,s),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),Wa(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),Wa(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 i=this.left.splice(r,Number.POSITIVE_INFINITY);Wa(this.right,i.reverse())}else{const i=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);Wa(this.left,i.reverse())}}}function Wa(e,r){let i=0;if(r.length<1e4)e.push(...r);else for(;i<r.length;)e.push(...r.slice(i,i+1e4)),i+=1e4}function Cy(e){const r={};let i=-1,s,c,u,f,l,d,p;const g=new xk(e);for(;++i<g.length;){for(;i in r;)i=r[i];if(s=g.get(i),i&&s[1].type==="chunkFlow"&&g.get(i-1)[1].type==="listItemPrefix"&&(d=s[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(s[0]==="enter")s[1].contentType&&(Object.assign(r,vk(g,i)),i=r[i],p=!0);else if(s[1]._container){for(u=i,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&&(s[1].end={...g.get(c)[1].start},l=g.slice(c,i),l.unshift(s),g.splice(c,i-c+1,l))}}return Fn(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!p}function vk(e,r){const i=e.get(r)[1],s=e.get(r)[2];let c=r-1;const u=[];let f=i._tokenizer;f||(f=s.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(f._contentTypeTextTrailing=!0));const l=f.events,d=[],p={};let g,m,b=-1,_=i,k=0,C=0;const y=[C];for(;_;){for(;e.get(++c)[1]!==_;);u.push(c),_._tokenizer||(g=s.sliceStream(_),_.next||g.push(null),m&&f.defineSkip(_.start),_._isInFirstContentOfListItem&&(f._gfmTasklistFirstContentOfListItem=!0),f.write(g),_._isInFirstContentOfListItem&&(f._gfmTasklistFirstContentOfListItem=void 0)),m=_,_=_.next}for(_=i;++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 x=l.slice(y[b],y[b+1]),v=u.pop();d.push([v,v+x.length-1]),e.splice(v,2,x)}for(d.reverse(),b=-1;++b<d.length;)p[k+d[b][0]]=k+d[b][1],k+=d[b][1]-d[b][0]-1;return p}const bk={resolve:_k,tokenize:Sk},yk={partial:!0,tokenize:wk};function _k(e){return Cy(e),e}function Sk(e,r){let i;return s;function s(l){return e.enter("content"),i=e.enter("chunkContent",{contentType:"content"}),c(l)}function c(l){return l===null?u(l):He(l)?e.check(yk,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"),i.next=e.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,c}}function wk(e,r,i){const s=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 i(f);const l=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?r(f):e.interrupt(s.parser.constructs.flow,i,r)(f)}}function ky(e,r,i,s,c,u,f,l,d){const p=d||Number.POSITIVE_INFINITY;let g=0;return m;function m(x){return x===60?(e.enter(s),e.enter(c),e.enter(u),e.consume(x),e.exit(u),b):x===null||x===32||x===41||Yl(x)?i(x):(e.enter(s),e.enter(f),e.enter(l),e.enter("chunkString",{contentType:"string"}),C(x))}function b(x){return x===62?(e.enter(u),e.consume(x),e.exit(u),e.exit(c),e.exit(s),r):(e.enter(l),e.enter("chunkString",{contentType:"string"}),_(x))}function _(x){return x===62?(e.exit("chunkString"),e.exit(l),b(x)):x===null||x===60||He(x)?i(x):(e.consume(x),x===92?k:_)}function k(x){return x===60||x===62||x===92?(e.consume(x),_):_(x)}function C(x){return!g&&(x===null||x===41||yt(x))?(e.exit("chunkString"),e.exit(l),e.exit(f),e.exit(s),r(x)):g<p&&x===40?(e.consume(x),g++,C):x===41?(e.consume(x),g--,C):x===null||x===32||x===40||Yl(x)?i(x):(e.consume(x),x===92?y:C)}function y(x){return x===40||x===41||x===92?(e.consume(x),C):C(x)}}function Ey(e,r,i,s,c,u){const f=this;let l=0,d;return p;function p(_){return e.enter(s),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?i(_):_===93?(e.exit(u),e.enter(c),e.consume(_),e.exit(c),e.exit(s),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 jy(e,r,i,s,c,u){let f;return l;function l(b){return b===34||b===39||b===40?(e.enter(s),e.enter(c),e.consume(b),e.exit(c),f=b===40?41:b,d):i(b)}function d(b){return b===f?(e.enter(c),e.consume(b),e.exit(c),e.exit(s),r):(e.enter(u),p(b))}function p(b){return b===f?(e.exit(u),d(f)):b===null?i(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 Ja(e,r){let i;return s;function s(c){return He(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),i=!0,s):tt(c)?at(e,s,i?"linePrefix":"lineSuffix")(c):r(c)}}const Ck={name:"definition",tokenize:Ek},kk={partial:!0,tokenize:jk};function Ek(e,r,i){const s=this;let c;return u;function u(_){return e.enter("definition"),f(_)}function f(_){return Ey.call(s,e,l,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(_)}function l(_){return c=ar(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),_===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),d):i(_)}function d(_){return yt(_)?Ja(e,p)(_):p(_)}function p(_){return ky(e,g,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(_)}function g(_){return e.attempt(kk,m,m)(_)}function m(_){return tt(_)?at(e,b,"whitespace")(_):b(_)}function b(_){return _===null||He(_)?(e.exit("definition"),s.parser.defined.push(c),r(_)):i(_)}}function jk(e,r,i){return s;function s(l){return yt(l)?Ja(e,c)(l):i(l)}function c(l){return jy(e,u,i,"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):i(l)}}const Nk={name:"hardBreakEscape",tokenize:Tk};function Tk(e,r,i){return s;function s(u){return e.enter("hardBreakEscape"),e.consume(u),c}function c(u){return He(u)?(e.exit("hardBreakEscape"),r(u)):i(u)}}const Ak={name:"headingAtx",resolve:Dk,tokenize:Lk};function Dk(e,r){let i=e.length-2,s=3,c,u;return e[s][1].type==="whitespace"&&(s+=2),i-2>s&&e[i][1].type==="whitespace"&&(i-=2),e[i][1].type==="atxHeadingSequence"&&(s===i-1||i-4>s&&e[i-2][1].type==="whitespace")&&(i-=s+1===i?2:4),i>s&&(c={type:"atxHeadingText",start:e[s][1].start,end:e[i][1].end},u={type:"chunkText",start:e[s][1].start,end:e[i][1].end,contentType:"text"},Fn(e,s,i-s+1,[["enter",c,r],["enter",u,r],["exit",u,r],["exit",c,r]])),e}function Lk(e,r,i){let s=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&&s++<6?(e.consume(g),f):g===null||yt(g)?(e.exit("atxHeadingSequence"),l(g)):i(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||yt(g)?(e.exit("atxHeadingText"),l(g)):(e.consume(g),p)}}const Rk=["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"],Cv=["pre","script","style","textarea"],Ok={concrete:!0,name:"htmlFlow",resolveTo:Bk,tokenize:zk},Mk={partial:!0,tokenize:Pk},Ik={partial:!0,tokenize:Hk};function Bk(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 zk(e,r,i){const s=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,s.interrupt?r:R):bn(U)?(e.consume(U),f=String.fromCharCode(U),y):i(U)}function b(U){return U===45?(e.consume(U),c=2,_):U===91?(e.consume(U),c=5,l=0,k):bn(U)?(e.consume(U),c=4,s.interrupt?r:R):i(U)}function _(U){return U===45?(e.consume(U),s.interrupt?r:R):i(U)}function k(U){const ne="CDATA[";return U===ne.charCodeAt(l++)?(e.consume(U),l===ne.length?s.interrupt?r:V:k):i(U)}function C(U){return bn(U)?(e.consume(U),f=String.fromCharCode(U),y):i(U)}function y(U){if(U===null||U===47||U===62||yt(U)){const ne=U===47,Q=f.toLowerCase();return!ne&&!u&&Cv.includes(Q)?(c=1,s.interrupt?r(U):V(U)):Rk.includes(f.toLowerCase())?(c=6,ne?(e.consume(U),x):s.interrupt?r(U):V(U)):(c=7,s.interrupt&&!s.parser.lazy[s.now().line]?i(U):u?v(U):S(U))}return U===45||gn(U)?(e.consume(U),f+=String.fromCharCode(U),y):i(U)}function x(U){return U===62?(e.consume(U),s.interrupt?r:V):i(U)}function v(U){return tt(U)?(e.consume(U),v):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?i(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,B):U===null||He(U)?i(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||yt(U)?T(U):(e.consume(U),A)}function B(U){return U===47||U===62||tt(U)?S(U):i(U)}function O(U){return U===62?(e.consume(U),q):i(U)}function q(U){return U===null||He(U)?V(U):tt(U)?(e.consume(U),q):i(U)}function V(U){return U===45&&c===2?(e.consume(U),P):U===60&&c===1?(e.consume(U),X):U===62&&c===4?(e.consume(U),L):U===63&&c===3?(e.consume(U),R):U===93&&c===5?(e.consume(U),z):He(U)&&(c===6||c===7)?(e.exit("htmlFlowData"),e.check(Mk,$,W)(U)):U===null||He(U)?(e.exit("htmlFlowData"),W(U)):(e.consume(U),V)}function W(U){return e.check(Ik,I,$)(U)}function I(U){return e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),F}function F(U){return U===null||He(U)?W(U):(e.enter("htmlFlowData"),V(U))}function P(U){return U===45?(e.consume(U),R):V(U)}function X(U){return U===47?(e.consume(U),f="",Z):V(U)}function Z(U){if(U===62){const ne=f.toLowerCase();return Cv.includes(ne)?(e.consume(U),L):V(U)}return bn(U)&&f.length<8?(e.consume(U),f+=String.fromCharCode(U),Z):V(U)}function z(U){return U===93?(e.consume(U),R):V(U)}function R(U){return U===62?(e.consume(U),L):U===45&&c===2?(e.consume(U),R):V(U)}function L(U){return U===null||He(U)?(e.exit("htmlFlowData"),$(U)):(e.consume(U),L)}function $(U){return e.exit("htmlFlow"),r(U)}}function Hk(e,r,i){const s=this;return c;function c(f){return He(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),u):i(f)}function u(f){return s.parser.lazy[s.now().line]?i(f):r(f)}}function Pk(e,r,i){return s;function s(c){return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),e.attempt(go,r,i)}}const Fk={name:"htmlText",tokenize:Uk};function Uk(e,r,i){const s=this;let c,u,f;return l;function l(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),d}function d(R){return R===33?(e.consume(R),p):R===47?(e.consume(R),T):R===63?(e.consume(R),S):bn(R)?(e.consume(R),A):i(R)}function p(R){return R===45?(e.consume(R),g):R===91?(e.consume(R),u=0,k):bn(R)?(e.consume(R),v):i(R)}function g(R){return R===45?(e.consume(R),_):i(R)}function m(R){return R===null?i(R):R===45?(e.consume(R),b):He(R)?(f=m,X(R)):(e.consume(R),m)}function b(R){return R===45?(e.consume(R),_):m(R)}function _(R){return R===62?P(R):R===45?b(R):m(R)}function k(R){const L="CDATA[";return R===L.charCodeAt(u++)?(e.consume(R),u===L.length?C:k):i(R)}function C(R){return R===null?i(R):R===93?(e.consume(R),y):He(R)?(f=C,X(R)):(e.consume(R),C)}function y(R){return R===93?(e.consume(R),x):C(R)}function x(R){return R===62?P(R):R===93?(e.consume(R),x):C(R)}function v(R){return R===null||R===62?P(R):He(R)?(f=v,X(R)):(e.consume(R),v)}function S(R){return R===null?i(R):R===63?(e.consume(R),j):He(R)?(f=S,X(R)):(e.consume(R),S)}function j(R){return R===62?P(R):S(R)}function T(R){return bn(R)?(e.consume(R),N):i(R)}function N(R){return R===45||gn(R)?(e.consume(R),N):D(R)}function D(R){return He(R)?(f=D,X(R)):tt(R)?(e.consume(R),D):P(R)}function A(R){return R===45||gn(R)?(e.consume(R),A):R===47||R===62||yt(R)?B(R):i(R)}function B(R){return R===47?(e.consume(R),P):R===58||R===95||bn(R)?(e.consume(R),O):He(R)?(f=B,X(R)):tt(R)?(e.consume(R),B):P(R)}function O(R){return R===45||R===46||R===58||R===95||gn(R)?(e.consume(R),O):q(R)}function q(R){return R===61?(e.consume(R),V):He(R)?(f=q,X(R)):tt(R)?(e.consume(R),q):B(R)}function V(R){return R===null||R===60||R===61||R===62||R===96?i(R):R===34||R===39?(e.consume(R),c=R,W):He(R)?(f=V,X(R)):tt(R)?(e.consume(R),V):(e.consume(R),I)}function W(R){return R===c?(e.consume(R),c=void 0,F):R===null?i(R):He(R)?(f=W,X(R)):(e.consume(R),W)}function I(R){return R===null||R===34||R===39||R===60||R===61||R===96?i(R):R===47||R===62||yt(R)?B(R):(e.consume(R),I)}function F(R){return R===47||R===62||yt(R)?B(R):i(R)}function P(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),r):i(R)}function X(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),Z}function Z(R){return tt(R)?at(e,z,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):z(R)}function z(R){return e.enter("htmlTextData"),f(R)}}const Vh={name:"labelEnd",resolveAll:Gk,resolveTo:Vk,tokenize:Kk},$k={tokenize:Yk},qk={tokenize:Xk},Wk={tokenize:Zk};function Gk(e){let r=-1;const i=[];for(;++r<e.length;){const s=e[r][1];if(i.push(e[r]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const c=s.type==="labelImage"?4:2;s.type="data",r+=c}}return e.length!==i.length&&Fn(e,0,e.length,i),e}function Vk(e,r){let i=e.length,s=0,c,u,f,l;for(;i--;)if(c=e[i][1],u){if(c.type==="link"||c.type==="labelLink"&&c._inactive)break;e[i][0]==="enter"&&c.type==="labelLink"&&(c._inactive=!0)}else if(f){if(e[i][0]==="enter"&&(c.type==="labelImage"||c.type==="labelLink")&&!c._balanced&&(u=i,c.type!=="labelLink")){s=2;break}}else c.type==="labelEnd"&&(f=i);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+s+2][1].end},end:{...e[f-2][1].start}};return l=[["enter",d,r],["enter",p,r]],l=Jn(l,e.slice(u+1,u+s+3)),l=Jn(l,[["enter",g,r]]),l=Jn(l,hc(r.parser.constructs.insideSpan.null,e.slice(u+s+4,f-3),r)),l=Jn(l,[["exit",g,r],e[f-2],e[f-1],["exit",p,r]]),l=Jn(l,e.slice(f+1)),l=Jn(l,[["exit",d,r]]),Fn(e,u,e.length,l),e}function Kk(e,r,i){const s=this;let c=s.events.length,u,f;for(;c--;)if((s.events[c][1].type==="labelImage"||s.events[c][1].type==="labelLink")&&!s.events[c][1]._balanced){u=s.events[c][1];break}return l;function l(b){return u?u._inactive?m(b):(f=s.parser.defined.includes(ar(s.sliceSerialize({start:u.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),d):i(b)}function d(b){return b===40?e.attempt($k,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(Wk,g,m)(b)}function g(b){return r(b)}function m(b){return u._balanced=!0,i(b)}}function Yk(e,r,i){return s;function s(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),c}function c(m){return yt(m)?Ja(e,u)(m):u(m)}function u(m){return m===41?g(m):ky(e,f,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function f(m){return yt(m)?Ja(e,d)(m):g(m)}function l(m){return i(m)}function d(m){return m===34||m===39||m===40?jy(e,p,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):g(m)}function p(m){return yt(m)?Ja(e,g)(m):g(m)}function g(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),r):i(m)}}function Xk(e,r,i){const s=this;return c;function c(l){return Ey.call(s,e,u,f,"reference","referenceMarker","referenceString")(l)}function u(l){return s.parser.defined.includes(ar(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?r(l):i(l)}function f(l){return i(l)}}function Zk(e,r,i){return s;function s(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):i(u)}}const Qk={name:"labelStartImage",resolveAll:Vh.resolveAll,tokenize:Jk};function Jk(e,r,i){const s=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):i(l)}function f(l){return l===94&&"_hiddenFootnoteSupport"in s.parser.constructs?i(l):r(l)}}const eE={name:"labelStartLink",resolveAll:Vh.resolveAll,tokenize:tE};function tE(e,r,i){const s=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 s.parser.constructs?i(f):r(f)}}const Kd={name:"lineEnding",tokenize:nE};function nE(e,r){return i;function i(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),at(e,r,"linePrefix")}}const Ul={name:"thematicBreak",tokenize:rE};function rE(e,r,i){let s=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)):s>=3&&(p===null||He(p))?(e.exit("thematicBreak"),r(p)):i(p)}function d(p){return p===c?(e.consume(p),s++,d):(e.exit("thematicBreakSequence"),tt(p)?at(e,l,"whitespace")(p):l(p))}}const Tn={continuation:{tokenize:oE},exit:cE,name:"list",tokenize:aE},iE={partial:!0,tokenize:uE},sE={partial:!0,tokenize:lE};function aE(e,r,i){const s=this,c=s.events[s.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 k=s.containerState.type||(_===42||_===43||_===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!s.containerState.marker||_===s.containerState.marker:xh(_)){if(s.containerState.type||(s.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),_===42||_===45?e.check(Ul,i,p)(_):p(_);if(!s.interrupt||_===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(_)}return i(_)}function d(_){return xh(_)&&++f<10?(e.consume(_),d):(!s.interrupt||f<2)&&(s.containerState.marker?_===s.containerState.marker:_===41||_===46)?(e.exit("listItemValue"),p(_)):i(_)}function p(_){return e.enter("listItemMarker"),e.consume(_),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||_,e.check(go,s.interrupt?i:g,e.attempt(iE,b,m))}function g(_){return s.containerState.initialBlankLine=!0,u++,b(_)}function m(_){return tt(_)?(e.enter("listItemPrefixWhitespace"),e.consume(_),e.exit("listItemPrefixWhitespace"),b):i(_)}function b(_){return s.containerState.size=u+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,r(_)}}function oE(e,r,i){const s=this;return s.containerState._closeFlow=void 0,e.check(go,c,u);function c(l){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,at(e,r,"listItemIndent",s.containerState.size+1)(l)}function u(l){return s.containerState.furtherBlankLines||!tt(l)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,f(l)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(sE,r,f)(l))}function f(l){return s.containerState._closeFlow=!0,s.interrupt=void 0,at(e,e.attempt(Tn,r,i),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function lE(e,r,i){const s=this;return at(e,c,"listItemIndent",s.containerState.size+1);function c(u){const f=s.events[s.events.length-1];return f&&f[1].type==="listItemIndent"&&f[2].sliceSerialize(f[1],!0).length===s.containerState.size?r(u):i(u)}}function cE(e){e.exit(this.containerState.type)}function uE(e,r,i){const s=this;return at(e,c,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function c(u){const f=s.events[s.events.length-1];return!tt(u)&&f&&f[1].type==="listItemPrefixWhitespace"?r(u):i(u)}}const kv={name:"setextUnderline",resolveTo:dE,tokenize:hE};function dE(e,r){let i=e.length,s,c,u;for(;i--;)if(e[i][0]==="enter"){if(e[i][1].type==="content"){s=i;break}e[i][1].type==="paragraph"&&(c=i)}else e[i][1].type==="content"&&e.splice(i,1),!u&&e[i][1].type==="definition"&&(u=i);const f={type:"setextHeading",start:{...e[s][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[s][1],r]),e[s][1].end={...e[u][1].end}):e[s][1]=f,e.push(["exit",f,r]),e}function hE(e,r,i){const s=this;let c;return u;function u(p){let g=s.events.length,m;for(;g--;)if(s.events[g][1].type!=="lineEnding"&&s.events[g][1].type!=="linePrefix"&&s.events[g][1].type!=="content"){m=s.events[g][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||m)?(e.enter("setextHeadingLine"),c=p,f(p)):i(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)):i(p)}}const fE={tokenize:pE};function pE(e){const r=this,i=e.attempt(go,s,e.attempt(this.parser.constructs.flowInitial,c,at(e,e.attempt(this.parser.constructs.flow,c,e.attempt(bk,c)),"linePrefix")));return i;function s(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),r.currentConstruct=void 0,i}function c(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),r.currentConstruct=void 0,i}}const mE={resolveAll:Ty()},gE=Ny("string"),xE=Ny("text");function Ny(e){return{resolveAll:Ty(e==="text"?vE:void 0),tokenize:r};function r(i){const s=this,c=this.parser.constructs[e],u=i.attempt(c,f,l);return f;function f(g){return p(g)?u(g):l(g)}function l(g){if(g===null){i.consume(g);return}return i.enter("data"),i.consume(g),d}function d(g){return p(g)?(i.exit("data"),u(g)):(i.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(s,s.previous))return!0}return!1}}}function Ty(e){return r;function r(i,s){let c=-1,u;for(;++c<=i.length;)u===void 0?i[c]&&i[c][1].type==="data"&&(u=c,c++):(!i[c]||i[c][1].type!=="data")&&(c!==u+2&&(i[u][1].end=i[c-1][1].end,i.splice(u+2,c-u-2),c=u+2),u=void 0);return e?e(i,s):i}}function vE(e,r){let i=0;for(;++i<=e.length;)if((i===e.length||e[i][1].type==="lineEnding")&&e[i-1][1].type==="data"){const s=e[i-1][1],c=r.sliceStream(s);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&&i===e.length&&(l=0),l){const p={type:i===e.length||d||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?f:s.start._bufferIndex+f,_index:s.start._index+u,line:s.end.line,column:s.end.column-l,offset:s.end.offset-l},end:{...s.end}};s.end={...p.start},s.start.offset===s.end.offset?Object.assign(s,p):(e.splice(i,0,["enter",p,r],["exit",p,r]),i+=2)}i++}return e}const bE={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:_y},yE={91:Ck},_E={[-2]:Vd,[-1]:Vd,32:Vd},SE={35:Ak,42:Ul,45:[kv,Ul],60:Ok,61:kv,95:Ul,96:wv,126:wv},wE={38:wy,92:Sy},CE={[-5]:Kd,[-4]:Kd,[-3]:Kd,33:Qk,38:wy,42:vh,60:[ek,Fk],91:eE,92:[Nk,Sy],93:Vh,95:vh,96:fk},kE={null:[vh,mE]},EE={null:[42,95]},jE={null:[]},NE=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:EE,contentInitial:yE,disable:jE,document:bE,flow:SE,flowInitial:_E,insideSpan:kE,string:wE,text:CE},Symbol.toStringTag,{value:"Module"}));function TE(e,r,i){let s={_bufferIndex:-1,_index:0,line:i&&i.line||1,column:i&&i.column||1,offset:i&&i.offset||0};const c={},u=[];let f=[],l=[];const d={attempt:D(T),check:D(N),consume:v,enter:S,exit:j,interrupt:D(N,{interrupt:!0})},p={code:null,containerState:{},defineSkip:C,events:[],now:k,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=Jn(f,q),y(),f[f.length-1]!==null?[]:(A(r,0),p.events=hc(u,p.events,p),p.events)}function b(q,V){return DE(_(q),V)}function _(q){return AE(f,q)}function k(){const{_bufferIndex:q,_index:V,line:W,column:I,offset:F}=s;return{_bufferIndex:q,_index:V,line:W,column:I,offset:F}}function C(q){c[q.line]=q.column,O()}function y(){let q;for(;s._index<f.length;){const V=f[s._index];if(typeof V=="string")for(q=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===q&&s._bufferIndex<V.length;)x(V.charCodeAt(s._bufferIndex));else x(V)}}function x(q){g=g(q)}function v(q){He(q)?(s.line++,s.column=1,s.offset+=q===-3?2:1,O()):q!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===f[s._index].length&&(s._bufferIndex=-1,s._index++)),p.previous=q}function S(q,V){const W=V||{};return W.type=q,W.start=k(),p.events.push(["enter",W,p]),l.push(W),W}function j(q){const V=l.pop();return V.end=k(),p.events.push(["exit",V,p]),V}function T(q,V){A(q,V.from)}function N(q,V){V.restore()}function D(q,V){return W;function W(I,F,P){let X,Z,z,R;return Array.isArray(I)?$(I):"tokenize"in I?$([I]):L(I);function L(ee){return Y;function Y(G){const oe=G!==null&&ee[G],re=G!==null&&ee.null,ve=[...Array.isArray(oe)?oe:oe?[oe]:[],...Array.isArray(re)?re:re?[re]:[]];return $(ve)(G)}}function $(ee){return X=ee,Z=0,ee.length===0?P:U(ee[Z])}function U(ee){return Y;function Y(G){return R=B(),z=ee,ee.partial||(p.currentConstruct=ee),ee.name&&p.parser.constructs.disable.null.includes(ee.name)?Q():ee.tokenize.call(V?Object.assign(Object.create(p),V):p,d,ne,Q)(G)}}function ne(ee){return q(z,R),F}function Q(ee){return R.restore(),++Z<X.length?U(X[Z]):P}}}function A(q,V){q.resolveAll&&!u.includes(q)&&u.push(q),q.resolve&&Fn(p.events,V,p.events.length-V,q.resolve(p.events.slice(V),p)),q.resolveTo&&(p.events=q.resolveTo(p.events,p))}function B(){const q=k(),V=p.previous,W=p.currentConstruct,I=p.events.length,F=Array.from(l);return{from:I,restore:P};function P(){s=q,p.previous=V,p.currentConstruct=W,p.events.length=I,l=F,O()}}function O(){s.line in c&&s.column<2&&(s.column=c[s.line],s.offset+=c[s.line]-1)}}function AE(e,r){const i=r.start._index,s=r.start._bufferIndex,c=r.end._index,u=r.end._bufferIndex;let f;if(i===c)f=[e[i].slice(s,u)];else{if(f=e.slice(i,c),s>-1){const l=f[0];typeof l=="string"?f[0]=l.slice(s):f.shift()}u>0&&f.push(e[c].slice(0,u))}return f}function DE(e,r){let i=-1;const s=[];let c;for(;++i<e.length;){const u=e[i];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,s.push(f)}return s.join("")}function LE(e){const s={constructs:by([NE,...(e||{}).extensions||[]]),content:c(V2),defined:[],document:c(Y2),flow:c(fE),lazy:{},string:c(gE),text:c(xE)};return s;function c(u){return f;function f(l){return TE(s,u,l)}}}function RE(e){for(;!Cy(e););return e}const Ev=/[\0\t\n\r]/g;function OE(){let e=1,r="",i=!0,s;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="",i&&(u.charCodeAt(0)===65279&&m++,i=void 0);m<u.length;){if(Ev.lastIndex=m,p=Ev.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&&s)d.push(-3),s=void 0;else switch(s&&(d.push(-5),s=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:s=!0,e=1}m=b+1}return l&&(s&&d.push(-5),r&&d.push(r),d.push(null)),d}}const ME=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function IE(e){return e.replace(ME,BE)}function BE(e,r,i){if(r)return r;if(i.charCodeAt(0)===35){const c=i.charCodeAt(1),u=c===120||c===88;return yy(i.slice(u?2:1),u?16:10)}return oo(i)||e}const Ay={}.hasOwnProperty;function zE(e,r,i){return r&&typeof r=="object"&&(i=r,r=void 0),HE(i)(RE(LE(i).document().write(OE()(e,r,!0))))}function HE(e){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(je),autolinkProtocol:B,autolinkEmail:B,atxHeading:u(ze),blockQuote:u(re),characterEscape:B,characterReference:B,codeFenced:u(ve),codeFencedFenceInfo:f,codeFencedFenceMeta:f,codeIndented:u(ve,f),codeText:u(be,f),codeTextData:B,data:B,codeFlowValue:B,definition:u(Le),definitionDestinationString:f,definitionLabelString:f,definitionTitleString:f,emphasis:u(Oe),hardBreakEscape:u(We),hardBreakTrailing:u(We),htmlFlow:u(Ee,f),htmlFlowData:B,htmlText:u(Ee,f),htmlTextData:B,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:G,blockQuote:d(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:Q,characterReferenceMarkerNumeric:Q,characterReferenceValue:ee,characterReference:Y,codeFenced:d(y),codeFencedFence:C,codeFencedFenceInfo:_,codeFencedFenceMeta:k,codeFlowValue:O,codeIndented:d(x),codeText:d(F),codeTextData:O,data:O,definition:d(),definitionDestinationString:j,definitionLabelString:v,definitionTitleString:S,emphasis:d(),hardBreakEscape:d(V),hardBreakTrailing:d(V),htmlFlow:d(W),htmlFlowData:O,htmlText:d(I),htmlTextData:O,image:d(X),label:z,labelText:Z,lineEnding:q,link:d(P),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:ne,resourceDestinationString:R,resourceTitleString:L,resource:$,setextHeading:d(A),setextHeadingLineSequence:D,setextHeadingText:N,strong:d(),thematicBreak:d()}};Dy(r,(e||{}).mdastExtensions||[]);const i={};return s;function s(ue){let _e={type:"root",children:[]};const Te={stack:[_e],tokenStack:[],config:r,enter:l,exit:p,buffer:f,resume:g,data:i},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 _t=Ie.pop();$e=c(ue,_t,$e)}for($e=-1;++$e<ue.length;){const _t=r[ue[$e][0]];Ay.call(_t,ue[$e][1].type)&&_t[ue[$e][1].type].call(Object.assign({sliceSerialize:ue[$e][2].sliceSerialize},Te),ue[$e][1])}if(Te.tokenStack.length>0){const _t=Te.tokenStack[Te.tokenStack.length-1];(_t[1]||jv).call(Te,void 0,_t[0])}for(_e.position={start:hi(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:hi(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,_t=!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&<[0]==="enter"&<[1].type==="listItemPrefix"||$e===-1&<[0]==="exit"&&(lt[1].type==="listUnordered"||lt[1].type==="listOrdered")){if(Ye){let Un=Ie;for(Dt=void 0;Un--;){const sn=ue[Un];if(sn[1].type==="lineEnding"||sn[1].type==="lineEndingBlank"){if(sn[0]==="exit")continue;Dt&&(ue[Dt][1].type="lineEndingBlank",_t=!0),sn[1].type="lineEnding",Dt=Un}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 Un={type:"listItem",_spread:!1,start:Object.assign({},lt[1].start),end:void 0};Ye=Un,ue.splice(Ie,0,["enter",Un,lt[2]]),Ie++,Te++,mt=void 0,Kt=!0}}}return ue[_e][1]._spread=_t,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:hi(_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]||jv).call(this,ue,Ie[0]));else throw new Error("Cannot close `"+ue.type+"` ("+Qa({start:ue.start,end:ue.end})+"): it’s not open");Te.position.end=hi(ue.end)}function g(){return Gh(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 k(){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 x(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue.replace(/(\r?\n|\r)$/g,"")}function v(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 B(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:hi(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=hi(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=hi(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(_e.type)&&(B.call(this,ue),O.call(this,ue))}function V(){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 F(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue}function P(){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=IE(_e),Te.identifier=ar(_e).toLowerCase()}function z(){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 R(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.url=ue}function L(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.title=ue}function $(){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=yy(_e,Te==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ie=oo(_e);const $e=this.stack[this.stack.length-1];$e.value+=Ie}function Y(ue){const _e=this.stack.pop();_e.position.end=hi(ue.end)}function G(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 hi(e){return{line:e.line,column:e.column,offset:e.offset}}function Dy(e,r){let i=-1;for(;++i<r.length;){const s=r[i];Array.isArray(s)?Dy(e,s):PE(e,s)}}function PE(e,r){let i;for(i in r)if(Ay.call(r,i))switch(i){case"canContainEols":{const s=r[i];s&&e[i].push(...s);break}case"transforms":{const s=r[i];s&&e[i].push(...s);break}case"enter":case"exit":{const s=r[i];s&&Object.assign(e[i],s);break}}}function jv(e,r){throw e?new Error("Cannot close `"+e.type+"` ("+Qa({start:e.start,end:e.end})+"): a different token (`"+r.type+"`, "+Qa({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+Qa({start:r.start,end:r.end})+") is still open")}function FE(e){const r=this;r.parser=i;function i(s){return zE(s,{...r.data("settings"),...e,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function UE(e,r){const i={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(r),!0)};return e.patch(r,i),e.applyData(r,i)}function $E(e,r){const i={type:"element",tagName:"br",properties:{},children:[]};return e.patch(r,i),[e.applyData(r,i),{type:"text",value:`
|
|
95
|
-
`}]}function qE(e,r){const i=r.value?r.value+`
|
|
96
|
-
`:"",s={},c=r.lang?r.lang.split(/\s+/):[];c.length>0&&(s.className=["language-"+c[0]]);let u={type:"element",tagName:"code",properties:s,children:[{type:"text",value:i}]};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 WE(e,r){const i={type:"element",tagName:"del",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function GE(e,r){const i={type:"element",tagName:"em",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function VE(e,r){const i=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(r.identifier).toUpperCase(),c=Ws(s.toLowerCase()),u=e.footnoteOrder.indexOf(s);let f,l=e.footnoteCounts.get(s);l===void 0?(l=0,e.footnoteOrder.push(s),f=e.footnoteOrder.length):f=u+1,l+=1,e.footnoteCounts.set(s,l);const d={type:"element",tagName:"a",properties:{href:"#"+i+"fn-"+c,id:i+"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 KE(e,r){const i={type:"element",tagName:"h"+r.depth,properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function YE(e,r){if(e.options.allowDangerousHtml){const i={type:"raw",value:r.value};return e.patch(r,i),e.applyData(r,i)}}function Ly(e,r){const i=r.referenceType;let s="]";if(i==="collapsed"?s+="[]":i==="full"&&(s+="["+(r.label||r.identifier)+"]"),r.type==="imageReference")return[{type:"text",value:"!["+r.alt+s}];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+=s:c.push({type:"text",value:s}),c}function XE(e,r){const i=String(r.identifier).toUpperCase(),s=e.definitionById.get(i);if(!s)return Ly(e,r);const c={src:Ws(s.url||""),alt:r.alt};s.title!==null&&s.title!==void 0&&(c.title=s.title);const u={type:"element",tagName:"img",properties:c,children:[]};return e.patch(r,u),e.applyData(r,u)}function ZE(e,r){const i={src:Ws(r.url)};r.alt!==null&&r.alt!==void 0&&(i.alt=r.alt),r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(r,s),e.applyData(r,s)}function QE(e,r){const i={type:"text",value:r.value.replace(/\r?\n|\r/g," ")};e.patch(r,i);const s={type:"element",tagName:"code",properties:{},children:[i]};return e.patch(r,s),e.applyData(r,s)}function JE(e,r){const i=String(r.identifier).toUpperCase(),s=e.definitionById.get(i);if(!s)return Ly(e,r);const c={href:Ws(s.url||"")};s.title!==null&&s.title!==void 0&&(c.title=s.title);const u={type:"element",tagName:"a",properties:c,children:e.all(r)};return e.patch(r,u),e.applyData(r,u)}function ej(e,r){const i={href:Ws(r.url)};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function tj(e,r,i){const s=e.all(r),c=i?nj(i):Ry(r),u={},f=[];if(typeof r.checked=="boolean"){const g=s[0];let m;g&&g.type==="element"&&g.tagName==="p"?m=g:(m={type:"element",tagName:"p",properties:{},children:[]},s.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<s.length;){const g=s[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=s[s.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 nj(e){let r=!1;if(e.type==="list"){r=e.spread||!1;const i=e.children;let s=-1;for(;!r&&++s<i.length;)r=Ry(i[s])}return r}function Ry(e){const r=e.spread;return r??e.children.length>1}function rj(e,r){const i={},s=e.all(r);let c=-1;for(typeof r.start=="number"&&r.start!==1&&(i.start=r.start);++c<s.length;){const f=s[c];if(f.type==="element"&&f.tagName==="li"&&f.properties&&Array.isArray(f.properties.className)&&f.properties.className.includes("task-list-item")){i.className=["contains-task-list"];break}}const u={type:"element",tagName:r.ordered?"ol":"ul",properties:i,children:e.wrap(s,!0)};return e.patch(r,u),e.applyData(r,u)}function ij(e,r){const i={type:"element",tagName:"p",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function sj(e,r){const i={type:"root",children:e.wrap(e.all(r))};return e.patch(r,i),e.applyData(r,i)}function aj(e,r){const i={type:"element",tagName:"strong",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function oj(e,r){const i=e.all(r),s=i.shift(),c=[];if(s){const f={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(r.children[0],f),c.push(f)}if(i.length>0){const f={type:"element",tagName:"tbody",properties:{},children:e.wrap(i,!0)},l=Uh(r.children[1]),d=hy(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 lj(e,r,i){const s=i?i.children:void 0,u=(s?s.indexOf(r):1)===0?"th":"td",f=i&&i.type==="table"?i.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 k={type:"element",tagName:u,properties:b,children:[]};m&&(k.children=e.all(m),e.patch(m,k),k=e.applyData(m,k)),p.push(k)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(p,!0)};return e.patch(r,g),e.applyData(r,g)}function cj(e,r){const i={type:"element",tagName:"td",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}const Nv=9,Tv=32;function uj(e){const r=String(e),i=/\r?\n|\r/g;let s=i.exec(r),c=0;const u=[];for(;s;)u.push(Av(r.slice(c,s.index),c>0,!0),s[0]),c=s.index+s[0].length,s=i.exec(r);return u.push(Av(r.slice(c),c>0,!1)),u.join("")}function Av(e,r,i){let s=0,c=e.length;if(r){let u=e.codePointAt(s);for(;u===Nv||u===Tv;)s++,u=e.codePointAt(s)}if(i){let u=e.codePointAt(c-1);for(;u===Nv||u===Tv;)c--,u=e.codePointAt(c-1)}return c>s?e.slice(s,c):""}function dj(e,r){const i={type:"text",value:uj(String(r.value))};return e.patch(r,i),e.applyData(r,i)}function hj(e,r){const i={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(r,i),e.applyData(r,i)}const fj={blockquote:UE,break:$E,code:qE,delete:WE,emphasis:GE,footnoteReference:VE,heading:KE,html:YE,imageReference:XE,image:ZE,inlineCode:QE,linkReference:JE,link:ej,listItem:tj,list:rj,paragraph:ij,root:sj,strong:aj,table:oj,tableCell:cj,tableRow:lj,text:dj,thematicBreak:hj,toml:Ol,yaml:Ol,definition:Ol,footnoteDefinition:Ol};function Ol(){}const Oy=-1,fc=0,eo=1,Xl=2,Kh=3,Yh=4,Xh=5,Zh=6,My=7,Iy=8,Dv=typeof self=="object"?self:globalThis,pj=(e,r)=>{const i=(c,u)=>(e.set(u,c),c),s=c=>{if(e.has(c))return e.get(c);const[u,f]=r[c];switch(u){case fc:case Oy:return i(f,c);case eo:{const l=i([],c);for(const d of f)l.push(s(d));return l}case Xl:{const l=i({},c);for(const[d,p]of f)l[s(d)]=s(p);return l}case Kh:return i(new Date(f),c);case Yh:{const{source:l,flags:d}=f;return i(new RegExp(l,d),c)}case Xh:{const l=i(new Map,c);for(const[d,p]of f)l.set(s(d),s(p));return l}case Zh:{const l=i(new Set,c);for(const d of f)l.add(s(d));return l}case My:{const{name:l,message:d}=f;return i(new Dv[l](d),c)}case Iy:return i(BigInt(f),c);case"BigInt":return i(Object(BigInt(f)),c);case"ArrayBuffer":return i(new Uint8Array(f).buffer,f);case"DataView":{const{buffer:l}=new Uint8Array(f);return i(new DataView(l),f)}}return i(new Dv[u](f),c)};return s},Lv=e=>pj(new Map,e)(0),Rs="",{toString:mj}={},{keys:gj}=Object,Ga=e=>{const r=typeof e;if(r!=="object"||!e)return[fc,r];const i=mj.call(e).slice(8,-1);switch(i){case"Array":return[eo,Rs];case"Object":return[Xl,Rs];case"Date":return[Kh,Rs];case"RegExp":return[Yh,Rs];case"Map":return[Xh,Rs];case"Set":return[Zh,Rs];case"DataView":return[eo,i]}return i.includes("Array")?[eo,i]:i.includes("Error")?[My,i]:[Xl,i]},Ml=([e,r])=>e===fc&&(r==="function"||r==="symbol"),xj=(e,r,i,s)=>{const c=(f,l)=>{const d=s.push(f)-1;return i.set(l,d),d},u=f=>{if(i.has(f))return i.get(f);let[l,d]=Ga(f);switch(l){case fc:{let g=f;switch(d){case"bigint":l=Iy,g=f.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);g=null;break;case"undefined":return c([Oy],f)}return c([l,g],f)}case eo:{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 Xl:{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 gj(f))(e||!Ml(Ga(f[b])))&&g.push([u(b),u(f[b])]);return m}case Kh:return c([l,f.toISOString()],f);case Yh:{const{source:g,flags:m}=f;return c([l,{source:g,flags:m}],f)}case Xh:{const g=[],m=c([l,g],f);for(const[b,_]of f)(e||!(Ml(Ga(b))||Ml(Ga(_))))&&g.push([u(b),u(_)]);return m}case Zh:{const g=[],m=c([l,g],f);for(const b of f)(e||!Ml(Ga(b)))&&g.push(u(b));return m}}const{message:p}=f;return c([l,{name:d,message:p}],f)};return u},Rv=(e,{json:r,lossy:i}={})=>{const s=[];return xj(!(r||i),!!r,new Map,s)(e),s},Zl=typeof structuredClone=="function"?(e,r)=>r&&("json"in r||"lossy"in r)?Lv(Rv(e,r)):structuredClone(e):(e,r)=>Lv(Rv(e,r));function vj(e,r){const i=[{type:"text",value:"↩"}];return r>1&&i.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(r)}]}),i}function bj(e,r){return"Back to reference "+(e+1)+(r>1?"-"+r:"")}function yj(e){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=e.options.footnoteBackContent||vj,s=e.options.footnoteBackLabel||bj,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=Ws(m.toLowerCase());let _=0;const k=[],C=e.footnoteCounts.get(m);for(;C!==void 0&&++_<=C;){k.length>0&&k.push({type:"text",value:" "});let v=typeof i=="string"?i:i(d,_);typeof v=="string"&&(v={type:"text",value:v}),k.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+b+(_>1?"-"+_:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(d,_),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const y=g[g.length-1];if(y&&y.type==="element"&&y.tagName==="p"){const v=y.children[y.children.length-1];v&&v.type==="text"?v.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...k)}else g.push(...k);const x={type:"element",tagName:"li",properties:{id:r+"fn-"+b},children:e.wrap(g,!0)};e.patch(p,x),l.push(x)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Zl(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 pc=(function(e){if(e==null)return Cj;if(typeof e=="function")return mc(e);if(typeof e=="object")return Array.isArray(e)?_j(e):Sj(e);if(typeof e=="string")return wj(e);throw new Error("Expected function, string, or object as test")});function _j(e){const r=[];let i=-1;for(;++i<e.length;)r[i]=pc(e[i]);return mc(s);function s(...c){let u=-1;for(;++u<r.length;)if(r[u].apply(this,c))return!0;return!1}}function Sj(e){const r=e;return mc(i);function i(s){const c=s;let u;for(u in e)if(c[u]!==r[u])return!1;return!0}}function wj(e){return mc(r);function r(i){return i&&i.type===e}}function mc(e){return r;function r(i,s,c){return!!(kj(i)&&e.call(this,i,typeof s=="number"?s:void 0,c||void 0))}}function Cj(){return!0}function kj(e){return e!==null&&typeof e=="object"&&"type"in e}const By=[],Ej=!0,bh=!1,jj="skip";function zy(e,r,i,s){let c;typeof r=="function"&&typeof i!="function"?(s=i,i=r):c=r;const u=pc(c),f=s?-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 _=By,k,C,y;if((!r||u(d,p,g[g.length-1]||void 0))&&(_=Nj(i(d,g)),_[0]===bh))return _;if("children"in d&&d.children){const x=d;if(x.children&&_[0]!==jj)for(C=(s?x.children.length:-1)+f,y=g.concat(x);C>-1&&C<x.children.length;){const v=x.children[C];if(k=l(v,C,y)(),k[0]===bh)return k;C=typeof k[1]=="number"?k[1]:C+f}}return _}}}function Nj(e){return Array.isArray(e)?e:typeof e=="number"?[Ej,e]:e==null?By:[e]}function Qh(e,r,i,s){let c,u,f;typeof r=="function"&&typeof i!="function"?(u=void 0,f=r,c=i):(u=r,f=i,c=s),zy(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 yh={}.hasOwnProperty,Tj={};function Aj(e,r){const i=r||Tj,s=new Map,c=new Map,u=new Map,f={...fj,...i.handlers},l={all:p,applyData:Lj,definitionById:s,footnoteById:c,footnoteCounts:u,footnoteOrder:[],handlers:f,one:d,options:i,patch:Dj,wrap:Oj};return Qh(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const m=g.type==="definition"?s: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(yh.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,x=Zl(y);return x.children=l.all(g),x}return Zl(g)}return(l.options.unknownHandler||Rj)(l,g,m)}function p(g){const m=[];if("children"in g){const b=g.children;let _=-1;for(;++_<b.length;){const k=l.one(b[_],g);if(k){if(_&&b[_-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=Ov(k.value)),!Array.isArray(k)&&k.type==="element")){const C=k.children[0];C&&C.type==="text"&&(C.value=Ov(C.value))}Array.isArray(k)?m.push(...k):m.push(k)}}}return m}}function Dj(e,r){e.position&&(r.position=b2(e))}function Lj(e,r){let i=r;if(e&&e.data){const s=e.data.hName,c=e.data.hChildren,u=e.data.hProperties;if(typeof s=="string")if(i.type==="element")i.tagName=s;else{const f="children"in i?i.children:[i];i={type:"element",tagName:s,properties:{},children:f}}i.type==="element"&&u&&Object.assign(i.properties,Zl(u)),"children"in i&&i.children&&c!==null&&c!==void 0&&(i.children=c)}return i}function Rj(e,r){const i=r.data||{},s="value"in r&&!(yh.call(i,"hProperties")||yh.call(i,"hChildren"))?{type:"text",value:r.value}:{type:"element",tagName:"div",properties:{},children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function Oj(e,r){const i=[];let s=-1;for(r&&i.push({type:"text",value:`
|
|
101
|
-
`});++s<e.length;)s&&i.push({type:"text",value:`
|
|
102
|
-
`}),i.push(e[s]);return r&&e.length>0&&i.push({type:"text",value:`
|
|
103
|
-
`}),i}function Ov(e){let r=0,i=e.charCodeAt(r);for(;i===9||i===32;)r++,i=e.charCodeAt(r);return e.slice(r)}function Mv(e,r){const i=Aj(e,r),s=i.one(e,void 0),c=yj(i),u=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return c&&u.children.push({type:"text",value:`
|
|
104
|
-
`},c),u}function Mj(e,r){return e&&"run"in e?async function(i,s){const c=Mv(i,{file:s,...r});await e.run(c,s)}:function(i,s){return Mv(i,{file:s,...e||r})}}function Iv(e){if(e)throw e}var Yd,Bv;function Ij(){if(Bv)return Yd;Bv=1;var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,s=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){i&&g.name==="__proto__"?i(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(s)return s(p,g).value}else return;return p[g]};return Yd=function d(){var p,g,m,b,_,k,C=arguments[0],y=1,x=arguments.length,v=!1;for(typeof C=="boolean"&&(v=C,C=arguments[1]||{},y=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});y<x;++y)if(p=arguments[y],p!=null)for(g in p)m=l(C,g),b=l(p,g),C!==b&&(v&&b&&(u(b)||(_=c(b)))?(_?(_=!1,k=m&&c(m)?m:[]):k=m&&u(m)?m:{},f(C,{name:g,newValue:d(v,k,b)})):typeof b<"u"&&f(C,{name:g,newValue:b}));return C},Yd}var Bj=Ij();const Xd=tc(Bj);function _h(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 zj(){const e=[],r={run:i,use:s};return r;function i(...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?Hj(g,l)(...p):f(null,...p)}}function s(c){if(typeof c!="function")throw new TypeError("Expected `middelware` to be a function, not "+c);return e.push(c),r}}function Hj(e,r){let i;return s;function s(...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&&i)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){i||(i=!0,r(f,...l))}function u(f){c(null,f)}}const fr={basename:Pj,dirname:Fj,extname:Uj,join:$j,sep:"/"};function Pj(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');xo(e);let i=0,s=-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){i=c+1;break}}else s<0&&(u=!0,s=c+1);return s<0?"":e.slice(i,s)}if(r===e)return"";let f=-1,l=r.length-1;for(;c--;)if(e.codePointAt(c)===47){if(u){i=c+1;break}}else f<0&&(u=!0,f=c+1),l>-1&&(e.codePointAt(c)===r.codePointAt(l--)?l<0&&(s=c):(l=-1,s=f));return i===s?s=f:s<0&&(s=e.length),e.slice(i,s)}function Fj(e){if(xo(e),e.length===0)return".";let r=-1,i=e.length,s;for(;--i;)if(e.codePointAt(i)===47){if(s){r=i;break}}else s||(s=!0);return r<0?e.codePointAt(0)===47?"/":".":r===1&&e.codePointAt(0)===47?"//":e.slice(0,r)}function Uj(e){xo(e);let r=e.length,i=-1,s=0,c=-1,u=0,f;for(;r--;){const l=e.codePointAt(r);if(l===47){if(f){s=r+1;break}continue}i<0&&(f=!0,i=r+1),l===46?c<0?c=r:u!==1&&(u=1):c>-1&&(u=-1)}return c<0||i<0||u===0||u===1&&c===i-1&&c===s+1?"":e.slice(c,i)}function $j(...e){let r=-1,i;for(;++r<e.length;)xo(e[r]),e[r]&&(i=i===void 0?e[r]:i+"/"+e[r]);return i===void 0?".":qj(i)}function qj(e){xo(e);const r=e.codePointAt(0)===47;let i=Wj(e,!r);return i.length===0&&!r&&(i="."),i.length>0&&e.codePointAt(e.length-1)===47&&(i+="/"),r?"/"+i:i}function Wj(e,r){let i="",s=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(i.length<2||s!==2||i.codePointAt(i.length-1)!==46||i.codePointAt(i.length-2)!==46){if(i.length>2){if(d=i.lastIndexOf("/"),d!==i.length-1){d<0?(i="",s=0):(i=i.slice(0,d),s=i.length-1-i.lastIndexOf("/")),c=f,u=0;continue}}else if(i.length>0){i="",s=0,c=f,u=0;continue}}r&&(i=i.length>0?i+"/..":"..",s=2)}else i.length>0?i+="/"+e.slice(c+1,f):i=e.slice(c+1,f),s=f-c-1;c=f,u=0}else l===46&&u>-1?u++:u=-1}return i}function xo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Gj={cwd:Vj};function Vj(){return"/"}function Sh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Kj(e){if(typeof e=="string")e=new URL(e);else if(!Sh(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 Yj(e)}function Yj(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const r=e.pathname;let i=-1;for(;++i<r.length;)if(r.codePointAt(i)===37&&r.codePointAt(i+1)===50){const s=r.codePointAt(i+2);if(s===70||s===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 Zd=["history","path","basename","stem","extname","dirname"];class Hy{constructor(r){let i;r?Sh(r)?i={path:r}:typeof r=="string"||Xj(r)?i={value:r}:i=r:i={},this.cwd="cwd"in i?"":Gj.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Zd.length;){const u=Zd[s];u in i&&i[u]!==void 0&&i[u]!==null&&(this[u]=u==="history"?[...i[u]]:i[u])}let c;for(c in i)Zd.includes(c)||(this[c]=i[c])}get basename(){return typeof this.path=="string"?fr.basename(this.path):void 0}set basename(r){Jd(r,"basename"),Qd(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){zv(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(Qd(r,"extname"),zv(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){Sh(r)&&(r=Kj(r)),Jd(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){Jd(r,"stem"),Qd(r,"stem"),this.path=fr.join(this.dirname||"",r+(this.extname||""))}fail(r,i,s){const c=this.message(r,i,s);throw c.fatal=!0,c}info(r,i,s){const c=this.message(r,i,s);return c.fatal=void 0,c}message(r,i,s){const c=new xn(r,i,s);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 Qd(e,r){if(e&&e.includes(fr.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+fr.sep+"`")}function Jd(e,r){if(!e)throw new Error("`"+r+"` cannot be empty")}function zv(e,r){if(!e)throw new Error("Setting `"+r+"` requires `path` to be set too")}function Xj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Zj=(function(e){const s=this.constructor.prototype,c=s[e],u=function(){return c.apply(u,arguments)};return Object.setPrototypeOf(u,s),u}),Qj={}.hasOwnProperty;class Jh extends Zj{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=zj()}copy(){const r=new Jh;let i=-1;for(;++i<this.attachers.length;){const s=this.attachers[i];r.use(...s)}return r.data(Xd(!0,{},this.namespace)),r}data(r,i){return typeof r=="string"?arguments.length===2?(nh("data",this.frozen),this.namespace[r]=i,this):Qj.call(this.namespace,r)&&this.namespace[r]||void 0:r?(nh("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[i,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const c=i.call(r,...s);typeof c=="function"&&this.transformers.use(c)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(r){this.freeze();const i=Il(r),s=this.parser||this.Parser;return eh("parse",s),s(String(i),i)}process(r,i){const s=this;return this.freeze(),eh("process",this.parser||this.Parser),th("process",this.compiler||this.Compiler),i?c(void 0,i):new Promise(c);function c(u,f){const l=Il(r),d=s.parse(l);s.run(d,l,function(g,m,b){if(g||!m||!b)return p(g);const _=m,k=s.stringify(_,b);tN(k)?b.value=k:b.result=k,p(g,b)});function p(g,m){g||!m?f(g):u?u(m):i(void 0,m)}}}processSync(r){let i=!1,s;return this.freeze(),eh("processSync",this.parser||this.Parser),th("processSync",this.compiler||this.Compiler),this.process(r,c),Pv("processSync","process",i),s;function c(u,f){i=!0,Iv(u),s=f}}run(r,i,s){Hv(r),this.freeze();const c=this.transformers;return!s&&typeof i=="function"&&(s=i,i=void 0),s?u(void 0,s):new Promise(u);function u(f,l){const d=Il(i);c.run(r,d,p);function p(g,m,b){const _=m||r;g?l(g):f?f(_):s(void 0,_,b)}}}runSync(r,i){let s=!1,c;return this.run(r,i,u),Pv("runSync","run",s),c;function u(f,l){Iv(f),c=l,s=!0}}stringify(r,i){this.freeze();const s=Il(i),c=this.compiler||this.Compiler;return th("stringify",c),Hv(r),c(r,s)}use(r,...i){const s=this.attachers,c=this.namespace;if(nh("use",this.frozen),r!=null)if(typeof r=="function")d(r,i);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=Xd(!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<s.length;)if(s[m][0]===p){b=m;break}if(b===-1)s.push([p,...g]);else if(g.length>0){let[_,...k]=g;const C=s[b][1];_h(C)&&_h(_)&&(_=Xd(!0,C,_)),s[b]=[p,_,...k]}}}}const Jj=new Jh().freeze();function eh(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function th(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function nh(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 Hv(e){if(!_h(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Pv(e,r,i){if(!i)throw new Error("`"+e+"` finished async. Use `"+r+"` instead")}function Il(e){return eN(e)?e:new Hy(e)}function eN(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function tN(e){return typeof e=="string"||nN(e)}function nN(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const rN="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Fv=[],Uv={allowDangerousHtml:!0},iN=/^(https?|ircs?|mailto|xmpp)$/i,sN=[{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 aN(e){const r=oN(e),i=lN(e);return cN(r.runSync(r.parse(i),i),e)}function oN(e){const r=e.rehypePlugins||Fv,i=e.remarkPlugins||Fv,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Uv}:Uv;return Jj().use(FE).use(i).use(Mj,s).use(r)}function lN(e){const r=e.children||"",i=new Hy;return typeof r=="string"&&(i.value=r),i}function cN(e,r){const i=r.allowedElements,s=r.allowElement,c=r.components,u=r.disallowedElements,f=r.skipHtml,l=r.unwrapDisallowed,d=r.urlTransform||uN;for(const g of sN)Object.hasOwn(r,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+rN+g.id,void 0);return Qh(e,p),C2(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 Gd)if(Object.hasOwn(Gd,_)&&Object.hasOwn(g.properties,_)){const k=g.properties[_],C=Gd[_];(C===null||C.includes(g.tagName))&&(g.properties[_]=d(String(k||""),_,g))}}if(g.type==="element"){let _=i?!i.includes(g.tagName):u?u.includes(g.tagName):!1;if(!_&&s&&typeof m=="number"&&(_=!s(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 uN(e){const r=e.indexOf(":"),i=e.indexOf("?"),s=e.indexOf("#"),c=e.indexOf("/");return r===-1||c!==-1&&r>c||i!==-1&&r>i||s!==-1&&r>s||iN.test(e.slice(0,r))?e:""}function $v(e,r){const i=String(e);if(typeof r!="string")throw new TypeError("Expected character");let s=0,c=i.indexOf(r);for(;c!==-1;)s++,c=i.indexOf(r,c+r.length);return s}function dN(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function hN(e,r,i){const c=pc((i||{}).ignore||[]),u=fN(r);let f=-1;for(;++f<u.length;)zy(e,"text",l);function l(p,g){let m=-1,b;for(;++m<g.length;){const _=g[m],k=b?b.children:void 0;if(c(_,k?k.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 k=0;const y=m.children.indexOf(p);let x=!1,v=[];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:(k!==j&&v.push({type:"text",value:p.value.slice(k,j)}),Array.isArray(N)?v.push(...N):N&&v.push(N),k=j+S[0].length,x=!0),!b.global)break;S=b.exec(p.value)}return x?(k<p.value.length&&v.push({type:"text",value:p.value.slice(k)}),m.children.splice(y,1,...v)):v=[p],y+v.length}}function fN(e){const r=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const i=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<i.length;){const c=i[s];r.push([pN(c[0]),mN(c[1])])}return r}function pN(e){return typeof e=="string"?new RegExp(dN(e),"g"):e}function mN(e){return typeof e=="function"?e:function(){return e}}const rh="phrasing",ih=["autolink","link","image","label"];function gN(){return{transforms:[wN],enter:{literalAutolink:vN,literalAutolinkEmail:sh,literalAutolinkHttp:sh,literalAutolinkWww:sh},exit:{literalAutolink:SN,literalAutolinkEmail:_N,literalAutolinkHttp:bN,literalAutolinkWww:yN}}}function xN(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:rh,notInConstruct:ih},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:rh,notInConstruct:ih},{character:":",before:"[ps]",after:"\\/",inConstruct:rh,notInConstruct:ih}]}}function vN(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function sh(e){this.config.enter.autolinkProtocol.call(this,e)}function bN(e){this.config.exit.autolinkProtocol.call(this,e)}function yN(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 _N(e){this.config.exit.autolinkEmail.call(this,e)}function SN(e){this.exit(e)}function wN(e){hN(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,CN],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),kN]],{ignore:["link","linkReference"]})}function CN(e,r,i,s,c){let u="";if(!Py(c)||(/^w/i.test(r)&&(i=r+i,r="",u="http://"),!EN(i)))return!1;const f=jN(i+s);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 kN(e,r,i,s){return!Py(s,!0)||/[-\d_]$/.test(i)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+i,children:[{type:"text",value:r+"@"+i}]}}function EN(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 jN(e){const r=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!r)return[e,void 0];e=e.slice(0,r.index);let i=r[0],s=i.indexOf(")");const c=$v(e,"(");let u=$v(e,")");for(;s!==-1&&c>u;)e+=i.slice(0,s+1),i=i.slice(s+1),s=i.indexOf(")"),u++;return[e,i]}function Py(e,r){const i=e.input.charCodeAt(e.index-1);return(e.index===0||Ui(i)||dc(i))&&(!r||i!==47)}Fy.peek=IN;function NN(){this.buffer()}function TN(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function AN(){this.buffer()}function DN(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function LN(e){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=ar(this.sliceSerialize(e)).toLowerCase(),i.label=r}function RN(e){this.exit(e)}function ON(e){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=ar(this.sliceSerialize(e)).toLowerCase(),i.label=r}function MN(e){this.exit(e)}function IN(){return"["}function Fy(e,r,i,s){const c=i.createTracker(s);let u=c.move("[^");const f=i.enter("footnoteReference"),l=i.enter("reference");return u+=c.move(i.safe(i.associationId(e),{after:"]",before:u})),l(),f(),u+=c.move("]"),u}function BN(){return{enter:{gfmFootnoteCallString:NN,gfmFootnoteCall:TN,gfmFootnoteDefinitionLabelString:AN,gfmFootnoteDefinition:DN},exit:{gfmFootnoteCallString:LN,gfmFootnoteCall:RN,gfmFootnoteDefinitionLabelString:ON,gfmFootnoteDefinition:MN}}}function zN(e){let r=!1;return e&&e.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:i,footnoteReference:Fy},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function i(s,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(s),{before:d,after:"]"})),g(),d+=l.move("]:"),s.children&&s.children.length>0&&(l.shift(4),d+=l.move((r?`
|
|
105
|
-
`:" ")+u.indentLines(u.containerFlow(s,l.current()),r?Uy:HN))),p(),d}}function HN(e,r,i){return r===0?e:Uy(e,r,i)}function Uy(e,r,i){return(i?"":" ")+e}const PN=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];$y.peek=WN;function FN(){return{canContainEols:["delete"],enter:{strikethrough:$N},exit:{strikethrough:qN}}}function UN(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:PN}],handlers:{delete:$y}}}function $N(e){this.enter({type:"delete",children:[]},e)}function qN(e){this.exit(e)}function $y(e,r,i,s){const c=i.createTracker(s),u=i.enter("strikethrough");let f=c.move("~~");return f+=i.containerPhrasing(e,{...c.current(),before:f,after:"~"}),f+=c.move("~~"),u(),f}function WN(){return"~"}function GN(e){return e.length}function VN(e,r){const i=r||{},s=(i.align||[]).concat(),c=i.stringLength||GN,u=[],f=[],l=[],d=[];let p=0,g=-1;for(;++g<e.length;){const C=[],y=[];let x=-1;for(e[g].length>p&&(p=e[g].length);++x<e[g].length;){const v=KN(e[g][x]);if(i.alignDelimiters!==!1){const S=c(v);y[x]=S,(d[x]===void 0||S>d[x])&&(d[x]=S)}C.push(v)}f[g]=C,l[g]=y}let m=-1;if(typeof s=="object"&&"length"in s)for(;++m<p;)u[m]=qv(s[m]);else{const C=qv(s);for(;++m<p;)u[m]=C}m=-1;const b=[],_=[];for(;++m<p;){const C=u[m];let y="",x="";C===99?(y=":",x=":"):C===108?y=":":C===114&&(x=":");let v=i.alignDelimiters===!1?1:Math.max(1,d[m]-y.length-x.length);const S=y+"-".repeat(v)+x;i.alignDelimiters!==!1&&(v=y.length+v+x.length,v>d[m]&&(d[m]=v),_[m]=v),b[m]=S}f.splice(1,0,b),l.splice(1,0,_),g=-1;const k=[];for(;++g<f.length;){const C=f[g],y=l[g];m=-1;const x=[];for(;++m<p;){const v=C[m]||"";let S="",j="";if(i.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)}i.delimiterStart!==!1&&!m&&x.push("|"),i.padding!==!1&&!(i.alignDelimiters===!1&&v==="")&&(i.delimiterStart!==!1||m)&&x.push(" "),i.alignDelimiters!==!1&&x.push(S),x.push(v),i.alignDelimiters!==!1&&x.push(j),i.padding!==!1&&x.push(" "),(i.delimiterEnd!==!1||m!==p-1)&&x.push("|")}k.push(i.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return k.join(`
|
|
106
|
-
`)}function KN(e){return e==null?"":String(e)}function qv(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 YN(e,r,i,s){const c=i.enter("blockquote"),u=i.createTracker(s);u.move("> "),u.shift(2);const f=i.indentLines(i.containerFlow(e,u.current()),XN);return c(),f}function XN(e,r,i){return">"+(i?"":" ")+e}function ZN(e,r){return Wv(e,r.inConstruct,!0)&&!Wv(e,r.notInConstruct,!1)}function Wv(e,r,i){if(typeof r=="string"&&(r=[r]),!r||r.length===0)return i;let s=-1;for(;++s<r.length;)if(e.includes(r[s]))return!0;return!1}function Gv(e,r,i,s){let c=-1;for(;++c<i.unsafe.length;)if(i.unsafe[c].character===`
|
|
107
|
-
`&&ZN(i.stack,i.unsafe[c]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
108
|
-
`}function QN(e,r){const i=String(e);let s=i.indexOf(r),c=s,u=0,f=0;if(typeof r!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===c?++u>f&&(f=u):u=1,c=s+r.length,s=i.indexOf(r,c);return f}function JN(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 eT(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 tT(e,r,i,s){const c=eT(i),u=e.value||"",f=c==="`"?"GraveAccent":"Tilde";if(JN(e,i)){const m=i.enter("codeIndented"),b=i.indentLines(u,nT);return m(),b}const l=i.createTracker(s),d=c.repeat(Math.max(QN(u,c)+1,3)),p=i.enter("codeFenced");let g=l.move(d);if(e.lang){const m=i.enter(`codeFencedLang${f}`);g+=l.move(i.safe(e.lang,{before:g,after:" ",encode:["`"],...l.current()})),m()}if(e.lang&&e.meta){const m=i.enter(`codeFencedMeta${f}`);g+=l.move(" "),g+=l.move(i.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 nT(e,r,i){return(i?"":" ")+e}function ef(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 rT(e,r,i,s){const c=ef(i),u=c==='"'?"Quote":"Apostrophe",f=i.enter("definition");let l=i.enter("label");const d=i.createTracker(s);let p=d.move("[");return p+=d.move(i.safe(i.associationId(e),{before:p,after:"]",...d.current()})),p+=d.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=i.enter("destinationLiteral"),p+=d.move("<"),p+=d.move(i.safe(e.url,{before:p,after:">",...d.current()})),p+=d.move(">")):(l=i.enter("destinationRaw"),p+=d.move(i.safe(e.url,{before:p,after:e.title?" ":`
|
|
112
|
-
`,...d.current()}))),l(),e.title&&(l=i.enter(`title${u}`),p+=d.move(" "+c),p+=d.move(i.safe(e.title,{before:p,after:c,...d.current()})),p+=d.move(c),l()),f(),p}function iT(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 lo(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Ql(e,r,i){const s=Us(e),c=Us(r);return s===void 0?c===void 0?i==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===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}}qy.peek=sT;function qy(e,r,i,s){const c=iT(i),u=i.enter("emphasis"),f=i.createTracker(s),l=f.move(c);let d=f.move(i.containerPhrasing(e,{after:c,before:l,...f.current()}));const p=d.charCodeAt(0),g=Ql(s.before.charCodeAt(s.before.length-1),p,c);g.inside&&(d=lo(p)+d.slice(1));const m=d.charCodeAt(d.length-1),b=Ql(s.after.charCodeAt(0),m,c);b.inside&&(d=d.slice(0,-1)+lo(m));const _=f.move(c);return u(),i.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},l+d+_}function sT(e,r,i){return i.options.emphasis||"*"}function aT(e,r){let i=!1;return Qh(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return i=!0,bh}),!!((!e.depth||e.depth<3)&&Gh(e)&&(r.options.setext||i))}function oT(e,r,i,s){const c=Math.max(Math.min(6,e.depth||1),1),u=i.createTracker(s);if(aT(e,i)){const g=i.enter("headingSetext"),m=i.enter("phrasing"),b=i.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=i.enter("headingAtx"),d=i.enter("phrasing");u.move(f+" ");let p=i.containerPhrasing(e,{before:"# ",after:`
|
|
117
|
-
`,...u.current()});return/^[\t ]/.test(p)&&(p=lo(p.charCodeAt(0))+p.slice(1)),p=p?f+" "+p:f,i.options.closeAtx&&(p+=" "+f),d(),l(),p}Wy.peek=lT;function Wy(e){return e.value||""}function lT(){return"<"}Gy.peek=cT;function Gy(e,r,i,s){const c=ef(i),u=c==='"'?"Quote":"Apostrophe",f=i.enter("image");let l=i.enter("label");const d=i.createTracker(s);let p=d.move("![");return p+=d.move(i.safe(e.alt,{before:p,after:"]",...d.current()})),p+=d.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=i.enter("destinationLiteral"),p+=d.move("<"),p+=d.move(i.safe(e.url,{before:p,after:">",...d.current()})),p+=d.move(">")):(l=i.enter("destinationRaw"),p+=d.move(i.safe(e.url,{before:p,after:e.title?" ":")",...d.current()}))),l(),e.title&&(l=i.enter(`title${u}`),p+=d.move(" "+c),p+=d.move(i.safe(e.title,{before:p,after:c,...d.current()})),p+=d.move(c),l()),p+=d.move(")"),f(),p}function cT(){return"!"}Vy.peek=uT;function Vy(e,r,i,s){const c=e.referenceType,u=i.enter("imageReference");let f=i.enter("label");const l=i.createTracker(s);let d=l.move("![");const p=i.safe(e.alt,{before:d,after:"]",...l.current()});d+=l.move(p+"]["),f();const g=i.stack;i.stack=[],f=i.enter("reference");const m=i.safe(i.associationId(e),{before:d,after:"]",...l.current()});return f(),i.stack=g,u(),c==="full"||!p||p!==m?d+=l.move(m+"]"):c==="shortcut"?d=d.slice(0,-1):d+=l.move("]"),d}function uT(){return"!"}Ky.peek=dT;function Ky(e,r,i){let s=e.value||"",c="`",u=-1;for(;new RegExp("(^|[^`])"+c+"([^`]|$)").test(s);)c+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++u<i.unsafe.length;){const f=i.unsafe[u],l=i.compilePattern(f);let d;if(f.atBreak)for(;d=l.exec(s);){let p=d.index;s.charCodeAt(p)===10&&s.charCodeAt(p-1)===13&&p--,s=s.slice(0,p)+" "+s.slice(d.index+1)}}return c+s+c}function dT(){return"`"}function Yy(e,r){const i=Gh(e);return!!(!r.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(i===e.url||"mailto:"+i===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Xy.peek=hT;function Xy(e,r,i,s){const c=ef(i),u=c==='"'?"Quote":"Apostrophe",f=i.createTracker(s);let l,d;if(Yy(e,i)){const g=i.stack;i.stack=[],l=i.enter("autolink");let m=f.move("<");return m+=f.move(i.containerPhrasing(e,{before:m,after:">",...f.current()})),m+=f.move(">"),l(),i.stack=g,m}l=i.enter("link"),d=i.enter("label");let p=f.move("[");return p+=f.move(i.containerPhrasing(e,{before:p,after:"](",...f.current()})),p+=f.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=i.enter("destinationLiteral"),p+=f.move("<"),p+=f.move(i.safe(e.url,{before:p,after:">",...f.current()})),p+=f.move(">")):(d=i.enter("destinationRaw"),p+=f.move(i.safe(e.url,{before:p,after:e.title?" ":")",...f.current()}))),d(),e.title&&(d=i.enter(`title${u}`),p+=f.move(" "+c),p+=f.move(i.safe(e.title,{before:p,after:c,...f.current()})),p+=f.move(c),d()),p+=f.move(")"),l(),p}function hT(e,r,i){return Yy(e,i)?"<":"["}Zy.peek=fT;function Zy(e,r,i,s){const c=e.referenceType,u=i.enter("linkReference");let f=i.enter("label");const l=i.createTracker(s);let d=l.move("[");const p=i.containerPhrasing(e,{before:d,after:"]",...l.current()});d+=l.move(p+"]["),f();const g=i.stack;i.stack=[],f=i.enter("reference");const m=i.safe(i.associationId(e),{before:d,after:"]",...l.current()});return f(),i.stack=g,u(),c==="full"||!p||p!==m?d+=l.move(m+"]"):c==="shortcut"?d=d.slice(0,-1):d+=l.move("]"),d}function fT(){return"["}function tf(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 pT(e){const r=tf(e),i=e.options.bulletOther;if(!i)return r==="*"?"-":"*";if(i!=="*"&&i!=="+"&&i!=="-")throw new Error("Cannot serialize items with `"+i+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(i===r)throw new Error("Expected `bullet` (`"+r+"`) and `bulletOther` (`"+i+"`) to be different");return i}function mT(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 Qy(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 gT(e,r,i,s){const c=i.enter("list"),u=i.bulletCurrent;let f=e.ordered?mT(i):tf(i);const l=e.ordered?f==="."?")":".":pT(i);let d=r&&i.bulletLastUsed?f===i.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((f==="*"||f==="-")&&g&&(!g.children||!g.children[0])&&i.stack[i.stack.length-1]==="list"&&i.stack[i.stack.length-2]==="listItem"&&i.stack[i.stack.length-3]==="list"&&i.stack[i.stack.length-4]==="listItem"&&i.indexStack[i.indexStack.length-1]===0&&i.indexStack[i.indexStack.length-2]===0&&i.indexStack[i.indexStack.length-3]===0&&(d=!0),Qy(i)===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),i.bulletCurrent=f;const p=i.containerFlow(e,s);return i.bulletLastUsed=f,i.bulletCurrent=u,c(),p}function xT(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 vT(e,r,i,s){const c=xT(i);let u=i.bulletCurrent||tf(i);r&&r.type==="list"&&r.ordered&&(u=(typeof r.start=="number"&&r.start>-1?r.start:1)+(i.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=i.createTracker(s);l.move(u+" ".repeat(f-u.length)),l.shift(f);const d=i.enter("listItem"),p=i.indentLines(i.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 bT(e,r,i,s){const c=i.enter("paragraph"),u=i.enter("phrasing"),f=i.containerPhrasing(e,s);return u(),c(),f}const yT=pc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function _T(e,r,i,s){return(e.children.some(function(f){return yT(f)})?i.containerPhrasing:i.containerFlow).call(i,e,s)}function ST(e){const r=e.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}Jy.peek=wT;function Jy(e,r,i,s){const c=ST(i),u=i.enter("strong"),f=i.createTracker(s),l=f.move(c+c);let d=f.move(i.containerPhrasing(e,{after:c,before:l,...f.current()}));const p=d.charCodeAt(0),g=Ql(s.before.charCodeAt(s.before.length-1),p,c);g.inside&&(d=lo(p)+d.slice(1));const m=d.charCodeAt(d.length-1),b=Ql(s.after.charCodeAt(0),m,c);b.inside&&(d=d.slice(0,-1)+lo(m));const _=f.move(c+c);return u(),i.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},l+d+_}function wT(e,r,i){return i.options.strong||"*"}function CT(e,r,i,s){return i.safe(e.value,s)}function kT(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 ET(e,r,i){const s=(Qy(i)+(i.options.ruleSpaces?" ":"")).repeat(kT(i));return i.options.ruleSpaces?s.slice(0,-1):s}const e0={blockquote:YN,break:Gv,code:tT,definition:rT,emphasis:qy,hardBreak:Gv,heading:oT,html:Wy,image:Gy,imageReference:Vy,inlineCode:Ky,link:Xy,linkReference:Zy,list:gT,listItem:vT,paragraph:bT,root:_T,strong:Jy,text:CT,thematicBreak:ET};function jT(){return{enter:{table:NT,tableData:Vv,tableHeader:Vv,tableRow:AT},exit:{codeText:DT,table:TT,tableData:ah,tableHeader:ah,tableRow:ah}}}function NT(e){const r=e._align;this.enter({type:"table",align:r.map(function(i){return i==="none"?null:i}),children:[]},e),this.data.inTable=!0}function TT(e){this.exit(e),this.data.inTable=void 0}function AT(e){this.enter({type:"tableRow",children:[]},e)}function ah(e){this.exit(e)}function Vv(e){this.enter({type:"tableCell",children:[]},e)}function DT(e){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,LT));const i=this.stack[this.stack.length-1];i.type,i.value=r,this.exit(e)}function LT(e,r){return r==="|"?r:e}function RT(e){const r=e||{},i=r.tableCellPadding,s=r.tablePipeAlign,c=r.stringLength,u=i?" ":"|";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(_,k,C,y){return p(g(_,C,y),_.align)}function l(_,k,C,y){const x=m(_,C,y),v=p([x]);return v.slice(0,v.indexOf(`
|
|
119
|
-
`))}function d(_,k,C,y){const x=C.enter("tableCell"),v=C.enter("phrasing"),S=C.containerPhrasing(_,{...y,before:u,after:u});return v(),x(),S}function p(_,k){return VN(_,{align:k,alignDelimiters:s,padding:i,stringLength:c})}function g(_,k,C){const y=_.children;let x=-1;const v=[],S=k.enter("table");for(;++x<y.length;)v[x]=m(y[x],k,C);return S(),v}function m(_,k,C){const y=_.children;let x=-1;const v=[],S=k.enter("tableRow");for(;++x<y.length;)v[x]=d(y[x],_,k,C);return S(),v}function b(_,k,C){let y=e0.inlineCode(_,k,C);return C.stack.includes("tableCell")&&(y=y.replace(/\|/g,"\\$&")),y}}function OT(){return{exit:{taskListCheckValueChecked:Kv,taskListCheckValueUnchecked:Kv,paragraph:IT}}}function MT(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:BT}}}function Kv(e){const r=this.stack[this.stack.length-2];r.type,r.checked=e.type==="taskListCheckValueChecked"}function IT(e){const r=this.stack[this.stack.length-2];if(r&&r.type==="listItem"&&typeof r.checked=="boolean"){const i=this.stack[this.stack.length-1];i.type;const s=i.children[0];if(s&&s.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===i&&(s.value=s.value.slice(1),s.value.length===0?i.children.shift():i.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,i.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function BT(e,r,i,s){const c=e.children[0],u=typeof e.checked=="boolean"&&c&&c.type==="paragraph",f="["+(e.checked?"x":" ")+"] ",l=i.createTracker(s);u&&l.move(f);let d=e0.listItem(e,r,i,{...s,...l.current()});return u&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),d;function p(g){return g+f}}function zT(){return[gN(),BN(),FN(),jT(),OT()]}function HT(e){return{extensions:[xN(),zN(e),UN(),RT(e),MT()]}}const PT={tokenize:GT,partial:!0},t0={tokenize:VT,partial:!0},n0={tokenize:KT,partial:!0},r0={tokenize:YT,partial:!0},FT={tokenize:XT,partial:!0},i0={name:"wwwAutolink",tokenize:qT,previous:a0},s0={name:"protocolAutolink",tokenize:WT,previous:o0},Fr={name:"emailAutolink",tokenize:$T,previous:l0},xr={};function UT(){return{text:xr}}let Mi=48;for(;Mi<123;)xr[Mi]=Fr,Mi++,Mi===58?Mi=65:Mi===91&&(Mi=97);xr[43]=Fr;xr[45]=Fr;xr[46]=Fr;xr[95]=Fr;xr[72]=[Fr,s0];xr[104]=[Fr,s0];xr[87]=[Fr,i0];xr[119]=[Fr,i0];function $T(e,r,i){const s=this;let c,u;return f;function f(m){return!wh(m)||!l0.call(s,s.previous)||nf(s.events)?i(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(m))}function l(m){return wh(m)?(e.consume(m),l):m===64?(e.consume(m),d):i(m)}function d(m){return m===46?e.check(FT,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(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),r(m)):i(m)}}function qT(e,r,i){const s=this;return c;function c(f){return f!==87&&f!==119||!a0.call(s,s.previous)||nf(s.events)?i(f):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(PT,e.attempt(t0,e.attempt(n0,u),i),i)(f))}function u(f){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),r(f)}}function WT(e,r,i){const s=this;let c="",u=!1;return f;function f(m){return(m===72||m===104)&&o0.call(s,s.previous)&&!nf(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),c+=String.fromCodePoint(m),e.consume(m),l):i(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 i(m)}function d(m){return m===47?(e.consume(m),u?p:(u=!0,d)):i(m)}function p(m){return m===null||Yl(m)||yt(m)||Ui(m)||dc(m)?i(m):e.attempt(t0,e.attempt(n0,g),i)(m)}function g(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),r(m)}}function GT(e,r,i){let s=0;return c;function c(f){return(f===87||f===119)&&s<3?(s++,e.consume(f),c):f===46&&s===3?(e.consume(f),u):i(f)}function u(f){return f===null?i(f):r(f)}}function VT(e,r,i){let s,c,u;return f;function f(p){return p===46||p===95?e.check(r0,d,l)(p):p===null||yt(p)||Ui(p)||p!==45&&dc(p)?d(p):(u=!0,e.consume(p),f)}function l(p){return p===95?s=!0:(c=s,s=void 0),e.consume(p),f}function d(p){return c||s||!u?i(p):r(p)}}function KT(e,r){let i=0,s=0;return c;function c(f){return f===40?(i++,e.consume(f),c):f===41&&s<i?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(r0,r,u)(f):f===null||yt(f)||Ui(f)?r(f):(e.consume(f),c)}function u(f){return f===41&&s++,e.consume(f),c}}function YT(e,r,i){return s;function s(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),s):l===38?(e.consume(l),u):l===93?(e.consume(l),c):l===60||l===null||yt(l)||Ui(l)?r(l):i(l)}function c(l){return l===null||l===40||l===91||yt(l)||Ui(l)?r(l):s(l)}function u(l){return bn(l)?f(l):i(l)}function f(l){return l===59?(e.consume(l),s):bn(l)?(e.consume(l),f):i(l)}}function XT(e,r,i){return s;function s(u){return e.consume(u),c}function c(u){return gn(u)?i(u):r(u)}}function a0(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||yt(e)}function o0(e){return!bn(e)}function l0(e){return!(e===47||wh(e))}function wh(e){return e===43||e===45||e===46||e===95||gn(e)}function nf(e){let r=e.length,i=!1;for(;r--;){const s=e[r][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){i=!0;break}if(s._gfmAutolinkLiteralWalkedInto){i=!1;break}}return e.length>0&&!i&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),i}const ZT={tokenize:s3,partial:!0};function QT(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:n3,continuation:{tokenize:r3},exit:i3}},text:{91:{name:"gfmFootnoteCall",tokenize:t3},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:JT,resolveTo:e3}}}}function JT(e,r,i){const s=this;let c=s.events.length;const u=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let f;for(;c--;){const d=s.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 i(d);const p=ar(s.sliceSerialize({start:f.end,end:s.now()}));return p.codePointAt(0)!==94||!u.includes(p.slice(1))?i(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),r(d))}}function e3(e,r){let i=e.length;for(;i--;)if(e[i][1].type==="labelImage"&&e[i][0]==="enter"){e[i][1];break}e[i+1][1].type="data",e[i+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[i+3][1].start),end:Object.assign({},e[e.length-1][1].end)},c={type:"gfmFootnoteCallMarker",start:Object.assign({},e[i+3][1].end),end:Object.assign({},e[i+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[i+1],e[i+2],["enter",s,r],e[i+3],e[i+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",s,r]];return e.splice(i,e.length-i+1,...l),e}function t3(e,r,i){const s=this,c=s.parser.gfmFootnotes||(s.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?i(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||yt(m))return i(m);if(m===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return c.includes(ar(s.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),r):i(m)}return yt(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 n3(e,r,i){const s=this,c=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u,f=0,l;return d;function d(k){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(k){return k===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):i(k)}function g(k){if(f>999||k===93&&!l||k===null||k===91||yt(k))return i(k);if(k===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return u=ar(s.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return yt(k)||(l=!0),f++,e.consume(k),k===92?m:g}function m(k){return k===91||k===92||k===93?(e.consume(k),f++,g):g(k)}function b(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),c.includes(u)||c.push(u),at(e,_,"gfmFootnoteDefinitionWhitespace")):i(k)}function _(k){return r(k)}}function r3(e,r,i){return e.check(go,r,e.attempt(ZT,r,i))}function i3(e){e.exit("gfmFootnoteDefinition")}function s3(e,r,i){const s=this;return at(e,c,"gfmFootnoteDefinitionIndent",5);function c(u){const f=s.events[s.events.length-1];return f&&f[1].type==="gfmFootnoteDefinitionIndent"&&f[2].sliceSerialize(f[1],!0).length===4?r(u):i(u)}}function a3(e){let i=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:u,resolveAll:c};return i==null&&(i=!0),{text:{126:s},insideSpan:{null:[s]},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,hc(_,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(k){return p===126&&g[g.length-1][1].type!=="characterEscape"?d(k):(f.enter("strikethroughSequenceTemporary"),_(k))}function _(k){const C=Us(p);if(k===126)return m>1?d(k):(f.consume(k),m++,_);if(m<2&&!i)return d(k);const y=f.exit("strikethroughSequenceTemporary"),x=Us(k);return y._open=!x||x===2&&!!C,y._close=!C||C===2&&!!x,l(k)}}}class o3{constructor(){this.map=[]}add(r,i,s){l3(this,r,i,s)}consume(r){if(this.map.sort(function(u,f){return u[0]-f[0]}),this.map.length===0)return;let i=this.map.length;const s=[];for(;i>0;)i-=1,s.push(r.slice(this.map[i][0]+this.map[i][1]),this.map[i][2]),r.length=this.map[i][0];s.push(r.slice()),r.length=0;let c=s.pop();for(;c;){for(const u of c)r.push(u);c=s.pop()}this.map.length=0}}function l3(e,r,i,s){let c=0;if(!(i===0&&s.length===0)){for(;c<e.map.length;){if(e.map[c][0]===r){e.map[c][1]+=i,e.map[c][2].push(...s);return}c+=1}e.map.push([r,i,s])}}function c3(e,r){let i=!1;const s=[];for(;r<e.length;){const c=e[r];if(i){if(c[0]==="enter")c[1].type==="tableContent"&&s.push(e[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(c[1].type==="tableContent"){if(e[r-1][1].type==="tableDelimiterMarker"){const u=s.length-1;s[u]=s[u]==="left"?"center":"right"}}else if(c[1].type==="tableDelimiterRow")break}else c[0]==="enter"&&c[1].type==="tableDelimiterRow"&&(i=!0);r+=1}return s}function u3(){return{flow:{null:{name:"table",tokenize:d3,resolveAll:h3}}}}function d3(e,r,i){const s=this;let c=0,u=0,f;return l;function l(O){let q=s.events.length-1;for(;q>-1;){const I=s.events[q][1].type;if(I==="lineEnding"||I==="linePrefix")q--;else break}const V=q>-1?s.events[q][1].type:null,W=V==="tableHead"||V==="tableRow"?N:d;return W===N&&s.parser.lazy[s.now().line]?i(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?i(O):He(O)?u>1?(u=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),_):i(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||yt(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 s.interrupt=!1,s.parser.lazy[s.now().line]?i(O):(e.enter("tableDelimiterRow"),f=!1,tt(O)?at(e,k,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):k(O))}function k(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"),x):O===45?(u+=1,x(O)):O===null||He(O)?j(O):T(O)}function x(O){return O===45?(e.enter("tableDelimiterFiller"),v(O)):T(O)}function v(O){return O===45?(e.consume(O),v):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?k(O):O===null||He(O)?!f||c!==u?T(O):(e.exit("tableDelimiterRow"),e.exit("tableHead"),r(O)):T(O)}function T(O){return i(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||yt(O)?(e.exit("data"),D(O)):(e.consume(O),O===92?B:A)}function B(O){return O===92||O===124?(e.consume(O),A):A(O)}}function h3(e,r){let i=-1,s=!0,c=0,u=[0,0,0,0],f=[0,0,0,0],l=!1,d=0,p,g,m;const b=new o3;for(;++i<e.length;){const _=e[i],k=_[1];_[0]==="enter"?k.type==="tableHead"?(l=!1,d!==0&&(Yv(b,r,d,p,g),g=void 0,d=0),p={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},b.add(i,0,[["enter",p,r]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(s=!0,m=void 0,u=[0,0,0,0],f=[0,i+1,0,0],l&&(l=!1,g={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},b.add(i,0,[["enter",g,r]])),c=k.type==="tableDelimiterRow"?2:g?3:1):c&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(s=!1,f[2]===0&&(u[1]!==0&&(f[0]=f[1],m=Bl(b,r,u,c,void 0,m),u=[0,0,0,0]),f[2]=i)):k.type==="tableCellDivider"&&(s?s=!1:(u[1]!==0&&(f[0]=f[1],m=Bl(b,r,u,c,void 0,m)),u=f,f=[u[1],i,0,0])):k.type==="tableHead"?(l=!0,d=i):k.type==="tableRow"||k.type==="tableDelimiterRow"?(d=i,u[1]!==0?(f[0]=f[1],m=Bl(b,r,u,c,i,m)):f[1]!==0&&(m=Bl(b,r,f,c,i,m)),c=0):c&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(f[3]=i)}for(d!==0&&Yv(b,r,d,p,g),b.consume(r.events),i=-1;++i<r.events.length;){const _=r.events[i];_[0]==="enter"&&_[1].type==="table"&&(_[1]._align=c3(r.events,i))}return e}function Bl(e,r,i,s,c,u){const f=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",l="tableContent";i[0]!==0&&(u.end=Object.assign({},Bs(r.events,i[0])),e.add(i[0],0,[["exit",u,r]]));const d=Bs(r.events,i[1]);if(u={type:f,start:Object.assign({},d),end:Object.assign({},d)},e.add(i[1],0,[["enter",u,r]]),i[2]!==0){const p=Bs(r.events,i[2]),g=Bs(r.events,i[3]),m={type:l,start:Object.assign({},p),end:Object.assign({},g)};if(e.add(i[2],0,[["enter",m,r]]),s!==2){const b=r.events[i[2]],_=r.events[i[3]];if(b[1].end=Object.assign({},_[1].end),b[1].type="chunkText",b[1].contentType="text",i[3]>i[2]+1){const k=i[2]+1,C=i[3]-i[2]-1;e.add(k,C,[])}}e.add(i[3]+1,0,[["exit",m,r]])}return c!==void 0&&(u.end=Object.assign({},Bs(r.events,c)),e.add(c,0,[["exit",u,r]]),u=void 0),u}function Yv(e,r,i,s,c){const u=[],f=Bs(r.events,i);c&&(c.end=Object.assign({},f),u.push(["exit",c,r])),s.end=Object.assign({},f),u.push(["exit",s,r]),e.add(i+1,0,u)}function Bs(e,r){const i=e[r],s=i[0]==="enter"?"start":"end";return i[1][s]}const f3={name:"tasklistCheck",tokenize:m3};function p3(){return{text:{91:f3}}}function m3(e,r,i){const s=this;return c;function c(d){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?i(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),u)}function u(d){return yt(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):i(d)}function f(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):i(d)}function l(d){return He(d)?r(d):tt(d)?e.check({tokenize:g3},r,i)(d):i(d)}}function g3(e,r,i){return at(e,s,"whitespace");function s(c){return c===null?i(c):r(c)}}function x3(e){return by([UT(),QT(),a3(e),u3(),p3()])}const v3={};function b3(e){const r=this,i=e||v3,s=r.data(),c=s.micromarkExtensions||(s.micromarkExtensions=[]),u=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),f=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);c.push(x3(i)),u.push(zT()),f.push(HT(i))}function y3(e,r){if(e==null)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(r.indexOf(s)!==-1)continue;i[s]=e[s]}return i}function _3(e,r){if(e==null)return{};var i,s,c=y3(e,r);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(s=0;s<u.length;s++)i=u[s],r.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(c[i]=e[i])}return c}function Ch(e,r){(r==null||r>e.length)&&(r=e.length);for(var i=0,s=Array(r);i<r;i++)s[i]=e[i];return s}function S3(e){if(Array.isArray(e))return Ch(e)}function w3(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function C3(e,r){if(e){if(typeof e=="string")return Ch(e,r);var i={}.toString.call(e).slice(8,-1);return i==="Object"&&e.constructor&&(i=e.constructor.name),i==="Map"||i==="Set"?Array.from(e):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Ch(e,r):void 0}}function k3(){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 kh(e){return S3(e)||w3(e)||C3(e)||k3()}function co(e){"@babel/helpers - typeof";return co=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},co(e)}function E3(e,r){if(co(e)!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var s=i.call(e,r);if(co(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function j3(e){var r=E3(e,"string");return co(r)=="symbol"?r:r+""}function c0(e,r,i){return(r=j3(r))in e?Object.defineProperty(e,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[r]=i,e}function Eh(){return Eh=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var i=arguments[r];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},Eh.apply(null,arguments)}function Xv(e,r){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(c){return Object.getOwnPropertyDescriptor(e,c).enumerable})),i.push.apply(i,s)}return i}function zs(e){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{};r%2?Xv(Object(i),!0).forEach(function(s){c0(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Xv(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}function N3(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 oh={};function T3(e){if(e.length===0||e.length===1)return e;var r=e.join(".");return oh[r]||(oh[r]=N3(e)),oh[r]}function A3(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,s=e.filter(function(u){return u!=="token"}),c=T3(s);return c.reduce(function(u,f){return zs(zs({},u),i[f])},r)}function Zv(e){return e.join(" ")}function D3(e,r){var i=0;return function(s){return i+=1,s.map(function(c,u){return u0({node:c,stylesheet:e,useInlineStyles:r,key:"code-segment-".concat(i,"-").concat(u)})})}}function u0(e){var r=e.node,i=e.stylesheet,s=e.style,c=s===void 0?{}:s,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=D3(i,u),b;if(!u)b=zs(zs({},l),{},{className:Zv(l.className)});else{var _=Object.keys(i).reduce(function(x,v){return v.split(".").forEach(function(S){x.includes(S)||x.push(S)}),x},[]),k=l.className&&l.className.includes("token")?["token"]:[],C=l.className&&k.concat(l.className.filter(function(x){return!_.includes(x)}));b=zs(zs({},l),{},{className:Zv(C)||void 0,style:A3(l.className,Object.assign({},l.style,c),i)})}var y=m(r.children);return mn.createElement(p,Eh({key:f},b),y)}}const L3=(function(e,r){var i=e.listLanguages();return i.indexOf(r)!==-1});var R3=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function Qv(e,r){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(c){return Object.getOwnPropertyDescriptor(e,c).enumerable})),i.push.apply(i,s)}return i}function pi(e){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{};r%2?Qv(Object(i),!0).forEach(function(s){c0(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Qv(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}var O3=/\n/g;function M3(e){return e.match(O3)}function I3(e){var r=e.lines,i=e.startingLineNumber,s=e.style;return r.map(function(c,u){var f=u+i;return mn.createElement("span",{key:"line-".concat(u),className:"react-syntax-highlighter-line-number",style:typeof s=="function"?s(f):s},"".concat(f,`
|
|
121
|
-
`))})}function B3(e){var r=e.codeString,i=e.codeStyle,s=e.containerStyle,c=s===void 0?{float:"left",paddingRight:"10px"}:s,u=e.numberStyle,f=u===void 0?{}:u,l=e.startingLineNumber;return mn.createElement("code",{style:Object.assign({},i,c)},I3({lines:r.replace(/\n$/,"").split(`
|
|
122
|
-
`),style:f,startingLineNumber:l}))}function z3(e){return"".concat(e.toString().length,".25em")}function d0(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 h0(e,r,i){var s={display:"inline-block",minWidth:z3(i),paddingRight:"1em",textAlign:"right",userSelect:"none"},c=typeof e=="function"?e(r):e,u=pi(pi({},s),c);return u}function $l(e){var r=e.children,i=e.lineNumber,s=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,k=_?pi({},typeof l=="function"?l(i):l):{};if(k.className=k.className?[].concat(kh(k.className.trim().split(/\s+/)),kh(p)):p,i&&u){var C=h0(s,i,c);r.unshift(d0(i,C))}return m&g&&(k.style=pi({display:"flex"},k.style)),{type:"element",tagName:"span",properties:k,children:r}}function f0(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];e.length===void 0&&(e=[e]);for(var s=0;s<e.length;s++){var c=e[s];if(c.type==="text")i.push($l({children:[c],className:kh(new Set(r))}));else if(c.children){var u,f=r.concat(((u=c.properties)===null||u===void 0?void 0:u.className)||[]);f0(c.children,f).forEach(function(l){return i.push(l)})}}return i}function H3(e,r,i,s,c,u,f,l,d){var p,g=f0(e.value),m=[],b=-1,_=0;function k(T,N){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return $l({children:T,lineNumber:N,lineNumberStyle:l,largestLineNumber:f,showInlineLineNumbers:c,lineProps:i,className:D,showLineNumbers:s,wrapLongLines:d,wrapLines:r})}function C(T,N){if(s&&N&&c){var D=h0(l,N,f);T.unshift(d0(N,D))}return T}function y(T,N){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return r||D.length>0?k(T,N,D):C(T,N)}for(var x=function(){var N=g[_],D=N.children[0].value,A=M3(D);if(A){var B=D.split(`
|
|
123
|
-
`);B.forEach(function(O,q){var V=s&&m.length+u,W={type:"text",value:"".concat(O,`
|
|
124
|
-
`)};if(q===0){var I=g.slice(b+1,_).concat($l({children:[W],className:N.properties.className})),F=y(I,V);m.push(F)}else if(q===B.length-1){var P=g[_+1]&&g[_+1].children&&g[_+1].children[0],X={type:"text",value:"".concat(O)};if(P){var Z=$l({children:[X],className:N.properties.className});g.splice(_+1,0,Z)}else{var z=[X],R=y(z,V,N.properties.className);m.push(R)}}else{var L=[W],$=y(L,V,N.properties.className);m.push($)}}),b=_}_++};_<g.length;)x();if(b!==g.length-1){var v=g.slice(b+1,g.length);if(v&&v.length){var S=s&&m.length+u,j=y(v,S);m.push(j)}}return r?m:(p=[]).concat.apply(p,m)}function P3(e){var r=e.rows,i=e.stylesheet,s=e.useInlineStyles;return r.map(function(c,u){return u0({node:c,stylesheet:i,useInlineStyles:s,key:"code-segment-".concat(u)})})}function p0(e){return e&&typeof e.highlightAuto<"u"}function F3(e){var r=e.astGenerator,i=e.language,s=e.code,c=e.defaultCodeValue;if(p0(r)){var u=L3(r,i);return i==="text"?{value:c,language:"text"}:u?r.highlight(i,s):r.highlightAuto(s)}try{return i&&i!=="text"?{value:r.highlight(s,i)}:{value:c}}catch{return{value:c}}}function U3(e,r){return function(s){var c,u,f=s.language,l=s.children,d=s.style,p=d===void 0?r:d,g=s.customStyle,m=g===void 0?{}:g,b=s.codeTagProps,_=b===void 0?{className:f?"language-".concat(f):void 0,style:pi(pi({},p['code[class*="language-"]']),p['code[class*="language-'.concat(f,'"]')])}:b,k=s.useInlineStyles,C=k===void 0?!0:k,y=s.showLineNumbers,x=y===void 0?!1:y,v=s.showInlineLineNumbers,S=v===void 0?!0:v,j=s.startingLineNumber,T=j===void 0?1:j,N=s.lineNumberContainerStyle,D=s.lineNumberStyle,A=D===void 0?{}:D,B=s.wrapLines,O=s.wrapLongLines,q=O===void 0?!1:O,V=s.lineProps,W=V===void 0?{}:V,I=s.renderer,F=s.PreTag,P=F===void 0?"pre":F,X=s.CodeTag,Z=X===void 0?"code":X,z=s.code,R=z===void 0?(Array.isArray(l)?l[0]:l)||"":z,L=s.astGenerator,$=_3(s,R3);L=L||e;var U=x?mn.createElement(B3,{containerStyle:N,codeStyle:_.style||{},numberStyle:A,startingLineNumber:T,codeString:R}):null,ne=p.hljs||p['pre[class*="language-"]']||{backgroundColor:"#fff"},Q=p0(L)?"hljs":"prismjs",ee=C?Object.assign({},$,{style:Object.assign({},ne,m)}):Object.assign({},$,{className:$.className?"".concat(Q," ").concat($.className):Q,style:Object.assign({},m)});if(q?_.style=pi({whiteSpace:"pre-wrap"},_.style):_.style=pi({whiteSpace:"pre"},_.style),!L)return mn.createElement(P,ee,U,mn.createElement(Z,_,R));(B===void 0&&I||q)&&(B=!0),I=I||P3;var Y=[{type:"text",value:R}],G=F3({astGenerator:L,language:f,code:R,defaultCodeValue:Y});G.language===null&&(G.value=Y);var oe=(c=(u=R.match(/\n/g))===null||u===void 0?void 0:u.length)!==null&&c!==void 0?c:0,re=T+oe,ve=H3(G,B,W,x,S,T,re,A,q);return mn.createElement(P,ee,mn.createElement(Z,_,!S&&U,I({rows:ve,stylesheet:p,useInlineStyles:C})))}}const Jv=/[#.]/g;function $3(e,r){const i=e||"",s={};let c=0,u,f;for(;c<i.length;){Jv.lastIndex=c;const l=Jv.exec(i),d=i.slice(c,l?l.index:i.length);d&&(u?u==="#"?s.id=d:Array.isArray(s.className)?s.className.push(d):s.className=[d]:f=d,c+=d.length),l&&(u=l[0],c++)}return{type:"element",tagName:f||r||"div",properties:s,children:[]}}function m0(e,r,i){const s=i?V3(i):void 0;function c(u,f,...l){let d;if(u==null){d={type:"root",children:[]};const p=f;l.unshift(p)}else{d=$3(u,r);const p=d.tagName.toLowerCase(),g=s?s.get(p):void 0;if(d.tagName=g||p,q3(f))l.unshift(f);else for(const[m,b]of Object.entries(f))W3(e,d.properties,m,b)}for(const p of l)jh(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,i=Object.keys(e);for(const s of i){const c=r[s];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 W3(e,r,i,s){const c=uy(e,i);let u;if(s!=null){if(typeof s=="number"){if(Number.isNaN(s))return;u=s}else typeof s=="boolean"?u=s:typeof s=="string"?c.spaceSeparated?u=uv(s):c.commaSeparated?u=sv(s):c.commaOrSpaceSeparated?u=uv(sv(s).join(" ")):u=eb(c,c.property,s):Array.isArray(s)?u=[...s]:u=c.property==="style"?G3(s):String(s);if(Array.isArray(u)){const f=[];for(const l of u)f.push(eb(c,c.property,l));u=f}c.property==="className"&&Array.isArray(r.className)&&(u=r.className.concat(u)),r[c.property]=u}}function jh(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 i of r)jh(e,i);else if(typeof r=="object"&&"type"in r)r.type==="root"?jh(e,r.children):e.push(r);else throw new Error("Expected node, nodes, or string, got `"+r+"`")}function eb(e,r,i){if(typeof i=="string"){if(e.number&&i&&!Number.isNaN(Number(i)))return Number(i);if((e.boolean||e.overloadedBoolean)&&(i===""||so(i)===so(r)))return!0}return i}function G3(e){const r=[];for(const[i,s]of Object.entries(e))r.push([i,s].join(": "));return r.join("; ")}function V3(e){const r=new Map;for(const i of e)r.set(i.toLowerCase(),i);return r}const K3=["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"],Y3=m0(dy,"div");m0(uc,"g",K3);const X3=["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"],tb={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 g0(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=48&&r<=57}function Z3(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=102||r>=65&&r<=70||r>=48&&r<=57}function Q3(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=122||r>=65&&r<=90}function nb(e){return Q3(e)||g0(e)}const J3=["","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 eA(e,r){const i={},s=typeof i.additional=="string"?i.additional.charCodeAt(0):i.additional,c=[];let u=0,f=-1,l="",d,p;i.position&&("start"in i.position||"indent"in i.position?(p=i.position.indent,d=i.position.start):d=i.position);let g=(d?d.line:0)||1,m=(d?d.column:0)||1,b=k(),_;for(u--;++u<=e.length;)if(_===10&&(m=(p?p[f]:0)||1),_=e.charCodeAt(u),_===38){const x=e.charCodeAt(u+1);if(x===9||x===10||x===12||x===32||x===38||x===60||Number.isNaN(x)||s&&x===s){l+=String.fromCharCode(_),m++;continue}const v=u+1;let S=v,j=v,T;if(x===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 B=T==="named"?nb:T==="decimal"?g0:Z3;for(j--;++j<=e.length;){const W=e.charCodeAt(j);if(!B(W))break;A+=String.fromCharCode(W),T==="named"&&X3.includes(A)&&(N=A,D=oo(A))}let O=e.charCodeAt(j)===59;if(O){j++;const W=T==="named"?oo(A):!1;W&&(N=A,D=W)}let q=1+j-v,V="";if(!(!O&&i.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(i.attribute){const I=e.charCodeAt(j);I===61?(C(W,q),D=""):nb(I)?D="":C(W,q)}else C(W,q)}V=D}else{O||C(2,q);let W=Number.parseInt(A,T==="hexadecimal"?16:10);if(tA(W))C(7,q),V="�";else if(W in tb)C(6,q),V=tb[W];else{let I="";nA(W)&&C(6,q),W>65535&&(W-=65536,I+=String.fromCharCode(W>>>10|55296),W=56320|W&1023),V=I+String.fromCharCode(W)}}if(V){y(),b=k(),u=j-1,m+=j-v+1,c.push(V);const W=k();W.offset++,i.reference&&i.reference.call(i.referenceContext||void 0,V,{start:b,end:W},e.slice(v-1,j)),b=W}else A=e.slice(v-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 k(){return{line:g,column:m,offset:u+((d?d.offset:0)||0)}}function C(x,v){let S;i.warning&&(S=k(),S.column+=v,S.offset+=v,i.warning.call(i.warningContext||void 0,J3[x],S,x))}function y(){l&&(c.push(l),i.text&&i.text.call(i.textContext||void 0,l,{start:b,end:k()}),l="")}}function tA(e){return e>=55296&&e<=57343||e>1114111}function nA(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 rA=0,zl={},nn={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++rA}),e.__id},clone:function e(r,i){i=i||{};var s,c;switch(nn.util.type(r)){case"Object":if(c=nn.util.objId(r),i[c])return i[c];s={},i[c]=s;for(var u in r)r.hasOwnProperty(u)&&(s[u]=e(r[u],i));return s;case"Array":return c=nn.util.objId(r),i[c]?i[c]:(s=[],i[c]=s,r.forEach(function(f,l){s[l]=e(f,i)}),s);default:return r}}},languages:{plain:zl,plaintext:zl,text:zl,txt:zl,extend:function(e,r){var i=nn.util.clone(nn.languages[e]);for(var s in r)i[s]=r[s];return i},insertBefore:function(e,r,i,s){s=s||nn.languages;var c=s[e],u={};for(var f in c)if(c.hasOwnProperty(f)){if(f==r)for(var l in i)i.hasOwnProperty(l)&&(u[l]=i[l]);i.hasOwnProperty(f)||(u[f]=c[f])}var d=s[e];return s[e]=u,nn.languages.DFS(nn.languages,function(p,g){g===d&&p!=e&&(this[p]=u)}),u},DFS:function e(r,i,s,c){c=c||{};var u=nn.util.objId;for(var f in r)if(r.hasOwnProperty(f)){i.call(r,f,r[f],s||f);var l=r[f],d=nn.util.type(l);d==="Object"&&!c[u(l)]?(c[u(l)]=!0,e(l,i,null,c)):d==="Array"&&!c[u(l)]&&(c[u(l)]=!0,e(l,i,f,c))}}},plugins:{},highlight:function(e,r,i){var s={code:e,grammar:r,language:i};if(nn.hooks.run("before-tokenize",s),!s.grammar)throw new Error('The language "'+s.language+'" has no grammar.');return s.tokens=nn.tokenize(s.code,s.grammar),nn.hooks.run("after-tokenize",s),to.stringify(nn.util.encode(s.tokens),s.language)},tokenize:function(e,r){var i=r.rest;if(i){for(var s in i)r[s]=i[s];delete r.rest}var c=new iA;return ql(c,c.head,e),x0(e,c,r,c.head,0),aA(c)},hooks:{all:{},add:function(e,r){var i=nn.hooks.all;i[e]=i[e]||[],i[e].push(r)},run:function(e,r){var i=nn.hooks.all[e];if(!(!i||!i.length))for(var s=0,c;c=i[s++];)c(r)}},Token:to};function to(e,r,i,s){this.type=e,this.content=r,this.alias=i,this.length=(s||"").length|0}function rb(e,r,i,s){e.lastIndex=r;var c=e.exec(i);if(c&&s&&c[1]){var u=c[1].length;c.index+=u,c[0]=c[0].slice(u)}return c}function x0(e,r,i,s,c,u){for(var f in i)if(!(!i.hasOwnProperty(f)||!i[f])){var l=i[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 k=p.pattern.toString().match(/[imsuy]*$/)[0];p.pattern=RegExp(p.pattern.source,k+"g")}for(var C=p.pattern||p,y=s.next,x=c;y!==r.tail&&!(u&&x>=u.reach);x+=y.value.length,y=y.next){var v=y.value;if(r.length>e.length)return;if(!(v instanceof to)){var S=1,j;if(b){if(j=rb(C,x,e,m),!j||j.index>=e.length)break;var A=j.index,T=j.index+j[0].length,N=x;for(N+=y.value.length;A>=N;)y=y.next,N+=y.value.length;if(N-=y.value.length,x=N,y.value instanceof to)continue;for(var D=y;D!==r.tail&&(N<T||typeof D.value=="string");D=D.next)S++,N+=D.value.length;S--,v=e.slice(x,N),j.index-=x}else if(j=rb(C,0,v,m),!j)continue;var A=j.index,B=j[0],O=v.slice(0,A),q=v.slice(A+B.length),V=x+v.length;u&&V>u.reach&&(u.reach=V);var W=y.prev;O&&(W=ql(r,W,O),x+=O.length),sA(r,W,S);var I=new to(f,g?nn.tokenize(B,g):B,_,B);if(y=ql(r,W,I),q&&ql(r,y,q),S>1){var F={cause:f+","+d,reach:V};x0(e,r,i,y.prev,x,F),u&&F.reach>u.reach&&(u.reach=F.reach)}}}}}}function iA(){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 ql(e,r,i){var s=r.next,c={value:i,prev:r,next:s};return r.next=c,s.prev=c,e.length++,c}function sA(e,r,i){for(var s=r.next,c=0;c<i&&s!==e.tail;c++)s=s.next;r.next=s,s.prev=r,e.length-=c}function aA(e){for(var r=[],i=e.head.next;i!==e.tail;)r.push(i.value),i=i.next;return r}const v0=nn;function b0(){}b0.prototype=v0;const Qt=new b0;Qt.highlight=oA;Qt.register=lA;Qt.alias=cA;Qt.registered=uA;Qt.listLanguages=dA;Qt.util.encode=hA;Qt.Token.stringify=Nh;function oA(e,r){if(typeof e!="string")throw new TypeError("Expected `string` for `value`, got `"+e+"`");let i,s;if(r&&typeof r=="object")i=r;else{if(s=r,typeof s!="string")throw new TypeError("Expected `string` for `name`, got `"+s+"`");if(Object.hasOwn(Qt.languages,s))i=Qt.languages[s];else throw new Error("Unknown language: `"+s+"` is not registered")}return{type:"root",children:v0.highlight.call(Qt,e,i,s)}}function lA(e){if(typeof e!="function"||!e.displayName)throw new Error("Expected `function` for `syntax`, got `"+e+"`");Object.hasOwn(Qt.languages,e.displayName)||e(Qt)}function cA(e,r){const i=Qt.languages;let s={};typeof e=="string"?r&&(s[e]=r):s=e;let c;for(c in s)if(Object.hasOwn(s,c)){const u=s[c],f=typeof u=="string"?[u]:u;let l=-1;for(;++l<f.length;)i[f[l]]=i[c]}}function uA(e){if(typeof e!="string")throw new TypeError("Expected `string` for `aliasOrLanguage`, got `"+e+"`");return Object.hasOwn(Qt.languages,e)}function dA(){const e=Qt.languages,r=[];let i;for(i in e)Object.hasOwn(e,i)&&typeof e[i]=="object"&&r.push(i);return r}function Nh(e,r){if(typeof e=="string")return{type:"text",value:e};if(Array.isArray(e)){const s=[];let c=-1;for(;++c<e.length;)e[c]!==null&&e[c]!==void 0&&e[c]!==""&&s.push(Nh(e[c],r));return s}const i={attributes:{},classes:["token",e.type],content:Nh(e.content,r),language:r,tag:"span",type:e.type};return e.alias&&i.classes.push(...typeof e.alias=="string"?[e.alias]:e.alias),Qt.hooks.run("wrap",i),Y3(i.tag+"."+i.classes.join("."),fA(i.attributes),i.content)}function hA(e){return e}function fA(e){let r;for(r in e)Object.hasOwn(e,r)&&(e[r]=eA(e[r]));return e}var pt=U3(Qt,{});pt.registerLanguage=function(e,r){return Qt.register(r)};pt.alias=function(e,r){return Qt.alias(e,r)};qi.displayName="markup";qi.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function qi(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(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(i,s){var c={};c["language-"+s]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:e.languages[s]},c.cdata=/^<!\[CDATA\[|\]\]>$/i;var u={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:c}};u["language-"+s]={pattern:/[\s\S]+/,inside:e.languages[s]};var f={};f[i]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return i}),"i"),lookbehind:!0,greedy:!0,inside:u},e.languages.insertBefore("markup","cdata",f)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(r,i){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:[i,"language-"+i],inside:e.languages[i]},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}gc.displayName="css";gc.aliases=[];function gc(e){(function(r){var i=/(?:"(?:\\(?:\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+"|"+i.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\\((?:"+i.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+i.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+i.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:i,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 s=r.languages.markup;s&&(s.tag.addInlined("style","css"),s.tag.addAttribute("style","css"))})(e)}Wi.displayName="clike";Wi.aliases=[];function Wi(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:/[{}[\];(),.:]/}}vo.displayName="javascript";vo.aliases=["js"];function vo(e){e.register(Wi),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}rf.displayName="sql";rf.aliases=[];function rf(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:/[;[\]()`,.]/}}xc.displayName="c";xc.aliases=[];function xc(e){e.register(Wi),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}sf.displayName="cpp";sf.aliases=[];function sf(e){e.register(xc),(function(r){var i=/\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/,s=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,function(){return i.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 i.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:i,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 s})+")"),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)}af.displayName="bash";af.aliases=["sh","shell"];function af(e){(function(r){var i="\\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",s={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},c={bash:s,environment:{pattern:RegExp("\\$"+i),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("(\\{)"+i),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;|&]|[<>]\\()"+i),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:s}},{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("\\$?"+i),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}},s.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)}of.displayName="yaml";of.aliases=["yml"];function of(e){(function(r){var i=/[*&][^\s[\]{},]+/,s=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,c="(?:"+s.source+"(?:[ ]+"+i.source+")?|"+i.source+"(?:[ ]+"+s.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:s,important:i,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},r.languages.yml=r.languages.yaml})(e)}lf.displayName="markdown";lf.aliases=["md"];function lf(e){e.register(qi),(function(r){var i=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function s(l){return l=l.replace(/<inner>/g,function(){return i}),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:s(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:s(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:s(/(~~?)(?:(?!~)<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:s(/!?\[(?:(?!\])<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],k=b.content[3];if(_&&k&&_.type==="code-language"&&k.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;k.alias?typeof k.alias=="string"?k.alias=[k.alias,y]:k.alias.push(y):k.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 k="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);l.attributes.id=k,r.plugins.autoloader.loadLanguages(d,function(){var C=document.getElementById(k);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)}cf.displayName="ruby";cf.aliases=["rb"];function cf(e){e.register(Wi),(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 i={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 s="(?:"+[/([^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+s+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:i,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:i,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+s),greedy:!0,inside:{interpolation:i,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:i,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:i,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+s),greedy:!0,inside:{interpolation:i,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:i,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)}uf.displayName="diff";uf.aliases=[];function uf(e){(function(r){r.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var i={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(i).forEach(function(s){var c=i[s],u=[];/^\w+$/.test(s)||u.push(/\w+/.exec(s)[0]),s==="diff"&&u.push("bold"),r.languages.diff[s]={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(s)[0]}}}}),Object.defineProperty(r.languages.diff,"PREFIXES",{value:i})})(e)}df.displayName="docker";df.aliases=["dockerfile"];function df(e){(function(r){var i=/\\[\r\n](?:\s|\\[\r\n]|#.*(?!.))*(?![\s#]|\\[\r\n])/.source,s=/(?:[ \t]+(?![ \t])(?:<SP_BS>)?|<SP_BS>)/.source.replace(/<SP_BS>/g,function(){return i}),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 s}),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)}hf.displayName="go";hf.aliases=[];function hf(e){e.register(Wi),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"]}ff.displayName="graphql";ff.aliases=[];function ff(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(i){if(i.language!=="graphql")return;var s=i.tokens.filter(function(y){return typeof y!="string"&&y.type!=="comment"&&y.type!=="scalar"}),c=0;function u(y){return s[c+y]}function f(y,x){x=x||0;for(var v=0;v<y.length;v++){var S=u(v+x);if(!S||S.type!==y[v])return!1}return!0}function l(y,x){for(var v=1,S=c;S<s.length;S++){var j=s[S],T=j.content;if(j.type==="punctuation"&&typeof T=="string"){if(y.test(T))v++;else if(x.test(T)&&(v--,v===0))return S}}return-1}function d(y,x){var v=y.alias;v?Array.isArray(v)||(y.alias=v=[v]):y.alias=v=[],v.push(x)}for(;c<s.length;){var p=s[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 k=c;k<_;k++){var C=s[k];C.type==="variable"&&g.indexOf(C.content)>=0&&d(C,"variable-input")}}}}})}pf.displayName="scss";pf.aliases=[];function pf(e){e.register(gc),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}mf.displayName="json";mf.aliases=["webmanifest"];function mf(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}gf.displayName="java";gf.aliases=[];function gf(e){e.register(Wi),(function(r){var i=/\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/,s=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,c={pattern:RegExp(/(^|[^\w.])/.source+s+/[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+s+/[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+s+/[A-Z]\w*\b/.source),lookbehind:!0,inside:c.inside}],keyword:i,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:i,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+s+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:c.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+s+/(?:\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 i.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(e)}vc.displayName="typescript";vc.aliases=["ts"];function vc(e){e.register(vo),(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 i=r.languages.extend("typescript",{});delete i["class-name"],r.languages.typescript["class-name"].inside=i,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:i}}}}),r.languages.ts=r.languages.typescript})(e)}xf.displayName="python";xf.aliases=["py"];function xf(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://,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}bc.displayName="jsx";bc.aliases=[];function bc(e){e.register(vo),e.register(qi),(function(r){var i=r.util.clone(r.languages.javascript),s=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,c=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,u=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function f(p,g){return p=p.replace(/<S>/g,function(){return s}).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",i),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=i.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 k=l(b);m<p.length-1&&(typeof p[m+1]=="string"||p[m+1].type==="plain-text")&&(k+=l(p[m+1]),p.splice(m+1,1)),m>0&&(typeof p[m-1]=="string"||p[m-1].type==="plain-text")&&(k=l(p[m-1])+k,p.splice(m-1,1),m--),p[m]=new r.Token("plain-text",k,null,k)}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)}vf.displayName="tsx";vf.aliases=[];function vf(e){e.register(bc),e.register(vc),(function(r){var i=r.util.clone(r.languages.typescript);r.languages.tsx=r.languages.extend("jsx",i),delete r.languages.tsx.parameter,delete r.languages.tsx["literal-property"];var s=r.languages.tsx.tag;s.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+s.pattern.source+")",s.pattern.flags),s.lookbehind=!0})(e)}bf.displayName="rust";bf.aliases=[];function bf(e){(function(r){for(var i=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,s=0;s<2;s++)i=i.replace(/<self>/g,function(){return i});i=i.replace(/<self>/g,function(){return/[^\s\S]/.source}),r.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+i),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)}yf.displayName="toml";yf.aliases=[];function yf(e){(function(r){var i=/(?:[\w-]+|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*")/.source;function s(c){return c.replace(/__/g,function(){return i})}r.languages.toml={comment:{pattern:/#.*/,greedy:!0},table:{pattern:RegExp(s(/(^[\t ]*\[\s*(?:\[\s*)?)__(?:\s*\.\s*__)*(?=\s*\])/.source),"m"),lookbehind:!0,greedy:!0,alias:"class-name"},key:{pattern:RegExp(s(/(^[\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 Wl={'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",vc);pt.registerLanguage("javascript",vo);pt.registerLanguage("tsx",vf);pt.registerLanguage("jsx",bc);pt.registerLanguage("python",xf);pt.registerLanguage("bash",af);pt.registerLanguage("json",mf);pt.registerLanguage("css",gc);pt.registerLanguage("html",qi);pt.registerLanguage("markup",qi);pt.registerLanguage("xml",qi);pt.registerLanguage("sql",rf);pt.registerLanguage("yaml",of);pt.registerLanguage("markdown",lf);pt.registerLanguage("diff",uf);pt.registerLanguage("rust",bf);pt.registerLanguage("go",hf);pt.registerLanguage("java",gf);pt.registerLanguage("c",xc);pt.registerLanguage("cpp",sf);pt.registerLanguage("ruby",cf);pt.registerLanguage("toml",yf);pt.registerLanguage("scss",pf);pt.registerLanguage("graphql",ff);pt.registerLanguage("docker",df);function y0(e=2e3){const[r,i]=H.useState(!1),s=H.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)}i(!0),setTimeout(()=>i(!1),e)}catch(u){console.error("Failed to copy:",u)}},[e]);return{copied:r,copy:s}}const pA={code({className:e,children:r,...i}){const s=/language-(\w+)/.exec(e||"");if(!s&&!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",...i,children:r});const u=(s==null?void 0:s[1])||"text",f=String(r).replace(/\n$/,""),{copied:l,copy:d}=y0();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(ic,{})})]}),o.jsx("div",{className:"overflow-x-auto",children:o.jsx(pt,{style:Wl,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})}},Gi=H.memo(function({content:r,className:i=""}){const s=H.useMemo(()=>{let c=mA(r);return c=gA(c),c},[r]);return o.jsx("div",{className:`markdown-content [&_li>p]:inline ${i}`,children:o.jsx(aN,{remarkPlugins:[b3],components:pA,children:s})})});function mA(e){let r=e.replace(/^(\s*)•\s/gm,"$1- ");return r=r.replace(/^(\d+)\.\s*\n(?=\S)/gm,"$1. "),r}function gA(e){const r=/```/g,i=e.match(r);if(((i==null?void 0:i.length)??0)%2===1){const c=e.lastIndexOf("```");return e.slice(c+3).includes(`
|
|
128
|
-
`),e+"\n```"}return e}const xA=H.memo(function({content:r,variant:i="default"}){return i==="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(Gi,{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 _0({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 vA={...Wl,'pre[class*="language-"]':{...Wl['pre[class*="language-"]'],background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word",overflowX:"hidden"},'code[class*="language-"]':{...Wl['code[class*="language-"]'],background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"}},bA={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 yc(e){var c;if(!e)return"text";const r=e.split("/").pop()??"",i=r.toLowerCase();if(i==="dockerfile")return"docker";if(i==="makefile")return"makefile";if(i==="cmakelists.txt")return"cmake";const s=(c=r.split(".").pop())==null?void 0:c.toLowerCase();return s?bA[s]??"text":"text"}const S0={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},yA={...S0,display:"inline"},_A={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},uo=H.memo(function({code:r,language:i,variant:s}){const c=s==="inline"?"span":s==="block-nowrap"?"div":"pre",u=s==="inline"?yA:s==="block-nowrap"?S0:_A;return o.jsx(pt,{style:vA,language:i,PreTag:c,customStyle:u,children:r})});function w0({src:e,alt:r,isOpen:i,onClose:s}){return i?o.jsx(At,{isOpen:i,onClose:s,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 SA=H.memo(function({oldString:r,newString:i,filePath:s}){const c=H.useMemo(()=>yc(s),[s]),u=r.split(`
|
|
129
|
-
`),f=i.split(`
|
|
130
|
-
`),l=r.length>0,d=i.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(uo,{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(uo,{code:i,language:c,variant:"block-nowrap"})})]})]})}),wA=H.memo(function({content:r,filePath:i}){const s=H.useMemo(()=>yc(i),[i]);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(uo,{code:r,language:s,variant:"block"})})]})})}),CA=H.memo(function({regions:r,filePath:i}){const s=H.useMemo(()=>yc(i),[i]);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(kA,{region:c,language:s},u))})}),kA=H.memo(function({region:r,language:i}){const s=EA(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:s.map((f,l)=>o.jsx(jA,{item:f,language:i,lineNumWidth:u},l))})});function EA(e){const r=[];for(const i of e.beforeContext)r.push({type:"context",lineNumber:i.lineNumber,content:i.content});for(const i of e.edits){const s=i.oldContent.split(`
|
|
132
|
-
`);for(let u=0;u<s.length;u++)r.push({type:"removed",lineNumber:i.startLine+u,content:s[u]});const c=i.newContent.split(`
|
|
133
|
-
`);for(let u=0;u<c.length;u++)r.push({type:"added",lineNumber:i.startLine+u,content:c[u]})}for(const i of e.afterContext)r.push({type:"context",lineNumber:i.lineNumber,content:i.content});return r}const jA=H.memo(function({item:r,language:i,lineNumWidth:s}){const c=String(r.lineNumber).padStart(s," "),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(uo,{code:r.content||" ",language:i,variant:"inline"})})]})}),NA=H.memo(function({result:r,metadata:i,filePath:s,heightExpanded:c=!1}){const[u,f]=H.useState(!1),l=H.useMemo(()=>yc(s),[s]),d=i==null?void 0:i.mimeType,p=i==null?void 0:i.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:s,className:"max-w-full max-h-[45vh] object-contain"})}),o.jsx(w0,{src:b,alt:s,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 k=b.match(/^(\d+): /);return o.jsx("div",{className:"leading-[1.5rem]",children:k?k[1]:_+1},_)})}),o.jsx("div",{className:"min-w-0 overflow-x-hidden py-0.5",children:o.jsx(uo,{code:m,language:l,variant:"block"})})]})})}),TA={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"}},ib=H.memo(function({diagnostics:r}){if(r.length===0)return null;const i=r.filter(u=>u.severity==="error"),s=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"}),i.length>0&&o.jsxs("span",{className:"text-xs text-accent-error font-medium",children:[i.length," error",i.length!==1?"s":""]}),s.length>0&&o.jsxs("span",{className:"text-xs text-accent-warning font-medium",children:[s.length," warning",s.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=TA[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)})})]})}),AA=H.memo(function({command:r,timeout:i,startedAt:s,streamingOutput:c,status:u,result:f,error:l,durationMs:d}){const p=H.useRef(null),[g,m]=H.useState(0);H.useEffect(()=>{p.current&&u==="pending"&&(p.current.scrollTop=p.current.scrollHeight)},[c,u]),H.useEffect(()=>{if(u!=="pending"||!s)return;const C=setInterval(()=>{m(Date.now()-s)},100);return()=>clearInterval(C)},[u,s]);const b=i/1e3,_=u==="pending"?g/1e3:(d??0)/1e3,k=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/i*100)}%`}})}),(k||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:io(C.content)},y)):io(k)}),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 DA(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 LA({confirmation:e}){const r=Ce(g=>g.confirmPath),i=Ce(g=>g.currentSession),s=Ce(g=>g.switchDangerLevel),{title:c,description:u}=DA(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=()=>{i!=null&&i.id&&s("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(Ub,{}),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-white 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 RA(e,r){if(e==="read_file"){const s=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?`${s} [${f.join(", ")}]`:s}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 s=String(r.content??"");return s.length>60?s.slice(0,60)+"...":s}const i=JSON.stringify(r);return i.length>50?i.slice(0,50)+"...":i}function sb(e,r,i){return RA(e,r)}function OA(e){return JSON.stringify(e,null,2)}const MA={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}},IA=H.memo(function({tool:r,args:i,status:s,variant:c="compact",forceCompact:u,result:f,error:l,durationMs:d,diagnostics:p,editContext:g,startedAt:m,streamingOutput:b,metadata:_,callId:k}){const C=r==="edit_file"||r==="write_file",y=r==="run_command"&&s==="pending",x=r==="read_file",S=u?!1:C||y||r==="return_value",[j,T]=H.useState(S),N=MA[s],D=Ce(B=>B.pendingPathConfirmation),A=s==="pending"&&D&&k&&D.callId===k?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(_0,{tool:r}),o.jsx("span",{className:"text-accent-primary font-medium",children:r}),o.jsx("span",{className:"text-text-muted truncate flex-1",children:sb(r,i)}),o.jsx("span",{className:`${N.color} ${N.animate?"animate-pulse":""}`,children:s==="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:sb(r,i)}),o.jsx("span",{className:"text-text-muted text-xs",children:j?"▼":"▶"})]}),A&&o.jsx(LA,{confirmation:A}),(j||x)&&o.jsxs("div",{className:"p-2 bg-primary border-t border-border space-y-2 min-w-0",children:[r==="run_command"&&o.jsx(AA,{command:String(i.command??""),timeout:i.timeout??12e4,startedAt:m,streamingOutput:b,status:s,result:f,error:l,durationMs:d}),r==="edit_file"&&s==="success"&&o.jsxs(o.Fragment,{children:[g&&g.regions.length>0?o.jsx(CA,{regions:g.regions,filePath:String(i.path??"")}):o.jsx(SA,{oldString:String(i.old_string??""),newString:String(i.new_string??""),filePath:String(i.path??"")}),p&&p.length>0&&o.jsx(ib,{diagnostics:p})]}),r==="write_file"&&s==="success"&&o.jsxs(o.Fragment,{children:[o.jsx(wA,{content:String(i.content??""),filePath:String(i.path??"")}),p&&p.length>0&&o.jsx(ib,{diagnostics:p})]}),r==="read_file"&&s==="success"&&o.jsx(NA,{result:f,metadata:_,filePath:String(i.path??""),heightExpanded:j}),r==="return_value"&&(()=>{const B=(b==null?void 0:b.map(q=>q.content).join(""))??"",O=s==="pending"&&B?B:String(i.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(Gi,{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:OA(i)})]}),s==="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"})]})]}),s==="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"]}),s==="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})]})]})]})}),BA={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 zA(e){return BA[e]??`Preparing ${e}`}const HA=H.memo(function({name:r}){const i=zA(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(_0,{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:[i,"..."]})]})})}),PA={pending:{icon:"○",color:"text-text-muted"},in_progress:{icon:"●",color:"text-accent-warning",animate:!0},completed:{icon:"✓",color:"text-accent-success"}},FA=H.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((i,s)=>{const c=PA[i.status];return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${s>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 ${i.status==="completed"?"text-text-muted":"text-text-primary"}`,children:i.content})]},s)})})]}):o.jsx("div",{className:"text-xs text-accent-warning italic my-1",children:"⚠️ Invalid todos data"})}),ab={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"}},C0=H.memo(function({toolCalls:r,criteria:i}){if(r.length===0)return null;const s=new Map((i==null?void 0:i.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(Gi,{content:`[${l.id}] ${l.description}`})})]},l.id??d))}catch{return r.map((f,l)=>o.jsx(ob,{tc:f,index:l,criteriaMap:s},f.id??l))}})():r.map((u,f)=>o.jsx(ob,{tc:u,index:f,criteriaMap:s},u.id??f))})]})});function ob({tc:e,index:r,criteriaMap:i}){const s=e.arguments.action,c=s&&ab[s]?ab[s]:{icon:"○",color:"text-text-muted"},u=e.arguments,f=s==="remove",l=u.id,d=u.description,p=l?i.get(l):void 0,g=d??(p==null?void 0:p.description)??(f&&l?`[${l}]`:"Criterion updated"),m=u.reason,b=s==="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(Gi,{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 UA(e){return e==="criterion"}const $A="#6b7280";function Jl(e,r){var i;return((i=e.find(s=>s.id===r))==null?void 0:i.color)??$A}const Nt=er(e=>{const r=async()=>{await Mh("/api/agents",e)};return{defaults:[],userItems:[],loading:!1,fetchAgents:r,fetchAgent:async i=>{try{const s=await ke(`/api/agents/${i}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async i=>{try{const s=await ke(`/api/agents/defaults/${i}`);return s.ok?await s.json():null}catch{return null}},createAgent:async i=>{const s=await mi("POST","/api/agents",i);return s.success&&await r(),s},updateAgent:async(i,s)=>{const c=await mi("PUT",`/api/agents/${i}`,s);return c.success&&await r(),c},deleteAgent:async i=>{try{const s=await ke(`/api/agents/${i}`,{method:"DELETE"}),c=await s.json();return s.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==i)})),{success:!0}):{success:!1,error:c.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateAgent:async i=>{try{const s=await ke(`/api/agents/${i}/duplicate`,{method:"POST"}),c=await s.json();return s.ok?(await r(),{success:!0}):{success:!1,error:c.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}});function qA(e){const r=[];let i=[];const s=()=>{i.length>0&&(r.push({type:"criteria_group",toolCalls:i}),i=[])};for(const c of e)c.type==="tool_call"&&UA(c.toolCall.name)?i.push(c.toolCall):(s(),r.push(c));return s(),r}function WA(e,r){if(e.segments&&e.segments.length>0)return GA(e.segments,e.toolCalls??[],e.preparingToolCalls??[],e.stats,r);const i=[];if(e.thinkingContent&&i.push({type:"thinking",content:e.thinkingContent}),e.content&&i.push({type:"text",content:e.content}),e.toolCalls)for(const s of e.toolCalls)i.push({type:"tool_call",toolCall:s});if(e.preparingToolCalls)for(const s of e.preparingToolCalls)i.push({type:"preparing_tool_call",preparing:s});return r&&e.stats&&i.push({type:"stats",stats:e.stats}),i}function GA(e,r,i,s,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 i)u.push({type:"preparing_tool_call",preparing:l});return c&&s&&u.push({type:"stats",stats:s}),u}const _f=H.memo(function({message:r,showStats:i=!0,showThinking:s=!0,showVerboseToolOutput:c=!0}){const u=Ce(b=>{var _;return(_=b.currentSession)==null?void 0:_.criteria}),f=Nt(b=>b.defaults),l=Nt(b=>b.userItems),d=[...f,...l],p=WA(r,i),g=s?p:p.filter(b=>b.type!=="thinking"),m=qA(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 k,C;switch(b.type){case"thinking":return o.jsx(xA,{content:b.content},_);case"text":return o.jsx("div",{className:"prose prose-sm prose-invert max-w-none",children:o.jsx(Gi,{content:b.content})},_);case"preparing_tool_call":return o.jsx(HA,{name:b.preparing.name},`preparing-${b.preparing.index}`);case"tool_call":{const y=b.toolCall,x=y.result;if(y.name==="todo_write"){const j=y.arguments.todos,T=Array.isArray(j)?j:[];return o.jsx(FA,{todos:T},_)}const v=(k=x==null?void 0:x.output)==null?void 0:k.includes("[interrupted by user]"),S=x?v?"interrupted":x.success?"success":"error":"pending";return o.jsx(IA,{tool:y.name,args:y.arguments,status:S,variant:"expandable",forceCompact:!c,result:x==null?void 0:x.output,error:x==null?void 0:x.error,durationMs:x==null?void 0:x.durationMs,diagnostics:x==null?void 0:x.diagnostics,editContext:x==null?void 0:x.editContext,startedAt:y.startedAt,streamingOutput:y.streamingOutput,metadata:x==null?void 0:x.metadata,callId:y.id},_)}case"criteria_group":return o.jsx(C0,{toolCalls:b.toolCalls,criteria:u},_);case"stats":{const y=b.stats,x=((C=y.model.split("/").pop())==null?void 0:C.split("-").slice(0,2).join("-"))??y.model,v=Jl(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:x}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsx("span",{style:{color:v},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(fw,{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(Ub,{}),o.jsx("span",{children:"Aborted"})]})]})})}),jt=er((e,r)=>({defaults:[],userItems:[],activeWorkflowId:"default",loading:!1,templateVariables:[],fetchTemplateVariables:async()=>{try{const s=await(await ke("/api/workflows/template-variables")).json();e({templateVariables:s.variables??[]})}catch{}},fetchWorkflows:async()=>{e({loading:!0});try{const s=await(await ke("/api/workflows")).json();e({defaults:s.defaults??[],userItems:s.userItems??[],activeWorkflowId:s.activeWorkflowId??"default",loading:!1})}catch{e({loading:!1})}},fetchWorkflow:async i=>{try{const s=await ke(`/api/workflows/${i}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async i=>{try{const s=await ke(`/api/workflows/defaults/${i}`);return s.ok?await s.json():null}catch{return null}},createWorkflow:async i=>{const s=await mi("POST","/api/workflows",i);return s.success&&await r().fetchWorkflows(),s},updateWorkflow:async(i,s)=>{const c=await mi("PUT",`/api/workflows/${i}`,s);return c.success&&await r().fetchWorkflows(),c},deleteWorkflow:async i=>{try{const s=await ke(`/api/workflows/${i}`,{method:"DELETE"}),c=await s.json();return s.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==i)})),{success:!0}):{success:!1,error:c.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateWorkflow:async i=>{try{const s=await ke(`/api/workflows/${i}/duplicate`,{method:"POST"}),c=await s.json();return s.ok?(await r().fetchWorkflows(),{success:!0}):{success:!1,error:c.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}));function ec(e,r){const i=parseInt(e.slice(1,3),16),s=parseInt(e.slice(3,5),16),c=parseInt(e.slice(5,7),16);return`rgba(${i},${s},${c},${r})`}function VA(e){if(e<60)return`${e}s`;const r=Math.floor(e/60),i=Math.round(e%60);return i>0?`${r}m ${i}s`:`${r}m`}function KA(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}const YA=H.memo(function({data:r}){var f;const i=jt(l=>l.defaults),s=jt(l=>l.userItems),u=((f=[...i,...s].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:ec(u,.3),backgroundColor:ec(u,.08)},children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(Sw,{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(Va,{label:"Iterations",value:String(r.iterations)}),o.jsx(Va,{label:"Total time",value:VA(r.totalTimeSeconds)}),o.jsx(Va,{label:"Tool calls",value:String(r.totalToolCalls)}),o.jsx(Va,{label:"Tokens",value:KA(r.totalTokensGenerated)}),o.jsx(Va,{label:"Speed",value:r.avgGenerationSpeed>0?`${r.avgGenerationSpeed} tok/s`:"-"})]})]})});function Va({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 XA=H.memo(function({data:r}){var f;const i=jt(l=>l.defaults),s=jt(l=>l.userItems),u=((f=[...i,...s].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:ec(u,.3),backgroundColor:ec(u,.08)},children:[o.jsx(gw,{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 ZA({attachments:e,messageId:r}){const[i,s]=H.useState(null),c=Ce(g=>g.visionFallbackByMessage),u=Ce(g=>g.messages),f=H.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=>{s(g)},d=()=>{s(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)})}),i&&o.jsx(w0,{src:i,alt:"Attached image",isOpen:!0,onClose:d})]})}function QA({isOpen:e,onClose:r,promptContext:i}){const[s,c]=H.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(Os,{title:"User Message",expanded:s.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:i.userMessage||"(empty)"})}),i.messages.length>0&&o.jsx(Os,{title:`Prompt Messages (${i.messages.length})`,expanded:s.messages??!0,onToggle:()=>u("messages"),children:o.jsx("div",{className:"space-y-2",children:i.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(Os,{title:`Tools (${i.tools.length})`,expanded:s.tools??!0,onToggle:()=>u("tools"),children:o.jsxs("div",{className:"space-y-2",children:[i.tools.length===0&&o.jsx("div",{className:"text-sm text-text-muted",children:"No tools sent with this request."}),i.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(Os,{title:"Request Options",expanded:s.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(i.requestOptions,null,2)})}),i.injectedFiles.length>0&&o.jsx(Os,{title:`Injected Files (${i.injectedFiles.length})`,expanded:s.injectedFiles??!0,onToggle:()=>u("injectedFiles"),children:o.jsx("div",{className:"space-y-2",children:i.injectedFiles.map((f,l)=>o.jsx(JA,{file:f,expanded:s[`file-${l}`]??!1,onToggle:()=>u(`file-${l}`)},l))})}),o.jsx(Os,{title:"System Prompt",expanded:s.systemPrompt??!1,onToggle:()=>u("systemPrompt"),badge:`${Math.round(i.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:i.systemPrompt})})]})})}function JA({file:e,expanded:r,onToggle:i}){return o.jsxs("div",{className:"bg-bg-tertiary rounded overflow-hidden",children:[o.jsxs("button",{onClick:i,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 Os({title:e,expanded:r,onToggle:i,badge:s,children:c}){return o.jsxs("div",{className:"border border-border rounded overflow-hidden",children:[o.jsx("button",{onClick:i,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}),s&&o.jsx("span",{className:"text-xs text-text-muted bg-bg-tertiary px-1.5 py-0.5 rounded",children:s})]})}),r&&o.jsx("div",{className:"p-3 border-t border-border",children:c})]})}function e5({content:e,promptContext:r,align:i="right"}){const[s,c]=H.useState(!1),[u,f]=H.useState(!1),[l,d]=H.useState(!1),p=H.useRef(null);H.useEffect(()=>{const b=_=>{p.current&&!p.current.contains(_.target)&&c(!1)};return s&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]);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=i==="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(!s),className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary",title:"Message options",children:o.jsx(Rh,{})}),s&&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(ic,{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(sc,{className:"w-4 h-4"}),"Inspect"]})]})]})]}),r&&o.jsx(QA,{isOpen:u,onClose:()=>f(!1),promptContext:r})]})}function t5({message:e}){const[r,i]=H.useState(!1);if(e.messageKind!=="auto-prompt")return null;const s=e.metadata,c=(s==null?void 0:s.color)??"#6b7280",u=(s==null?void 0:s.name)??"Agent",f=(s==null?void 0:s.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&&i(!0)}),o.jsx("span",{className:p?"":"cursor-pointer hover:text-text-secondary transition-colors",style:{color:c},onClick:()=>!p&&i(!0),children:u}),o.jsx("span",{children:"·"}),o.jsx("span",{className:p?"":"cursor-pointer hover:text-text-secondary transition-colors",onClick:()=>!p&&i(!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:()=>i(!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 n5({message:e,promptContext:r}){const i=e.messageKind==="auto-prompt",s=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(e5,{content:e.content,promptContext:r,align:"right"}),o.jsxs("div",{className:`max-w-[75%] rounded p-2 ${c?s?"bg-teal-500/10 border border-teal-500/30":i?"bg-slate-500/10 border border-slate-500/30":"bg-amber-500/10 border border-amber-500/30":"bg-accent-primary/15 text-neutral-200"}`,children:[c&&o.jsx("span",{className:`text-[10px] block mb-0.5 ${s?"text-teal-400":i?"text-slate-400":"text-amber-400"}`,children:s?"Command":i?"Auto":"System"}),o.jsx("div",{className:`whitespace-pre-wrap text-sm ${c?`${s?"text-teal-200":i?"text-slate-200":"text-amber-200 italic"}`:""}`,children:e.content}),e.attachments&&e.attachments.length>0&&o.jsx(ZA,{attachments:e.attachments,messageId:e.id})]})]})}const k0=H.memo(function({message:r,isLastAssistantMessage:i=!1,promptContext:s}){const c=r.role==="user",u=r.role==="assistant",f=r.role==="system",l=r.role==="tool";if(u)return o.jsx(_f,{message:r,showStats:i});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(XA,{data:d})}catch{}if(r.messageKind==="task-completed")try{const d=JSON.parse(r.content);return o.jsx(YA,{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(t5,{message:r}):c?o.jsx(n5,{message:r,promptContext:s}):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(Gi,{content:r.content})})})});function r5({stats:e,onClose:r}){var i;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(Hl,{label:"Total Time",value:`${e.totalTime.toFixed(1)}s`}),o.jsx(Hl,{label:"Prefill",value:e.prefillTokens>=1e3?`${(e.prefillTokens/1e3).toFixed(1)}k`:String(e.prefillTokens)}),o.jsx(Hl,{label:"Generated",value:e.generationTokens>=1e3?`${(e.generationTokens/1e3).toFixed(1)}k`:String(e.generationTokens)}),o.jsx(Hl,{label:"LLM Calls",value:String(((i=e.llmCalls)==null?void 0:i.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((s,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:[s.ttft.toFixed(2),"s TTFT · ",s.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:[s.promptTokens," → ",s.completionTokens]})]}),o.jsxs("div",{className:"flex flex-wrap gap-x-2 gap-y-1",children:[s.temperature!==void 0&&o.jsx(Pl,{label:"temp",value:s.temperature.toFixed(2)}),s.topP!==void 0&&o.jsx(Pl,{label:"topP",value:s.topP.toFixed(2)}),s.topK!==void 0&&o.jsx(Pl,{label:"topK",value:String(s.topK)}),s.maxTokens!==void 0&&o.jsx(Pl,{label:"maxTok",value:String(s.maxTokens)})]})]})]},c))]})]})})}function Hl({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 Pl({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 E0=(e,r)=>{const i=H.useRef(!0),s=H.useRef(null),[c,u]=H.useState(!0),f=()=>{const l=e.current;l&&(l.scrollTop=l.scrollHeight)};return H.useEffect(()=>{const l=e.current;if(!l)return;const d=_=>{if(_.deltaY>0){requestAnimationFrame(()=>requestAnimationFrame(()=>{l.scrollHeight-l.scrollTop-l.offsetHeight<100&&(i.current=!0,u(!0))}));return}i.current=!1,u(!1)},p=_=>{_.touches[0]&&(s.current=_.touches[0].clientY)},g=_=>{if(s.current===null)return;const k=_.touches[0];if(!k)return;if(k.clientY-s.current>0){i.current=!1,u(!1);return}requestAnimationFrame(()=>requestAnimationFrame(()=>{l.scrollHeight-l.scrollTop-l.offsetHeight<100&&(i.current=!0,u(!0))}))},m=new MutationObserver(()=>{i.current&&requestAnimationFrame(f)}),b=setInterval(()=>{i.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:()=>{i.current=!0,u(!0),f()},isAutoScrollActive:c,setAutoScroll:l=>{i.current=l,u(l),l&&f()}}},i5={verifier:"Verification",code_reviewer:"Code Review",test_generator:"Test Generation",debugger:"Debug"};function s5(e){return{backgroundColor:`${e}20`,color:e,borderColor:`${e}4d`}}function lb(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function a5({contextState:e}){const{currentTokens:r,maxTokens:i,compactionCount:s,dangerZone:c}=e,u=Math.round(r/i*100);return o.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[o.jsxs("span",{className:lb(u,c),children:[Vl(r),"/",Vl(i)]}),o.jsxs("span",{className:lb(u,c),children:["(",u,"%)"]}),o.jsx(ny,{percent:u,dangerZone:c,size:"sm"}),c&&o.jsx("span",{className:"text-accent-error animate-pulse",children:"Low!"}),s>0&&o.jsxs("span",{className:"text-text-muted bg-bg-tertiary px-1 rounded",children:[s,"x"]})]})}const o5=H.memo(function({messages:r,subAgentType:i,subAgentId:s,isStreaming:c}){const u=H.useRef(null),f=H.useRef(null),[l,d]=H.useState(!1),p=Nt(D=>D.defaults),g=Nt(D=>D.userItems),m=[...p,...g],b=Ce(D=>D.subAgentContextStates[s]),{showThinking:_,showVerboseToolOutput:k}=Nb(),{isAutoScrollActive:C,setAutoScroll:y}=E0(f,null);H.useEffect(()=>{c||y(!0)},[c]);const x=H.useCallback(()=>{const D=!l;d(D),D&&setTimeout(()=>{var A;(A=u.current)==null||A.scrollIntoView({block:"start",behavior:"smooth"})},220)},[l]),v=m.find(D=>D.id===i),S=(v==null?void 0:v.name)??i5[i]??i,j=Jl(m,i),T=s5(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(a5,{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:x,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(_f,{message:D,showStats:!0,showThinking:_,showVerboseToolOutput:k},D.id):o.jsx(k0,{message:D,isLastAssistantMessage:!1},D.id))})]})});function l5(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")}function c5({agent:e,isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:c,onDuplicate:u,onDelete:f}){return o.jsxs(Wb,{isBuiltIn:r,isConfirmingDelete:i,onView:s,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 cb({title:e,agents:r,subagents:i,isBuiltIn:s,onView:c,onDuplicate:u,onEdit:f,onDelete:l}){if(r.length===0&&i.length===0)return null;const d=p=>o.jsx(c5,{agent:p,isBuiltIn:s,isConfirmingDelete:!1,onView:()=>c(p.id),onEdit:s?void 0:()=>f==null?void 0:f(p.id),onDuplicate:()=>u(p.id),onDelete:s?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),i.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:i.map(d)})]})]})]})}function u5({isOpen:e,onClose:r,initialEditId:i}){const s=Nt(pe=>pe.defaults),c=Nt(pe=>pe.userItems),u=Nt(pe=>pe.loading),f=Nt(pe=>pe.fetchAgents),l=Nt(pe=>pe.fetchAgent),d=Nt(pe=>pe.fetchDefaultContent),p=Nt(pe=>pe.createAgent),g=Nt(pe=>pe.updateAgent),m=Nt(pe=>pe.deleteAgent),[b,_]=H.useState("list"),[k,C]=H.useState(null),[y,x]=H.useState(!1),[v,S]=H.useState(""),[j,T]=H.useState(""),[N,D]=H.useState(""),[A,B]=H.useState(!0),[O,q]=H.useState([]),[V,W]=H.useState("#6b7280"),[I,F]=H.useState(""),[P,X]=H.useState(""),[Z,z]=H.useState(!1),[R,L]=H.useState([]);function $(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=$(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),B(pe.metadata.subagent),q(pe.metadata.allowedTools),W(pe.metadata.color??"#6b7280"),F(pe.prompt),X("")},G=(pe,Ne,Me)=>{S(pe.metadata.name+" (copy)"),T(`${Ne}-copy-${Date.now()}`),D(pe.metadata.description),B(pe.metadata.subagent),q(pe.metadata.allowedTools),W(pe.metadata.color??"#6b7280"),F(pe.prompt),X(""),C(null),x(!1),_("edit")},oe=(pe,Ne)=>{Y(pe),C(Ne),x(!0),_("edit")};H.useEffect(()=>{e&&(f(),ke("/api/tools").then(pe=>pe.json()).then(pe=>L(pe.tools||[])).catch(()=>L([])),i?s.some(Ne=>Ne.id===i)?d(i).then(Ne=>{Ne&&G(Ne,i)}):l(i).then(Ne=>{Ne&&(Y(Ne),C(i),x(!1),_("edit"))}):(_("list"),C(null),x(!1)))},[e,f,l,d,i]);const re=async pe=>{if(s.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&&G(Ne,pe)},be=()=>{C(null),S(""),T(""),D(""),B(!0),q(["read_file"]),W("#6b7280"),F(""),X(""),x(!1),_("edit")},Le=async pe=>{const Ne=await l(pe);Ne&&(Y(Ne),C(pe),x(!1),_("edit"))},Oe=async pe=>{await m(pe)},ze=async()=>{const pe=k??j;if(!pe||!v||!I){X("Name and prompt are required.");return}z(!0),X("");const Ne={metadata:{id:pe,name:v,description:N,subagent:A,allowedTools:O,color:V},prompt:I},Me=k?await g(k,Ne):await p(Ne);if(z(!1),!Me.success){X(Me.error??"Failed to save agent.");return}i?r():_("list")},We=()=>{i?r():(_("list"),x(!1))},Ee=pe=>{S(pe),k||T(l5(pe))},fe=s.filter(pe=>pe.subagent),je=s.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?`${v}`:k?"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:[P&&o.jsx(Hh,{message:P}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Hi,{label:"Name",value:v,onChange:Ee,placeholder:"My Agent",readOnly:y}),o.jsx(Hi,{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(Hi,{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&&B(!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&&B(!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:V,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:R.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(po,{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&&F(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(Dw,{onCancel:We,onSave:ze,saving:Z,saveDisabled:!v||!I||y}),y&&o.jsx("div",{className:"flex justify-end mt-2",children:o.jsx(it,{variant:"primary",onClick:()=>{S(v+" (copy)"),T(`${k}-copy-${Date.now()}`),C(null),x(!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(it,{variant:"primary",size:"sm",onClick:be,children:"+ New"})})]}),u&&s.length===0&&c.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"Loading agents..."}):s.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:[s.length>0&&o.jsx(cb,{title:"Built-in",agents:je,subagents:fe,isBuiltIn:!0,onView:re,onDuplicate:ve}),c.length>0&&o.jsx(cb,{title:"Custom",agents:It,subagents:Ue,isBuiltIn:!1,onView:re,onDuplicate:ve,onEdit:Le,onDelete:Oe})]})]})}function d5(){const e=Ce(x=>{var v;return(v=x.currentSession)==null?void 0:v.mode}),r=Ce(x=>x.switchMode),i=Nt(x=>x.defaults),s=Nt(x=>x.userItems),c=Nt(x=>x.fetchAgents),u=[...i,...s],[f,l]=H.useState(!1),[d,p]=H.useState(!1),[g,m]=H.useState(null),b=H.useRef(null);if(H.useEffect(()=>{c()},[c]),H.useEffect(()=>{function x(v){b.current&&!b.current.contains(v.target)&&l(!1)}return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[]),!e)return null;const _=u.filter(x=>!x.subagent),k=_.find(x=>x.id===e),C=(k==null?void 0:k.name)??e,y=Jl(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((x,v)=>{const S=x.id===e,j=Jl(u,x.id),T=v<4?`Ctrl+${v+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(x.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:x.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+",v+1]})]},x.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(u5,{isOpen:d,onClose:()=>{p(!1),m(null)},initialEditId:g})]})}function h5(){const e=Ce(s=>s.currentSession),r=Ce(s=>s.switchDangerLevel);if(!e)return null;const i=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 ${i==="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 ${i==="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 f5({question:e}){const r=Ce(f=>f.answerQuestion),[i,s]=H.useState(""),c=()=>{r(e.callId,i)},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:i,onChange:f=>s(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(it,{variant:"secondary",size:"sm",onClick:()=>r(e.callId,""),children:"Skip"}),o.jsx(it,{variant:"primary",size:"sm",onClick:c,children:"Send Answer"})]})]})})}function p5(){const e=Ce(s=>s.connectionStatus),r=Ce(s=>s.reconnect);if(e==="connected")return null;const i=e==="reconnecting";return o.jsxs("div",{className:`
|
|
139
|
-
flex items-center justify-between px-4 py-2
|
|
140
|
-
text-sm font-medium
|
|
141
|
-
${i?"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:i?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(Cw,{}),o.jsx("span",{children:"Connection lost"})]})}),o.jsx("button",{onClick:()=>r(),disabled:i,className:`
|
|
143
|
-
px-3 py-1 rounded text-xs font-medium
|
|
144
|
-
transition-colors
|
|
145
|
-
${i?"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:i?"Reconnecting...":"Reconnect"})]})}function m5(){const e=nw(),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 g5({attachment:e,onRemove:r}){const i=s=>s<1024?`${s} B`:s<1048576?`${(s/1024).toFixed(1)} KB`:`${(s/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(ro,{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:i(e.size)})]})}function x5({history:e,selectedIndex:r,onSelect:i,onEscape:s,onNavigate:c}){const u=H.useRef(null),f=H.useRef(null);H.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]&&i(e[r].content);break;case"Escape":p.preventDefault(),s();break;case"ArrowUp":p.preventDefault(),c("up");break;case"ArrowDown":p.preventDefault(),c("down");break}},d=p=>{i(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=er((e,r)=>({defaults:[],userItems:[],loading:!1,fetchCommands:async()=>{await Mh("/api/commands",e)},fetchCommand:async i=>{try{const s=await ke(`/api/commands/${i}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async i=>{try{const s=await ke(`/api/commands/defaults/${i}`);return s.ok?await s.json():null}catch{return null}},createCommand:async i=>{const s=await mi("POST","/api/commands",i);return s.success&&await r().fetchCommands(),s},updateCommand:async(i,s)=>{const c=await mi("PUT",`/api/commands/${i}`,s);return c.success&&await r().fetchCommands(),c},deleteCommand:async i=>{try{const s=await ke(`/api/commands/${i}`,{method:"DELETE"}),c=await s.json();return s.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==i)})),{success:!0}):{success:!1,error:c.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateCommand:async i=>{try{const s=await ke(`/api/commands/${i}/duplicate`,{method:"POST"}),c=await s.json();return s.ok?(await r().fetchCommands(),{success:!0}):{success:!1,error:c.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}})),v5={maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576};async function b5(e,r={}){const i={...v5,...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<=i.maxSizeBytes){const c=await e.arrayBuffer(),u=E5(c),f=`data:${e.type};base64,${u}`,l=await j0(f);return{dataUrl:f,mimeType:e.type,size:e.size,width:l.width,height:l.height}}return await y5(e,i)}async function y5(e,r){const i=await S5(e),s=await j0(i),{width:c,height:u}=_5(s.width,s.height,r.maxWidth,r.maxHeight),f=w5();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(s,0,0,c,u);let d=r.quality,p;do{if(p=f.toDataURL(e.type.startsWith("image/gif")?"image/png":e.type,d),ub(p)<=r.maxSizeBytes||d<=.3)break;d-=.1}while(!0);const g=ub(p);return{dataUrl:p,mimeType:e.type.startsWith("image/gif")?"image/png":e.type,size:g,width:c,height:u}}function _5(e,r,i,s){const c=e/r;return e>r&&e>i?{width:i,height:Math.round(i/c)}:r>e&&r>s?{width:Math.round(s*c),height:s}:{width:e,height:r}}function S5(e){return new Promise((r,i)=>{const s=k5(),c=new s;c.onload=()=>r(c.result),c.onerror=()=>i(new Error("Failed to read file")),c.readAsDataURL(e)})}function j0(e){return new Promise((r,i)=>{const s=C5(),c=new s;c.onload=()=>r(c),c.onerror=()=>i(new Error("Failed to load image")),c.src=e})}function w5(){var r;const e=Sf();if(!((r=e.document)!=null&&r.createElement))throw new Error("Image compression requires browser canvas APIs");return e.document.createElement("canvas")}function C5(){const e=Sf();if(!e.Image)throw new Error("Image compression requires browser image APIs");return e.Image}function k5(){const e=Sf();if(!e.FileReader)throw new Error("Image compression requires browser file APIs");return e.FileReader}function Sf(){return globalThis}function E5(e){const r=new Uint8Array(e);let i="";for(let s=0;s<r.byteLength;s++){const c=r[s];c!==void 0&&(i+=String.fromCharCode(c))}return btoa(i)}function ub(e){const i=e.split(",")[1];return i?Math.round(i.length*3/4):0}function j5(e){return["image/png","image/jpeg","image/gif"].includes(e.type)}function N5(e,r=50*1024*1024){return e.size>r?{valid:!1,error:`Image file is too large (${db(e.size)}). Maximum size is ${db(r)}.`}:{valid:!0}}function db(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function lh(e,r,i,s={}){const{maxSizeBytes:c=50*1024*1024,filename:u}=s;if(!j5(e)){i(`Unsupported file type: ${e.type}. Only PNG, JPG, and GIF are supported.`);return}const f=N5(e,c);if(!f.valid){i(f.error??"Image file is too large");return}try{const l=await b5(e,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),d={id:Eb(),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";i(d)}}function T5(e){const r={};let i=null;for(const s of e){if(s.role==="user"&&!s.isSystemGenerated){i=s.id;continue}s.role==="assistant"&&s.promptContext&&i&&r[i]===void 0&&(r[i]=s.promptContext)}return r}function ch(e){return{contextWindow:e.contextWindow,temperature:e.temperature??null,topP:e.topP??null,topK:e.topK??null,maxTokens:e.maxTokens??null}}function A5({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 Ka({label:e,value:r,onChange:i,min:s,max:c,step:u=1,helpText:f,defaultValue:l}){const[d,p]=H.useState((r==null?void 0:r.toString())??""),[g,m]=H.useState(r===null);H.useEffect(()=>{p((r==null?void 0:r.toString())??""),m(r===null)},[r]);const b=k=>{if(p(k),k==="")i(null);else{const C=parseFloat(k);isNaN(C)||i(C)}},_=()=>{g?(m(!1),l!==void 0&&(p(l.toString()),i(l))):(m(!0),i(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:s,max:c,step:u,value:d,readOnly:g,onChange:k=>b(k.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 D5({isOpen:e,onClose:r,providerId:i,model:s}){const[c,u]=H.useState(()=>ch(s)),[f,l]=H.useState(!1),d=Lt(m=>m.updateModelSettings);H.useEffect(()=>{u(ch(s))},[s]);const p=async()=>{if(c.contextWindow<1024||c.contextWindow>1e7)return;l(!0);const m=c.temperature!==(s.temperature??null)||c.topP!==(s.topP??null)||c.topK!==(s.topK??null)||c.maxTokens!==(s.maxTokens??null);await d(i,s.id,{contextWindow:c.contextWindow,...m&&{temperature:c.temperature,topP:c.topP,topK:c.topK,maxTokens:c.maxTokens}}),l(!1),r()},g=()=>{u(ch(s)),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(it,{variant:"secondary",onClick:g,disabled:f,children:"Cancel"}),o.jsx(it,{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:s.id})]}),o.jsx(Ka,{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(A5,{label:"Sampling Parameters",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ka,{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(Ka,{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(Ka,{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(Ka,{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:[s.source==="backend"&&"Auto-detected from backend",s.source==="user"&&"Manually set",s.source==="default"&&"Default value"]})]})]})}):null}function L5(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function R5(){var F;const[,e]=gr(),r=Ce(P=>P.currentSession),i=Ce(P=>P.setSessionProvider),[s,c]=H.useState(!1),[u,f]=H.useState([]),[l,d]=H.useState(null),p=H.useRef(null),[g,m]=H.useState(null),b=H.useRef(new Set),_=Lt(P=>P.providers),k=Lt(P=>P.activeProviderId),C=Lt(P=>P.model);Lt(P=>P.backend);const y=Lt(P=>P.llmStatus),x=Lt(P=>P.activating),v=Lt(P=>P.activateProvider),S=Lt(P=>P.refreshModel),j=Lt(P=>P.refreshProviderModels);H.useEffect(()=>{function P(X){p.current&&!p.current.contains(X.target)&&(c(!1),f([]),b.current=new Set)}return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[]),H.useEffect(()=>{if(s){const P=_.map(X=>X.id);f(P),P.forEach(X=>{b.current.has(X)||(b.current.add(X),D(X))})}},[s,_]),_.find(P=>P.id===k);const T=y==="disconnected",N=C?((F=C.split("/").pop())==null?void 0:F.replace(/-/g," "))??C:"detecting...",D=async P=>{d(P);try{await j(P)}catch{}finally{d(null)}},A=P=>{u.includes(P.id)?f(u.filter(X=>X!==P.id)):(f([...u,P.id]),D(P.id))},B=async P=>{if(P.id===k){A(P);return}r?(i(P.id,void 0),Lt.getState().syncFromSession(P.id,""),c(!1),f([])):await v(P.id)&&(c(!1),f([]))},O=P=>{A(P)},q=async(P,X)=>{P.stopPropagation(),b.current.delete(X),await j(X),await D(X)},V=(P,X)=>{m({providerId:P,model:X})},W=()=>{m(null)},I=async(P,X)=>{if(console.log("[ProviderSelector.handleModelClick] providerId:",P,"model:",X),r){console.log("[ProviderSelector.handleModelClick] Calling setSessionProvider"),i(P,X),Lt.getState().syncFromSession(P,X),f([]),c(!1);return}d("activating");try{(await ke(`/api/providers/${P}/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(!s),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:s?180:0})]}),s&&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(P=>{var X;return o.jsxs("div",{children:[o.jsxs("div",{className:`px-3 py-2 flex items-center justify-between ${P.id===k?"bg-bg-tertiary":"hover:bg-bg-tertiary"} ${x?"opacity-50 cursor-wait":"cursor-pointer"}`,children:[o.jsxs("div",{onClick:()=>!x&&B(P),className:"flex flex-col min-w-0 flex-1 cursor-pointer",children:[o.jsx("span",{className:`text-sm font-medium truncate ${P.id===k?"text-accent-primary":"text-text-primary"}`,children:P.name}),o.jsx("span",{className:"text-xs text-text-muted truncate",children:P.backend!=="auto"&&B1(P.backend)})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[P.id===k?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,P.id)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Refresh models",children:o.jsx(vw,{className:`w-4 h-4 ${l===P.id?"animate-spin":""} ${P.id===k?"text-accent-primary":"text-text-muted"}`})}),o.jsx("button",{type:"button",onClick:Z=>{Z.stopPropagation(),O(P)},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(P.id)?"rotate-180":""} ${P.id===k?"text-accent-primary":"text-text-muted"}`})})]})]}),u.includes(P.id)&&o.jsx("div",{className:"bg-bg-primary border-t border-border",children:l===P.id?o.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"Loading models..."}):(X=P.models)!=null&&X.length?P.models.map(Z=>{var z;return o.jsxs("button",{type:"button",onClick:()=>I(P.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:((z=Z.id.split("/").pop())==null?void 0:z.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:L5(Z.contextWindow)}),o.jsx("button",{type:"button",onClick:R=>{R.stopPropagation(),V(P.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(cw,{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"})})]},P.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(D5,{isOpen:!0,onClose:W,providerId:g.providerId,model:g.model})]})}function O5(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function M5({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(sc,{})})}function N0({isOpen:e,onClose:r,initialEditId:i}){const s=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,_]=H.useState(null),[k,C]=H.useState(null),{view:y,editingId:x,formError:v,saving:S,formData:j,setView:T,setEditingId:N,setFormError:D,setFormData:A,setSaving:B}=Kb(),{requestDelete:O,clearConfirm:q,isConfirming:V}=Ih(),W=H.useRef(!1),I=Nt(fe=>fe.defaults),F=Nt(fe=>fe.userItems),P=Nt(fe=>fe.fetchAgents),Z=[...I,...F].filter(fe=>!fe.subagent),z=H.useRef(f),R=H.useRef(P),L=H.useRef(l),$=H.useRef(d),U=H.useRef(i),ne=H.useRef(T),Q=H.useRef(N),ee=H.useRef(D),Y=H.useRef(q);H.useEffect(()=>{z.current=f,R.current=P,L.current=l,$.current=d,U.current=i,ne.current=T,Q.current=N,ee.current=D,Y.current=q}),H.useEffect(()=>{if(e)if(z.current(),R.current(),W.current||(Y.current(),W.current=!0),U.current){const fe=s.some(je=>je.id===U.current);ne.current("edit"),Q.current(U.current),ee.current(""),fe?$.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})}):L.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 G=async fe=>{_(fe);const je=await d(fe);C((je==null?void 0:je.prompt)??null)},oe=async fe=>{if(s.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=x??j.id;if(!fe||!j.name||!j.prompt){D("Name and message are required.");return}B(!0),D("");const je={metadata:{id:fe,name:j.name,...j.agentMode?{agentMode:j.agentMode}:{}},prompt:j.prompt},Ue=x?await g(x,je):await p(je);if(B(!1),!Ue.success){D(Ue.error??"Failed to save command.");return}i?r():T("list")},Oe=()=>{i?r():(T("list"),_(null),C(null))},ze=fe=>{A(je=>({...je,name:fe})),(!x||j.isDefault)&&A(je=>({...je,id:O5(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=s.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:k??"",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(it,{variant:"secondary",onClick:We,children:"Close"}),o.jsx(it,{variant:"primary",onClick:Ee,children:"Duplicate & Customize"})]})]})})}return y==="edit"?o.jsx(At,{isOpen:e,onClose:Oe,title:x?"Edit Command":"New Command",size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[v&&o.jsx(Hh,{message:v}),o.jsxs("div",{className:"space-y-3 mb-3",children:[o.jsx(Vb,{name:j.name,id:j.id,nameLabel:"Name",idLabel:"ID",namePlaceholder:"My Command",idPlaceholder:"my-command",readOnlyId:!!x&&!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(it,{variant:"secondary",onClick:Oe,children:"Cancel"}),o.jsx(it,{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(qb,{description:"Commands are pre-defined messages you can send with a single click.",onNew:re}),o.jsxs(Gb,{loading:u,hasItems:s.length>0||c.length>0,loadingLabel:"Loading commands...",emptyLabel:"No commands created yet.",children:[s.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:s.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(M5,{onClick:()=>G(fe.id)}),o.jsx(no,{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(Fs,{onClick:()=>ve(fe.id)}),o.jsx(no,{onClick:()=>oe(fe.id)}),V(fe.id,"delete")?o.jsx(Bh,{onConfirm:()=>be(fe.id),onCancel:q}):o.jsx(zh,{onClick:()=>O(fe.id)})]})]},fe.id))})]})]})]})}function I5(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function B5(e){let r=1;for(;e.some(i=>i.id===`s${r}`);)r++;return`s${r}`}const z5=[{value:"agent",label:"Agent"},{value:"sub_agent",label:"Sub-Agent"},{value:"shell",label:"Shell"}],T0={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"},A0=[{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)"}],Ii=150,Hr=54,Ms=80,zn=30,Is=70,hb=100,Bi=50,Fl=50,fb=4;function wf(e,r){if(e.type==="agent"){const i=r.find(s=>s.id===e.toolMode);return{name:(i==null?void 0:i.name)??(e.toolMode||"Agent"),color:(i==null?void 0:i.color)||"#3b82f6"}}if(e.type==="sub_agent"){const i=r.find(s=>s.id===e.subAgentType);return{name:(i==null?void 0:i.name)??(e.subAgentType||"Sub-Agent"),color:(i==null?void 0:i.color)||"#a855f7"}}return{name:"Shell",color:"#22c55e"}}function H5(e,r,i,s){const c=Fl+Bi+Ii+hb+Ii+Bi+Fl,u=c/2,f=Fl+Bi+Ii/2,l=Fl+Bi+Ii+hb+Ii/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,k=_?f:u,C=m.length>0?l:u,y=Bi+zn/2;if(d.push({id:"$start",type:"terminal",label:"Start",cx:k,cy:y,w:Ms,h:zn}),g.set("$start",{cx:k,cy:y,w:Ms,h:zn}),e.length===0){const I=y+zn/2+Is*2+zn/2;return d.push({id:"$done",type:"terminal",label:"Done",cx:k,cy:I,w:Ms,h:zn}),g.set("$done",{cx:k,cy:I,w:Ms,h:zn}),{nodes:d,edges:p,width:c,height:I+zn/2+Bi,posMap:g}}const x=y+zn/2+Is,v=(I,F)=>{I.forEach((P,X)=>{const Z=x+X*(Hr+Is)+Hr/2,{name:z,color:R}=wf(P,s);d.push({id:P.id,type:"step",label:z,color:R,cx:F,cy:Z,w:Ii,h:Hr}),g.set(P.id,{cx:F,cy:Z,w:Ii,h:Hr})})};v(m,k),v(b,C);const S=m.length>0?x+(m.length-1)*(Hr+Is)+Hr/2:y,j=_?x+(b.length-1)*(Hr+Is)+Hr/2:y,T=Math.max(S,j)+Hr/2+Is+zn/2;d.push({id:"$done",type:"terminal",label:"Done",cx:k,cy:T,w:Ms,h:zn}),g.set("$done",{cx:k,cy:T,w:Ms,h:zn});const N=[];r&&g.has(r)&&N.push({from:"$start",to:r,label:i,edgeKey:"start",direction:"down",backEdgeIndex:0});let D=0;for(const I of e)I.transitions.forEach((F,P)=>{if(!F.goto||!g.has(F.goto))return;const X=g.get(I.id),Z=g.get(F.goto),z=F.when.type==="step_result"?`${F.when.result}`:T0[F.when.type]??F.when.type,R=I.id===F.goto;let L;R?L="back":Z.cy>X.cy+1?L="down":Z.cy<X.cy-1?L="back":L="same",N.push({from:I.id,to:F.goto,label:z,edgeKey:`${I.id}:${P}`,direction:L,backEdgeIndex:L==="back"?D++:0})});const A=new Map,B=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),B.set(I.to,(B.get(I.to)??0)+1));const V=new Map,W=new Map;for(const I of N){if(I.direction!=="same")continue;const F=[I.from,I.to].sort().join("|");V.set(F,(V.get(F)??0)+1)}for(const I of N){if(I.direction==="back"||I.direction==="same"){let L=0;if(I.direction==="same"){const $=[I.from,I.to].sort().join("|");L=W.get($)??0,W.set($,L+1)}p.push({...I,fromPort:0,toPort:0,sameEdgeIndex:L});continue}const F=A.get(I.from)??1,P=B.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 z=F===1?0:-.6+1.2*X/(F-1),R=P===1?0:-.6+1.2*Z/(P-1);p.push({...I,fromPort:z,toPort:R,sameEdgeIndex:0})}return{nodes:d,edges:p,width:c,height:T+zn/2+Bi,posMap:g}}function P5({steps:e,entryStep:r,selectedNodeId:i,selectedEdgeKey:s,startConditionLabel:c,agentTypes:u,isReadOnly:f,onSelectNode:l,onSelectEdge:d,onRemoveStep:p,onCreateTransition:g,onReconnectTo:m,onReconnectFrom:b,onDeleteTransition:_}){const k=H.useRef(null),C=H.useRef(!1),[y,x]=H.useState(null),[v,S]=H.useState(null),[j,T]=H.useState(null),{nodes:N,edges:D,width:A,height:B,posMap:O}=H.useMemo(()=>H5(e,r,c,u),[e,r,c,u]),q=H.useCallback(Q=>{var re;const ee=k.current;if(!ee)return{x:0,y:0};const Y=ee.createSVGPoint();Y.x=Q.clientX,Y.y=Q.clientY;const G=(re=ee.getScreenCTM())==null?void 0:re.inverse();if(!G)return{x:0,y:0};const oe=Y.matrixTransform(G);return{x:oe.x,y:oe.y}},[]),V=H.useCallback(Q=>!Q||!v||Q==="$start"?!1:v.type==="reconnect-from"?Q!=="$done":!0,[v]),W=H.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=H.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]),F=H.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]),P=H.useCallback(Q=>{if(!v)return;const ee=q(Q);S(Y=>Y?{...Y,mouseX:ee.x,mouseY:ee.y}:null)},[v,q]),X=H.useCallback(()=>{v&&(C.current=!0,j&&V(j)&&(v.type==="new"?g(v.fromNodeId,j):v.type==="reconnect-to"?m(v.edgeKey,j):v.type==="reconnect-from"&&b(v.edgeKey,j)),S(null),T(null))},[v,j,V,g,m,b]),Z=H.useCallback(()=>{if(C.current){C.current=!1;return}l(null),d(null)},[l,d]);H.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")&&s&&s!=="start"&&(ee.preventDefault(),_(s),d(null))};return document.addEventListener("keydown",Q),()=>document.removeEventListener("keydown",Q)},[f,s,_,d]);const z=Q=>{const ee=O.get(Q.from),Y=O.get(Q.to);if(!ee||!Y)return null;let G,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;G=`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;G=`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;G=`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;G=`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:G,labelX:oe,labelY:re,labelAnchor:ve,fromPt:be,toPt:Le}},R=(Q,ee)=>{const Y=z(Q);if(!Y)return null;const{path:G,labelX:oe,labelY:re,labelAnchor:ve}=Y,be=s===Q.edgeKey,Le=Q.label&&!(Q.from==="$start"&&Q.label==="Always");return o.jsxs("g",{children:[o.jsx("path",{d:G,fill:"none",stroke:"transparent",strokeWidth:14,className:"cursor-pointer",onClick:Oe=>{Oe.stopPropagation(),d(be?null:Q.edgeKey)}}),o.jsx("path",{d:G,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)},L=()=>{if(!s||v)return null;const Q=D.find(re=>re.edgeKey===s);if(!Q)return null;const ee=z(Q);if(!ee)return null;const{fromPt:Y,toPt:G}=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=>F(re,Q)}),o.jsx("circle",{cx:G.x,cy:G.y,r:oe,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:re=>I(re,Q)})]})},$=()=>{if(!v)return null;let Q,ee,Y,G;if(v.type==="reconnect-from"){const ve=O.get(v.fixedTargetId);if(!ve)return null;Q=v.mouseX,ee=v.mouseY,Y=ve.cx,G=ve.cy-ve.h/2}else{const ve=O.get(v.fromNodeId);if(!ve)return null;Q=ve.cx,ee=ve.cy+ve.h/2,Y=v.mouseX,G=v.mouseY}const oe=G-ee,re=Math.abs(oe)>10?`M ${Q} ${ee} C ${Q} ${ee+oe*.4}, ${Y} ${G-oe*.4}, ${Y} ${G}`:`M ${Q} ${ee} L ${Y} ${G}`;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=(v==null?void 0:v.fromNodeId)===Q.id;return o.jsx("circle",{cx:Q.cx,cy:ee,r:fb,fill:Y?"#58a6ff":"#1c2128",stroke:Y?"#58a6ff":"#484f58",strokeWidth:1.5,strokeOpacity:Y?1:.5,className:"cursor-crosshair",onMouseDown:G=>W(G,Q.id)})},ne=Q=>{const ee=Q.cy-Q.h/2,Y=v&&j===Q.id&&V(Q.id);return o.jsx("circle",{cx:Q.cx,cy:ee,r:fb,fill:Y?"#3fb950":"#1c2128",stroke:Y?"#3fb950":"#484f58",strokeWidth:1.5,strokeOpacity:Y?1:.5})};return o.jsxs("svg",{ref:k,viewBox:`0 0 ${A} ${B}`,className:"block w-full",preserveAspectRatio:"xMidYMin meet",onMouseMove:P,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)=>R(Q,ee)),N.map(Q=>{const ee=i===Q.id,Y=Q.cx-Q.w/2,G=Q.cy-Q.h/2,oe=y===Q.id,re=v&&j===Q.id&&V(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:G-3,width:Q.w+6,height:Q.h+6,rx:Q.h/2+3,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),be&&s==="start"&&o.jsx("rect",{x:Y-3,y:G-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:G,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:()=>x(Q.id),onMouseLeave:()=>x(null),className:f?void 0:"cursor-pointer",children:[re&&o.jsx("rect",{x:Y-3,y:G-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:G-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:G,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&&!v&&!f&&o.jsxs("g",{onClick:be=>{be.stopPropagation(),p(Q.id)},className:"cursor-pointer",children:[o.jsx("circle",{cx:Y+Q.w-2,cy:G+2,r:8,fill:"#0d1117",fillOpacity:.9,stroke:"#f85149",strokeOpacity:.5,strokeWidth:1}),o.jsx("line",{x1:Y+Q.w-5,y1:G-1,x2:Y+Q.w+1,y2:G+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"}),o.jsx("line",{x1:Y+Q.w+1,y1:G-1,x2:Y+Q.w-5,y2:G+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"})]})]},Q.id)}),v&&N.map(Q=>V(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),$(),L()]})}const sr="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",Fi="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 F5({fromLabel:e,toLabel:r,condition:i,fromStep:s,agentTypes:c,onUpdateCondition:u,onDelete:f}){const l=s&&(s.type==="sub_agent"||s.type==="agent")?c.find(p=>p.id===(s.type==="sub_agent"?s.subAgentType:s.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(Ob,{}),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:i.type,onChange:p=>{u(p.target.value==="step_result"?{type:"step_result",result:"success"}:{type:p.target.value})},className:Fi,children:A0.map(p=>o.jsx("option",{value:p.value,children:p.label},p.value))})]}),i.type==="step_result"&&o.jsxs("div",{children:[o.jsx("label",{className:hn,children:"Result"}),d?o.jsx("select",{value:i.result??l.results[0],onChange:p=>{u({type:"step_result",result:p.target.value})},className:Fi,children:l.results.map(p=>o.jsx("option",{value:p,children:p},p))}):o.jsx("input",{type:"text",value:i.result??"success",onChange:p=>u({type:"step_result",result:p.target.value}),placeholder:"e.g. success, passed, failed",className:sr})]}),o.jsx("p",{className:"text-text-muted text-[10px]",children:"Drag handles to reconnect. Press Delete to remove."})]})}function uh({variables:e,onInsert:r}){return e.length===0?null:o.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:e.map(i=>o.jsx("button",{type:"button",onClick:()=>r(i.name),title:i.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:`{{${i.name}}}`},i.name))})}function U5({step:e,isEntry:r,agentTypes:i,transitionCount:s,templateVariables:c,onUpdate:u,onRemove:f,onSetEntry:l}){const{color:d,name:p}=wf(e,i);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 _=i.find(k=>!k.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 _=i.find(k=>k.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:Fi,children:z5.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=i.find(b=>b.id===g.target.value);u({...e,toolMode:g.target.value,name:(m==null?void 0:m.name)??g.target.value})},className:Fi,children:i.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=i.find(b=>b.id===g.target.value);u({...e,subAgentType:g.target.value,name:(m==null?void 0:m.name)??g.target.value})},className:Fi,children:[o.jsx("option",{value:"",children:"— select —"}),i.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:`${sr} resize-y text-xs`,placeholder:"Injected on first entry..."}),o.jsx(uh,{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:`${sr} resize-y text-xs`,placeholder:"Injected on re-entry..."}),o.jsx(uh,{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:`${sr} font-mono text-xs resize-y`,placeholder:"cd {{workdir}} && npm run lint"}),o.jsx(uh,{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:`${sr} 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:`${sr} 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:[s," outgoing transition",s!==1?"s":""," — drag from the bottom port to connect."]})})]})}const pb=[];function D0({isOpen:e,onClose:r,initialEditId:i}){const s=jt(me=>me.defaults),c=jt(me=>me.userItems),u=jt(me=>me.loading),f=jt(me=>me.templateVariables),l=jt(me=>me.fetchWorkflows),d=jt(me=>me.fetchWorkflow),p=jt(me=>me.fetchDefaultContent),g=jt(me=>me.fetchTemplateVariables),m=jt(me=>me.createWorkflow),b=jt(me=>me.updateWorkflow),_=jt(me=>me.deleteWorkflow),{requestDelete:k,clearConfirm:C,isConfirming:y}=Ih(),[x,v]=H.useState("list"),[S,j]=H.useState(null),[T,N]=H.useState(!1),[D,A]=H.useState(null),[B,O]=H.useState(null),[q,V]=H.useState(""),[W,I]=H.useState(""),[F,P]=H.useState(""),[X,Z]=H.useState("1.0.0"),[z,R]=H.useState("#3b82f6"),[L,$]=H.useState(""),[U,ne]=H.useState(50),[Q,ee]=H.useState(pb),[Y,G]=H.useState({type:"always"}),[oe,re]=H.useState(""),[ve,be]=H.useState(!1),[Le,Oe]=H.useState([]),[ze]=H.useState(null);H.useEffect(()=>{e&&(l(),g(),ke("/api/agents").then(me=>me.json()).then(me=>Oe(me.agents??[])).catch(()=>{}),A(null),O(null),i?s.some(ye=>ye.id===i)?p(i).then(ye=>{ye&&(V(ye.metadata.name+" (copy)"),I(`${i}-copy-${Date.now()}`),P(ye.metadata.description),Z(ye.metadata.version),R(ye.metadata.color??"#3b82f6"),$(ye.entryStep),ne(ye.settings.maxIterations),ee(ye.steps),G(ye.startCondition??{type:"always"}),re(""),j(null),N(!1),v("edit"))}):d(i).then(ye=>{ye&&(V(ye.metadata.name),I(ye.metadata.id),P(ye.metadata.description),Z(ye.metadata.version),R(ye.metadata.color??"#3b82f6"),$(ye.entryStep),ne(ye.settings.maxIterations),ee(ye.steps),G(ye.startCondition??{type:"always"}),re(""),j(i),N(!1),v("edit"))}):(v("list"),j(null),N(!1)))},[e,l,d,p,g,i]);const We=async me=>{const ye=await d(me);ye&&(j(me),V(ye.metadata.name),I(ye.metadata.id),P(ye.metadata.description),Z(ye.metadata.version),R(ye.metadata.color??"#3b82f6"),$(ye.entryStep),ne(ye.settings.maxIterations),ee(ye.steps),G(ye.startCondition??{type:"always"}),re(""),A(null),O(null),v("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=L;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;$(ye)}be(!0),re("");const we={metadata:{id:me,name:q,description:F,version:X||"1.0.0",color:z},entryStep:ye,settings:{maxIterations:U},steps:Q,startCondition:Y},Ge=S?await b(S,we):await m(we);return be(!1),Ge.success?(S||j(me),!0):(re(Ge.error??"Failed to save."),!1)},fe=async()=>{await Ee()},je=async()=>{await Ee()&&(i?r():v("list"))},Ue=()=>{i?r():v("list")},It=me=>{V(me),S||I(I5(me))},pe=async me=>{if(s.some(we=>we.id===me)){const we=await p(me);if(!we)return;V(we.metadata.name),I(we.metadata.id),P(we.metadata.description),Z(we.metadata.version),R(we.metadata.color??"#3b82f6"),$(we.entryStep),ne(we.settings.maxIterations),ee(we.steps),G(we.startCondition??{type:"always"}),re(""),j(me),N(!0)}else{const we=await d(me);if(!we)return;V(we.metadata.name),I(we.metadata.id),P(we.metadata.description),Z(we.metadata.version),R(we.metadata.color??"#3b82f6"),$(we.entryStep),ne(we.settings.maxIterations),ee(we.steps),G(we.startCondition??{type:"always"}),re(""),j(me),N(!0)}v("edit")},Ne=async me=>{const we=s.some(Ge=>Ge.id===me)?await p(me):await d(me);we&&(V(we.metadata.name+" (copy)"),I(`${me}-copy-${Date.now()}`),P(we.metadata.description),Z(we.metadata.version),R(we.metadata.color??"#3b82f6"),$(we.entryStep),ne(we.settings.maxIterations),ee(we.steps),G(we.startCondition??{type:"always"}),re(""),j(null),N(!1),v("edit"))},Me=()=>{j(null),V(""),I(""),P(""),Z("1.0.0"),R("#3b82f6"),$(""),ne(50),ee(structuredClone(pb)),G({type:"always"}),re(""),A(null),O(null),N(!1),v("edit")},ot=async me=>{await _(me),C()},ue=H.useCallback(me=>{A(me),O(null)},[]),_e=H.useCallback(me=>{O(me),A(null)},[]),Te=D!==null?Number(D):-1,Ie=Te>=0?Q[Te]??null:null,$e=H.useCallback(me=>{ee(ye=>ye.map((we,Ge)=>Ge===Te?me:we))},[Te]),_t=Y.type==="step_result"?`${Y.result}`:T0[Y.type]??Y.type,Ye=()=>{const me=Q.length,ye=B5(Q),we=Le.find(Ge=>!Ge.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:[]}]),L||$(ye),ue(String(me))},Dt=H.useCallback((me,ye)=>{me==="$start"?($(ye),_e("start")):ee(we=>{const Ge=we.find(Pe=>Pe.id===me),Qe=Ge?Ge.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=H.useCallback((me,ye)=>{if(me==="start")$(ye);else{const we=me.lastIndexOf(":"),Ge=me.slice(0,we),Qe=parseInt(me.slice(we+1));ee(Pe=>Pe.map(Yt=>Yt.id===Ge?{...Yt,transitions:Yt.transitions.map((Rt,Bt)=>Bt===Qe?{...Rt,goto:ye}:Rt)}:Yt))}},[]),Kt=H.useCallback((me,ye)=>{const we=me.lastIndexOf(":"),Ge=me.slice(0,we),Qe=parseInt(me.slice(we+1));ee(Pe=>{const Yt=Pe.find(Bt=>Bt.id===Ge);if(!Yt)return Pe;const Rt=Yt.transitions[Qe];return Rt?Pe.map(Bt=>Bt.id===Ge?{...Bt,transitions:Bt.transitions.filter((Ur,se)=>se!==Qe)}:Bt.id===ye?{...Bt,transitions:[...Bt.transitions,Rt]}:Bt):Pe}),O(null)},[]),lt=H.useCallback(me=>{if(me==="start")$("");else{const ye=me.lastIndexOf(":"),we=me.slice(0,ye),Ge=parseInt(me.slice(ye+1));ee(Qe=>Qe.map(Pe=>Pe.id===we?{...Pe,transitions:Pe.transitions.filter((Yt,Rt)=>Rt!==Ge)}:Pe))}O(null)},[]),Un=H.useCallback((me,ye)=>{if(me==="start")G(ye);else{const we=me.lastIndexOf(":"),Ge=me.slice(0,we),Qe=parseInt(me.slice(we+1));ee(Pe=>Pe.map(Yt=>Yt.id===Ge?{...Yt,transitions:Yt.transitions.map((Rt,Bt)=>Bt===Qe?{...Rt,when:ye}:Rt)}:Yt))}},[]),sn=me=>wf(me,Le).name,Gs=()=>{if(!B)return null;if(B==="start"){const Rt=Q.find(Bt=>Bt.id===L);return{type:"start",fromLabel:"Start",toLabel:Rt?sn(Rt):"(none)",condition:Y}}const me=B.lastIndexOf(":"),ye=B.slice(0,me),we=parseInt(B.slice(me+1)),Ge=Q.find(Rt=>Rt.id===ye);if(!Ge)return null;const Qe=Ge.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(Ge),toLabel:Yt,condition:Qe.when}};if(x==="edit"){const me=Gs();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:`${sr} ${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:`${sr} 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:F,onChange:ye=>!T&&P(ye.target.value),readOnly:T,placeholder:"What does this workflow do?",className:`${sr} ${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:`${sr} font-mono ${T?"opacity-50":""}`})]}),o.jsxs("div",{children:[o.jsx("label",{className:hn,children:"Color"}),o.jsx("input",{type:"color",value:z,onChange:ye=>!T&&R(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(P5,{steps:Q,entryStep:L,selectedNodeId:(Ie==null?void 0:Ie.id)??null,selectedEdgeKey:B,startConditionLabel:_t,agentTypes:Le,isReadOnly:T,onSelectNode:ye=>{if(ye===null){ue(null);return}const we=Q.findIndex(Ge=>Ge.id===ye);ue(we>=0?String(we):null)},onSelectEdge:_e,onRemoveStep:ye=>{var Ge;const we=Q.findIndex(Qe=>Qe.id===ye);if(ee(Qe=>Qe.filter(Pe=>Pe.id!==ye)),Te===we&&ue(null),L===ye){const Qe=Q.filter(Pe=>Pe.id!==ye);$(((Ge=Qe[0])==null?void 0:Ge.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"})}),L&&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(Ob,{}),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=>G(ye.target.value==="step_result"?{type:"step_result",result:"success"}:{type:ye.target.value}),className:Fi,children:A0.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"}),L&&(()=>{const ye=Q.find(Pe=>Pe.id===L),we=ye&&(ye.type==="sub_agent"||ye.type==="agent")?Le.find(Pe=>Pe.id===(ye.type==="sub_agent"?ye.subAgentType:ye.toolMode)):void 0,Ge=(we==null?void 0:we.results)&&we.results.length>0,Qe=(we==null?void 0:we.results)??[];return Ge?o.jsx("select",{value:Y.result??Qe[0],onChange:Pe=>G({type:"step_result",result:Pe.target.value}),className:Fi,children:Qe.map(Pe=>o.jsx("option",{value:Pe,children:Pe},Pe))}):o.jsx("input",{type:"text",value:Y.result??"success",onChange:Pe=>G({type:"step_result",result:Pe.target.value}),placeholder:"e.g. success, passed, failed",className:sr})})()]}),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(F5,{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=>Un(B,ye),onDelete:()=>lt(B)}):Ie?o.jsx(U5,{step:Ie,isEntry:Ie.id===L,agentTypes:Le,transitionCount:Ie.transitions.length,templateVariables:f,onUpdate:$e,onRemove:()=>{var ye;if(Ie&&(ee(Q.filter((we,Ge)=>Ge!==Te)),ue(null),L===Ie.id)){const we=Q.filter((Ge,Qe)=>Qe!==Te);$(((ye=we[0])==null?void 0:ye.id)??"")}},onSetEntry:()=>$(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(it,{variant:"secondary",onClick:Ue,children:"Close"}),T?o.jsx(it,{variant:"primary",onClick:()=>{V(q+" (copy)"),I(`${S}-copy-${Date.now()}`),j(null),N(!1)},children:"Duplicate & Customize"}):o.jsxs(o.Fragment,{children:[o.jsx(it,{variant:"secondary",onClick:fe,disabled:ve||!q,children:ve?"Saving...":"Save"}),o.jsx(it,{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(it,{variant:"primary",size:"sm",onClick:Me,children:"+ New"})})]}),u&&s.length===0&&c.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"Loading workflows..."}):s.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:[s.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:s.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(sc,{})}),o.jsx(no,{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(no,{onClick:()=>Ne(me.id)}),o.jsx(Fs,{onClick:()=>We(me.id)}),y(me.id,"delete")?o.jsx(Bh,{onConfirm:()=>ot(me.id),onCancel:()=>{}}):o.jsx(zh,{onClick:()=>k(me.id)})]})]},me.id))})]})]})]})}function $5(e,r){const i=e.startCondition;if(!i||i.type==="always")return!0;switch(i.type){case"has_pending_criteria":return r.some(s=>s.status.type!=="passed");case"all_criteria_passed":return r.length===0||r.every(s=>s.status.type==="passed");case"all_criteria_completed_or_passed":return r.every(s=>s.status.type==="completed"||s.status.type==="passed");case"any_criteria_blocked":return r.some(s=>s.status.type==="failed"&&s.attempts.filter(c=>c.status==="failed").length>=4);case"step_result":return null;default:return null}}function q5({onSendCommand:e,onSelectWorkflow:r,onOpenCommandsManager:i,onOpenWorkflowsManager:s,onAttach:c,textareaContent:u,attachments:f,criteria:l}){const[d,p]=H.useState(!1),[g,m]=H.useState("commands"),[b,_]=H.useState(""),[k,C]=H.useState(0),[y,x]=H.useState(null),[v,S]=H.useState(null),j=H.useRef(null),T=H.useRef(null),N=dn($=>$.defaults),D=dn($=>$.userItems),A=dn($=>$.fetchCommands),B=jt($=>$.defaults),O=jt($=>$.userItems),q=jt($=>$.fetchWorkflows),V=[...N,...D],W=[...B,...O];H.useEffect(()=>{d&&(g==="commands"?A():g==="workflows"&&q())},[d,g,A,q]),H.useEffect(()=>{d&&(_(""),C(0),requestAnimationFrame(()=>{var $;return($=j.current)==null?void 0:$.focus()}))},[d,g]),H.useEffect(()=>{if(!d)return;const $=U=>{var ne;(ne=T.current)!=null&&ne.contains(U.target)||p(!1)};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[d]);const I=$=>{switch($.key){case"ArrowDown":$.preventDefault(),C(U=>{const Q=(g==="commands"?V: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":$.preventDefault(),C(U=>Math.max(U-1,0));break;case"Enter":$.preventDefault();break;case"Escape":$.preventDefault(),p(!1);break}},F=$=>{_($),C(0)},P=V.filter($=>!b||$.name.toLowerCase().includes(b.toLowerCase())),X=W.filter($=>!b||$.name.toLowerCase().includes(b.toLowerCase())),Z=async $=>{const U=await dn.getState().fetchCommand($);U&&e(U.prompt,U.metadata.agentMode,u,f),p(!1)},z=$=>{r($),p(!1)},R=($,U)=>{U.stopPropagation(),p(!1),x($)},L=($,U)=>{U.stopPropagation(),p(!1),S($)};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(Mb,{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($.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"?P.length===0?o.jsx("div",{className:"px-3 py-2 text-text-muted text-sm",children:V.length===0?"No commands yet":"No matches"}):P.map(($,U)=>o.jsxs("div",{className:`flex items-center gap-1 px-3 py-2 rounded transition-colors group ${U===k?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[o.jsx("button",{type:"button",onClick:()=>Z($.id),className:"flex-1 text-left",children:o.jsx("div",{className:"text-sm text-text-primary font-medium",children:$.name})}),o.jsx(Fs,{className:"opacity-0 group-hover:opacity-100",onClick:ne=>R($.id,ne)})]},$.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(($,U)=>{const ne=$5($,l),Q=$.color??"#3b82f6";return o.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 rounded transition-colors group ${U===k?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[o.jsxs("button",{type:"button",onClick:()=>z($.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:$.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(Fs,{className:"opacity-0 group-hover:opacity-100",onClick:ee=>L($.id,ee)})]},$.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(sw,{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"?i():s()},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(N0,{isOpen:!!y,onClose:()=>x(null),initialEditId:y}),o.jsx(D0,{isOpen:!!v,onClose:()=>S(null),initialEditId:v})]})}function L0(e,r){if(!r)return!0;const i=r.toLowerCase().split(/\s+/),s=e.toLowerCase().split(/\s+/);return i.every(c=>{for(const u of s){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 R0(e,r,i,s,c){switch(e.key){case"ArrowDown":e.preventDefault(),i(u=>Math.min(u+1,r));break;case"ArrowUp":e.preventDefault(),i(u=>Math.max(u-1,0));break;case"Enter":e.preventDefault(),s();break;case"Escape":e.preventDefault(),c();break}}function W5({isOpen:e,onClose:r,onCloseComplete:i,onSelectCommand:s,onSelectWorkflow:c,onCloseCompleteAction:u,textareaContent:f,onSearchMessages:l,onToggleAutoScroll:d,isAutoScrollActive:p}){const g=dn(L=>L.fetchCommands),m=jt(L=>L.fetchWorkflows),b=Nt(L=>L.fetchAgents),_=dn(L=>L.defaults),k=dn(L=>L.userItems),C=jt(L=>L.defaults),y=jt(L=>L.userItems),x=Nt(L=>L.defaults),v=Nt(L=>L.userItems),S=Ce(L=>{var $;return($=L.currentSession)==null?void 0:$.mode}),j=Ce(L=>{var $;return(($=L.currentSession)==null?void 0:$.dangerLevel)??"normal"}),T=Ce(L=>L.switchMode),N=Ce(L=>L.switchDangerLevel),D=Ce(L=>{var $;return($=L.currentSession)==null?void 0:$.projectId}),A=Ce(L=>L.createSession),B=H.useRef(void 0),[O,q]=H.useState(""),[V,W]=H.useState(0),I=H.useRef(null),F=H.useRef(!1);H.useEffect(()=>{e&&(F.current=!0)},[e]),H.useEffect(()=>{if(e){g(),m(),b(),q(""),W(0);const L=setTimeout(()=>{var $;return($=I.current)==null?void 0:$.focus()},50);return()=>clearTimeout(L)}},[e,g,m,b]),H.useEffect(()=>{var L;!e&&F.current&&(i==null||i(),(L=B.current)==null||L.call(B),B.current=void 0)},[e,i]);const P=(L,$)=>{const U=new Set($.map(ne=>ne.id));return[...L.filter(ne=>!U.has(ne.id)),...$]},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:()=>{B.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)}},...P(x,v).filter(L=>!L.subagent&&L.id!==S).map(L=>({id:L.id,name:L.name,prefix:"Agent > Switch to",action:()=>T(L.id)})),...P(_,k).map(L=>({id:L.id,name:L.name,prefix:"Command > Launch",action:()=>s(L.id,f)})),...P(C,y).map(L=>({id:L.id,name:L.name,prefix:"Workflow > Run",action:()=>c(L.id)})),...["normal","dangerous"].filter(L=>L!==j).map(L=>({id:L,name:L.charAt(0).toUpperCase()+L.slice(1),prefix:"Mode > Switch to",action:()=>N(L)}))].filter(L=>L0(`${L.prefix} ${L.name}`,O)),z=Z.length-1,R=L=>{R0(L,z,W,()=>{var $;($=Z[V])==null||$.action(),r()},r)};return e?fo.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:L=>{q(L.target.value),W(0)},onKeyDown:R,placeholder:"Search...",className:"flex-1 bg-transparent text-sm focus:outline-none placeholder:text-text-muted"}),o.jsx(Oh,{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+k.length+C.length+y.length>0?"No matches":"No agents, commands, or workflows yet"}):Z.map((L,$)=>o.jsxs("button",{type:"button",onClick:()=>{L.action(),r()},className:`w-full text-left px-3 py-2 rounded text-sm transition-colors ${$===V?"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:[L.prefix," "]}),o.jsx("span",{children:L.name})]},L.id))})]})]}),document.body):null}function G5(e){const r=new Date(e),i=new Date;if(r.getDate()===i.getDate()&&r.getMonth()===i.getMonth()&&r.getFullYear()===i.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 V5({isOpen:e,onClose:r,messages:i,onSelectMessage:s}){const[c,u]=H.useState(""),[f,l]=H.useState(0),d=H.useRef(null),p=H.useRef(!1),g=i.filter(C=>C.role==="user"&&!C.isSystemGenerated&&C.messageKind!=="auto-prompt"&&C.messageKind!=="command");H.useEffect(()=>{e&&(p.current=!0)},[e]),H.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=>L0(C.content,c)),b=m.length-1,_=C=>{R0(C,b,l,()=>{m[f]&&(s(m[f].id),r())},r)},k=C=>{s(C),r()};return e?fo.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(Fb,{}),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($b,{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:()=>k(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:G5(C.timestamp)})]})},C.id))})]})]}),document.body):null}function K5(e){return e==="criterion"}function Y5(e){var r,i;return e.role!=="assistant"||e.subAgentId||(r=e.content)!=null&&r.trim()||(i=e.thinkingContent)!=null&&i.trim()||!e.toolCalls||e.toolCalls.length===0?!1:e.toolCalls.every(s=>K5(s.name))}function X5(e,r=[]){const i=[];let s=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 x;return C.id===((x=c[y])==null?void 0:x.id)})?i.push(_):i.push({type:"criteria-batch",toolCalls:[...c]}),g++,c=[]}},b=()=>{if(!s)return;const _=s,k=d.get(_.subAgentId);k&&k.type==="subagent"&&k.messages.length===_.messages.length&&k.messages.every((y,x)=>y===_.messages[x])?i.push(k):i.push({type:"subagent",subAgentId:_.subAgentId,subAgentType:_.subAgentType,messages:_.messages}),s=null};for(const _ of e)if(_.role!=="tool"){if(_.contextWindowId&&u&&_.contextWindowId!==u&&(m(),b(),f++,i.push({type:"context-divider",windowSequence:f})),u=_.contextWindowId,Y5(_)){b();for(const k of _.toolCalls)c.push(k);continue}if(m(),_.subAgentId&&_.subAgentType)s&&s.subAgentId===_.subAgentId?s.messages.push(_):(b(),s={subAgentId:_.subAgentId,subAgentType:_.subAgentType,messages:[_]});else{b();const k=l.get(_.id);k&&k.type==="message"&&k.message===_?i.push(k):i.push({type:"message",message:_})}}return m(),b(),i}function Z5(e){const{year:r,month:i,day:s}=Zb(e);return`${r}/${i}/${s} ${oc(e)}`}function Q5(e,r){return e.length<=r?e:e.substring(0,r)+"..."}const J5=10,eD=150;function tD(e){const r=[];if(e.recentUserPrompts)for(const i of e.recentUserPrompts)r.push({id:i.id,content:i.content,timestamp:i.timestamp,sessionId:e.id,sessionName:e.title||e.id});return r}function nD(e){return[...e].sort((s,c)=>new Date(c.timestamp).getTime()-new Date(s.timestamp).getTime()).slice(0,J5).reverse().map(s=>({id:s.id,content:s.content,timestamp:s.timestamp,formattedTimestamp:Z5(s.timestamp),trimmedContent:Q5(s.content,eD),sessionId:s.sessionId,sessionName:s.sessionName}))}function rD(e,r,i){const s=[],c=e.filter(u=>u.role==="user"&&!u.isSystemGenerated&&u.messageKind!=="auto-prompt");for(const u of c)s.push({id:u.id,content:u.content,timestamp:u.timestamp,sessionId:i??"",sessionName:"This session"});for(const u of r)i&&u.id===i||s.push(...tD(u));return nD(s)}function iD(e,r=[],i=null){const[s,c]=H.useState(0),[u,f]=H.useState(!1),l=H.useMemo(()=>rD(e,r,i),[e,r,i]),d=H.useCallback(()=>{l.length>0&&(c(l.length-1),f(!0))},[l.length]),p=H.useCallback(()=>{f(!1),c(0)},[]),g=H.useCallback(()=>{c(_=>l.length===0?_:_===0?l.length-1:_-1)},[l.length]),m=H.useCallback(()=>{c(_=>l.length===0?_:_===l.length-1?0:_+1)},[l.length]),b=H.useCallback(()=>{if(l.length===0||!u)return null;const _=l[s];return(_==null?void 0:_.content)??null},[l,s,u]);return{history:l,selectedIndex:s,showHistory:u,openHistory:d,closeHistory:p,navigateUp:g,navigateDown:m,selectCurrent:b}}function sD({criteriaSidebarOpen:e,onCriteriaSidebarToggle:r}={}){const i=e??!0,[s,c]=H.useState(""),[u,f]=H.useState([]),[l,d]=H.useState(!1),[p,g]=H.useState(null),[m,b]=H.useState(!1),[_,k]=H.useState(!1),[C,y]=H.useState(!1),[x,v]=H.useState(!1),[S,j]=H.useState(null),[T,N]=H.useState(null),D=H.useRef(null),A=H.useRef(null),B=H.useRef(null),O=Ce(se=>se.currentSession),q=Ce(se=>se.messages),V=Ce(se=>se.streamingMessage),W=Ce(se=>se.sessions),I=Ce(se=>se.error),F=Ce(se=>se.pendingQuestion),P=Rb(),X=Ce(se=>se.sendMessage),Z=Ce(se=>se.clearError),z=Ce(se=>se.acceptAndBuild),R=Ce(se=>se.stopGeneration),L=Ce(se=>se.launchRunner),$=Ce(se=>se.cancelQueued),U=tw(),{showThinking:ne,showVerboseToolOutput:Q,showStats:ee,showAgentDefinitions:Y,showWorkflowBars:G}=Nb(),oe=jt(se=>se.defaults),re=jt(se=>se.userItems),ve=[...oe,...re],be=jt(se=>se.fetchWorkflows),Le=Nt(se=>se.defaults),Oe=Nt(se=>se.userItems),ze=[...Le,...Oe].filter(se=>!se.subagent);H.useEffect(()=>{be()},[be]);const{history:We,selectedIndex:Ee,showHistory:fe,openHistory:je,closeHistory:Ue,navigateUp:It,navigateDown:pe,selectCurrent:Ne}=iD(q,W,O==null?void 0:O.id),Me=H.useCallback(se=>{j(se),_t(!1);const Ae=document.querySelector(`[data-message-id="${se}"]`);Ae&&Ae.scrollIntoView({behavior:"smooth",block:"center"}),setTimeout(()=>j(null),3e3)},[]);H.useEffect(()=>{const se=Ae=>{N(Ae.detail.stats)};return window.addEventListener("open-turn-stats",se),()=>window.removeEventListener("open-turn-stats",se)},[]);const ot=H.useMemo(()=>V?q.map(se=>se.id===V.id?V:se):q,[q,V]),ue=H.useRef([]),_e=H.useMemo(()=>{const se=X5(ot,ue.current);return ue.current=se,se},[ot]),Te=H.useMemo(()=>T5(q),[q]),{force_scroll_to_bottom:Ie,isAutoScrollActive:$e,setAutoScroll:_t}=E0(D,O),Ye=H.useCallback(()=>{const se=A.current;if(!se)return;se.style.height="auto";const Ae=Math.min(200,se.scrollHeight);se.style.height=`${Ae}px`},[]);H.useEffect(()=>{if(!(O!=null&&O.id))return;const se=`openfox:draft:${O.id}`,Ae=localStorage.getItem(se);Ae!==null&&c(Ae)},[O==null?void 0:O.id]),H.useEffect(()=>{var se;(se=A.current)==null||se.focus(),Ye()},[O==null?void 0:O.id,Ye]),H.useEffect(()=>{if(!(O!=null&&O.id))return;const se=`openfox:draft:${O.id}`,Ae=setTimeout(()=>{s?localStorage.setItem(se,s):localStorage.removeItem(se)},500);return()=>clearTimeout(Ae)},[O==null?void 0:O.id,s]),H.useEffect(()=>{Ye()},[s,Ye]),H.useEffect(()=>{const se=Ae=>{Ae.key==="Escape"&&P&&R(),Ae.key==="ScrollLock"&&_t(!$e)};return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[P,R,$e]);const Dt=H.useRef(0);H.useEffect(()=>{const se=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",se),()=>window.removeEventListener("keydown",se)},[]),H.useEffect(()=>{const se=A.current;if(!se)return;const Ae=async qe=>{var Jt;if(document.activeElement!==se)return;const wt=(Jt=qe.clipboardData)==null?void 0:Jt.items;if(wt){for(const yn of Array.from(wt))if(yn.type.startsWith("image/")){qe.preventDefault();const vr=yn.getAsFile();if(!vr)continue;await lh(vr,Vi=>f(_n=>[..._n,Vi]),g,{filename:"pasted-image"})}}};return se.addEventListener("paste",Ae),()=>se.removeEventListener("paste",Ae)},[]);const mt=()=>{c(""),f([]),O!=null&&O.id&&localStorage.removeItem(`openfox:draft:${O.id}`)},Kt=async se=>{se.preventDefault(),!(!s.trim()&&u.length===0)&&(Ie(),X(s,u.length>0?u:void 0),mt())},lt=se=>{if((se.ctrlKey||se.metaKey)&&se.code.startsWith("Digit")){const qe=parseInt(se.code.slice(-1),10)-1,wt=ze[qe];wt&&(se.preventDefault(),Ce.getState().switchMode(wt.id));return}if(fe)switch(se.key){case"Enter":se.preventDefault();const Ae=Ne();Ae&&(c(Ae),Ue());return;case"Escape":se.preventDefault(),Ue(),P&&R();return;case"ArrowUp":se.preventDefault(),It();return;case"ArrowDown":se.preventDefault(),pe();return}if(se.key==="ArrowUp"&&s.trim()===""&&!fe){se.preventDefault(),je();return}se.key==="Enter"&&!se.shiftKey&&(se.preventDefault(),Kt(se))},Un=H.useCallback(async se=>{const Ae=se.target.files;if(!(!Ae||Ae.length===0)){g(null);for(const qe of Array.from(Ae))await lh(qe,wt=>f(Jt=>[...Jt,wt]),g);B.current&&(B.current.value="")}},[]),sn=H.useCallback(se=>{se.preventDefault(),se.stopPropagation(),d(!0)},[]),Gs=H.useCallback(se=>{se.preventDefault(),se.stopPropagation(),d(!1)},[]),me=H.useCallback(async se=>{se.preventDefault(),se.stopPropagation(),d(!1),g(null);const Ae=se.dataTransfer.files;if(!(!Ae||Ae.length===0))for(const qe of Array.from(Ae))await lh(qe,wt=>f(Jt=>[...Jt,wt]),g)},[]),ye=H.useCallback(se=>{f(Ae=>Ae.filter(qe=>qe.id!==se))},[]),we=H.useCallback(()=>{var se;(se=B.current)==null||se.click()},[]),Ge=(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(se=>se.type==="message"&&se.message.role==="assistant"),Bt=Ge&&Pe&&!P&&Rt&&!Yt,Ur=se=>{const Ae=s.trim()?s:void 0,qe=u.length>0?u:void 0;Ge?z(se,Ae,qe):Qe&&L(Ae,qe,se),mt()};return o.jsxs(o.Fragment,{children:[o.jsxs(KC,{criteriaSidebarOpen:i,onCriteriaSidebarToggle:r,messages:ot,children:[F&&o.jsx(f5,{question:F}),o.jsx(ZC,{}),T&&o.jsx(r5,{stats:T,onClose:()=>N(null)}),o.jsx(p5,{}),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((se,Ae)=>{if(se.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(se.type==="subagent"){const yn=se.messages.some(vr=>vr.isStreaming);return o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(o5,{messages:se.messages,subAgentType:se.subAgentType,subAgentId:se.subAgentId,isStreaming:yn})},Ae)}if(se.type==="criteria-batch")return o.jsx("div",{className:"feed-item px-2 md:px-4",children:o.jsx(C0,{toolCalls:se.toolCalls,criteria:O==null?void 0:O.criteria})},Ae);const qe=se.message;if(qe.role==="assistant")return o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(_f,{message:qe,showStats:ee,showThinking:ne,showVerboseToolOutput:Q})},Ae);const wt=!Y&&qe.messageKind==="auto-prompt",Jt=!G&&(qe.messageKind==="workflow-started"||qe.messageKind==="task-completed");return wt||Jt?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(k0,{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(ro,{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(se=>{const Ae=se.color??"#3b82f6",qe=parseInt(Ae.slice(1,3),16),wt=parseInt(Ae.slice(3,5),16),Jt=parseInt(Ae.slice(5,7),16),yn=`rgba(${qe},${wt},${Jt},0.12)`,vr=`rgba(${qe},${wt},${Jt},0.22)`,Vi=`rgba(${qe},${wt},${Jt},0.25)`;return o.jsxs("button",{onClick:()=>z(se.id),className:"px-4 py-1.5 rounded text-sm font-medium transition-colors",style:{backgroundColor:yn,color:Ae,border:`1px solid ${Vi}`},onMouseEnter:_n=>{_n.currentTarget.style.backgroundColor=vr},onMouseLeave:_n=>{_n.currentTarget.style.backgroundColor=yn},children:["▶ ",se.name]},se.id)})}),P&&o.jsx(m5,{})]})]}),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:()=>_t(!$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:()=>v(!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(Fb,{})}),o.jsx("input",{ref:B,type:"file",accept:".png,.jpg,.jpeg,.gif",onChange:Un,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(se=>o.jsx(g5,{attachment:se,onRemove:ye},se.id))}),fe&&o.jsx(x5,{history:We,selectedIndex:Ee,onSelect:se=>{c(se),Ue()},onEscape:Ue,onNavigate:se=>{se==="up"?It():pe()}}),U.length>0&&o.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:U.map(se=>o.jsxs("div",{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded text-xs ${se.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:[se.mode==="asap"?"ASAP":"Queue",":"]}),o.jsx("span",{className:"truncate max-w-[200px]",children:se.content}),o.jsx(ro,{onClick:()=>$(se.queueId),size:"sm"})]},se.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:Gs,onDrop:me,children:[o.jsx("textarea",{ref:A,value:s,onChange:se=>{c(se.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 se;!s.trim()&&u.length===0||((se=D.current)==null||se.scrollTo({top:D.current.scrollHeight,behavior:"smooth"}),X(s,u),mt())},disabled:!s.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(q5,{onSendCommand:(se,Ae,qe,wt)=>{var yn;Ae&&(O==null?void 0:O.mode)!==Ae&&Ce.getState().switchMode(Ae);const Jt=qe&&qe.trim()?`${qe.trim()}
|
|
150
|
-
|
|
151
|
-
${se}`:se;(yn=D.current)==null||yn.scrollTo({top:D.current.scrollHeight,behavior:"smooth"}),X(Jt,wt!=null&&wt.length?wt:void 0,{messageKind:"command",isSystemGenerated:!0}),mt()},onSelectWorkflow:Ur,onOpenCommandsManager:()=>b(!0),onOpenWorkflowsManager:()=>k(!0),onAttach:we,textareaContent:s,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(d5,{}),o.jsx(h5,{})]}),o.jsx(R5,{})]})]}),o.jsx(N0,{isOpen:m,onClose:()=>b(!1)}),o.jsx(D0,{isOpen:_,onClose:()=>k(!1)}),o.jsx(W5,{isOpen:C,onClose:()=>y(!1),onSearchMessages:()=>v(!0),isAutoScrollActive:$e,onToggleAutoScroll:_t,textareaContent:s,onCloseComplete:()=>{var se;return(se=A.current)==null?void 0:se.focus()},onCloseCompleteAction:()=>window.dispatchEvent(new CustomEvent("open-session-dropdown")),onSelectCommand:async(se,Ae)=>{const qe=await dn.getState().fetchCommand(se);if(qe){const wt=Ae!=null&&Ae.trim()?`${Ae.trim()}
|
|
152
|
-
|
|
153
|
-
${qe.prompt}`:qe.prompt;qe.metadata.agentMode&&Ce.getState().switchMode(qe.metadata.agentMode),X(wt,u!=null&&u.length?u:void 0,{messageKind:"command",isSystemGenerated:!0}),mt()}},onSelectWorkflow:se=>{const Ae=s.trim()||void 0,qe=u.length>0?u:void 0;(O==null?void 0:O.mode)==="planner"?Ce.getState().acceptAndBuild(se,Ae,qe):Ce.getState().launchRunner(Ae,qe,se),mt()}})]}),x&&o.jsx(V5,{isOpen:x,onClose:()=>v(!1),messages:q,onSelectMessage:Me})]})}H.memo(function({item:r}){const[i,s]=H.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:()=>s(!i),className:"text-xs text-accent-primary hover:text-accent-primary/80 transition-colors",children:i?"Hide":"Show"})]}),i&&r.description&&o.jsx("div",{className:"mt-2 text-xs prose prose-invert prose-sm max-w-none",children:o.jsx(Gi,{content:r.description})})]})]})});function mb({isOpen:e,isRetry:r,onSubmit:i,onCancel:s}){const[c,u]=H.useState(""),f=H.useRef(null);H.useEffect(()=>{e&&(u(""),setTimeout(()=>{var d;return(d=f.current)==null?void 0:d.focus()},100))},[e]);const l=d=>{d.preventDefault(),c.trim()&&i(c)};return o.jsx(At,{isOpen:e,onClose:s,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(lc,{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(it,{type:"button",variant:"secondary",onClick:s,children:"Cancel"}),o.jsx(it,{type:"submit",disabled:!c.trim(),children:r?"Try Again":"Connect"})]})]})})}const aD=[8e3,11434,8080],oD=[{name:"OpenCode Go",url:"https://opencode.ai/zen/go/v1",backend:"opencode-go"}];function gb(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 lD({currentStep:e,totalSteps:r,labels:i,onStepClick:s}){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:()=>s==null?void 0:s(f),className:`size-8 rounded-full flex items-center justify-center text-sm font-medium transition-colors shrink-0 ${l?"bg-accent-primary text-white hover:opacity-80":d?"bg-accent-primary text-white":"bg-bg-tertiary text-text-muted"}`,children:l?"✓":f}),o.jsx("button",{onClick:()=>s==null?void 0:s(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:i[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 cD({onNext:e}){const[r,i]=H.useState([]),[s,c]=H.useState([]),[u,f]=H.useState(!1),[l,d]=H.useState(""),[p,g]=H.useState(""),[m,b]=H.useState(""),[_,k]=H.useState("auto"),[C,y]=H.useState(!1),[x,v]=H.useState(null),[S,j]=H.useState(null),[T,N]=H.useState(null),[D,A]=H.useState("");H.useEffect(()=>{B()},[]);async function B(){try{const F=await ke("/api/providers");if(F.ok){const X=(await F.json()).providers.map(Z=>({id:Z.id,name:Z.name,url:Z.url,backend:Z.backend,model:null,apiKey:Z.apiKey}));i(X),c(X)}}catch{}}async function O(F){y(!0),v(null);const P=_!=="auto";try{const Z=await(await ke("/api/providers/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:F,skipBackendDetection:P})})).json();Z.success?(P||k(Z.backend??"auto"),v({success:!0,model:Z.model??void 0})):v({success:!1,error:Z.error??"Connection failed"})}catch(X){v({success:!1,error:X instanceof Error?X.message:"Connection failed"})}y(!1)}function q(){if(!p)return;const F=l||`Provider ${s.length+1}`,P={id:`temp-${Date.now()}`,name:F,url:p,backend:x!=null&&x.success?_:"auto",model:x!=null&&x.success?x.model??null:null,apiKey:m||void 0};c([...s,P]),d(""),g(""),b(""),v(null)}function V(F){j(F),r.some(X=>X.id===F)?ke(`/api/providers/${F}`,{method:"DELETE"}).then(()=>{c(s.filter(X=>X.id!==F)),i(r.filter(X=>X.id!==F)),j(null)}).catch(()=>{j(null)}):(c(s.filter(X=>X.id!==F)),j(null))}async function W(){for(const P of s)(P.id.startsWith("temp-")||!r.some(X=>X.id===P.id))&&((await ke("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:P.name,url:P.url,backend:P.backend,model:P.model,apiKey:P.apiKey})})).ok||console.error("Failed to add provider",P));const F=s.filter(P=>!P.id.startsWith("temp-"));e({providers:F})}const I=s.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:[s.length>0?o.jsx("div",{className:"space-y-2",children:s.map(F=>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:gb(F.backend)}),T===F.id?o.jsx("input",{type:"text",value:D,onChange:P=>A(P.target.value),onKeyDown:P=>{P.key==="Enter"&&(c(s.map(X=>X.id===F.id?{...X,name:D}:X)),N(null)),P.key==="Escape"&&N(null)},onBlur:()=>{c(s.map(P=>P.id===F.id?{...P,name:D}:P)),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(F.id),A(F.name)},title:"Click to edit",children:F.name})]}),o.jsx("p",{className:"text-text-muted text-sm mt-1",children:F.url}),F.model&&o.jsxs("p",{className:"text-text-secondary text-xs mt-0.5",children:["Model: ",F.model]})]}),o.jsx("button",{onClick:()=>V(F.id),disabled:S===F.id,className:"p-2 text-text-muted hover:text-red-500 transition-colors disabled:opacity-50",title:"Remove provider",children:o.jsx(Pb,{})})]},F.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:F=>{F.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:oD.map(F=>o.jsx("button",{type:"button",onClick:()=>{d(F.name),g(F.url),k(F.backend),v(null)},className:`p-2 rounded border text-center text-sm transition-colors ${p===F.url?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:F.name},F.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:aD.map(F=>o.jsxs("button",{type:"button",onClick:()=>{d(""),g(`http://localhost:${F}`),k("auto"),v(null)},className:`p-2 rounded border text-center text-sm transition-colors ${p===`http://localhost:${F}`?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:["localhost:",F]},F))})]}),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:F=>{g(F.target.value),v(null)},onKeyDown:F=>{F.key==="Enter"&&(F.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:F=>d(F.target.value),onKeyDown:F=>{F.key==="Enter"&&(F.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:F=>b(F.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"})]}),x&&o.jsx("div",{className:`p-3 rounded-lg ${x.success?"bg-accent-primary/10":"bg-red-500/10"}`,children:x.success?o.jsxs("p",{className:"text-accent-primary font-medium",children:["✓ Connected to ",gb(_),x.model&&` (${x.model})`]}):o.jsx("p",{className:"text-red-500",children:x.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(Hb,{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-white rounded-lg hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors font-medium",children:x!=null&&x.success?"Add Provider ✓":"Add Provider"})]}),o.jsx("button",{type:"button",onClick:()=>{f(!1),d(""),g(""),v(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(zb,{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-white rounded-lg font-medium hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Continue"})]})]})}function uD({onNext:e}){const[r,i]=H.useState(""),[s,c]=H.useState(!1);return H.useEffect(()=>{ke("/api/config").then(u=>u.json()).then(u=>{u.workdir?i(u.workdir):fetch("/api/directories?path="+encodeURIComponent("/home")).then(f=>f.json()).then(f=>{f.current&&i(f.current)}).catch(()=>{})}).catch(()=>{fetch("/api/directories?path="+encodeURIComponent("/home")).then(u=>u.json()).then(u=>{u.current&&i(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=>i(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"})]})]}),s&&o.jsx(ey,{initialPath:r||void 0,onSelect:u=>{i(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-white rounded-lg font-medium hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Continue"})]})]})}function dD({onNext:e}){const[r,i]=H.useState(!1),[s,c]=H.useState("http://localhost:11434"),[u,f]=H.useState("qwen3-vl:2b"),{copied:l,copy:d}=y0();H.useEffect(()=>{ke("/api/config").then(g=>g.json()).then(g=>{g.visionFallback&&(i(g.visionFallback.enabled),c(g.visionFallback.url),f(g.visionFallback.model))}).catch(()=>{})},[]);function p(g){if(g){e({});return}e({visionFallback:{enabled:r,url:s,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(lw,{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=>i(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:s,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-white rounded-lg font-medium hover:bg-accent-primary/90 transition-colors",children:"Finish Setup"})]})]})]})}function hD({onComplete:e}){const[r,i]=H.useState(1),[s,c]=H.useState(!1),[u,f]=H.useState({});async function l(m){f(b=>({...b,providers:m.providers})),i(2)}async function d(m){f(b=>({...b,...m})),i(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=>{i(m)};return o.jsxs("div",{className:"w-full max-w-xl mx-auto px-6 py-16 relative",children:[o.jsx(ro,{onClick:e,className:"absolute top-4 right-4 p-2",variant:"modal",size:"xl"}),o.jsx(lD,{currentStep:r,totalSteps:3,labels:["LLM Server","Projects Folder","Vision"],onStepClick:g}),o.jsx("div",{className:"max-w-xl mx-auto",children:s?o.jsxs("div",{className:"text-center",children:[o.jsx(zb,{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(cD,{onNext:l}),r===2&&o.jsx(uD,{onNext:d}),r===3&&o.jsx(dD,{onNext:p})]})})]})}function Cf(){return typeof window>"u"?!1:localStorage.getItem("openfox_token")!==null}function O0(){return o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(cc,{})})}function fD({sidebarOpen:e,onSidebarToggle:r}){const[,i]=Lh("/p/:projectId"),s=i==null?void 0:i.projectId,c=Ce(m=>m.connectionStatus),u=Ce(m=>m.listSessions),f=Ce(m=>m.clearSession),l=Zt(m=>m.currentProject),d=Zt(m=>m.loadProject),p=Cf(),g=c==="connected"||p;return H.useEffect(()=>{g&&s&&((l==null?void 0:l.id)!==s&&d(s),u(s),f())},[g,s,l==null?void 0:l.id,d,u,f]),!l||l.id!==s?o.jsx(O0,{}):o.jsxs(o.Fragment,{children:[o.jsx(Jb,{projectId:s,isOpen:e,onClose:r}),o.jsx("div",{className:"flex-1 min-w-0 bg-primary",children:o.jsx(fC,{})})]})}function pD({sidebarOpen:e,onSidebarToggle:r,rightSidebarOpen:i,onRightSidebarToggle:s}){const[,c]=Lh("/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),k=Ce(S=>S.clearError),C=Zt(S=>S.currentProject),y=Zt(S=>S.loadProject),x=Cf(),v=d==="connected"||x;return H.useEffect(()=>{v&&u&&(C==null?void 0:C.id)!==u&&y(u)},[v,u,C==null?void 0:C.id,y]),H.useEffect(()=>{v&&f&&(p==null?void 0:p.id)!==f&&!b&&g(f),v&&u&&m(u)},[v,f,p==null?void 0:p.id,g,m,b,u]),H.useEffect(()=>{(_==null?void 0:_.code)==="NOT_FOUND"&&u&&(k(),l(`/p/${u}`))},[_,u,k,l]),!C||C.id!==u?o.jsx(O0,{}):o.jsxs(o.Fragment,{children:[o.jsx(Jb,{projectId:u,isOpen:e,onClose:r}),o.jsx("div",{className:"flex-1 min-w-0 bg-primary",children:o.jsx(sD,{criteriaSidebarOpen:i,onCriteriaSidebarToggle:s})})]})}function mD(){const e=Lt(i=>i.fetchConfig);function r(){e(),window.history.back()}return o.jsx("div",{className:"flex-1 overflow-y-auto",children:o.jsx(hD,{onComplete:r})})}function gD(){const{connectionStatus:e}=rw(),r=Lt(F=>F.fetchConfig),i=Lt(F=>F.refreshProviderModels),s=rn(F=>F.getSetting),c=Lt(F=>F.providers),u=Lt(F=>F.activeProviderId),[,f]=gr(),l=Cf(),[d,p]=H.useState(!1);H.useEffect(()=>{(e==="connected"||l)&&r().then(()=>{p(!0);for(const F of z1)s(F)})},[e,l,r,s]),H.useEffect(()=>{d&&u&&i(u).then(()=>{r()})},[d,u,i,r]),H.useEffect(()=>{d&&c.length===0&&f("/onboarding")},[d,c.length]);const g=()=>{const F=localStorage.getItem("openfox:leftSidebar");return F!==null?F==="true":!1},m=()=>{const F=localStorage.getItem("openfox:rightSidebar");return F!==null?F==="true":!0},[b,_]=H.useState(g),[k,C]=H.useState(m),[y,x]=H.useState(!1),[v,S]=H.useState(!1),[j,T]=H.useState(!1),N=a1();H.useEffect(()=>{const F=()=>{T(window.innerWidth<768)};return F(),window.addEventListener("resize",F),()=>window.removeEventListener("resize",F)},[]);const D=j?y:b,A=j?v:k,B=()=>{j?x(!y):_(!b)},O=()=>{j?S(!v):C(!k)};H.useEffect(()=>{j||localStorage.setItem("openfox:leftSidebar",String(b))},[b,j]),H.useEffect(()=>{j||localStorage.setItem("openfox:rightSidebar",String(k))},[k,j]),H.useEffect(()=>{(e==="connected"||l)&&r()},[e,r,l]);const q=Ce(F=>F.showPasswordModal),V=Ce(F=>F.passwordModalRetry),W=Ce(F=>F.submitPassword),I=Ce(F=>F.cancelPassword);return e!=="connected"&&!q&&!l?o.jsxs(o.Fragment,{children:[o.jsx(mb,{isOpen:!0,isRetry:V,onSubmit:W,onCancel:I}),o.jsx("div",{className:"h-screen flex items-center justify-center",children:o.jsx(cC,{text:"Connecting to server..."})})]}):o.jsxs(o.Fragment,{children:[o.jsx(mb,{isOpen:q,isRetry:V,onSubmit:W,onCancel:I}),o.jsxs("div",{className:"flex flex-col",style:{height:j?`calc(${N.offsetTop}px + ${N.height}px)`:"100vh"},children:[o.jsx(iC,{}),o.jsx(Qw,{onMenuClick:B,onCriteriaToggle:O}),o.jsx("div",{className:"flex-1 flex overflow-hidden",children:o.jsxs(N1,{children:[o.jsx(za,{path:"/onboarding",children:o.jsx(mD,{})}),o.jsx(za,{path:"/p/:projectId/s/:sessionId",children:o.jsx(pD,{sidebarOpen:D,onSidebarToggle:B,rightSidebarOpen:A,onRightSidebarToggle:O})}),o.jsx(za,{path:"/p/:projectId/new",children:o.jsx(hC,{})}),o.jsx(za,{path:"/p/:projectId",children:o.jsx(fD,{sidebarOpen:D,onSidebarToggle:B})}),o.jsx(za,{path:"/",children:o.jsx(dC,{})})]})})]})]})}s1.createRoot(document.getElementById("root")).render(o.jsx(mn.StrictMode,{children:o.jsx(gD,{})}));
|