openfox 1.6.20 → 1.6.23
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/README.md +46 -13
- package/dist/{auto-compaction-NFLWKJAO.js → auto-compaction-7LK3QGPI.js} +4 -3
- package/dist/{chat-handler-2RVTVNPF.js → chat-handler-ZU74RXED.js} +6 -5
- package/dist/{chunk-KOBGCNUE.js → chunk-4O3C2JMB.js} +58 -14
- package/dist/{chunk-QY7BMXWT.js → chunk-B7E3BICY.js} +6 -2
- package/dist/{chunk-U3KMU3UE.js → chunk-BOEXJCOD.js} +2 -2
- package/dist/{chunk-IN5EP4ZB.js → chunk-CJNQGEYG.js} +2 -2
- package/dist/{chunk-OVLFEBRR.js → chunk-D4ZLSV6P.js} +133 -468
- package/dist/{chunk-LTPZ4GTW.js → chunk-FTJPNCAV.js} +6 -6
- package/dist/chunk-KSASIV4B.js +486 -0
- package/dist/{chunk-ZDNXCVW4.js → chunk-P6GUT2QQ.js} +11 -5
- package/dist/{chunk-KOUMYBYM.js → chunk-PYBB34ZK.js} +54 -3
- package/dist/{chunk-R7UAGXQW.js → chunk-YCQSAFAQ.js} +42 -24
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{config-67AX6CNS.js → config-ACVEHBKG.js} +5 -5
- package/dist/{orchestrator-ZICQ5NIZ.js → orchestrator-OE7WFEW6.js} +5 -4
- package/dist/package.json +3 -3
- package/dist/{processor-MPSYT534.js → processor-GAOK7TPI.js} +2 -2
- package/dist/{protocol-I7rn7Msg.d.ts → protocol-BYM6rZvW.d.ts} +12 -0
- package/dist/{provider-DKGBQHUS.js → provider-RLQMVV2Z.js} +9 -8
- package/dist/{serve-B5A52252.js → serve-IBJ3SN3Q.js} +10 -10
- package/dist/server/index.d.ts +24 -1
- package/dist/server/index.js +8 -8
- package/dist/shared/index.d.ts +2 -2
- package/dist/shared/index.js +1 -1
- package/dist/{tools-ERJ3QRQU.js → tools-CSV7G554.js} +4 -3
- package/dist/{vision-fallback-ADYRFFD4.js → vision-fallback-QJ26DCEF.js} +2 -2
- package/dist/web/assets/index-BrZqZwpA.js +153 -0
- package/dist/web/assets/{index-vBklayFL.css → index-DF26vcqg.css} +1 -1
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-55N6FAAZ.js +0 -117
- package/dist/web/assets/index-vOba1XKB.js +0 -151
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
var I1=Object.defineProperty;var B1=(e,r,i)=>r in e?I1(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i;var sr=(e,r,i)=>B1(e,typeof r!="symbol"?r+"":r,i);function z1(e,r){for(var i=0;i<r.length;i++){const s=r[i];if(typeof s!="string"&&!Array.isArray(s)){for(const l in s)if(l!=="default"&&!(l in e)){const u=Object.getOwnPropertyDescriptor(s,l);u&&Object.defineProperty(e,l,u.get?u:{enumerable:!0,get:()=>s[l]})}}}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 l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const u of l)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(l){const u={};return l.integrity&&(u.integrity=l.integrity),l.referrerPolicy&&(u.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?u.credentials="include":l.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function s(l){if(l.ep)return;l.ep=!0;const u=i(l);fetch(l.href,u)}})();function Gl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Sd={exports:{}},Ta={};/**
|
|
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 cx;function H1(){if(cx)return Ta;cx=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function i(s,l,u){var f=null;if(u!==void 0&&(f=""+u),l.key!==void 0&&(f=""+l.key),"key"in l){u={};for(var c in l)c!=="key"&&(u[c]=l[c])}else u=l;return l=u.ref,{$$typeof:e,type:s,key:f,ref:l!==void 0?l:null,props:u}}return Ta.Fragment=r,Ta.jsx=i,Ta.jsxs=i,Ta}var ux;function P1(){return ux||(ux=1,Sd.exports=H1()),Sd.exports}var o=P1(),wd={exports:{}},We={};/**
|
|
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 dx;function F1(){if(dx)return We;dx=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),f=Symbol.for("react.context"),c=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"),x=Symbol.iterator;function _(I){return I===null||typeof I!="object"?null:(I=x&&I[x]||I["@@iterator"],typeof I=="function"?I:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,b={};function v(I,V,F){this.props=I,this.context=V,this.refs=b,this.updater=F||k}v.prototype.isReactComponent={},v.prototype.setState=function(I,V){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,V,"setState")},v.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function y(){}y.prototype=v.prototype;function S(I,V,F){this.props=I,this.context=V,this.refs=b,this.updater=F||k}var j=S.prototype=new y;j.constructor=S,C(j,v.prototype),j.isPureReactComponent=!0;var A=Array.isArray;function N(){}var D={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function B(I,V,F){var ie=F.ref;return{$$typeof:e,type:I,key:V,ref:ie!==void 0?ie:null,props:F}}function H(I,V){return B(I.type,V,I.props)}function W(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function K(I){var V={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(F){return V[F]})}var q=/\/+/g;function R(I,V){return typeof I=="object"&&I!==null&&I.key!=null?K(""+I.key):V.toString(36)}function U(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(N,N):(I.status="pending",I.then(function(V){I.status==="pending"&&(I.status="fulfilled",I.value=V)},function(V){I.status==="pending"&&(I.status="rejected",I.reason=V)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function M(I,V,F,ie,Q){var ee=typeof I;(ee==="undefined"||ee==="boolean")&&(I=null);var X=!1;if(I===null)X=!0;else switch(ee){case"bigint":case"string":case"number":X=!0;break;case"object":switch(I.$$typeof){case e:case r:X=!0;break;case g:return X=I._init,M(X(I._payload),V,F,ie,Q)}}if(X)return Q=Q(I),X=ie===""?"."+R(I,0):ie,A(Q)?(F="",X!=null&&(F=X.replace(q,"$&/")+"/"),M(Q,V,F,"",function(re){return re})):Q!=null&&(W(Q)&&(Q=H(Q,F+(Q.key==null||I&&I.key===Q.key?"":(""+Q.key).replace(q,"$&/")+"/")+X)),V.push(Q)),1;X=0;var $=ie===""?".":ie+":";if(A(I))for(var oe=0;oe<I.length;oe++)ie=I[oe],ee=$+R(ie,oe),X+=M(ie,V,F,ee,Q);else if(oe=_(I),typeof oe=="function")for(I=oe.call(I),oe=0;!(ie=I.next()).done;)ie=ie.value,ee=$+R(ie,oe++),X+=M(ie,V,F,ee,Q);else if(ee==="object"){if(typeof I.then=="function")return M(U(I),V,F,ie,Q);throw V=String(I),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return X}function Y(I,V,F){if(I==null)return I;var ie=[],Q=0;return M(I,ie,"","",function(ee){return V.call(F,ee,Q++)}),ie}function Z(I){if(I._status===-1){var V=I._result;V=V(),V.then(function(F){(I._status===0||I._status===-1)&&(I._status=1,I._result=F)},function(F){(I._status===0||I._status===-1)&&(I._status=2,I._result=F)}),I._status===-1&&(I._status=0,I._result=V)}if(I._status===1)return I._result.default;throw I._result}var z=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)},L={map:Y,forEach:function(I,V,F){Y(I,function(){V.apply(this,arguments)},F)},count:function(I){var V=0;return Y(I,function(){V++}),V},toArray:function(I){return Y(I,function(V){return V})||[]},only:function(I){if(!W(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return We.Activity=m,We.Children=L,We.Component=v,We.Fragment=i,We.Profiler=l,We.PureComponent=S,We.StrictMode=s,We.Suspense=d,We.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,We.__COMPILER_RUNTIME={__proto__:null,c:function(I){return D.H.useMemoCache(I)}},We.cache=function(I){return function(){return I.apply(null,arguments)}},We.cacheSignal=function(){return null},We.cloneElement=function(I,V,F){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var ie=C({},I.props),Q=I.key;if(V!=null)for(ee in V.key!==void 0&&(Q=""+V.key),V)!T.call(V,ee)||ee==="key"||ee==="__self"||ee==="__source"||ee==="ref"&&V.ref===void 0||(ie[ee]=V[ee]);var ee=arguments.length-2;if(ee===1)ie.children=F;else if(1<ee){for(var X=Array(ee),$=0;$<ee;$++)X[$]=arguments[$+2];ie.children=X}return B(I.type,Q,ie)},We.createContext=function(I){return I={$$typeof:f,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:u,_context:I},I},We.createElement=function(I,V,F){var ie,Q={},ee=null;if(V!=null)for(ie in V.key!==void 0&&(ee=""+V.key),V)T.call(V,ie)&&ie!=="key"&&ie!=="__self"&&ie!=="__source"&&(Q[ie]=V[ie]);var X=arguments.length-2;if(X===1)Q.children=F;else if(1<X){for(var $=Array(X),oe=0;oe<X;oe++)$[oe]=arguments[oe+2];Q.children=$}if(I&&I.defaultProps)for(ie in X=I.defaultProps,X)Q[ie]===void 0&&(Q[ie]=X[ie]);return B(I,ee,Q)},We.createRef=function(){return{current:null}},We.forwardRef=function(I){return{$$typeof:c,render:I}},We.isValidElement=W,We.lazy=function(I){return{$$typeof:g,_payload:{_status:-1,_result:I},_init:Z}},We.memo=function(I,V){return{$$typeof:p,type:I,compare:V===void 0?null:V}},We.startTransition=function(I){var V=D.T,F={};D.T=F;try{var ie=I(),Q=D.S;Q!==null&&Q(F,ie),typeof ie=="object"&&ie!==null&&typeof ie.then=="function"&&ie.then(N,z)}catch(ee){z(ee)}finally{V!==null&&F.types!==null&&(V.types=F.types),D.T=V}},We.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},We.use=function(I){return D.H.use(I)},We.useActionState=function(I,V,F){return D.H.useActionState(I,V,F)},We.useCallback=function(I,V){return D.H.useCallback(I,V)},We.useContext=function(I){return D.H.useContext(I)},We.useDebugValue=function(){},We.useDeferredValue=function(I,V){return D.H.useDeferredValue(I,V)},We.useEffect=function(I,V){return D.H.useEffect(I,V)},We.useEffectEvent=function(I){return D.H.useEffectEvent(I)},We.useId=function(){return D.H.useId()},We.useImperativeHandle=function(I,V,F){return D.H.useImperativeHandle(I,V,F)},We.useInsertionEffect=function(I,V){return D.H.useInsertionEffect(I,V)},We.useLayoutEffect=function(I,V){return D.H.useLayoutEffect(I,V)},We.useMemo=function(I,V){return D.H.useMemo(I,V)},We.useOptimistic=function(I,V){return D.H.useOptimistic(I,V)},We.useReducer=function(I,V,F){return D.H.useReducer(I,V,F)},We.useRef=function(I){return D.H.useRef(I)},We.useState=function(I){return D.H.useState(I)},We.useSyncExternalStore=function(I,V,F){return D.H.useSyncExternalStore(I,V,F)},We.useTransition=function(){return D.H.useTransition()},We.version="19.2.4",We}var hx;function Vl(){return hx||(hx=1,wd.exports=F1()),wd.exports}var P=Vl();const dn=Gl(P),U1=z1({__proto__:null,default:dn},[P]);var Cd={exports:{}},Aa={},kd={exports:{}},Ed={};/**
|
|
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 fx;function $1(){return fx||(fx=1,(function(e){function r(M,Y){var Z=M.length;M.push(Y);e:for(;0<Z;){var z=Z-1>>>1,L=M[z];if(0<l(L,Y))M[z]=Y,M[Z]=L,Z=z;else break e}}function i(M){return M.length===0?null:M[0]}function s(M){if(M.length===0)return null;var Y=M[0],Z=M.pop();if(Z!==Y){M[0]=Z;e:for(var z=0,L=M.length,I=L>>>1;z<I;){var V=2*(z+1)-1,F=M[V],ie=V+1,Q=M[ie];if(0>l(F,Z))ie<L&&0>l(Q,F)?(M[z]=Q,M[ie]=Z,z=ie):(M[z]=F,M[V]=Z,z=V);else if(ie<L&&0>l(Q,Z))M[z]=Q,M[ie]=Z,z=ie;else break e}}return Y}function l(M,Y){var Z=M.sortIndex-Y.sortIndex;return Z!==0?Z:M.id-Y.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,c=f.now();e.unstable_now=function(){return f.now()-c}}var d=[],p=[],g=1,m=null,x=3,_=!1,k=!1,C=!1,b=!1,v=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;function j(M){for(var Y=i(p);Y!==null;){if(Y.callback===null)s(p);else if(Y.startTime<=M)s(p),Y.sortIndex=Y.expirationTime,r(d,Y);else break;Y=i(p)}}function A(M){if(C=!1,j(M),!k)if(i(d)!==null)k=!0,N||(N=!0,K());else{var Y=i(p);Y!==null&&U(A,Y.startTime-M)}}var N=!1,D=-1,T=5,B=-1;function H(){return b?!0:!(e.unstable_now()-B<T)}function W(){if(b=!1,N){var M=e.unstable_now();B=M;var Y=!0;try{e:{k=!1,C&&(C=!1,y(D),D=-1),_=!0;var Z=x;try{t:{for(j(M),m=i(d);m!==null&&!(m.expirationTime>M&&H());){var z=m.callback;if(typeof z=="function"){m.callback=null,x=m.priorityLevel;var L=z(m.expirationTime<=M);if(M=e.unstable_now(),typeof L=="function"){m.callback=L,j(M),Y=!0;break t}m===i(d)&&s(d),j(M)}else s(d);m=i(d)}if(m!==null)Y=!0;else{var I=i(p);I!==null&&U(A,I.startTime-M),Y=!1}}break e}finally{m=null,x=Z,_=!1}Y=void 0}}finally{Y?K():N=!1}}}var K;if(typeof S=="function")K=function(){S(W)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,R=q.port2;q.port1.onmessage=W,K=function(){R.postMessage(null)}}else K=function(){v(W,0)};function U(M,Y){D=v(function(){M(e.unstable_now())},Y)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(M){M.callback=null},e.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<M?Math.floor(1e3/M):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(M){switch(x){case 1:case 2:case 3:var Y=3;break;default:Y=x}var Z=x;x=Y;try{return M()}finally{x=Z}},e.unstable_requestPaint=function(){b=!0},e.unstable_runWithPriority=function(M,Y){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var Z=x;x=M;try{return Y()}finally{x=Z}},e.unstable_scheduleCallback=function(M,Y,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,M){case 1:var L=-1;break;case 2:L=250;break;case 5:L=1073741823;break;case 4:L=1e4;break;default:L=5e3}return L=Z+L,M={id:g++,callback:Y,priorityLevel:M,startTime:Z,expirationTime:L,sortIndex:-1},Z>z?(M.sortIndex=Z,r(p,M),i(d)===null&&M===i(p)&&(C?(y(D),D=-1):C=!0,U(A,Z-z))):(M.sortIndex=L,r(d,M),k||_||(k=!0,N||(N=!0,K()))),M},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(M){var Y=x;return function(){var Z=x;x=Y;try{return M.apply(this,arguments)}finally{x=Z}}}})(Ed)),Ed}var px;function q1(){return px||(px=1,kd.exports=$1()),kd.exports}var jd={exports:{}},cn={};/**
|
|
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 mx;function W1(){if(mx)return cn;mx=1;var e=Vl();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},l=Symbol.for("react.portal");function u(d,p,g){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,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 c(d,p){if(d==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return cn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,cn.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)},cn.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()}},cn.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))},cn.prefetchDNS=function(d){typeof d=="string"&&s.d.D(d)},cn.preinit=function(d,p){if(typeof d=="string"&&p&&typeof p.as=="string"){var g=p.as,m=c(g,p.crossOrigin),x=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:x,fetchPriority:_}):g==="script"&&s.d.X(d,{crossOrigin:m,integrity:x,fetchPriority:_,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},cn.preinitModule=function(d,p){if(typeof d=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var g=c(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)},cn.preload=function(d,p){if(typeof d=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var g=p.as,m=c(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})}},cn.preloadModule=function(d,p){if(typeof d=="string")if(p){var g=c(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)},cn.requestFormReset=function(d){s.d.r(d)},cn.unstable_batchedUpdates=function(d,p){return d(p)},cn.useFormState=function(d,p,g){return f.H.useFormState(d,p,g)},cn.useFormStatus=function(){return f.H.useHostTransitionStatus()},cn.version="19.2.4",cn}var gx;function db(){if(gx)return jd.exports;gx=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(),jd.exports=W1(),jd.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 xx;function G1(){if(xx)return Aa;xx=1;var e=q1(),r=Vl(),i=db();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 l(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 c(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 O=!1,G=w.child;G;){if(G===a){O=!0,a=w,h=E;break}if(G===h){O=!0,h=w,a=E;break}G=G.sibling}if(!O){for(G=E.child;G;){if(G===a){O=!0,a=E,h=w;break}if(G===h){O=!0,h=E,a=w;break}G=G.sibling}if(!O)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,x=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),y=Symbol.for("react.consumer"),S=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),H=Symbol.for("react.memo_cache_sentinel"),W=Symbol.iterator;function K(t){return t===null||typeof t!="object"?null:(t=W&&t[W]||t["@@iterator"],typeof t=="function"?t:null)}var q=Symbol.for("react.client.reference");function R(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===q?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case C:return"Fragment";case v:return"Profiler";case b:return"StrictMode";case A: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 y: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:R(t.type)||"Memo";case T:n=t._payload,t=t._init;try{return R(t(n))}catch{}}return null}var U=Array.isArray,M=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z={pending:!1,data:null,method:null,action:null},z=[],L=-1;function I(t){return{current:t}}function V(t){0>L||(t.current=z[L],z[L]=null,L--)}function F(t,n){L++,z[L]=t.current,t.current=n}var ie=I(null),Q=I(null),ee=I(null),X=I(null);function $(t,n){switch(F(ee,n),F(Q,t),F(ie,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?Lg(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=Lg(n),t=Rg(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}V(ie),F(ie,t)}function oe(){V(ie),V(Q),V(ee)}function re(t){t.memoizedState!==null&&F(X,t);var n=ie.current,a=Rg(n,t.type);n!==a&&(F(Q,t),F(ie,a))}function ve(t){Q.current===t&&(V(ie),V(Q)),X.current===t&&(V(X),ka._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 He=!1;function Ue(t,n){if(!t||He)return"";He=!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(),O=E[0],G=E[1];if(O&&G){var J=O.split(`
|
|
44
|
+
`),le=G.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{He=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?Oe(a):""}function Ne(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 Ue(t.type,!1);case 11:return Ue(t.type.render,!1);case 1:return Ue(t.type,!0);case 31:return Oe("Activity");default:return""}}function me(t){try{var n="",a=null;do n+=Ne(t,a),a=t,t=t.return;while(t);return n}catch(h){return`
|
|
47
|
+
Error generating stack: `+h.message+`
|
|
48
|
+
`+h.stack}}var Te=Object.prototype.hasOwnProperty,$e=e.unstable_scheduleCallback,Rt=e.unstable_cancelCallback,fe=e.unstable_shouldYield,Ae=e.unstable_requestPaint,Be=e.unstable_now,ot=e.unstable_getCurrentPriorityLevel,ue=e.unstable_ImmediatePriority,Se=e.unstable_UserBlockingPriority,je=e.unstable_NormalPriority,Ie=e.unstable_LowPriority,Ge=e.unstable_IdlePriority,Nt=e.log,Ze=e.unstable_setDisableYieldValue,Ot=null,Tt=null;function Kt(t){if(typeof Nt=="function"&&Ze(t),Tt&&typeof Tt.setStrictMode=="function")try{Tt.setStrictMode(Ot,t)}catch{}}var lt=Math.clz32?Math.clz32:Hs,kn=Math.log,Jt=Math.LN2;function Hs(t){return t>>>=0,t===0?32:31-(kn(t)/Jt|0)|0}var pe=256,_e=262144,Ce=4194304;function qe(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 ne(t,n,a){var h=t.pendingLanes;if(h===0)return 0;var w=0,E=t.suspendedLanes,O=t.pingedLanes;t=t.warmLanes;var G=h&134217727;return G!==0?(h=G&~E,h!==0?w=qe(h):(O&=G,O!==0?w=qe(O):a||(a=G&~t,a!==0&&(w=qe(a))))):(G=h&~E,G!==0?w=qe(G):O!==0?w=qe(O):a||(a=h&~t,a!==0&&(w=qe(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 ye(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function Me(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 Ve(){var t=Ce;return Ce<<=1,(Ce&62914560)===0&&(Ce=4194304),t}function st(t){for(var n=[],a=0;31>a;a++)n.push(t);return n}function en(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function er(t,n,a,h,w,E){var O=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 G=t.entanglements,J=t.expirationTimes,le=t.hiddenUpdates;for(a=O&~a;0<a;){var he=31-lt(a),xe=1<<he;G[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&&Pi(t,h,0),E!==0&&w===0&&t.tag!==0&&(t.suspendedLanes|=E&~(O&~n))}function Pi(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 Or(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 gf(t,n){var a=n&-n;return a=(a&42)!==0?1:dc(a),(a&(t.suspendedLanes|n))!==0?0:a}function dc(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 hc(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function xf(){var t=Y.p;return t!==0?t:(t=window.event,t===void 0?32:nx(t.type))}function vf(t,n){var a=Y.p;try{return Y.p=t,n()}finally{Y.p=a}}var Mr=Math.random().toString(36).slice(2),tn="__reactFiber$"+Mr,gn="__reactProps$"+Mr,Fi="__reactContainer$"+Mr,fc="__reactEvents$"+Mr,k0="__reactListeners$"+Mr,E0="__reactHandles$"+Mr,bf="__reactResources$"+Mr,Ps="__reactMarker$"+Mr;function pc(t){delete t[tn],delete t[gn],delete t[fc],delete t[k0],delete t[E0]}function Ui(t){var n=t[tn];if(n)return n;for(var a=t.parentNode;a;){if(n=a[Fi]||a[tn]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(t=Pg(t);t!==null;){if(a=t[tn])return a;t=Pg(t)}return n}t=a,a=t.parentNode}return null}function $i(t){if(t=t[tn]||t[Fi]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function Fs(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(s(33))}function qi(t){var n=t[bf];return n||(n=t[bf]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Yt(t){t[Ps]=!0}var yf=new Set,_f={};function ui(t,n){Wi(t,n),Wi(t+"Capture",n)}function Wi(t,n){for(_f[t]=n,t=0;t<n.length;t++)yf.add(n[t])}var j0=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]*$"),Sf={},wf={};function N0(t){return Te.call(wf,t)?!0:Te.call(Sf,t)?!1:j0.test(t)?wf[t]=!0:(Sf[t]=!0,!1)}function uo(t,n,a){if(N0(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 ho(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 hr(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 Bn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Cf(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function T0(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(O){a=""+O,E.call(this,O)}}),Object.defineProperty(t,n,{enumerable:h.enumerable}),{getValue:function(){return a},setValue:function(O){a=""+O},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function mc(t){if(!t._valueTracker){var n=Cf(t)?"checked":"value";t._valueTracker=T0(t,n,""+t[n])}}function kf(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var a=n.getValue(),h="";return t&&(h=Cf(t)?t.checked?"true":"false":t.value),t=h,t!==a?(n.setValue(t),!0):!1}function fo(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 A0=/[\n"\\]/g;function zn(t){return t.replace(A0,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function gc(t,n,a,h,w,E,O,G){t.name="",O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?t.type=O:t.removeAttribute("type"),n!=null?O==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+Bn(n)):t.value!==""+Bn(n)&&(t.value=""+Bn(n)):O!=="submit"&&O!=="reset"||t.removeAttribute("value"),n!=null?xc(t,O,Bn(n)):a!=null?xc(t,O,Bn(a)):h!=null&&t.removeAttribute("value"),w==null&&E!=null&&(t.defaultChecked=!!E),w!=null&&(t.checked=w&&typeof w!="function"&&typeof w!="symbol"),G!=null&&typeof G!="function"&&typeof G!="symbol"&&typeof G!="boolean"?t.name=""+Bn(G):t.removeAttribute("name")}function Ef(t,n,a,h,w,E,O,G){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)){mc(t);return}a=a!=null?""+Bn(a):"",n=n!=null?""+Bn(n):a,G||n===t.value||(t.value=n),t.defaultValue=n}h=h??w,h=typeof h!="function"&&typeof h!="symbol"&&!!h,t.checked=G?t.checked:!!h,t.defaultChecked=!!h,O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"&&(t.name=O),mc(t)}function xc(t,n,a){n==="number"&&fo(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function Gi(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=""+Bn(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 jf(t,n,a){if(n!=null&&(n=""+Bn(n),n!==t.value&&(t.value=n),a==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=a!=null?""+Bn(a):""}function Nf(t,n,a,h){if(n==null){if(h!=null){if(a!=null)throw Error(s(92));if(U(h)){if(1<h.length)throw Error(s(93));h=h[0]}a=h}a==null&&(a=""),n=a}a=Bn(n),t.defaultValue=a,h=t.textContent,h===a&&h!==""&&h!==null&&(t.value=h),mc(t)}function Vi(t,n){if(n){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=n;return}}t.textContent=n}var D0=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 Tf(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||D0.has(n)?n==="float"?t.cssFloat=a:t[n]=(""+a).trim():t[n]=a+"px"}function Af(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&&Tf(t,w,h)}else for(var E in n)n.hasOwnProperty(E)&&Tf(t,E,n[E])}function vc(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 L0=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"]]),R0=/^[\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 po(t){return R0.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function fr(){}var bc=null;function yc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Ki=null,Yi=null;function Df(t){var n=$i(t);if(n&&(t=n.stateNode)){var a=t[gn]||null;e:switch(t=n.stateNode,n.type){case"input":if(gc(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="'+zn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var h=a[n];if(h!==t&&h.form===t.form){var w=h[gn]||null;if(!w)throw Error(s(90));gc(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&&kf(h)}break e;case"textarea":jf(t,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Gi(t,!!a.multiple,n,!1)}}}var _c=!1;function Lf(t,n,a){if(_c)return t(n,a);_c=!0;try{var h=t(n);return h}finally{if(_c=!1,(Ki!==null||Yi!==null)&&(tl(),Ki&&(n=Ki,t=Yi,Yi=Ki=null,Df(n),t)))for(n=0;n<t.length;n++)Df(t[n])}}function Us(t,n){var a=t.stateNode;if(a===null)return null;var h=a[gn]||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 pr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Sc=!1;if(pr)try{var $s={};Object.defineProperty($s,"passive",{get:function(){Sc=!0}}),window.addEventListener("test",$s,$s),window.removeEventListener("test",$s,$s)}catch{Sc=!1}var Ir=null,wc=null,mo=null;function Rf(){if(mo)return mo;var t,n=wc,a=n.length,h,w="value"in Ir?Ir.value:Ir.textContent,E=w.length;for(t=0;t<a&&n[t]===w[t];t++);var O=a-t;for(h=1;h<=O&&n[a-h]===w[E-h];h++);return mo=w.slice(t,1<h?1-h:void 0)}function go(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 xo(){return!0}function Of(){return!1}function xn(t){function n(a,h,w,E,O){this._reactName=a,this._targetInst=w,this.type=h,this.nativeEvent=E,this.target=O,this.currentTarget=null;for(var G in t)t.hasOwnProperty(G)&&(a=t[G],this[G]=a?a(E):E[G]);return this.isDefaultPrevented=(E.defaultPrevented!=null?E.defaultPrevented:E.returnValue===!1)?xo:Of,this.isPropagationStopped=Of,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=xo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=xo)},persist:function(){},isPersistent:xo}),n}var di={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vo=xn(di),qs=m({},di,{view:0,detail:0}),O0=xn(qs),Cc,kc,Ws,bo=m({},qs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:jc,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!==Ws&&(Ws&&t.type==="mousemove"?(Cc=t.screenX-Ws.screenX,kc=t.screenY-Ws.screenY):kc=Cc=0,Ws=t),Cc)},movementY:function(t){return"movementY"in t?t.movementY:kc}}),Mf=xn(bo),M0=m({},bo,{dataTransfer:0}),I0=xn(M0),B0=m({},qs,{relatedTarget:0}),Ec=xn(B0),z0=m({},di,{animationName:0,elapsedTime:0,pseudoElement:0}),H0=xn(z0),P0=m({},di,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),F0=xn(P0),U0=m({},di,{data:0}),If=xn(U0),$0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},q0={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"},W0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function G0(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=W0[t])?!!n[t]:!1}function jc(){return G0}var V0=m({},qs,{key:function(t){if(t.key){var n=$0[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=go(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?q0[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:jc,charCode:function(t){return t.type==="keypress"?go(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?go(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),K0=xn(V0),Y0=m({},bo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Bf=xn(Y0),X0=m({},qs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jc}),Z0=xn(X0),Q0=m({},di,{propertyName:0,elapsedTime:0,pseudoElement:0}),J0=xn(Q0),e_=m({},bo,{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}),t_=xn(e_),n_=m({},di,{newState:0,oldState:0}),r_=xn(n_),i_=[9,13,27,32],Nc=pr&&"CompositionEvent"in window,Gs=null;pr&&"documentMode"in document&&(Gs=document.documentMode);var s_=pr&&"TextEvent"in window&&!Gs,zf=pr&&(!Nc||Gs&&8<Gs&&11>=Gs),Hf=" ",Pf=!1;function Ff(t,n){switch(t){case"keyup":return i_.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Uf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Xi=!1;function a_(t,n){switch(t){case"compositionend":return Uf(n);case"keypress":return n.which!==32?null:(Pf=!0,Hf);case"textInput":return t=n.data,t===Hf&&Pf?null:t;default:return null}}function o_(t,n){if(Xi)return t==="compositionend"||!Nc&&Ff(t,n)?(t=Rf(),mo=wc=Ir=null,Xi=!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 zf&&n.locale!=="ko"?null:n.data;default:return null}}var l_={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 $f(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!l_[t.type]:n==="textarea"}function qf(t,n,a,h){Ki?Yi?Yi.push(h):Yi=[h]:Ki=h,n=ll(n,"onChange"),0<n.length&&(a=new vo("onChange","change",null,a,h),t.push({event:a,listeners:n}))}var Vs=null,Ks=null;function c_(t){Eg(t,0)}function yo(t){var n=Fs(t);if(kf(n))return t}function Wf(t,n){if(t==="change")return n}var Gf=!1;if(pr){var Tc;if(pr){var Ac="oninput"in document;if(!Ac){var Vf=document.createElement("div");Vf.setAttribute("oninput","return;"),Ac=typeof Vf.oninput=="function"}Tc=Ac}else Tc=!1;Gf=Tc&&(!document.documentMode||9<document.documentMode)}function Kf(){Vs&&(Vs.detachEvent("onpropertychange",Yf),Ks=Vs=null)}function Yf(t){if(t.propertyName==="value"&&yo(Ks)){var n=[];qf(n,Ks,t,yc(t)),Lf(c_,n)}}function u_(t,n,a){t==="focusin"?(Kf(),Vs=n,Ks=a,Vs.attachEvent("onpropertychange",Yf)):t==="focusout"&&Kf()}function d_(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return yo(Ks)}function h_(t,n){if(t==="click")return yo(n)}function f_(t,n){if(t==="input"||t==="change")return yo(n)}function p_(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var En=typeof Object.is=="function"?Object.is:p_;function Ys(t,n){if(En(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(!Te.call(n,w)||!En(t[w],n[w]))return!1}return!0}function Xf(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Zf(t,n){var a=Xf(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=Xf(a)}}function Qf(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?Qf(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function Jf(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=fo(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=fo(t.document)}return n}function Dc(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 m_=pr&&"documentMode"in document&&11>=document.documentMode,Zi=null,Lc=null,Xs=null,Rc=!1;function ep(t,n,a){var h=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Rc||Zi==null||Zi!==fo(h)||(h=Zi,"selectionStart"in h&&Dc(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}),Xs&&Ys(Xs,h)||(Xs=h,h=ll(Lc,"onSelect"),0<h.length&&(n=new vo("onSelect","select",null,n,a),t.push({event:n,listeners:h}),n.target=Zi)))}function hi(t,n){var a={};return a[t.toLowerCase()]=n.toLowerCase(),a["Webkit"+t]="webkit"+n,a["Moz"+t]="moz"+n,a}var Qi={animationend:hi("Animation","AnimationEnd"),animationiteration:hi("Animation","AnimationIteration"),animationstart:hi("Animation","AnimationStart"),transitionrun:hi("Transition","TransitionRun"),transitionstart:hi("Transition","TransitionStart"),transitioncancel:hi("Transition","TransitionCancel"),transitionend:hi("Transition","TransitionEnd")},Oc={},tp={};pr&&(tp=document.createElement("div").style,"AnimationEvent"in window||(delete Qi.animationend.animation,delete Qi.animationiteration.animation,delete Qi.animationstart.animation),"TransitionEvent"in window||delete Qi.transitionend.transition);function fi(t){if(Oc[t])return Oc[t];if(!Qi[t])return t;var n=Qi[t],a;for(a in n)if(n.hasOwnProperty(a)&&a in tp)return Oc[t]=n[a];return t}var np=fi("animationend"),rp=fi("animationiteration"),ip=fi("animationstart"),g_=fi("transitionrun"),x_=fi("transitionstart"),v_=fi("transitioncancel"),sp=fi("transitionend"),ap=new Map,Mc="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(" ");Mc.push("scrollEnd");function Yn(t,n){ap.set(t,n),ui(n,[t])}var _o=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)},Hn=[],Ji=0,Ic=0;function So(){for(var t=Ji,n=Ic=Ji=0;n<t;){var a=Hn[n];Hn[n++]=null;var h=Hn[n];Hn[n++]=null;var w=Hn[n];Hn[n++]=null;var E=Hn[n];if(Hn[n++]=null,h!==null&&w!==null){var O=h.pending;O===null?w.next=w:(w.next=O.next,O.next=w),h.pending=w}E!==0&&op(a,w,E)}}function wo(t,n,a,h){Hn[Ji++]=t,Hn[Ji++]=n,Hn[Ji++]=a,Hn[Ji++]=h,Ic|=h,t.lanes|=h,t=t.alternate,t!==null&&(t.lanes|=h)}function Bc(t,n,a,h){return wo(t,n,a,h),Co(t)}function pi(t,n){return wo(t,null,null,n),Co(t)}function op(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 Co(t){if(50<va)throw va=0,Gu=null,Error(s(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var es={};function b_(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 jn(t,n,a,h){return new b_(t,n,a,h)}function zc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function mr(t,n){var a=t.alternate;return a===null?(a=jn(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 lp(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 ko(t,n,a,h,w,E){var O=0;if(h=t,typeof t=="function")zc(t)&&(O=1);else if(typeof t=="string")O=C1(t,a,ie.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case B:return t=jn(31,a,n,w),t.elementType=B,t.lanes=E,t;case C:return mi(a.children,w,E,n);case b:O=8,w|=24;break;case v:return t=jn(12,a,n,w|2),t.elementType=v,t.lanes=E,t;case A:return t=jn(13,a,n,w),t.elementType=A,t.lanes=E,t;case N:return t=jn(19,a,n,w),t.elementType=N,t.lanes=E,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case S:O=10;break e;case y:O=9;break e;case j:O=11;break e;case D:O=14;break e;case T:O=16,h=null;break e}O=29,a=Error(s(130,t===null?"null":typeof t,"")),h=null}return n=jn(O,a,n,w),n.elementType=t,n.type=h,n.lanes=E,n}function mi(t,n,a,h){return t=jn(7,t,h,n),t.lanes=a,t}function Hc(t,n,a){return t=jn(6,t,null,n),t.lanes=a,t}function cp(t){var n=jn(18,null,null,0);return n.stateNode=t,n}function Pc(t,n,a){return n=jn(4,t.children!==null?t.children:[],t.key,n),n.lanes=a,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var up=new WeakMap;function Pn(t,n){if(typeof t=="object"&&t!==null){var a=up.get(t);return a!==void 0?a:(n={value:t,source:n,stack:me(n)},up.set(t,n),n)}return{value:t,source:n,stack:me(n)}}var ts=[],ns=0,Eo=null,Zs=0,Fn=[],Un=0,Br=null,tr=1,nr="";function gr(t,n){ts[ns++]=Zs,ts[ns++]=Eo,Eo=t,Zs=n}function dp(t,n,a){Fn[Un++]=tr,Fn[Un++]=nr,Fn[Un++]=Br,Br=t;var h=tr;t=nr;var w=32-lt(h)-1;h&=~(1<<w),a+=1;var E=32-lt(n)+w;if(30<E){var O=w-w%5;E=(h&(1<<O)-1).toString(32),h>>=O,w-=O,tr=1<<32-lt(n)+w|a<<w|h,nr=E+t}else tr=1<<E|a<<w|h,nr=t}function Fc(t){t.return!==null&&(gr(t,1),dp(t,1,0))}function Uc(t){for(;t===Eo;)Eo=ts[--ns],ts[ns]=null,Zs=ts[--ns],ts[ns]=null;for(;t===Br;)Br=Fn[--Un],Fn[Un]=null,nr=Fn[--Un],Fn[Un]=null,tr=Fn[--Un],Fn[Un]=null}function hp(t,n){Fn[Un++]=tr,Fn[Un++]=nr,Fn[Un++]=Br,tr=n.id,nr=n.overflow,Br=t}var nn=null,_t=null,it=!1,zr=null,$n=!1,$c=Error(s(519));function Hr(t){var n=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Qs(Pn(n,t)),$c}function fp(t){var n=t.stateNode,a=t.type,h=t.memoizedProps;switch(n[tn]=t,n[gn]=h,a){case"dialog":Je("cancel",n),Je("close",n);break;case"iframe":case"object":case"embed":Je("load",n);break;case"video":case"audio":for(a=0;a<ya.length;a++)Je(ya[a],n);break;case"source":Je("error",n);break;case"img":case"image":case"link":Je("error",n),Je("load",n);break;case"details":Je("toggle",n);break;case"input":Je("invalid",n),Ef(n,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":Je("invalid",n);break;case"textarea":Je("invalid",n),Nf(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||Ag(n.textContent,a)?(h.popover!=null&&(Je("beforetoggle",n),Je("toggle",n)),h.onScroll!=null&&Je("scroll",n),h.onScrollEnd!=null&&Je("scrollend",n),h.onClick!=null&&(n.onclick=fr),n=!0):n=!1,n||Hr(t,!0)}function pp(t){for(nn=t.return;nn;)switch(nn.tag){case 5:case 31:case 13:$n=!1;return;case 27:case 3:$n=!0;return;default:nn=nn.return}}function rs(t){if(t!==nn)return!1;if(!it)return pp(t),it=!0,!1;var n=t.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||od(t.type,t.memoizedProps)),a=!a),a&&_t&&Hr(t),pp(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));_t=Hg(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));_t=Hg(t)}else n===27?(n=_t,Jr(t.type)?(t=hd,hd=null,_t=t):_t=n):_t=nn?Wn(t.stateNode.nextSibling):null;return!0}function gi(){_t=nn=null,it=!1}function qc(){var t=zr;return t!==null&&(_n===null?_n=t:_n.push.apply(_n,t),zr=null),t}function Qs(t){zr===null?zr=[t]:zr.push(t)}var Wc=I(null),xi=null,xr=null;function Pr(t,n,a){F(Wc,n._currentValue),n._currentValue=a}function vr(t){t._currentValue=Wc.current,V(Wc)}function Gc(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 Vc(t,n,a,h){var w=t.child;for(w!==null&&(w.return=t);w!==null;){var E=w.dependencies;if(E!==null){var O=w.child;E=E.firstContext;e:for(;E!==null;){var G=E;E=w;for(var J=0;J<n.length;J++)if(G.context===n[J]){E.lanes|=a,G=E.alternate,G!==null&&(G.lanes|=a),Gc(E.return,a,t),h||(O=null);break e}E=G.next}}else if(w.tag===18){if(O=w.return,O===null)throw Error(s(341));O.lanes|=a,E=O.alternate,E!==null&&(E.lanes|=a),Gc(O,a,t),O=null}else O=w.child;if(O!==null)O.return=w;else for(O=w;O!==null;){if(O===t){O=null;break}if(w=O.sibling,w!==null){w.return=O.return,O=w;break}O=O.return}w=O}}function is(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 O=w.alternate;if(O===null)throw Error(s(387));if(O=O.memoizedProps,O!==null){var G=w.type;En(w.pendingProps.value,O.value)||(t!==null?t.push(G):t=[G])}}else if(w===X.current){if(O=w.alternate,O===null)throw Error(s(387));O.memoizedState.memoizedState!==w.memoizedState.memoizedState&&(t!==null?t.push(ka):t=[ka])}w=w.return}t!==null&&Vc(n,t,a,h),n.flags|=262144}function jo(t){for(t=t.firstContext;t!==null;){if(!En(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function vi(t){xi=t,xr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function rn(t){return mp(xi,t)}function No(t,n){return xi===null&&vi(t),mp(t,n)}function mp(t,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},xr===null){if(t===null)throw Error(s(308));xr=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else xr=xr.next=n;return a}var y_=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()})}},__=e.unstable_scheduleCallback,S_=e.unstable_NormalPriority,zt={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Kc(){return{controller:new y_,data:new Map,refCount:0}}function Js(t){t.refCount--,t.refCount===0&&__(S_,function(){t.controller.abort()})}var ea=null,Yc=0,ss=0,as=null;function w_(t,n){if(ea===null){var a=ea=[];Yc=0,ss=Qu(),as={status:"pending",value:void 0,then:function(h){a.push(h)}}}return Yc++,n.then(gp,gp),n}function gp(){if(--Yc===0&&ea!==null){as!==null&&(as.status="fulfilled");var t=ea;ea=null,ss=0,as=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function C_(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 xp=M.S;M.S=function(t,n){eg=Be(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&w_(t,n),xp!==null&&xp(t,n)};var bi=I(null);function Xc(){var t=bi.current;return t!==null?t:vt.pooledCache}function To(t,n){n===null?F(bi,bi.current):F(bi,n.pool)}function vp(){var t=Xc();return t===null?null:{parent:zt._currentValue,pool:t}}var os=Error(s(460)),Zc=Error(s(474)),Ao=Error(s(542)),Do={then:function(){}};function bp(t){return t=t.status,t==="fulfilled"||t==="rejected"}function yp(t,n,a){switch(a=t[a],a===void 0?t.push(n):a!==n&&(n.then(fr,fr),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,Sp(t),t;default:if(typeof n.status=="string")n.then(fr,fr);else{if(t=vt,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,Sp(t),t}throw _i=n,os}}function yi(t){try{var n=t._init;return n(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(_i=a,os):a}}var _i=null;function _p(){if(_i===null)throw Error(s(459));var t=_i;return _i=null,t}function Sp(t){if(t===os||t===Ao)throw Error(s(483))}var ls=null,ta=0;function Lo(t){var n=ta;return ta+=1,ls===null&&(ls=[]),yp(ls,t,n)}function na(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function Ro(t,n){throw n.$$typeof===x?Error(s(525)):(t=Object.prototype.toString.call(n),Error(s(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function wp(t){function n(se,te){if(t){var ae=se.deletions;ae===null?(se.deletions=[te],se.flags|=16):ae.push(te)}}function a(se,te){if(!t)return null;for(;te!==null;)n(se,te),te=te.sibling;return null}function h(se){for(var te=new Map;se!==null;)se.key!==null?te.set(se.key,se):te.set(se.index,se),se=se.sibling;return te}function w(se,te){return se=mr(se,te),se.index=0,se.sibling=null,se}function E(se,te,ae){return se.index=ae,t?(ae=se.alternate,ae!==null?(ae=ae.index,ae<te?(se.flags|=67108866,te):ae):(se.flags|=67108866,te)):(se.flags|=1048576,te)}function O(se){return t&&se.alternate===null&&(se.flags|=67108866),se}function G(se,te,ae,ge){return te===null||te.tag!==6?(te=Hc(ae,se.mode,ge),te.return=se,te):(te=w(te,ae),te.return=se,te)}function J(se,te,ae,ge){var ze=ae.type;return ze===C?he(se,te,ae.props.children,ge,ae.key):te!==null&&(te.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===T&&yi(ze)===te.type)?(te=w(te,ae.props),na(te,ae),te.return=se,te):(te=ko(ae.type,ae.key,ae.props,null,se.mode,ge),na(te,ae),te.return=se,te)}function le(se,te,ae,ge){return te===null||te.tag!==4||te.stateNode.containerInfo!==ae.containerInfo||te.stateNode.implementation!==ae.implementation?(te=Pc(ae,se.mode,ge),te.return=se,te):(te=w(te,ae.children||[]),te.return=se,te)}function he(se,te,ae,ge,ze){return te===null||te.tag!==7?(te=mi(ae,se.mode,ge,ze),te.return=se,te):(te=w(te,ae),te.return=se,te)}function xe(se,te,ae){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return te=Hc(""+te,se.mode,ae),te.return=se,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case _:return ae=ko(te.type,te.key,te.props,null,se.mode,ae),na(ae,te),ae.return=se,ae;case k:return te=Pc(te,se.mode,ae),te.return=se,te;case T:return te=yi(te),xe(se,te,ae)}if(U(te)||K(te))return te=mi(te,se.mode,ae,null),te.return=se,te;if(typeof te.then=="function")return xe(se,Lo(te),ae);if(te.$$typeof===S)return xe(se,No(se,te),ae);Ro(se,te)}return null}function ce(se,te,ae,ge){var ze=te!==null?te.key:null;if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return ze!==null?null:G(se,te,""+ae,ge);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case _:return ae.key===ze?J(se,te,ae,ge):null;case k:return ae.key===ze?le(se,te,ae,ge):null;case T:return ae=yi(ae),ce(se,te,ae,ge)}if(U(ae)||K(ae))return ze!==null?null:he(se,te,ae,ge,null);if(typeof ae.then=="function")return ce(se,te,Lo(ae),ge);if(ae.$$typeof===S)return ce(se,te,No(se,ae),ge);Ro(se,ae)}return null}function de(se,te,ae,ge,ze){if(typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint")return se=se.get(ae)||null,G(te,se,""+ge,ze);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case _:return se=se.get(ge.key===null?ae:ge.key)||null,J(te,se,ge,ze);case k:return se=se.get(ge.key===null?ae:ge.key)||null,le(te,se,ge,ze);case T:return ge=yi(ge),de(se,te,ae,ge,ze)}if(U(ge)||K(ge))return se=se.get(ae)||null,he(te,se,ge,ze,null);if(typeof ge.then=="function")return de(se,te,ae,Lo(ge),ze);if(ge.$$typeof===S)return de(se,te,ae,No(te,ge),ze);Ro(te,ge)}return null}function De(se,te,ae,ge){for(var ze=null,ct=null,Re=te,Ye=te=0,rt=null;Re!==null&&Ye<ae.length;Ye++){Re.index>Ye?(rt=Re,Re=null):rt=Re.sibling;var ut=ce(se,Re,ae[Ye],ge);if(ut===null){Re===null&&(Re=rt);break}t&&Re&&ut.alternate===null&&n(se,Re),te=E(ut,te,Ye),ct===null?ze=ut:ct.sibling=ut,ct=ut,Re=rt}if(Ye===ae.length)return a(se,Re),it&&gr(se,Ye),ze;if(Re===null){for(;Ye<ae.length;Ye++)Re=xe(se,ae[Ye],ge),Re!==null&&(te=E(Re,te,Ye),ct===null?ze=Re:ct.sibling=Re,ct=Re);return it&&gr(se,Ye),ze}for(Re=h(Re);Ye<ae.length;Ye++)rt=de(Re,se,Ye,ae[Ye],ge),rt!==null&&(t&&rt.alternate!==null&&Re.delete(rt.key===null?Ye:rt.key),te=E(rt,te,Ye),ct===null?ze=rt:ct.sibling=rt,ct=rt);return t&&Re.forEach(function(ii){return n(se,ii)}),it&&gr(se,Ye),ze}function Fe(se,te,ae,ge){if(ae==null)throw Error(s(151));for(var ze=null,ct=null,Re=te,Ye=te=0,rt=null,ut=ae.next();Re!==null&&!ut.done;Ye++,ut=ae.next()){Re.index>Ye?(rt=Re,Re=null):rt=Re.sibling;var ii=ce(se,Re,ut.value,ge);if(ii===null){Re===null&&(Re=rt);break}t&&Re&&ii.alternate===null&&n(se,Re),te=E(ii,te,Ye),ct===null?ze=ii:ct.sibling=ii,ct=ii,Re=rt}if(ut.done)return a(se,Re),it&&gr(se,Ye),ze;if(Re===null){for(;!ut.done;Ye++,ut=ae.next())ut=xe(se,ut.value,ge),ut!==null&&(te=E(ut,te,Ye),ct===null?ze=ut:ct.sibling=ut,ct=ut);return it&&gr(se,Ye),ze}for(Re=h(Re);!ut.done;Ye++,ut=ae.next())ut=de(Re,se,Ye,ut.value,ge),ut!==null&&(t&&ut.alternate!==null&&Re.delete(ut.key===null?Ye:ut.key),te=E(ut,te,Ye),ct===null?ze=ut:ct.sibling=ut,ct=ut);return t&&Re.forEach(function(M1){return n(se,M1)}),it&&gr(se,Ye),ze}function xt(se,te,ae,ge){if(typeof ae=="object"&&ae!==null&&ae.type===C&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case _:e:{for(var ze=ae.key;te!==null;){if(te.key===ze){if(ze=ae.type,ze===C){if(te.tag===7){a(se,te.sibling),ge=w(te,ae.props.children),ge.return=se,se=ge;break e}}else if(te.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===T&&yi(ze)===te.type){a(se,te.sibling),ge=w(te,ae.props),na(ge,ae),ge.return=se,se=ge;break e}a(se,te);break}else n(se,te);te=te.sibling}ae.type===C?(ge=mi(ae.props.children,se.mode,ge,ae.key),ge.return=se,se=ge):(ge=ko(ae.type,ae.key,ae.props,null,se.mode,ge),na(ge,ae),ge.return=se,se=ge)}return O(se);case k:e:{for(ze=ae.key;te!==null;){if(te.key===ze)if(te.tag===4&&te.stateNode.containerInfo===ae.containerInfo&&te.stateNode.implementation===ae.implementation){a(se,te.sibling),ge=w(te,ae.children||[]),ge.return=se,se=ge;break e}else{a(se,te);break}else n(se,te);te=te.sibling}ge=Pc(ae,se.mode,ge),ge.return=se,se=ge}return O(se);case T:return ae=yi(ae),xt(se,te,ae,ge)}if(U(ae))return De(se,te,ae,ge);if(K(ae)){if(ze=K(ae),typeof ze!="function")throw Error(s(150));return ae=ze.call(ae),Fe(se,te,ae,ge)}if(typeof ae.then=="function")return xt(se,te,Lo(ae),ge);if(ae.$$typeof===S)return xt(se,te,No(se,ae),ge);Ro(se,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint"?(ae=""+ae,te!==null&&te.tag===6?(a(se,te.sibling),ge=w(te,ae),ge.return=se,se=ge):(a(se,te),ge=Hc(ae,se.mode,ge),ge.return=se,se=ge),O(se)):a(se,te)}return function(se,te,ae,ge){try{ta=0;var ze=xt(se,te,ae,ge);return ls=null,ze}catch(Re){if(Re===os||Re===Ao)throw Re;var ct=jn(29,Re,null,se.mode);return ct.lanes=ge,ct.return=se,ct}finally{}}}var Si=wp(!0),Cp=wp(!1),Fr=!1;function Qc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Jc(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 Ur(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function $r(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=Co(t),op(t,null,a),n}return wo(t,h,n,a),Co(t)}function ra(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,Or(t,a)}}function eu(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 O={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};E===null?w=E=O:E=E.next=O,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 tu=!1;function ia(){if(tu){var t=as;if(t!==null)throw t}}function sa(t,n,a,h){tu=!1;var w=t.updateQueue;Fr=!1;var E=w.firstBaseUpdate,O=w.lastBaseUpdate,G=w.shared.pending;if(G!==null){w.shared.pending=null;var J=G,le=J.next;J.next=null,O===null?E=le:O.next=le,O=J;var he=t.alternate;he!==null&&(he=he.updateQueue,G=he.lastBaseUpdate,G!==O&&(G===null?he.firstBaseUpdate=le:G.next=le,he.lastBaseUpdate=J))}if(E!==null){var xe=w.baseState;O=0,he=le=J=null,G=E;do{var ce=G.lane&-536870913,de=ce!==G.lane;if(de?(nt&ce)===ce:(h&ce)===ce){ce!==0&&ce===ss&&(tu=!0),he!==null&&(he=he.next={lane:0,tag:G.tag,payload:G.payload,callback:null,next:null});e:{var De=t,Fe=G;ce=n;var xt=a;switch(Fe.tag){case 1:if(De=Fe.payload,typeof De=="function"){xe=De.call(xt,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(xt,xe,ce):De,ce==null)break e;xe=m({},xe,ce);break e;case 2:Fr=!0}}ce=G.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:G.tag,payload:G.payload,callback:G.callback,next:null},he===null?(le=he=de,J=xe):he=he.next=de,O|=ce;if(G=G.next,G===null){if(G=w.shared.pending,G===null)break;de=G,G=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),Kr|=O,t.lanes=O,t.memoizedState=xe}}function kp(t,n){if(typeof t!="function")throw Error(s(191,t));t.call(n)}function Ep(t,n){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)kp(a[t],n)}var cs=I(null),Oo=I(0);function jp(t,n){t=jr,F(Oo,t),F(cs,n),jr=t|n.baseLanes}function nu(){F(Oo,jr),F(cs,cs.current)}function ru(){jr=Oo.current,V(cs),V(Oo)}var Nn=I(null),qn=null;function qr(t){var n=t.alternate;F(Mt,Mt.current&1),F(Nn,t),qn===null&&(n===null||cs.current!==null||n.memoizedState!==null)&&(qn=t)}function iu(t){F(Mt,Mt.current),F(Nn,t),qn===null&&(qn=t)}function Np(t){t.tag===22?(F(Mt,Mt.current),F(Nn,t),qn===null&&(qn=t)):Wr()}function Wr(){F(Mt,Mt.current),F(Nn,Nn.current)}function Tn(t){V(Nn),qn===t&&(qn=null),V(Mt)}var Mt=I(0);function Mo(t){for(var n=t;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||ud(a)||dd(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 br=0,Ke=null,mt=null,Ht=null,Io=!1,us=!1,wi=!1,Bo=0,aa=0,ds=null,k_=0;function Dt(){throw Error(s(321))}function su(t,n){if(n===null)return!1;for(var a=0;a<n.length&&a<t.length;a++)if(!En(t[a],n[a]))return!1;return!0}function au(t,n,a,h,w,E){return br=E,Ke=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,M.H=t===null||t.memoizedState===null?dm:_u,wi=!1,E=a(h,w),wi=!1,us&&(E=Ap(n,a,h,w)),Tp(t),E}function Tp(t){M.H=ca;var n=mt!==null&&mt.next!==null;if(br=0,Ht=mt=Ke=null,Io=!1,aa=0,ds=null,n)throw Error(s(300));t===null||Pt||(t=t.dependencies,t!==null&&jo(t)&&(Pt=!0))}function Ap(t,n,a,h){Ke=t;var w=0;do{if(us&&(ds=null),aa=0,us=!1,25<=w)throw Error(s(301));if(w+=1,Ht=mt=null,t.updateQueue!=null){var E=t.updateQueue;E.lastEffect=null,E.events=null,E.stores=null,E.memoCache!=null&&(E.memoCache.index=0)}M.H=hm,E=n(a,h)}while(us);return E}function E_(){var t=M.H,n=t.useState()[0];return n=typeof n.then=="function"?oa(n):n,t=t.useState()[0],(mt!==null?mt.memoizedState:null)!==t&&(Ke.flags|=1024),n}function ou(){var t=Bo!==0;return Bo=0,t}function lu(t,n,a){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~a}function cu(t){if(Io){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}Io=!1}br=0,Ht=mt=Ke=null,us=!1,aa=Bo=0,ds=null}function pn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ht===null?Ke.memoizedState=Ht=t:Ht=Ht.next=t,Ht}function It(){if(mt===null){var t=Ke.alternate;t=t!==null?t.memoizedState:null}else t=mt.next;var n=Ht===null?Ke.memoizedState:Ht.next;if(n!==null)Ht=n,mt=t;else{if(t===null)throw Ke.alternate===null?Error(s(467)):Error(s(310));mt=t,t={memoizedState:mt.memoizedState,baseState:mt.baseState,baseQueue:mt.baseQueue,queue:mt.queue,next:null},Ht===null?Ke.memoizedState=Ht=t:Ht=Ht.next=t}return Ht}function zo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function oa(t){var n=aa;return aa+=1,ds===null&&(ds=[]),t=yp(ds,t,n),n=Ke,(Ht===null?n.memoizedState:Ht.next)===null&&(n=n.alternate,M.H=n===null||n.memoizedState===null?dm:_u),t}function Ho(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return oa(t);if(t.$$typeof===S)return rn(t)}throw Error(s(438,String(t)))}function uu(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=zo(),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]=H;return n.index++,a}function yr(t,n){return typeof n=="function"?n(t):n}function Po(t){var n=It();return du(n,mt,t)}function du(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 O=w.next;w.next=E.next,E.next=O}n.baseQueue=w=E,h.pending=null}if(E=t.baseState,w===null)t.memoizedState=E;else{n=w.next;var G=O=null,J=null,le=n,he=!1;do{var xe=le.lane&-536870913;if(xe!==le.lane?(nt&xe)===xe:(br&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===ss&&(he=!0);else if((br&ce)===ce){le=le.next,ce===ss&&(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?(G=J=xe,O=E):J=J.next=xe,Ke.lanes|=ce,Kr|=ce;xe=le.action,wi&&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?(G=J=ce,O=E):J=J.next=ce,Ke.lanes|=xe,Kr|=xe;le=le.next}while(le!==null&&le!==n);if(J===null?O=E:J.next=G,!En(E,t.memoizedState)&&(Pt=!0,he&&(a=as,a!==null)))throw a;t.memoizedState=E,t.baseState=O,t.baseQueue=J,h.lastRenderedState=E}return w===null&&(h.lanes=0),[t.memoizedState,h.dispatch]}function hu(t){var n=It(),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 O=w=w.next;do E=t(E,O.action),O=O.next;while(O!==w);En(E,n.memoizedState)||(Pt=!0),n.memoizedState=E,n.baseQueue===null&&(n.baseState=E),a.lastRenderedState=E}return[E,h]}function Dp(t,n,a){var h=Ke,w=It(),E=it;if(E){if(a===void 0)throw Error(s(407));a=a()}else a=n();var O=!En((mt||w).memoizedState,a);if(O&&(w.memoizedState=a,Pt=!0),w=w.queue,mu(Op.bind(null,h,w,t),[t]),w.getSnapshot!==n||O||Ht!==null&&Ht.memoizedState.tag&1){if(h.flags|=2048,hs(9,{destroy:void 0},Rp.bind(null,h,w,a,n),null),vt===null)throw Error(s(349));E||(br&127)!==0||Lp(h,n,a)}return a}function Lp(t,n,a){t.flags|=16384,t={getSnapshot:n,value:a},n=Ke.updateQueue,n===null?(n=zo(),Ke.updateQueue=n,n.stores=[t]):(a=n.stores,a===null?n.stores=[t]:a.push(t))}function Rp(t,n,a,h){n.value=a,n.getSnapshot=h,Mp(n)&&Ip(t)}function Op(t,n,a){return a(function(){Mp(n)&&Ip(t)})}function Mp(t){var n=t.getSnapshot;t=t.value;try{var a=n();return!En(t,a)}catch{return!0}}function Ip(t){var n=pi(t,2);n!==null&&Sn(n,t,2)}function fu(t){var n=pn();if(typeof t=="function"){var a=t;if(t=a(),wi){Kt(!0);try{a()}finally{Kt(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:yr,lastRenderedState:t},n}function Bp(t,n,a,h){return t.baseState=a,du(t,mt,typeof h=="function"?h:yr)}function j_(t,n,a,h,w){if($o(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(O){E.listeners.push(O)}};M.T!==null?a(!0):E.isTransition=!1,h(E),a=n.pending,a===null?(E.next=n.pending=E,zp(n,E)):(E.next=a.next,n.pending=a.next=E)}}function zp(t,n){var a=n.action,h=n.payload,w=t.state;if(n.isTransition){var E=M.T,O={};M.T=O;try{var G=a(w,h),J=M.S;J!==null&&J(O,G),Hp(t,n,G)}catch(le){pu(t,n,le)}finally{E!==null&&O.types!==null&&(E.types=O.types),M.T=E}}else try{E=a(w,h),Hp(t,n,E)}catch(le){pu(t,n,le)}}function Hp(t,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(h){Pp(t,n,h)},function(h){return pu(t,n,h)}):Pp(t,n,a)}function Pp(t,n,a){n.status="fulfilled",n.value=a,Fp(n),t.state=a,n=t.pending,n!==null&&(a=n.next,a===n?t.pending=null:(a=a.next,n.next=a,zp(t,a)))}function pu(t,n,a){var h=t.pending;if(t.pending=null,h!==null){h=h.next;do n.status="rejected",n.reason=a,Fp(n),n=n.next;while(n!==h)}t.action=null}function Fp(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function Up(t,n){return n}function $p(t,n){if(it){var a=vt.formState;if(a!==null){e:{var h=Ke;if(it){if(_t){t:{for(var w=_t,E=$n;w.nodeType!==8;){if(!E){w=null;break t}if(w=Wn(w.nextSibling),w===null){w=null;break t}}E=w.data,w=E==="F!"||E==="F"?w:null}if(w){_t=Wn(w.nextSibling),h=w.data==="F!";break e}}Hr(h)}h=!1}h&&(n=a[0])}}return a=pn(),a.memoizedState=a.baseState=n,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Up,lastRenderedState:n},a.queue=h,a=lm.bind(null,Ke,h),h.dispatch=a,h=fu(!1),E=yu.bind(null,Ke,!1,h.queue),h=pn(),w={state:n,dispatch:null,action:t,pending:null},h.queue=w,a=j_.bind(null,Ke,w,E,a),w.dispatch=a,h.memoizedState=t,[n,a,!1]}function qp(t){var n=It();return Wp(n,mt,t)}function Wp(t,n,a){if(n=du(t,n,Up)[0],t=Po(yr)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var h=oa(n)}catch(O){throw O===os?Ao:O}else h=n;n=It();var w=n.queue,E=w.dispatch;return a!==n.memoizedState&&(Ke.flags|=2048,hs(9,{destroy:void 0},N_.bind(null,w,a),null)),[h,E,t]}function N_(t,n){t.action=n}function Gp(t){var n=It(),a=mt;if(a!==null)return Wp(n,a,t);It(),n=n.memoizedState,a=It();var h=a.queue.dispatch;return a.memoizedState=t,[n,h,!1]}function hs(t,n,a,h){return t={tag:t,create:a,deps:h,inst:n,next:null},n=Ke.updateQueue,n===null&&(n=zo(),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 Vp(){return It().memoizedState}function Fo(t,n,a,h){var w=pn();Ke.flags|=t,w.memoizedState=hs(1|n,{destroy:void 0},a,h===void 0?null:h)}function Uo(t,n,a,h){var w=It();h=h===void 0?null:h;var E=w.memoizedState.inst;mt!==null&&h!==null&&su(h,mt.memoizedState.deps)?w.memoizedState=hs(n,E,a,h):(Ke.flags|=t,w.memoizedState=hs(1|n,E,a,h))}function Kp(t,n){Fo(8390656,8,t,n)}function mu(t,n){Uo(2048,8,t,n)}function T_(t){Ke.flags|=4;var n=Ke.updateQueue;if(n===null)n=zo(),Ke.updateQueue=n,n.events=[t];else{var a=n.events;a===null?n.events=[t]:a.push(t)}}function Yp(t){var n=It().memoizedState;return T_({ref:n,nextImpl:t}),function(){if((dt&2)!==0)throw Error(s(440));return n.impl.apply(void 0,arguments)}}function Xp(t,n){return Uo(4,2,t,n)}function Zp(t,n){return Uo(4,4,t,n)}function Qp(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 Jp(t,n,a){a=a!=null?a.concat([t]):null,Uo(4,4,Qp.bind(null,n,t),a)}function gu(){}function em(t,n){var a=It();n=n===void 0?null:n;var h=a.memoizedState;return n!==null&&su(n,h[1])?h[0]:(a.memoizedState=[t,n],t)}function tm(t,n){var a=It();n=n===void 0?null:n;var h=a.memoizedState;if(n!==null&&su(n,h[1]))return h[0];if(h=t(),wi){Kt(!0);try{t()}finally{Kt(!1)}}return a.memoizedState=[h,n],h}function xu(t,n,a){return a===void 0||(br&1073741824)!==0&&(nt&261930)===0?t.memoizedState=n:(t.memoizedState=a,t=ng(),Ke.lanes|=t,Kr|=t,a)}function nm(t,n,a,h){return En(a,n)?a:cs.current!==null?(t=xu(t,a,h),En(t,n)||(Pt=!0),t):(br&42)===0||(br&1073741824)!==0&&(nt&261930)===0?(Pt=!0,t.memoizedState=a):(t=ng(),Ke.lanes|=t,Kr|=t,n)}function rm(t,n,a,h,w){var E=Y.p;Y.p=E!==0&&8>E?E:8;var O=M.T,G={};M.T=G,yu(t,!1,n,a);try{var J=w(),le=M.S;if(le!==null&&le(G,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var he=C_(J,h);la(t,n,he,Ln(t))}else la(t,n,h,Ln(t))}catch(xe){la(t,n,{then:function(){},status:"rejected",reason:xe},Ln())}finally{Y.p=E,O!==null&&G.types!==null&&(O.types=G.types),M.T=O}}function A_(){}function vu(t,n,a,h){if(t.tag!==5)throw Error(s(476));var w=im(t).queue;rm(t,w,n,Z,a===null?A_:function(){return sm(t),a(h)})}function im(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:yr,lastRenderedState:Z},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yr,lastRenderedState:a},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function sm(t){var n=im(t);n.next===null&&(n=t.alternate.memoizedState),la(t,n.next.queue,{},Ln())}function bu(){return rn(ka)}function am(){return It().memoizedState}function om(){return It().memoizedState}function D_(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var a=Ln();t=Ur(a);var h=$r(n,t,a);h!==null&&(Sn(h,n,a),ra(h,n,a)),n={cache:Kc()},t.payload=n;return}n=n.return}}function L_(t,n,a){var h=Ln();a={lane:h,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},$o(t)?cm(n,a):(a=Bc(t,n,a,h),a!==null&&(Sn(a,t,h),um(a,n,h)))}function lm(t,n,a){var h=Ln();la(t,n,a,h)}function la(t,n,a,h){var w={lane:h,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if($o(t))cm(n,w);else{var E=t.alternate;if(t.lanes===0&&(E===null||E.lanes===0)&&(E=n.lastRenderedReducer,E!==null))try{var O=n.lastRenderedState,G=E(O,a);if(w.hasEagerState=!0,w.eagerState=G,En(G,O))return wo(t,n,w,0),vt===null&&So(),!1}catch{}finally{}if(a=Bc(t,n,w,h),a!==null)return Sn(a,t,h),um(a,n,h),!0}return!1}function yu(t,n,a,h){if(h={lane:2,revertLane:Qu(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},$o(t)){if(n)throw Error(s(479))}else n=Bc(t,a,h,2),n!==null&&Sn(n,t,2)}function $o(t){var n=t.alternate;return t===Ke||n!==null&&n===Ke}function cm(t,n){us=Io=!0;var a=t.pending;a===null?n.next=n:(n.next=a.next,a.next=n),t.pending=n}function um(t,n,a){if((a&4194048)!==0){var h=n.lanes;h&=t.pendingLanes,a|=h,n.lanes=a,Or(t,a)}}var ca={readContext:rn,use:Ho,useCallback:Dt,useContext:Dt,useEffect:Dt,useImperativeHandle:Dt,useLayoutEffect:Dt,useInsertionEffect:Dt,useMemo:Dt,useReducer:Dt,useRef:Dt,useState:Dt,useDebugValue:Dt,useDeferredValue:Dt,useTransition:Dt,useSyncExternalStore:Dt,useId:Dt,useHostTransitionStatus:Dt,useFormState:Dt,useActionState:Dt,useOptimistic:Dt,useMemoCache:Dt,useCacheRefresh:Dt};ca.useEffectEvent=Dt;var dm={readContext:rn,use:Ho,useCallback:function(t,n){return pn().memoizedState=[t,n===void 0?null:n],t},useContext:rn,useEffect:Kp,useImperativeHandle:function(t,n,a){a=a!=null?a.concat([t]):null,Fo(4194308,4,Qp.bind(null,n,t),a)},useLayoutEffect:function(t,n){return Fo(4194308,4,t,n)},useInsertionEffect:function(t,n){Fo(4,2,t,n)},useMemo:function(t,n){var a=pn();n=n===void 0?null:n;var h=t();if(wi){Kt(!0);try{t()}finally{Kt(!1)}}return a.memoizedState=[h,n],h},useReducer:function(t,n,a){var h=pn();if(a!==void 0){var w=a(n);if(wi){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=L_.bind(null,Ke,t),[h.memoizedState,t]},useRef:function(t){var n=pn();return t={current:t},n.memoizedState=t},useState:function(t){t=fu(t);var n=t.queue,a=lm.bind(null,Ke,n);return n.dispatch=a,[t.memoizedState,a]},useDebugValue:gu,useDeferredValue:function(t,n){var a=pn();return xu(a,t,n)},useTransition:function(){var t=fu(!1);return t=rm.bind(null,Ke,t.queue,!0,!1),pn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,a){var h=Ke,w=pn();if(it){if(a===void 0)throw Error(s(407));a=a()}else{if(a=n(),vt===null)throw Error(s(349));(nt&127)!==0||Lp(h,n,a)}w.memoizedState=a;var E={value:a,getSnapshot:n};return w.queue=E,Kp(Op.bind(null,h,E,t),[t]),h.flags|=2048,hs(9,{destroy:void 0},Rp.bind(null,h,E,a,n),null),a},useId:function(){var t=pn(),n=vt.identifierPrefix;if(it){var a=nr,h=tr;a=(h&~(1<<32-lt(h)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Bo++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=k_++,n="_"+n+"r_"+a.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:bu,useFormState:$p,useActionState:$p,useOptimistic:function(t){var n=pn();n.memoizedState=n.baseState=t;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=yu.bind(null,Ke,!0,a),a.dispatch=n,[t,n]},useMemoCache:uu,useCacheRefresh:function(){return pn().memoizedState=D_.bind(null,Ke)},useEffectEvent:function(t){var n=pn(),a={impl:t};return n.memoizedState=a,function(){if((dt&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},_u={readContext:rn,use:Ho,useCallback:em,useContext:rn,useEffect:mu,useImperativeHandle:Jp,useInsertionEffect:Xp,useLayoutEffect:Zp,useMemo:tm,useReducer:Po,useRef:Vp,useState:function(){return Po(yr)},useDebugValue:gu,useDeferredValue:function(t,n){var a=It();return nm(a,mt.memoizedState,t,n)},useTransition:function(){var t=Po(yr)[0],n=It().memoizedState;return[typeof t=="boolean"?t:oa(t),n]},useSyncExternalStore:Dp,useId:am,useHostTransitionStatus:bu,useFormState:qp,useActionState:qp,useOptimistic:function(t,n){var a=It();return Bp(a,mt,t,n)},useMemoCache:uu,useCacheRefresh:om};_u.useEffectEvent=Yp;var hm={readContext:rn,use:Ho,useCallback:em,useContext:rn,useEffect:mu,useImperativeHandle:Jp,useInsertionEffect:Xp,useLayoutEffect:Zp,useMemo:tm,useReducer:hu,useRef:Vp,useState:function(){return hu(yr)},useDebugValue:gu,useDeferredValue:function(t,n){var a=It();return mt===null?xu(a,t,n):nm(a,mt.memoizedState,t,n)},useTransition:function(){var t=hu(yr)[0],n=It().memoizedState;return[typeof t=="boolean"?t:oa(t),n]},useSyncExternalStore:Dp,useId:am,useHostTransitionStatus:bu,useFormState:Gp,useActionState:Gp,useOptimistic:function(t,n){var a=It();return mt!==null?Bp(a,mt,t,n):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:uu,useCacheRefresh:om};hm.useEffectEvent=Yp;function Su(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 wu={enqueueSetState:function(t,n,a){t=t._reactInternals;var h=Ln(),w=Ur(h);w.payload=n,a!=null&&(w.callback=a),n=$r(t,w,h),n!==null&&(Sn(n,t,h),ra(n,t,h))},enqueueReplaceState:function(t,n,a){t=t._reactInternals;var h=Ln(),w=Ur(h);w.tag=1,w.payload=n,a!=null&&(w.callback=a),n=$r(t,w,h),n!==null&&(Sn(n,t,h),ra(n,t,h))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var a=Ln(),h=Ur(a);h.tag=2,n!=null&&(h.callback=n),n=$r(t,h,a),n!==null&&(Sn(n,t,a),ra(n,t,a))}};function fm(t,n,a,h,w,E,O){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(h,E,O):n.prototype&&n.prototype.isPureReactComponent?!Ys(a,h)||!Ys(w,E):!0}function pm(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&&wu.enqueueReplaceState(n,n.state,null)}function Ci(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 mm(t){_o(t)}function gm(t){console.error(t)}function xm(t){_o(t)}function qo(t,n){try{var a=t.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(h){setTimeout(function(){throw h})}}function vm(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 Cu(t,n,a){return a=Ur(a),a.tag=3,a.payload={element:null},a.callback=function(){qo(t,n)},a}function bm(t){return t=Ur(t),t.tag=3,t}function ym(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(){vm(n,a,h)}}var O=a.stateNode;O!==null&&typeof O.componentDidCatch=="function"&&(t.callback=function(){vm(n,a,h),typeof w!="function"&&(Yr===null?Yr=new Set([this]):Yr.add(this));var G=h.stack;this.componentDidCatch(h.value,{componentStack:G!==null?G:""})})}function R_(t,n,a,h,w){if(a.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(n=a.alternate,n!==null&&is(n,a,w,!0),a=Nn.current,a!==null){switch(a.tag){case 31:case 13:return qn===null?nl():a.alternate===null&&Lt===0&&(Lt=3),a.flags&=-257,a.flags|=65536,a.lanes=w,h===Do?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([h]):n.add(h),Yu(t,h,w)),!1;case 22:return a.flags|=65536,h===Do?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)),Yu(t,h,w)),!1}throw Error(s(435,a.tag))}return Yu(t,h,w),nl(),!1}if(it)return n=Nn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=w,h!==$c&&(t=Error(s(422),{cause:h}),Qs(Pn(t,a)))):(h!==$c&&(n=Error(s(423),{cause:h}),Qs(Pn(n,a))),t=t.current.alternate,t.flags|=65536,w&=-w,t.lanes|=w,h=Pn(h,a),w=Cu(t.stateNode,h,w),eu(t,w),Lt!==4&&(Lt=2)),!1;var E=Error(s(520),{cause:h});if(E=Pn(E,a),xa===null?xa=[E]:xa.push(E),Lt!==4&&(Lt=2),n===null)return!0;h=Pn(h,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,t=w&-w,a.lanes|=t,t=Cu(a.stateNode,h,t),eu(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"&&(Yr===null||!Yr.has(E))))return a.flags|=65536,w&=-w,a.lanes|=w,w=bm(w),ym(w,t,a,h),eu(a,w),!1}a=a.return}while(a!==null);return!1}var ku=Error(s(461)),Pt=!1;function sn(t,n,a,h){n.child=t===null?Cp(n,null,a,h):Si(n,t.child,a,h)}function _m(t,n,a,h,w){a=a.render;var E=n.ref;if("ref"in h){var O={};for(var G in h)G!=="ref"&&(O[G]=h[G])}else O=h;return vi(n),h=au(t,n,a,O,E,w),G=ou(),t!==null&&!Pt?(lu(t,n,w),_r(t,n,w)):(it&&G&&Fc(n),n.flags|=1,sn(t,n,h,w),n.child)}function Sm(t,n,a,h,w){if(t===null){var E=a.type;return typeof E=="function"&&!zc(E)&&E.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=E,wm(t,n,E,h,w)):(t=ko(a.type,null,h,n,n.mode,w),t.ref=n.ref,t.return=n,n.child=t)}if(E=t.child,!Ru(t,w)){var O=E.memoizedProps;if(a=a.compare,a=a!==null?a:Ys,a(O,h)&&t.ref===n.ref)return _r(t,n,w)}return n.flags|=1,t=mr(E,h),t.ref=n.ref,t.return=n,n.child=t}function wm(t,n,a,h,w){if(t!==null){var E=t.memoizedProps;if(Ys(E,h)&&t.ref===n.ref)if(Pt=!1,n.pendingProps=h=E,Ru(t,w))(t.flags&131072)!==0&&(Pt=!0);else return n.lanes=t.lanes,_r(t,n,w)}return Eu(t,n,a,h,w)}function Cm(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 km(t,n,E,a,h)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&To(n,E!==null?E.cachePool:null),E!==null?jp(n,E):nu(),Np(n);else return h=n.lanes=536870912,km(t,n,E!==null?E.baseLanes|a:a,a,h)}else E!==null?(To(n,E.cachePool),jp(n,E),Wr(),n.memoizedState=null):(t!==null&&To(n,null),nu(),Wr());return sn(t,n,w,a),n.child}function ua(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function km(t,n,a,h,w){var E=Xc();return E=E===null?null:{parent:zt._currentValue,pool:E},n.memoizedState={baseLanes:a,cachePool:E},t!==null&&To(n,null),nu(),Np(n),t!==null&&is(t,n,h,!0),n.childLanes=w,null}function Wo(t,n){return n=Vo({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function Em(t,n,a){return Si(n,t.child,null,a),t=Wo(n,n.pendingProps),t.flags|=2,Tn(n),n.memoizedState=null,t}function O_(t,n,a){var h=n.pendingProps,w=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(it){if(h.mode==="hidden")return t=Wo(n,h),n.lanes=536870912,ua(null,t);if(iu(n),(t=_t)?(t=zg(t,$n),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Br!==null?{id:tr,overflow:nr}:null,retryLane:536870912,hydrationErrors:null},a=cp(t),a.return=n,n.child=a,nn=n,_t=null)):t=null,t===null)throw Hr(n);return n.lanes=536870912,null}return Wo(n,h)}var E=t.memoizedState;if(E!==null){var O=E.dehydrated;if(iu(n),w)if(n.flags&256)n.flags&=-257,n=Em(t,n,a);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(s(558));else if(Pt||is(t,n,a,!1),w=(a&t.childLanes)!==0,Pt||w){if(h=vt,h!==null&&(O=gf(h,a),O!==0&&O!==E.retryLane))throw E.retryLane=O,pi(t,O),Sn(h,t,O),ku;nl(),n=Em(t,n,a)}else t=E.treeContext,_t=Wn(O.nextSibling),nn=n,it=!0,zr=null,$n=!1,t!==null&&hp(n,t),n=Wo(n,h),n.flags|=4096;return n}return t=mr(t.child,{mode:h.mode,children:h.children}),t.ref=n.ref,n.child=t,t.return=n,t}function Go(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 Eu(t,n,a,h,w){return vi(n),a=au(t,n,a,h,void 0,w),h=ou(),t!==null&&!Pt?(lu(t,n,w),_r(t,n,w)):(it&&h&&Fc(n),n.flags|=1,sn(t,n,a,w),n.child)}function jm(t,n,a,h,w,E){return vi(n),n.updateQueue=null,a=Ap(n,h,a,w),Tp(t),h=ou(),t!==null&&!Pt?(lu(t,n,E),_r(t,n,E)):(it&&h&&Fc(n),n.flags|=1,sn(t,n,a,E),n.child)}function Nm(t,n,a,h,w){if(vi(n),n.stateNode===null){var E=es,O=a.contextType;typeof O=="object"&&O!==null&&(E=rn(O)),E=new a(h,E),n.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,E.updater=wu,n.stateNode=E,E._reactInternals=n,E=n.stateNode,E.props=h,E.state=n.memoizedState,E.refs={},Qc(n),O=a.contextType,E.context=typeof O=="object"&&O!==null?rn(O):es,E.state=n.memoizedState,O=a.getDerivedStateFromProps,typeof O=="function"&&(Su(n,a,O,h),E.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(O=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),O!==E.state&&wu.enqueueReplaceState(E,E.state,null),sa(n,h,E,w),ia(),E.state=n.memoizedState),typeof E.componentDidMount=="function"&&(n.flags|=4194308),h=!0}else if(t===null){E=n.stateNode;var G=n.memoizedProps,J=Ci(a,G);E.props=J;var le=E.context,he=a.contextType;O=es,typeof he=="object"&&he!==null&&(O=rn(he));var xe=a.getDerivedStateFromProps;he=typeof xe=="function"||typeof E.getSnapshotBeforeUpdate=="function",G=n.pendingProps!==G,he||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(G||le!==O)&&pm(n,E,h,O),Fr=!1;var ce=n.memoizedState;E.state=ce,sa(n,h,E,w),ia(),le=n.memoizedState,G||ce!==le||Fr?(typeof xe=="function"&&(Su(n,a,xe,h),le=n.memoizedState),(J=Fr||fm(n,a,J,h,ce,le,O))?(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=O,h=J):(typeof E.componentDidMount=="function"&&(n.flags|=4194308),h=!1)}else{E=n.stateNode,Jc(t,n),O=n.memoizedProps,he=Ci(a,O),E.props=he,xe=n.pendingProps,ce=E.context,le=a.contextType,J=es,typeof le=="object"&&le!==null&&(J=rn(le)),G=a.getDerivedStateFromProps,(le=typeof G=="function"||typeof E.getSnapshotBeforeUpdate=="function")||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(O!==xe||ce!==J)&&pm(n,E,h,J),Fr=!1,ce=n.memoizedState,E.state=ce,sa(n,h,E,w),ia();var de=n.memoizedState;O!==xe||ce!==de||Fr||t!==null&&t.dependencies!==null&&jo(t.dependencies)?(typeof G=="function"&&(Su(n,a,G,h),de=n.memoizedState),(he=Fr||fm(n,a,he,h,ce,de,J)||t!==null&&t.dependencies!==null&&jo(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"||O===t.memoizedProps&&ce===t.memoizedState||(n.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||O===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"||O===t.memoizedProps&&ce===t.memoizedState||(n.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||O===t.memoizedProps&&ce===t.memoizedState||(n.flags|=1024),h=!1)}return E=h,Go(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=Si(n,t.child,null,w),n.child=Si(n,null,a,w)):sn(t,n,a,w),n.memoizedState=E.state,t=n.child):t=_r(t,n,w),t}function Tm(t,n,a,h){return gi(),n.flags|=256,sn(t,n,a,h),n.child}var ju={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Nu(t){return{baseLanes:t,cachePool:vp()}}function Tu(t,n,a){return t=t!==null?t.childLanes&~a:0,n&&(t|=Dn),t}function Am(t,n,a){var h=n.pendingProps,w=!1,E=(n.flags&128)!==0,O;if((O=E)||(O=t!==null&&t.memoizedState===null?!1:(Mt.current&2)!==0),O&&(w=!0,n.flags&=-129),O=(n.flags&32)!==0,n.flags&=-33,t===null){if(it){if(w?qr(n):Wr(),(t=_t)?(t=zg(t,$n),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Br!==null?{id:tr,overflow:nr}:null,retryLane:536870912,hydrationErrors:null},a=cp(t),a.return=n,n.child=a,nn=n,_t=null)):t=null,t===null)throw Hr(n);return dd(t)?n.lanes=32:n.lanes=536870912,null}var G=h.children;return h=h.fallback,w?(Wr(),w=n.mode,G=Vo({mode:"hidden",children:G},w),h=mi(h,w,a,null),G.return=n,h.return=n,G.sibling=h,n.child=G,h=n.child,h.memoizedState=Nu(a),h.childLanes=Tu(t,O,a),n.memoizedState=ju,ua(null,h)):(qr(n),Au(n,G))}var J=t.memoizedState;if(J!==null&&(G=J.dehydrated,G!==null)){if(E)n.flags&256?(qr(n),n.flags&=-257,n=Du(t,n,a)):n.memoizedState!==null?(Wr(),n.child=t.child,n.flags|=128,n=null):(Wr(),G=h.fallback,w=n.mode,h=Vo({mode:"visible",children:h.children},w),G=mi(G,w,a,null),G.flags|=2,h.return=n,G.return=n,h.sibling=G,n.child=h,Si(n,t.child,null,a),h=n.child,h.memoizedState=Nu(a),h.childLanes=Tu(t,O,a),n.memoizedState=ju,n=ua(null,h));else if(qr(n),dd(G)){if(O=G.nextSibling&&G.nextSibling.dataset,O)var le=O.dgst;O=le,h=Error(s(419)),h.stack="",h.digest=O,Qs({value:h,source:null,stack:null}),n=Du(t,n,a)}else if(Pt||is(t,n,a,!1),O=(a&t.childLanes)!==0,Pt||O){if(O=vt,O!==null&&(h=gf(O,a),h!==0&&h!==J.retryLane))throw J.retryLane=h,pi(t,h),Sn(O,t,h),ku;ud(G)||nl(),n=Du(t,n,a)}else ud(G)?(n.flags|=192,n.child=t.child,n=null):(t=J.treeContext,_t=Wn(G.nextSibling),nn=n,it=!0,zr=null,$n=!1,t!==null&&hp(n,t),n=Au(n,h.children),n.flags|=4096);return n}return w?(Wr(),G=h.fallback,w=n.mode,J=t.child,le=J.sibling,h=mr(J,{mode:"hidden",children:h.children}),h.subtreeFlags=J.subtreeFlags&65011712,le!==null?G=mr(le,G):(G=mi(G,w,a,null),G.flags|=2),G.return=n,h.return=n,h.sibling=G,n.child=h,ua(null,h),h=n.child,G=t.child.memoizedState,G===null?G=Nu(a):(w=G.cachePool,w!==null?(J=zt._currentValue,w=w.parent!==J?{parent:J,pool:J}:w):w=vp(),G={baseLanes:G.baseLanes|a,cachePool:w}),h.memoizedState=G,h.childLanes=Tu(t,O,a),n.memoizedState=ju,ua(t.child,h)):(qr(n),a=t.child,t=a.sibling,a=mr(a,{mode:"visible",children:h.children}),a.return=n,a.sibling=null,t!==null&&(O=n.deletions,O===null?(n.deletions=[t],n.flags|=16):O.push(t)),n.child=a,n.memoizedState=null,a)}function Au(t,n){return n=Vo({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function Vo(t,n){return t=jn(22,t,null,n),t.lanes=0,t}function Du(t,n,a){return Si(n,t.child,null,a),t=Au(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function Dm(t,n,a){t.lanes|=n;var h=t.alternate;h!==null&&(h.lanes|=n),Gc(t.return,n,a)}function Lu(t,n,a,h,w,E){var O=t.memoizedState;O===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:h,tail:a,tailMode:w,treeForkCount:E}:(O.isBackwards=n,O.rendering=null,O.renderingStartTime=0,O.last=h,O.tail=a,O.tailMode=w,O.treeForkCount=E)}function Lm(t,n,a){var h=n.pendingProps,w=h.revealOrder,E=h.tail;h=h.children;var O=Mt.current,G=(O&2)!==0;if(G?(O=O&1|2,n.flags|=128):O&=1,F(Mt,O),sn(t,n,h,a),h=it?Zs:0,!G&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Dm(t,a,n);else if(t.tag===19)Dm(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&&Mo(t)===null&&(w=a),a=a.sibling;a=w,a===null?(w=n.child,n.child=null):(w=a.sibling,a.sibling=null),Lu(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&&Mo(t)===null){n.child=w;break}t=w.sibling,w.sibling=a,a=w,w=t}Lu(n,!0,a,null,E,h);break;case"together":Lu(n,!1,null,null,void 0,h);break;default:n.memoizedState=null}return n.child}function _r(t,n,a){if(t!==null&&(n.dependencies=t.dependencies),Kr|=n.lanes,(a&n.childLanes)===0)if(t!==null){if(is(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=mr(t,t.pendingProps),n.child=a,a.return=n;t.sibling!==null;)t=t.sibling,a=a.sibling=mr(t,t.pendingProps),a.return=n;a.sibling=null}return n.child}function Ru(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&jo(t)))}function M_(t,n,a){switch(n.tag){case 3:$(n,n.stateNode.containerInfo),Pr(n,zt,t.memoizedState.cache),gi();break;case 27:case 5:re(n);break;case 4:$(n,n.stateNode.containerInfo);break;case 10:Pr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,iu(n),null;break;case 13:var h=n.memoizedState;if(h!==null)return h.dehydrated!==null?(qr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?Am(t,n,a):(qr(n),t=_r(t,n,a),t!==null?t.sibling:null);qr(n);break;case 19:var w=(t.flags&128)!==0;if(h=(a&n.childLanes)!==0,h||(is(t,n,a,!1),h=(a&n.childLanes)!==0),w){if(h)return Lm(t,n,a);n.flags|=128}if(w=n.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),F(Mt,Mt.current),h)break;return null;case 22:return n.lanes=0,Cm(t,n,a,n.pendingProps);case 24:Pr(n,zt,t.memoizedState.cache)}return _r(t,n,a)}function Rm(t,n,a){if(t!==null)if(t.memoizedProps!==n.pendingProps)Pt=!0;else{if(!Ru(t,a)&&(n.flags&128)===0)return Pt=!1,M_(t,n,a);Pt=(t.flags&131072)!==0}else Pt=!1,it&&(n.flags&1048576)!==0&&dp(n,Zs,n.index);switch(n.lanes=0,n.tag){case 16:e:{var h=n.pendingProps;if(t=yi(n.elementType),n.type=t,typeof t=="function")zc(t)?(h=Ci(t,h),n.tag=1,n=Nm(null,n,t,h,a)):(n.tag=0,n=Eu(null,n,t,h,a));else{if(t!=null){var w=t.$$typeof;if(w===j){n.tag=11,n=_m(null,n,t,h,a);break e}else if(w===D){n.tag=14,n=Sm(null,n,t,h,a);break e}}throw n=R(t)||t,Error(s(306,n,""))}}return n;case 0:return Eu(t,n,n.type,n.pendingProps,a);case 1:return h=n.type,w=Ci(h,n.pendingProps),Nm(t,n,h,w,a);case 3:e:{if($(n,n.stateNode.containerInfo),t===null)throw Error(s(387));h=n.pendingProps;var E=n.memoizedState;w=E.element,Jc(t,n),sa(n,h,null,a);var O=n.memoizedState;if(h=O.cache,Pr(n,zt,h),h!==E.cache&&Vc(n,[zt],a,!0),ia(),h=O.element,E.isDehydrated)if(E={element:h,isDehydrated:!1,cache:O.cache},n.updateQueue.baseState=E,n.memoizedState=E,n.flags&256){n=Tm(t,n,h,a);break e}else if(h!==w){w=Pn(Error(s(424)),n),Qs(w),n=Tm(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(_t=Wn(t.firstChild),nn=n,it=!0,zr=null,$n=!0,a=Cp(n,null,h,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(gi(),h===w){n=_r(t,n,a);break e}sn(t,n,h,a)}n=n.child}return n;case 26:return Go(t,n),t===null?(a=qg(n.type,null,n.pendingProps,null))?n.memoizedState=a:it||(a=n.type,t=n.pendingProps,h=cl(ee.current).createElement(a),h[tn]=n,h[gn]=t,an(h,a,t),Yt(h),n.stateNode=h):n.memoizedState=qg(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return re(n),t===null&&it&&(h=n.stateNode=Fg(n.type,n.pendingProps,ee.current),nn=n,$n=!0,w=_t,Jr(n.type)?(hd=w,_t=Wn(h.firstChild)):_t=w),sn(t,n,n.pendingProps.children,a),Go(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&it&&((w=h=_t)&&(h=d1(h,n.type,n.pendingProps,$n),h!==null?(n.stateNode=h,nn=n,_t=Wn(h.firstChild),$n=!1,w=!0):w=!1),w||Hr(n)),re(n),w=n.type,E=n.pendingProps,O=t!==null?t.memoizedProps:null,h=E.children,od(w,E)?h=null:O!==null&&od(w,O)&&(n.flags|=32),n.memoizedState!==null&&(w=au(t,n,E_,null,null,a),ka._currentValue=w),Go(t,n),sn(t,n,h,a),n.child;case 6:return t===null&&it&&((t=a=_t)&&(a=h1(a,n.pendingProps,$n),a!==null?(n.stateNode=a,nn=n,_t=null,t=!0):t=!1),t||Hr(n)),null;case 13:return Am(t,n,a);case 4:return $(n,n.stateNode.containerInfo),h=n.pendingProps,t===null?n.child=Si(n,null,h,a):sn(t,n,h,a),n.child;case 11:return _m(t,n,n.type,n.pendingProps,a);case 7:return sn(t,n,n.pendingProps,a),n.child;case 8:return sn(t,n,n.pendingProps.children,a),n.child;case 12:return sn(t,n,n.pendingProps.children,a),n.child;case 10:return h=n.pendingProps,Pr(n,n.type,h.value),sn(t,n,h.children,a),n.child;case 9:return w=n.type._context,h=n.pendingProps.children,vi(n),w=rn(w),h=h(w),n.flags|=1,sn(t,n,h,a),n.child;case 14:return Sm(t,n,n.type,n.pendingProps,a);case 15:return wm(t,n,n.type,n.pendingProps,a);case 19:return Lm(t,n,a);case 31:return O_(t,n,a);case 22:return Cm(t,n,a,n.pendingProps);case 24:return vi(n),h=rn(zt),t===null?(w=Xc(),w===null&&(w=vt,E=Kc(),w.pooledCache=E,E.refCount++,E!==null&&(w.pooledCacheLanes|=a),w=E),n.memoizedState={parent:h,cache:w},Qc(n),Pr(n,zt,w)):((t.lanes&a)!==0&&(Jc(t,n),sa(n,null,null,a),ia()),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),Pr(n,zt,h)):(h=E.cache,Pr(n,zt,h),h!==w.cache&&Vc(n,[zt],a,!0))),sn(t,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(s(156,n.tag))}function Sr(t){t.flags|=4}function Ou(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(ag())t.flags|=8192;else throw _i=Do,Zc}else t.flags&=-16777217}function Om(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Yg(n))if(ag())t.flags|=8192;else throw _i=Do,Zc}function Ko(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?Ve():536870912,t.lanes|=n,gs|=n)}function da(t,n){if(!it)switch(t.tailMode){case"hidden":n=t.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var h=null;a!==null;)a.alternate!==null&&(h=a),a=a.sibling;h===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:h.sibling=null}}function St(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 I_(t,n,a){var h=n.pendingProps;switch(Uc(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return St(n),null;case 1:return St(n),null;case 3:return a=n.stateNode,h=null,t!==null&&(h=t.memoizedState.cache),n.memoizedState.cache!==h&&(n.flags|=2048),vr(zt),oe(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(rs(n)?Sr(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,qc())),St(n),null;case 26:var w=n.type,E=n.memoizedState;return t===null?(Sr(n),E!==null?(St(n),Om(n,E)):(St(n),Ou(n,w,null,h,a))):E?E!==t.memoizedState?(Sr(n),St(n),Om(n,E)):(St(n),n.flags&=-16777217):(t=t.memoizedProps,t!==h&&Sr(n),St(n),Ou(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&&Sr(n);else{if(!h){if(n.stateNode===null)throw Error(s(166));return St(n),null}t=ie.current,rs(n)?fp(n):(t=Fg(w,h,a),n.stateNode=t,Sr(n))}return St(n),null;case 5:if(ve(n),w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==h&&Sr(n);else{if(!h){if(n.stateNode===null)throw Error(s(166));return St(n),null}if(E=ie.current,rs(n))fp(n);else{var O=cl(ee.current);switch(E){case 1:E=O.createElementNS("http://www.w3.org/2000/svg",w);break;case 2:E=O.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;default:switch(w){case"svg":E=O.createElementNS("http://www.w3.org/2000/svg",w);break;case"math":E=O.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;case"script":E=O.createElement("div"),E.innerHTML="<script><\/script>",E=E.removeChild(E.firstChild);break;case"select":E=typeof h.is=="string"?O.createElement("select",{is:h.is}):O.createElement("select"),h.multiple?E.multiple=!0:h.size&&(E.size=h.size);break;default:E=typeof h.is=="string"?O.createElement(w,{is:h.is}):O.createElement(w)}}E[tn]=n,E[gn]=h;e:for(O=n.child;O!==null;){if(O.tag===5||O.tag===6)E.appendChild(O.stateNode);else if(O.tag!==4&&O.tag!==27&&O.child!==null){O.child.return=O,O=O.child;continue}if(O===n)break e;for(;O.sibling===null;){if(O.return===null||O.return===n)break e;O=O.return}O.sibling.return=O.return,O=O.sibling}n.stateNode=E;e:switch(an(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&&Sr(n)}}return St(n),Ou(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,a),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==h&&Sr(n);else{if(typeof h!="string"&&n.stateNode===null)throw Error(s(166));if(t=ee.current,rs(n)){if(t=n.stateNode,a=n.memoizedProps,h=null,w=nn,w!==null)switch(w.tag){case 27:case 5:h=w.memoizedProps}t[tn]=n,t=!!(t.nodeValue===a||h!==null&&h.suppressHydrationWarning===!0||Ag(t.nodeValue,a)),t||Hr(n,!0)}else t=cl(t).createTextNode(h),t[tn]=n,n.stateNode=t}return St(n),null;case 31:if(a=n.memoizedState,t===null||t.memoizedState!==null){if(h=rs(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[tn]=n}else gi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;St(n),t=!1}else a=qc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return n.flags&256?(Tn(n),n):(Tn(n),null);if((n.flags&128)!==0)throw Error(s(558))}return St(n),null;case 13:if(h=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(w=rs(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[tn]=n}else gi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;St(n),w=!1}else w=qc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=w),w=!0;if(!w)return n.flags&256?(Tn(n),n):(Tn(n),null)}return Tn(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),Ko(n,n.updateQueue),St(n),null);case 4:return oe(),t===null&&nd(n.stateNode.containerInfo),St(n),null;case 10:return vr(n.type),St(n),null;case 19:if(V(Mt),h=n.memoizedState,h===null)return St(n),null;if(w=(n.flags&128)!==0,E=h.rendering,E===null)if(w)da(h,!1);else{if(Lt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(E=Mo(t),E!==null){for(n.flags|=128,da(h,!1),t=E.updateQueue,n.updateQueue=t,Ko(n,t),n.subtreeFlags=0,t=a,a=n.child;a!==null;)lp(a,t),a=a.sibling;return F(Mt,Mt.current&1|2),it&&gr(n,h.treeForkCount),n.child}t=t.sibling}h.tail!==null&&Be()>Jo&&(n.flags|=128,w=!0,da(h,!1),n.lanes=4194304)}else{if(!w)if(t=Mo(E),t!==null){if(n.flags|=128,w=!0,t=t.updateQueue,n.updateQueue=t,Ko(n,t),da(h,!0),h.tail===null&&h.tailMode==="hidden"&&!E.alternate&&!it)return St(n),null}else 2*Be()-h.renderingStartTime>Jo&&a!==536870912&&(n.flags|=128,w=!0,da(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=Be(),t.sibling=null,a=Mt.current,F(Mt,w?a&1|2:a&1),it&&gr(n,h.treeForkCount),t):(St(n),null);case 22:case 23:return Tn(n),ru(),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&&(St(n),n.subtreeFlags&6&&(n.flags|=8192)):St(n),a=n.updateQueue,a!==null&&Ko(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&&V(bi),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),vr(zt),St(n),null;case 25:return null;case 30:return null}throw Error(s(156,n.tag))}function B_(t,n){switch(Uc(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return vr(zt),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(Tn(n),n.alternate===null)throw Error(s(340));gi()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(Tn(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(s(340));gi()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return V(Mt),null;case 4:return oe(),null;case 10:return vr(n.type),null;case 22:case 23:return Tn(n),ru(),t!==null&&V(bi),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return vr(zt),null;case 25:return null;default:return null}}function Mm(t,n){switch(Uc(n),n.tag){case 3:vr(zt),oe();break;case 26:case 27:case 5:ve(n);break;case 4:oe();break;case 31:n.memoizedState!==null&&Tn(n);break;case 13:Tn(n);break;case 19:V(Mt);break;case 10:vr(n.type);break;case 22:case 23:Tn(n),ru(),t!==null&&V(bi);break;case 24:vr(zt)}}function ha(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,O=a.inst;h=E(),O.destroy=h}a=a.next}while(a!==w)}}catch(G){ft(n,n.return,G)}}function Gr(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 O=h.inst,G=O.destroy;if(G!==void 0){O.destroy=void 0,w=n;var J=a,le=G;try{le()}catch(he){ft(w,J,he)}}}h=h.next}while(h!==E)}}catch(he){ft(n,n.return,he)}}function Im(t){var n=t.updateQueue;if(n!==null){var a=t.stateNode;try{Ep(n,a)}catch(h){ft(t,t.return,h)}}}function Bm(t,n,a){a.props=Ci(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(h){ft(t,n,h)}}function fa(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 rr(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 zm(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 Mu(t,n,a){try{var h=t.stateNode;s1(h,t.type,a,n),h[gn]=n}catch(w){ft(t,t.return,w)}}function Hm(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Jr(t.type)||t.tag===4}function Iu(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Hm(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&&Jr(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 Bu(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=fr));else if(h!==4&&(h===27&&Jr(t.type)&&(a=t.stateNode,n=null),t=t.child,t!==null))for(Bu(t,n,a),t=t.sibling;t!==null;)Bu(t,n,a),t=t.sibling}function Yo(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&&Jr(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(Yo(t,n,a),t=t.sibling;t!==null;)Yo(t,n,a),t=t.sibling}function Pm(t){var n=t.stateNode,a=t.memoizedProps;try{for(var h=t.type,w=n.attributes;w.length;)n.removeAttributeNode(w[0]);an(n,h,a),n[tn]=t,n[gn]=a}catch(E){ft(t,t.return,E)}}var wr=!1,Ft=!1,zu=!1,Fm=typeof WeakSet=="function"?WeakSet:Set,Xt=null;function z_(t,n){if(t=t.containerInfo,sd=gl,t=Jf(t),Dc(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 O=0,G=-1,J=-1,le=0,he=0,xe=t,ce=null;t:for(;;){for(var de;xe!==a||w!==0&&xe.nodeType!==3||(G=O+w),xe!==E||h!==0&&xe.nodeType!==3||(J=O+h),xe.nodeType===3&&(O+=xe.nodeValue.length),(de=xe.firstChild)!==null;)ce=xe,xe=de;for(;;){if(xe===t)break t;if(ce===a&&++le===w&&(G=O),ce===E&&++he===h&&(J=O),(de=xe.nextSibling)!==null)break;xe=ce,ce=xe.parentNode}xe=de}a=G===-1||J===-1?null:{start:G,end:J}}else a=null}a=a||{start:0,end:0}}else a=null;for(ad={focusedElem:t,selectionRange:a},gl=!1,Xt=n;Xt!==null;)if(n=Xt,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,Xt=t;else for(;Xt!==null;){switch(n=Xt,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=Ci(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)cd(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":cd(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,Xt=t;break}Xt=n.return}}function Um(t,n,a){var h=a.flags;switch(a.tag){case 0:case 11:case 15:kr(t,a),h&4&&ha(5,a);break;case 1:if(kr(t,a),h&4)if(t=a.stateNode,n===null)try{t.componentDidMount()}catch(O){ft(a,a.return,O)}else{var w=Ci(a.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(w,n,t.__reactInternalSnapshotBeforeUpdate)}catch(O){ft(a,a.return,O)}}h&64&&Im(a),h&512&&fa(a,a.return);break;case 3:if(kr(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{Ep(t,n)}catch(O){ft(a,a.return,O)}}break;case 27:n===null&&h&4&&Pm(a);case 26:case 5:kr(t,a),n===null&&h&4&&zm(a),h&512&&fa(a,a.return);break;case 12:kr(t,a);break;case 31:kr(t,a),h&4&&Wm(t,a);break;case 13:kr(t,a),h&4&&Gm(t,a),h&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=V_.bind(null,a),f1(t,a))));break;case 22:if(h=a.memoizedState!==null||wr,!h){n=n!==null&&n.memoizedState!==null||Ft,w=wr;var E=Ft;wr=h,(Ft=n)&&!E?Er(t,a,(a.subtreeFlags&8772)!==0):kr(t,a),wr=w,Ft=E}break;case 30:break;default:kr(t,a)}}function $m(t){var n=t.alternate;n!==null&&(t.alternate=null,$m(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&pc(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 wt=null,vn=!1;function Cr(t,n,a){for(a=a.child;a!==null;)qm(t,n,a),a=a.sibling}function qm(t,n,a){if(Tt&&typeof Tt.onCommitFiberUnmount=="function")try{Tt.onCommitFiberUnmount(Ot,a)}catch{}switch(a.tag){case 26:Ft||rr(a,n),Cr(t,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Ft||rr(a,n);var h=wt,w=vn;Jr(a.type)&&(wt=a.stateNode,vn=!1),Cr(t,n,a),Sa(a.stateNode),wt=h,vn=w;break;case 5:Ft||rr(a,n);case 6:if(h=wt,w=vn,wt=null,Cr(t,n,a),wt=h,vn=w,wt!==null)if(vn)try{(wt.nodeType===9?wt.body:wt.nodeName==="HTML"?wt.ownerDocument.body:wt).removeChild(a.stateNode)}catch(E){ft(a,n,E)}else try{wt.removeChild(a.stateNode)}catch(E){ft(a,n,E)}break;case 18:wt!==null&&(vn?(t=wt,Ig(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),Cs(t)):Ig(wt,a.stateNode));break;case 4:h=wt,w=vn,wt=a.stateNode.containerInfo,vn=!0,Cr(t,n,a),wt=h,vn=w;break;case 0:case 11:case 14:case 15:Gr(2,a,n),Ft||Gr(4,a,n),Cr(t,n,a);break;case 1:Ft||(rr(a,n),h=a.stateNode,typeof h.componentWillUnmount=="function"&&Bm(a,n,h)),Cr(t,n,a);break;case 21:Cr(t,n,a);break;case 22:Ft=(h=Ft)||a.memoizedState!==null,Cr(t,n,a),Ft=h;break;default:Cr(t,n,a)}}function Wm(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Cs(t)}catch(a){ft(n,n.return,a)}}}function Gm(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Cs(t)}catch(a){ft(n,n.return,a)}}function H_(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new Fm),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new Fm),n;default:throw Error(s(435,t.tag))}}function Xo(t,n){var a=H_(t);n.forEach(function(h){if(!a.has(h)){a.add(h);var w=K_.bind(null,t,h);h.then(w,w)}})}function bn(t,n){var a=n.deletions;if(a!==null)for(var h=0;h<a.length;h++){var w=a[h],E=t,O=n,G=O;e:for(;G!==null;){switch(G.tag){case 27:if(Jr(G.type)){wt=G.stateNode,vn=!1;break e}break;case 5:wt=G.stateNode,vn=!1;break e;case 3:case 4:wt=G.stateNode.containerInfo,vn=!0;break e}G=G.return}if(wt===null)throw Error(s(160));qm(E,O,w),wt=null,vn=!1,E=w.alternate,E!==null&&(E.return=null),w.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Vm(n,t),n=n.sibling}var Xn=null;function Vm(t,n){var a=t.alternate,h=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:bn(n,t),yn(t),h&4&&(Gr(3,t,t.return),ha(3,t),Gr(5,t,t.return));break;case 1:bn(n,t),yn(t),h&512&&(Ft||a===null||rr(a,a.return)),h&64&&wr&&(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=Xn;if(bn(n,t),yn(t),h&512&&(Ft||a===null||rr(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[Ps]||E[tn]||E.namespaceURI==="http://www.w3.org/2000/svg"||E.hasAttribute("itemprop"))&&(E=w.createElement(h),w.head.insertBefore(E,w.querySelector("head > title"))),an(E,h,a),E[tn]=t,Yt(E),h=E;break e;case"link":var O=Vg("link","href",w).get(h+(a.href||""));if(O){for(var G=0;G<O.length;G++)if(E=O[G],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)){O.splice(G,1);break t}}E=w.createElement(h),an(E,h,a),w.head.appendChild(E);break;case"meta":if(O=Vg("meta","content",w).get(h+(a.content||""))){for(G=0;G<O.length;G++)if(E=O[G],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)){O.splice(G,1);break t}}E=w.createElement(h),an(E,h,a),w.head.appendChild(E);break;default:throw Error(s(468,h))}E[tn]=t,Yt(E),h=E}t.stateNode=h}else Kg(w,t.type,t.stateNode);else t.stateNode=Gg(w,h,t.memoizedProps);else E!==h?(E===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):E.count--,h===null?Kg(w,t.type,t.stateNode):Gg(w,h,t.memoizedProps)):h===null&&t.stateNode!==null&&Mu(t,t.memoizedProps,a.memoizedProps)}break;case 27:bn(n,t),yn(t),h&512&&(Ft||a===null||rr(a,a.return)),a!==null&&h&4&&Mu(t,t.memoizedProps,a.memoizedProps);break;case 5:if(bn(n,t),yn(t),h&512&&(Ft||a===null||rr(a,a.return)),t.flags&32){w=t.stateNode;try{Vi(w,"")}catch(De){ft(t,t.return,De)}}h&4&&t.stateNode!=null&&(w=t.memoizedProps,Mu(t,w,a!==null?a.memoizedProps:w)),h&1024&&(zu=!0);break;case 6:if(bn(n,t),yn(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(hl=null,w=Xn,Xn=ul(n.containerInfo),bn(n,t),Xn=w,yn(t),h&4&&a!==null&&a.memoizedState.isDehydrated)try{Cs(n.containerInfo)}catch(De){ft(t,t.return,De)}zu&&(zu=!1,Km(t));break;case 4:h=Xn,Xn=ul(t.stateNode.containerInfo),bn(n,t),yn(t),Xn=h;break;case 12:bn(n,t),yn(t);break;case 31:bn(n,t),yn(t),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,Xo(t,h)));break;case 13:bn(n,t),yn(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Qo=Be()),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,Xo(t,h)));break;case 22:w=t.memoizedState!==null;var J=a!==null&&a.memoizedState!==null,le=wr,he=Ft;if(wr=le||w,Ft=he||J,bn(n,t),Ft=he,wr=le,yn(t),h&8192)e:for(n=t.stateNode,n._visibility=w?n._visibility&-2:n._visibility|1,w&&(a===null||J||wr||Ft||ki(t)),a=null,n=t;;){if(n.tag===5||n.tag===26){if(a===null){J=a=n;try{if(E=J.stateNode,w)O=E.style,typeof O.setProperty=="function"?O.setProperty("display","none","important"):O.display="none";else{G=J.stateNode;var xe=J.memoizedProps.style,ce=xe!=null&&xe.hasOwnProperty("display")?xe.display:null;G.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?Bg(de,!0):Bg(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,Xo(t,a))));break;case 19:bn(n,t),yn(t),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,Xo(t,h)));break;case 30:break;case 21:break;default:bn(n,t),yn(t)}}function yn(t){var n=t.flags;if(n&2){try{for(var a,h=t.return;h!==null;){if(Hm(h)){a=h;break}h=h.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var w=a.stateNode,E=Iu(t);Yo(t,E,w);break;case 5:var O=a.stateNode;a.flags&32&&(Vi(O,""),a.flags&=-33);var G=Iu(t);Yo(t,G,O);break;case 3:case 4:var J=a.stateNode.containerInfo,le=Iu(t);Bu(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 Km(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;Km(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function kr(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Um(t,n.alternate,n),n=n.sibling}function ki(t){for(t=t.child;t!==null;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:Gr(4,n,n.return),ki(n);break;case 1:rr(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&Bm(n,n.return,a),ki(n);break;case 27:Sa(n.stateNode);case 26:case 5:rr(n,n.return),ki(n);break;case 22:n.memoizedState===null&&ki(n);break;case 30:ki(n);break;default:ki(n)}t=t.sibling}}function Er(t,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var h=n.alternate,w=t,E=n,O=E.flags;switch(E.tag){case 0:case 11:case 15:Er(w,E,a),ha(4,E);break;case 1:if(Er(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 G=h.stateNode;try{var J=w.shared.hiddenCallbacks;if(J!==null)for(w.shared.hiddenCallbacks=null,w=0;w<J.length;w++)kp(J[w],G)}catch(le){ft(h,h.return,le)}}a&&O&64&&Im(E),fa(E,E.return);break;case 27:Pm(E);case 26:case 5:Er(w,E,a),a&&h===null&&O&4&&zm(E),fa(E,E.return);break;case 12:Er(w,E,a);break;case 31:Er(w,E,a),a&&O&4&&Wm(w,E);break;case 13:Er(w,E,a),a&&O&4&&Gm(w,E);break;case 22:E.memoizedState===null&&Er(w,E,a),fa(E,E.return);break;case 30:break;default:Er(w,E,a)}n=n.sibling}}function Hu(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&&Js(a))}function Pu(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Js(t))}function Zn(t,n,a,h){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Ym(t,n,a,h),n=n.sibling}function Ym(t,n,a,h){var w=n.flags;switch(n.tag){case 0:case 11:case 15:Zn(t,n,a,h),w&2048&&ha(9,n);break;case 1:Zn(t,n,a,h);break;case 3:Zn(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&&Js(t)));break;case 12:if(w&2048){Zn(t,n,a,h),t=n.stateNode;try{var E=n.memoizedProps,O=E.id,G=E.onPostCommit;typeof G=="function"&&G(O,n.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(J){ft(n,n.return,J)}}else Zn(t,n,a,h);break;case 31:Zn(t,n,a,h);break;case 13:Zn(t,n,a,h);break;case 23:break;case 22:E=n.stateNode,O=n.alternate,n.memoizedState!==null?E._visibility&2?Zn(t,n,a,h):pa(t,n):E._visibility&2?Zn(t,n,a,h):(E._visibility|=2,fs(t,n,a,h,(n.subtreeFlags&10256)!==0||!1)),w&2048&&Hu(O,n);break;case 24:Zn(t,n,a,h),w&2048&&Pu(n.alternate,n);break;default:Zn(t,n,a,h)}}function fs(t,n,a,h,w){for(w=w&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var E=t,O=n,G=a,J=h,le=O.flags;switch(O.tag){case 0:case 11:case 15:fs(E,O,G,J,w),ha(8,O);break;case 23:break;case 22:var he=O.stateNode;O.memoizedState!==null?he._visibility&2?fs(E,O,G,J,w):pa(E,O):(he._visibility|=2,fs(E,O,G,J,w)),w&&le&2048&&Hu(O.alternate,O);break;case 24:fs(E,O,G,J,w),w&&le&2048&&Pu(O.alternate,O);break;default:fs(E,O,G,J,w)}n=n.sibling}}function pa(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:pa(a,h),w&2048&&Hu(h.alternate,h);break;case 24:pa(a,h),w&2048&&Pu(h.alternate,h);break;default:pa(a,h)}n=n.sibling}}var ma=8192;function ps(t,n,a){if(t.subtreeFlags&ma)for(t=t.child;t!==null;)Xm(t,n,a),t=t.sibling}function Xm(t,n,a){switch(t.tag){case 26:ps(t,n,a),t.flags&ma&&t.memoizedState!==null&&k1(a,Xn,t.memoizedState,t.memoizedProps);break;case 5:ps(t,n,a);break;case 3:case 4:var h=Xn;Xn=ul(t.stateNode.containerInfo),ps(t,n,a),Xn=h;break;case 22:t.memoizedState===null&&(h=t.alternate,h!==null&&h.memoizedState!==null?(h=ma,ma=16777216,ps(t,n,a),ma=h):ps(t,n,a));break;default:ps(t,n,a)}}function Zm(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 ga(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];Xt=h,Jm(h,t)}Zm(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Qm(t),t=t.sibling}function Qm(t){switch(t.tag){case 0:case 11:case 15:ga(t),t.flags&2048&&Gr(9,t,t.return);break;case 3:ga(t);break;case 12:ga(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,Zo(t)):ga(t);break;default:ga(t)}}function Zo(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];Xt=h,Jm(h,t)}Zm(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:Gr(8,n,n.return),Zo(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Zo(n));break;default:Zo(n)}t=t.sibling}}function Jm(t,n){for(;Xt!==null;){var a=Xt;switch(a.tag){case 0:case 11:case 15:Gr(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:Js(a.memoizedState.cache)}if(h=a.child,h!==null)h.return=a,Xt=h;else e:for(a=t;Xt!==null;){h=Xt;var w=h.sibling,E=h.return;if($m(h),h===a){Xt=null;break e}if(w!==null){w.return=E,Xt=w;break e}Xt=E}}}var P_={getCacheForType:function(t){var n=rn(zt),a=n.data.get(t);return a===void 0&&(a=t(),n.data.set(t,a)),a},cacheSignal:function(){return rn(zt).controller.signal}},F_=typeof WeakMap=="function"?WeakMap:Map,dt=0,vt=null,Qe=null,nt=0,ht=0,An=null,Vr=!1,ms=!1,Fu=!1,jr=0,Lt=0,Kr=0,Ei=0,Uu=0,Dn=0,gs=0,xa=null,_n=null,$u=!1,Qo=0,eg=0,Jo=1/0,el=null,Yr=null,Wt=0,Xr=null,xs=null,Nr=0,qu=0,Wu=null,tg=null,va=0,Gu=null;function Ln(){return(dt&2)!==0&&nt!==0?nt&-nt:M.T!==null?Qu():xf()}function ng(){if(Dn===0)if((nt&536870912)===0||it){var t=_e;_e<<=1,(_e&3932160)===0&&(_e=262144),Dn=t}else Dn=536870912;return t=Nn.current,t!==null&&(t.flags|=32),Dn}function Sn(t,n,a){(t===vt&&(ht===2||ht===9)||t.cancelPendingCommit!==null)&&(vs(t,0),Zr(t,nt,Dn,!1)),en(t,a),((dt&2)===0||t!==vt)&&(t===vt&&((dt&2)===0&&(Ei|=a),Lt===4&&Zr(t,nt,Dn,!1)),ir(t))}function rg(t,n,a){if((dt&6)!==0)throw Error(s(327));var h=!a&&(n&127)===0&&(n&t.expiredLanes)===0||ye(t,n),w=h?q_(t,n):Ku(t,n,!0),E=h;do{if(w===0){ms&&!h&&Zr(t,n,0,!1);break}else{if(a=t.current.alternate,E&&!U_(a)){w=Ku(t,n,!1),E=!1;continue}if(w===2){if(E=n,t.errorRecoveryDisabledLanes&E)var O=0;else O=t.pendingLanes&-536870913,O=O!==0?O:O&536870912?536870912:0;if(O!==0){n=O;e:{var G=t;w=xa;var J=G.current.memoizedState.isDehydrated;if(J&&(vs(G,O).flags|=256),O=Ku(G,O,!1),O!==2){if(Fu&&!J){G.errorRecoveryDisabledLanes|=E,Ei|=E,w=4;break e}E=_n,_n=w,E!==null&&(_n===null?_n=E:_n.push.apply(_n,E))}w=O}if(E=!1,w!==2)continue}}if(w===1){vs(t,0),Zr(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:Zr(h,n,Dn,!Vr);break e;case 2:_n=null;break;case 3:case 5:break;default:throw Error(s(329))}if((n&62914560)===n&&(w=Qo+300-Be(),10<w)){if(Zr(h,n,Dn,!Vr),ne(h,0,!0)!==0)break e;Nr=n,h.timeoutHandle=Og(ig.bind(null,h,a,_n,el,$u,n,Dn,Ei,gs,Vr,E,"Throttled",-0,0),w);break e}ig(h,a,_n,el,$u,n,Dn,Ei,gs,Vr,E,null,-0,0)}}break}while(!0);ir(t)}function ig(t,n,a,h,w,E,O,G,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:fr},Xm(n,E,xe);var De=(E&62914560)===E?Qo-Be():(E&4194048)===E?eg-Be():0;if(De=E1(xe,De),De!==null){Nr=E,t.cancelPendingCommit=De(hg.bind(null,t,n,E,a,h,w,O,G,J,he,xe,null,ce,de)),Zr(t,E,O,!le);return}}hg(t,n,E,a,h,w,O,G,J)}function U_(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(!En(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 Zr(t,n,a,h){n&=~Uu,n&=~Ei,t.suspendedLanes|=n,t.pingedLanes&=~n,h&&(t.warmLanes|=n),h=t.expirationTimes;for(var w=n;0<w;){var E=31-lt(w),O=1<<E;h[E]=-1,w&=~O}a!==0&&Pi(t,a,n)}function tl(){return(dt&6)===0?(ba(0),!1):!0}function Vu(){if(Qe!==null){if(ht===0)var t=Qe.return;else t=Qe,xr=xi=null,cu(t),ls=null,ta=0,t=Qe;for(;t!==null;)Mm(t.alternate,t),t=t.return;Qe=null}}function vs(t,n){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,l1(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),Nr=0,Vu(),vt=t,Qe=a=mr(t.current,null),nt=n,ht=0,An=null,Vr=!1,ms=ye(t,n),Fu=!1,gs=Dn=Uu=Ei=Kr=Lt=0,_n=xa=null,$u=!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 jr=n,So(),a}function sg(t,n){Ke=null,M.H=ca,n===os||n===Ao?(n=_p(),ht=3):n===Zc?(n=_p(),ht=4):ht=n===ku?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,An=n,Qe===null&&(Lt=1,qo(t,Pn(n,t.current)))}function ag(){var t=Nn.current;return t===null?!0:(nt&4194048)===nt?qn===null:(nt&62914560)===nt||(nt&536870912)!==0?t===qn:!1}function og(){var t=M.H;return M.H=ca,t===null?ca:t}function lg(){var t=M.A;return M.A=P_,t}function nl(){Lt=4,Vr||(nt&4194048)!==nt&&Nn.current!==null||(ms=!0),(Kr&134217727)===0&&(Ei&134217727)===0||vt===null||Zr(vt,nt,Dn,!1)}function Ku(t,n,a){var h=dt;dt|=2;var w=og(),E=lg();(vt!==t||nt!==n)&&(el=null,vs(t,n)),n=!1;var O=Lt;e:do try{if(ht!==0&&Qe!==null){var G=Qe,J=An;switch(ht){case 8:Vu(),O=6;break e;case 3:case 2:case 9:case 6:Nn.current===null&&(n=!0);var le=ht;if(ht=0,An=null,bs(t,G,J,le),a&&ms){O=0;break e}break;default:le=ht,ht=0,An=null,bs(t,G,J,le)}}$_(),O=Lt;break}catch(he){sg(t,he)}while(!0);return n&&t.shellSuspendCounter++,xr=xi=null,dt=h,M.H=w,M.A=E,Qe===null&&(vt=null,nt=0,So()),O}function $_(){for(;Qe!==null;)cg(Qe)}function q_(t,n){var a=dt;dt|=2;var h=og(),w=lg();vt!==t||nt!==n?(el=null,Jo=Be()+500,vs(t,n)):ms=ye(t,n);e:do try{if(ht!==0&&Qe!==null){n=Qe;var E=An;t:switch(ht){case 1:ht=0,An=null,bs(t,n,E,1);break;case 2:case 9:if(bp(E)){ht=0,An=null,ug(n);break}n=function(){ht!==2&&ht!==9||vt!==t||(ht=7),ir(t)},E.then(n,n);break e;case 3:ht=7;break e;case 4:ht=5;break e;case 7:bp(E)?(ht=0,An=null,ug(n)):(ht=0,An=null,bs(t,n,E,7));break;case 5:var O=null;switch(Qe.tag){case 26:O=Qe.memoizedState;case 5:case 27:var G=Qe;if(O?Yg(O):G.stateNode.complete){ht=0,An=null;var J=G.sibling;if(J!==null)Qe=J;else{var le=G.return;le!==null?(Qe=le,rl(le)):Qe=null}break t}}ht=0,An=null,bs(t,n,E,5);break;case 6:ht=0,An=null,bs(t,n,E,6);break;case 8:Vu(),Lt=6;break e;default:throw Error(s(462))}}W_();break}catch(he){sg(t,he)}while(!0);return xr=xi=null,M.H=h,M.A=w,dt=a,Qe!==null?0:(vt=null,nt=0,So(),Lt)}function W_(){for(;Qe!==null&&!fe();)cg(Qe)}function cg(t){var n=Rm(t.alternate,t,jr);t.memoizedProps=t.pendingProps,n===null?rl(t):Qe=n}function ug(t){var n=t,a=n.alternate;switch(n.tag){case 15:case 0:n=jm(a,n,n.pendingProps,n.type,void 0,nt);break;case 11:n=jm(a,n,n.pendingProps,n.type.render,n.ref,nt);break;case 5:cu(n);default:Mm(a,n),n=Qe=lp(n,jr),n=Rm(a,n,jr)}t.memoizedProps=t.pendingProps,n===null?rl(t):Qe=n}function bs(t,n,a,h){xr=xi=null,cu(n),ls=null,ta=0;var w=n.return;try{if(R_(t,w,n,a,nt)){Lt=1,qo(t,Pn(a,t.current)),Qe=null;return}}catch(E){if(w!==null)throw Qe=w,E;Lt=1,qo(t,Pn(a,t.current)),Qe=null;return}n.flags&32768?(it||h===1?t=!0:ms||(nt&536870912)!==0?t=!1:(Vr=t=!0,(h===2||h===9||h===3||h===6)&&(h=Nn.current,h!==null&&h.tag===13&&(h.flags|=16384))),dg(n,t)):rl(n)}function rl(t){var n=t;do{if((n.flags&32768)!==0){dg(n,Vr);return}t=n.return;var a=I_(n.alternate,n,jr);if(a!==null){Qe=a;return}if(n=n.sibling,n!==null){Qe=n;return}Qe=n=t}while(n!==null);Lt===0&&(Lt=5)}function dg(t,n){do{var a=B_(t.alternate,t);if(a!==null){a.flags&=32767,Qe=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(t=t.sibling,t!==null)){Qe=t;return}Qe=t=a}while(t!==null);Lt=6,Qe=null}function hg(t,n,a,h,w,E,O,G,J){t.cancelPendingCommit=null;do il();while(Wt!==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|=Ic,er(t,a,E,O,G,J),t===vt&&(Qe=vt=null,nt=0),xs=n,Xr=t,Nr=a,qu=E,Wu=w,tg=h,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,Y_(je,function(){return xg(),null})):(t.callbackNode=null,t.callbackPriority=0),h=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||h){h=M.T,M.T=null,w=Y.p,Y.p=2,O=dt,dt|=4;try{z_(t,n,a)}finally{dt=O,Y.p=w,M.T=h}}Wt=1,fg(),pg(),mg()}}function fg(){if(Wt===1){Wt=0;var t=Xr,n=xs,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=M.T,M.T=null;var h=Y.p;Y.p=2;var w=dt;dt|=4;try{Vm(n,t);var E=ad,O=Jf(t.containerInfo),G=E.focusedElem,J=E.selectionRange;if(O!==G&&G&&G.ownerDocument&&Qf(G.ownerDocument.documentElement,G)){if(J!==null&&Dc(G)){var le=J.start,he=J.end;if(he===void 0&&(he=le),"selectionStart"in G)G.selectionStart=le,G.selectionEnd=Math.min(he,G.value.length);else{var xe=G.ownerDocument||document,ce=xe&&xe.defaultView||window;if(ce.getSelection){var de=ce.getSelection(),De=G.textContent.length,Fe=Math.min(J.start,De),xt=J.end===void 0?Fe:Math.min(J.end,De);!de.extend&&Fe>xt&&(O=xt,xt=Fe,Fe=O);var se=Zf(G,Fe),te=Zf(G,xt);if(se&&te&&(de.rangeCount!==1||de.anchorNode!==se.node||de.anchorOffset!==se.offset||de.focusNode!==te.node||de.focusOffset!==te.offset)){var ae=xe.createRange();ae.setStart(se.node,se.offset),de.removeAllRanges(),Fe>xt?(de.addRange(ae),de.extend(te.node,te.offset)):(ae.setEnd(te.node,te.offset),de.addRange(ae))}}}}for(xe=[],de=G;de=de.parentNode;)de.nodeType===1&&xe.push({element:de,left:de.scrollLeft,top:de.scrollTop});for(typeof G.focus=="function"&&G.focus(),G=0;G<xe.length;G++){var ge=xe[G];ge.element.scrollLeft=ge.left,ge.element.scrollTop=ge.top}}gl=!!sd,ad=sd=null}finally{dt=w,Y.p=h,M.T=a}}t.current=n,Wt=2}}function pg(){if(Wt===2){Wt=0;var t=Xr,n=xs,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=M.T,M.T=null;var h=Y.p;Y.p=2;var w=dt;dt|=4;try{Um(t,n.alternate,n)}finally{dt=w,Y.p=h,M.T=a}}Wt=3}}function mg(){if(Wt===4||Wt===3){Wt=0,Ae();var t=Xr,n=xs,a=Nr,h=tg;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Wt=5:(Wt=0,xs=Xr=null,gg(t,t.pendingLanes));var w=t.pendingLanes;if(w===0&&(Yr=null),hc(a),n=n.stateNode,Tt&&typeof Tt.onCommitFiberRoot=="function")try{Tt.onCommitFiberRoot(Ot,n,void 0,(n.current.flags&128)===128)}catch{}if(h!==null){n=M.T,w=Y.p,Y.p=2,M.T=null;try{for(var E=t.onRecoverableError,O=0;O<h.length;O++){var G=h[O];E(G.value,{componentStack:G.stack})}}finally{M.T=n,Y.p=w}}(Nr&3)!==0&&il(),ir(t),w=t.pendingLanes,(a&261930)!==0&&(w&42)!==0?t===Gu?va++:(va=0,Gu=t):va=0,ba(0)}}function gg(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,Js(n)))}function il(){return fg(),pg(),mg(),xg()}function xg(){if(Wt!==5)return!1;var t=Xr,n=qu;qu=0;var a=hc(Nr),h=M.T,w=Y.p;try{Y.p=32>a?32:a,M.T=null,a=Wu,Wu=null;var E=Xr,O=Nr;if(Wt=0,xs=Xr=null,Nr=0,(dt&6)!==0)throw Error(s(331));var G=dt;if(dt|=4,Qm(E.current),Ym(E,E.current,O,a),dt=G,ba(0,!1),Tt&&typeof Tt.onPostCommitFiberRoot=="function")try{Tt.onPostCommitFiberRoot(Ot,E)}catch{}return!0}finally{Y.p=w,M.T=h,gg(t,n)}}function vg(t,n,a){n=Pn(a,n),n=Cu(t.stateNode,n,2),t=$r(t,n,2),t!==null&&(en(t,2),ir(t))}function ft(t,n,a){if(t.tag===3)vg(t,t,a);else for(;n!==null;){if(n.tag===3){vg(n,t,a);break}else if(n.tag===1){var h=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(Yr===null||!Yr.has(h))){t=Pn(a,t),a=bm(2),h=$r(n,a,2),h!==null&&(ym(a,h,n,t),en(h,2),ir(h));break}}n=n.return}}function Yu(t,n,a){var h=t.pingCache;if(h===null){h=t.pingCache=new F_;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)||(Fu=!0,w.add(a),t=G_.bind(null,t,n,a),n.then(t,t))}function G_(t,n,a){var h=t.pingCache;h!==null&&h.delete(n),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,vt===t&&(nt&a)===a&&(Lt===4||Lt===3&&(nt&62914560)===nt&&300>Be()-Qo?(dt&2)===0&&vs(t,0):Uu|=a,gs===nt&&(gs=0)),ir(t)}function bg(t,n){n===0&&(n=Ve()),t=pi(t,n),t!==null&&(en(t,n),ir(t))}function V_(t){var n=t.memoizedState,a=0;n!==null&&(a=n.retryLane),bg(t,a)}function K_(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),bg(t,a)}function Y_(t,n){return $e(t,n)}var sl=null,ys=null,Xu=!1,al=!1,Zu=!1,Qr=0;function ir(t){t!==ys&&t.next===null&&(ys===null?sl=ys=t:ys=ys.next=t),al=!0,Xu||(Xu=!0,Z_())}function ba(t,n){if(!Zu&&al){Zu=!0;do for(var a=!1,h=sl;h!==null;){if(t!==0){var w=h.pendingLanes;if(w===0)var E=0;else{var O=h.suspendedLanes,G=h.pingedLanes;E=(1<<31-lt(42|t)+1)-1,E&=w&~(O&~G),E=E&201326741?E&201326741|1:E?E|2:0}E!==0&&(a=!0,wg(h,E))}else E=nt,E=ne(h,h===vt?E:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(E&3)===0||ye(h,E)||(a=!0,wg(h,E));h=h.next}while(a);Zu=!1}}function X_(){yg()}function yg(){al=Xu=!1;var t=0;Qr!==0&&o1()&&(t=Qr);for(var n=Be(),a=null,h=sl;h!==null;){var w=h.next,E=_g(h,n);E===0?(h.next=null,a===null?sl=w:a.next=w,w===null&&(ys=a)):(a=h,(t!==0||(E&3)!==0)&&(al=!0)),h=w}Wt!==0&&Wt!==5||ba(t),Qr!==0&&(Qr=0)}function _g(t,n){for(var a=t.suspendedLanes,h=t.pingedLanes,w=t.expirationTimes,E=t.pendingLanes&-62914561;0<E;){var O=31-lt(E),G=1<<O,J=w[O];J===-1?((G&a)===0||(G&h)!==0)&&(w[O]=Me(G,n)):J<=n&&(t.expiredLanes|=G),E&=~G}if(n=vt,a=nt,a=ne(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&&Rt(h),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||ye(t,a)){if(n=a&-a,n===t.callbackPriority)return n;switch(h!==null&&Rt(h),hc(a)){case 2:case 8:a=Se;break;case 32:a=je;break;case 268435456:a=Ge;break;default:a=je}return h=Sg.bind(null,t),a=$e(a,h),t.callbackPriority=n,t.callbackNode=a,n}return h!==null&&h!==null&&Rt(h),t.callbackPriority=2,t.callbackNode=null,2}function Sg(t,n){if(Wt!==0&&Wt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if(il()&&t.callbackNode!==a)return null;var h=nt;return h=ne(t,t===vt?h:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),h===0?null:(rg(t,h,n),_g(t,Be()),t.callbackNode!=null&&t.callbackNode===a?Sg.bind(null,t):null)}function wg(t,n){if(il())return null;rg(t,n,!0)}function Z_(){c1(function(){(dt&6)!==0?$e(ue,X_):yg()})}function Qu(){if(Qr===0){var t=ss;t===0&&(t=pe,pe<<=1,(pe&261888)===0&&(pe=256)),Qr=t}return Qr}function Cg(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:po(""+t)}function kg(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 Q_(t,n,a,h,w){if(n==="submit"&&a&&a.stateNode===w){var E=Cg((w[gn]||null).action),O=h.submitter;O&&(n=(n=O[gn]||null)?Cg(n.formAction):O.getAttribute("formAction"),n!==null&&(E=n,O=null));var G=new vo("action","action",null,h,w);t.push({event:G,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(Qr!==0){var J=O?kg(w,O):new FormData(w);vu(a,{pending:!0,data:J,method:w.method,action:E},null,J)}}else typeof E=="function"&&(G.preventDefault(),J=O?kg(w,O):new FormData(w),vu(a,{pending:!0,data:J,method:w.method,action:E},E,J))},currentTarget:w}]})}}for(var Ju=0;Ju<Mc.length;Ju++){var ed=Mc[Ju],J_=ed.toLowerCase(),e1=ed[0].toUpperCase()+ed.slice(1);Yn(J_,"on"+e1)}Yn(np,"onAnimationEnd"),Yn(rp,"onAnimationIteration"),Yn(ip,"onAnimationStart"),Yn("dblclick","onDoubleClick"),Yn("focusin","onFocus"),Yn("focusout","onBlur"),Yn(g_,"onTransitionRun"),Yn(x_,"onTransitionStart"),Yn(v_,"onTransitionCancel"),Yn(sp,"onTransitionEnd"),Wi("onMouseEnter",["mouseout","mouseover"]),Wi("onMouseLeave",["mouseout","mouseover"]),Wi("onPointerEnter",["pointerout","pointerover"]),Wi("onPointerLeave",["pointerout","pointerover"]),ui("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ui("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ui("onBeforeInput",["compositionend","keypress","textInput","paste"]),ui("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ui("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ui("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ya="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(" "),t1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ya));function Eg(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 O=h.length-1;0<=O;O--){var G=h[O],J=G.instance,le=G.currentTarget;if(G=G.listener,J!==E&&w.isPropagationStopped())break e;E=G,w.currentTarget=le;try{E(w)}catch(he){_o(he)}w.currentTarget=null,E=J}else for(O=0;O<h.length;O++){if(G=h[O],J=G.instance,le=G.currentTarget,G=G.listener,J!==E&&w.isPropagationStopped())break e;E=G,w.currentTarget=le;try{E(w)}catch(he){_o(he)}w.currentTarget=null,E=J}}}}function Je(t,n){var a=n[fc];a===void 0&&(a=n[fc]=new Set);var h=t+"__bubble";a.has(h)||(jg(n,t,2,!1),a.add(h))}function td(t,n,a){var h=0;n&&(h|=4),jg(a,t,h,n)}var ol="_reactListening"+Math.random().toString(36).slice(2);function nd(t){if(!t[ol]){t[ol]=!0,yf.forEach(function(a){a!=="selectionchange"&&(t1.has(a)||td(a,!1,t),td(a,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[ol]||(n[ol]=!0,td("selectionchange",!1,n))}}function jg(t,n,a,h){switch(nx(n)){case 2:var w=T1;break;case 8:w=A1;break;default:w=xd}a=w.bind(null,n,a,t),w=void 0,!Sc||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 rd(t,n,a,h,w){var E=h;if((n&1)===0&&(n&2)===0&&h!==null)e:for(;;){if(h===null)return;var O=h.tag;if(O===3||O===4){var G=h.stateNode.containerInfo;if(G===w)break;if(O===4)for(O=h.return;O!==null;){var J=O.tag;if((J===3||J===4)&&O.stateNode.containerInfo===w)return;O=O.return}for(;G!==null;){if(O=Ui(G),O===null)return;if(J=O.tag,J===5||J===6||J===26||J===27){h=E=O;continue e}G=G.parentNode}}h=h.return}Lf(function(){var le=E,he=yc(a),xe=[];e:{var ce=ap.get(t);if(ce!==void 0){var de=vo,De=t;switch(t){case"keypress":if(go(a)===0)break e;case"keydown":case"keyup":de=K0;break;case"focusin":De="focus",de=Ec;break;case"focusout":De="blur",de=Ec;break;case"beforeblur":case"afterblur":de=Ec;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=Mf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":de=I0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":de=Z0;break;case np:case rp:case ip:de=H0;break;case sp:de=J0;break;case"scroll":case"scrollend":de=O0;break;case"wheel":de=t_;break;case"copy":case"cut":case"paste":de=F0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":de=Bf;break;case"toggle":case"beforetoggle":de=r_}var Fe=(n&4)!==0,xt=!Fe&&(t==="scroll"||t==="scrollend"),se=Fe?ce!==null?ce+"Capture":null:ce;Fe=[];for(var te=le,ae;te!==null;){var ge=te;if(ae=ge.stateNode,ge=ge.tag,ge!==5&&ge!==26&&ge!==27||ae===null||se===null||(ge=Us(te,se),ge!=null&&Fe.push(_a(te,ge,ae))),xt)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!==bc&&(De=a.relatedTarget||a.fromElement)&&(Ui(De)||De[Fi]))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?Ui(De):null,De!==null&&(xt=u(De),Fe=De.tag,De!==xt||Fe!==5&&Fe!==27&&Fe!==6)&&(De=null)):(de=null,De=le),de!==De)){if(Fe=Mf,ge="onMouseLeave",se="onMouseEnter",te="mouse",(t==="pointerout"||t==="pointerover")&&(Fe=Bf,ge="onPointerLeave",se="onPointerEnter",te="pointer"),xt=de==null?ce:Fs(de),ae=De==null?ce:Fs(De),ce=new Fe(ge,te+"leave",de,a,he),ce.target=xt,ce.relatedTarget=ae,ge=null,Ui(he)===le&&(Fe=new Fe(se,te+"enter",De,a,he),Fe.target=ae,Fe.relatedTarget=xt,ge=Fe),xt=ge,de&&De)t:{for(Fe=n1,se=de,te=De,ae=0,ge=se;ge;ge=Fe(ge))ae++;ge=0;for(var ze=te;ze;ze=Fe(ze))ge++;for(;0<ae-ge;)se=Fe(se),ae--;for(;0<ge-ae;)te=Fe(te),ge--;for(;ae--;){if(se===te||te!==null&&se===te.alternate){Fe=se;break t}se=Fe(se),te=Fe(te)}Fe=null}else Fe=null;de!==null&&Ng(xe,ce,de,Fe,!1),De!==null&&xt!==null&&Ng(xe,xt,De,Fe,!0)}}e:{if(ce=le?Fs(le):window,de=ce.nodeName&&ce.nodeName.toLowerCase(),de==="select"||de==="input"&&ce.type==="file")var ct=Wf;else if($f(ce))if(Gf)ct=f_;else{ct=d_;var Re=u_}else de=ce.nodeName,!de||de.toLowerCase()!=="input"||ce.type!=="checkbox"&&ce.type!=="radio"?le&&vc(le.elementType)&&(ct=Wf):ct=h_;if(ct&&(ct=ct(t,le))){qf(xe,ct,a,he);break e}Re&&Re(t,ce,le),t==="focusout"&&le&&ce.type==="number"&&le.memoizedProps.value!=null&&xc(ce,"number",ce.value)}switch(Re=le?Fs(le):window,t){case"focusin":($f(Re)||Re.contentEditable==="true")&&(Zi=Re,Lc=le,Xs=null);break;case"focusout":Xs=Lc=Zi=null;break;case"mousedown":Rc=!0;break;case"contextmenu":case"mouseup":case"dragend":Rc=!1,ep(xe,a,he);break;case"selectionchange":if(m_)break;case"keydown":case"keyup":ep(xe,a,he)}var Ye;if(Nc)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 Xi?Ff(t,a)&&(rt="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(rt="onCompositionStart");rt&&(zf&&a.locale!=="ko"&&(Xi||rt!=="onCompositionStart"?rt==="onCompositionEnd"&&Xi&&(Ye=Rf()):(Ir=he,wc="value"in Ir?Ir.value:Ir.textContent,Xi=!0)),Re=ll(le,rt),0<Re.length&&(rt=new If(rt,t,null,a,he),xe.push({event:rt,listeners:Re}),Ye?rt.data=Ye:(Ye=Uf(a),Ye!==null&&(rt.data=Ye)))),(Ye=s_?a_(t,a):o_(t,a))&&(rt=ll(le,"onBeforeInput"),0<rt.length&&(Re=new If("onBeforeInput","beforeinput",null,a,he),xe.push({event:Re,listeners:rt}),Re.data=Ye)),Q_(xe,t,le,a,he)}Eg(xe,n)})}function _a(t,n,a){return{instance:t,listener:n,currentTarget:a}}function ll(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=Us(t,a),w!=null&&h.unshift(_a(t,w,E)),w=Us(t,n),w!=null&&h.push(_a(t,w,E))),t.tag===3)return h;t=t.return}return[]}function n1(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Ng(t,n,a,h,w){for(var E=n._reactName,O=[];a!==null&&a!==h;){var G=a,J=G.alternate,le=G.stateNode;if(G=G.tag,J!==null&&J===h)break;G!==5&&G!==26&&G!==27||le===null||(J=le,w?(le=Us(a,E),le!=null&&O.unshift(_a(a,le,J))):w||(le=Us(a,E),le!=null&&O.push(_a(a,le,J)))),a=a.return}O.length!==0&&t.push({event:n,listeners:O})}var r1=/\r\n?/g,i1=/\u0000|\uFFFD/g;function Tg(t){return(typeof t=="string"?t:""+t).replace(r1,`
|
|
49
|
+
`).replace(i1,"")}function Ag(t,n){return n=Tg(n),Tg(t)===n}function gt(t,n,a,h,w,E){switch(a){case"children":typeof h=="string"?n==="body"||n==="textarea"&&h===""||Vi(t,h):(typeof h=="number"||typeof h=="bigint")&&n!=="body"&&Vi(t,""+h);break;case"className":ho(t,"class",h);break;case"tabIndex":ho(t,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":ho(t,a,h);break;case"style":Af(t,h,E);break;case"data":if(n!=="object"){ho(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=po(""+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"&>(t,n,"name",w.name,w,null),gt(t,n,"formEncType",w.formEncType,w,null),gt(t,n,"formMethod",w.formMethod,w,null),gt(t,n,"formTarget",w.formTarget,w,null)):(gt(t,n,"encType",w.encType,w,null),gt(t,n,"method",w.method,w,null),gt(t,n,"target",w.target,w,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){t.removeAttribute(a);break}h=po(""+h),t.setAttribute(a,h);break;case"onClick":h!=null&&(t.onclick=fr);break;case"onScroll":h!=null&&Je("scroll",t);break;case"onScrollEnd":h!=null&&Je("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=po(""+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":Je("beforetoggle",t),Je("toggle",t),uo(t,"popover",h);break;case"xlinkActuate":hr(t,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":hr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":hr(t,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":hr(t,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":hr(t,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":hr(t,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":hr(t,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":hr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":hr(t,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":uo(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=L0.get(a)||a,uo(t,a,h))}}function id(t,n,a,h,w,E){switch(a){case"style":Af(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"?Vi(t,h):(typeof h=="number"||typeof h=="bigint")&&Vi(t,""+h);break;case"onScroll":h!=null&&Je("scroll",t);break;case"onScrollEnd":h!=null&&Je("scrollend",t);break;case"onClick":h!=null&&(t.onclick=fr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!_f.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[gn]||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,""):uo(t,a,h)}}}function an(t,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Je("error",t),Je("load",t);var h=!1,w=!1,E;for(E in a)if(a.hasOwnProperty(E)){var O=a[E];if(O!=null)switch(E){case"src":h=!0;break;case"srcSet":w=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:gt(t,n,E,O,a,null)}}w&>(t,n,"srcSet",a.srcSet,a,null),h&>(t,n,"src",a.src,a,null);return;case"input":Je("invalid",t);var G=E=O=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":O=he;break;case"checked":J=he;break;case"defaultChecked":le=he;break;case"value":E=he;break;case"defaultValue":G=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(s(137,n));break;default:gt(t,n,h,he,a,null)}}Ef(t,E,G,J,le,O,w,!1);return;case"select":Je("invalid",t),h=O=E=null;for(w in a)if(a.hasOwnProperty(w)&&(G=a[w],G!=null))switch(w){case"value":E=G;break;case"defaultValue":O=G;break;case"multiple":h=G;default:gt(t,n,w,G,a,null)}n=E,a=O,t.multiple=!!h,n!=null?Gi(t,!!h,n,!1):a!=null&&Gi(t,!!h,a,!0);return;case"textarea":Je("invalid",t),E=w=h=null;for(O in a)if(a.hasOwnProperty(O)&&(G=a[O],G!=null))switch(O){case"value":h=G;break;case"defaultValue":w=G;break;case"children":E=G;break;case"dangerouslySetInnerHTML":if(G!=null)throw Error(s(91));break;default:gt(t,n,O,G,a,null)}Nf(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:gt(t,n,J,h,a,null)}return;case"dialog":Je("beforetoggle",t),Je("toggle",t),Je("cancel",t),Je("close",t);break;case"iframe":case"object":Je("load",t);break;case"video":case"audio":for(h=0;h<ya.length;h++)Je(ya[h],t);break;case"image":Je("error",t),Je("load",t);break;case"details":Je("toggle",t);break;case"embed":case"source":case"link":Je("error",t),Je("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:gt(t,n,le,h,a,null)}return;default:if(vc(n)){for(he in a)a.hasOwnProperty(he)&&(h=a[he],h!==void 0&&id(t,n,he,h,a,void 0));return}}for(G in a)a.hasOwnProperty(G)&&(h=a[G],h!=null&>(t,n,G,h,a,null))}function s1(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,O=null,G=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)||gt(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":O=de;break;case"defaultValue":G=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(s(137,n));break;default:de!==xe&>(t,n,ce,de,h,xe)}}gc(t,O,G,J,le,he,E,w);return;case"select":de=O=G=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)||gt(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":G=E;break;case"multiple":O=E;default:E!==J&>(t,n,w,E,h,J)}n=G,a=O,h=de,ce!=null?Gi(t,!!a,ce,!1):!!h!=!!a&&(n!=null?Gi(t,!!a,n,!0):Gi(t,!!a,a?[]:"",!1));return;case"textarea":de=ce=null;for(G in a)if(w=a[G],a.hasOwnProperty(G)&&w!=null&&!h.hasOwnProperty(G))switch(G){case"value":break;case"children":break;default:gt(t,n,G,null,h,w)}for(O in h)if(w=h[O],E=a[O],h.hasOwnProperty(O)&&(w!=null||E!=null))switch(O){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&>(t,n,O,w,h,E)}jf(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:gt(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:gt(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)&>(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:gt(t,n,le,ce,h,de)}return;default:if(vc(n)){for(var xt in a)ce=a[xt],a.hasOwnProperty(xt)&&ce!==void 0&&!h.hasOwnProperty(xt)&&id(t,n,xt,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||id(t,n,he,ce,h,de);return}}for(var se in a)ce=a[se],a.hasOwnProperty(se)&&ce!=null&&!h.hasOwnProperty(se)&>(t,n,se,null,h,ce);for(xe in h)ce=h[xe],de=a[xe],!h.hasOwnProperty(xe)||ce===de||ce==null&&de==null||gt(t,n,xe,ce,h,de)}function Dg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function a1(){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,O=w.initiatorType,G=w.duration;if(E&&G&&Dg(O)){for(O=0,G=w.responseEnd,h+=1;h<a.length;h++){var J=a[h],le=J.startTime;if(le>G)break;var he=J.transferSize,xe=J.initiatorType;he&&Dg(xe)&&(J=J.responseEnd,O+=he*(J<G?1:(G-le)/(J-le)))}if(--h,n+=8*(E+O)/(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 sd=null,ad=null;function cl(t){return t.nodeType===9?t:t.ownerDocument}function Lg(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 Rg(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 od(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 ld=null;function o1(){var t=window.event;return t&&t.type==="popstate"?t===ld?!1:(ld=t,!0):(ld=null,!1)}var Og=typeof setTimeout=="function"?setTimeout:void 0,l1=typeof clearTimeout=="function"?clearTimeout:void 0,Mg=typeof Promise=="function"?Promise:void 0,c1=typeof queueMicrotask=="function"?queueMicrotask:typeof Mg<"u"?function(t){return Mg.resolve(null).then(t).catch(u1)}:Og;function u1(t){setTimeout(function(){throw t})}function Jr(t){return t==="head"}function Ig(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),Cs(n);return}h--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")h++;else if(a==="html")Sa(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,Sa(a);for(var E=a.firstChild;E;){var O=E.nextSibling,G=E.nodeName;E[Ps]||G==="SCRIPT"||G==="STYLE"||G==="LINK"&&E.rel.toLowerCase()==="stylesheet"||a.removeChild(E),E=O}}else a==="body"&&Sa(t.ownerDocument.body);a=w}while(a);Cs(n)}function Bg(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 cd(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":cd(a),pc(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function d1(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[Ps])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=Wn(t.nextSibling),t===null)break}return null}function h1(t,n,a){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Wn(t.nextSibling),t===null))return null;return t}function zg(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=Wn(t.nextSibling),t===null))return null;return t}function ud(t){return t.data==="$?"||t.data==="$~"}function dd(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function f1(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 Wn(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 hd=null;function Hg(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"||a==="/&"){if(n===0)return Wn(t.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}t=t.nextSibling}return null}function Pg(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 Fg(t,n,a){switch(n=cl(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 Sa(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);pc(t)}var Gn=new Map,Ug=new Set;function ul(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Tr=Y.d;Y.d={f:p1,r:m1,D:g1,C:x1,L:v1,m:b1,X:_1,S:y1,M:S1};function p1(){var t=Tr.f(),n=tl();return t||n}function m1(t){var n=$i(t);n!==null&&n.tag===5&&n.type==="form"?sm(n):Tr.r(t)}var _s=typeof document>"u"?null:document;function $g(t,n,a){var h=_s;if(h&&typeof n=="string"&&n){var w=zn(n);w='link[rel="'+t+'"][href="'+w+'"]',typeof a=="string"&&(w+='[crossorigin="'+a+'"]'),Ug.has(w)||(Ug.add(w),t={rel:t,crossOrigin:a,href:n},h.querySelector(w)===null&&(n=h.createElement("link"),an(n,"link",t),Yt(n),h.head.appendChild(n)))}}function g1(t){Tr.D(t),$g("dns-prefetch",t,null)}function x1(t,n){Tr.C(t,n),$g("preconnect",t,n)}function v1(t,n,a){Tr.L(t,n,a);var h=_s;if(h&&t&&n){var w='link[rel="preload"][as="'+zn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(w+='[imagesrcset="'+zn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(w+='[imagesizes="'+zn(a.imageSizes)+'"]')):w+='[href="'+zn(t)+'"]';var E=w;switch(n){case"style":E=Ss(t);break;case"script":E=ws(t)}Gn.has(E)||(t=m({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:t,as:n},a),Gn.set(E,t),h.querySelector(w)!==null||n==="style"&&h.querySelector(wa(E))||n==="script"&&h.querySelector(Ca(E))||(n=h.createElement("link"),an(n,"link",t),Yt(n),h.head.appendChild(n)))}}function b1(t,n){Tr.m(t,n);var a=_s;if(a&&t){var h=n&&typeof n.as=="string"?n.as:"script",w='link[rel="modulepreload"][as="'+zn(h)+'"][href="'+zn(t)+'"]',E=w;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":E=ws(t)}if(!Gn.has(E)&&(t=m({rel:"modulepreload",href:t},n),Gn.set(E,t),a.querySelector(w)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ca(E)))return}h=a.createElement("link"),an(h,"link",t),Yt(h),a.head.appendChild(h)}}}function y1(t,n,a){Tr.S(t,n,a);var h=_s;if(h&&t){var w=qi(h).hoistableStyles,E=Ss(t);n=n||"default";var O=w.get(E);if(!O){var G={loading:0,preload:null};if(O=h.querySelector(wa(E)))G.loading=5;else{t=m({rel:"stylesheet",href:t,"data-precedence":n},a),(a=Gn.get(E))&&fd(t,a);var J=O=h.createElement("link");Yt(J),an(J,"link",t),J._p=new Promise(function(le,he){J.onload=le,J.onerror=he}),J.addEventListener("load",function(){G.loading|=1}),J.addEventListener("error",function(){G.loading|=2}),G.loading|=4,dl(O,n,h)}O={type:"stylesheet",instance:O,count:1,state:G},w.set(E,O)}}}function _1(t,n){Tr.X(t,n);var a=_s;if(a&&t){var h=qi(a).hoistableScripts,w=ws(t),E=h.get(w);E||(E=a.querySelector(Ca(w)),E||(t=m({src:t,async:!0},n),(n=Gn.get(w))&&pd(t,n),E=a.createElement("script"),Yt(E),an(E,"link",t),a.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},h.set(w,E))}}function S1(t,n){Tr.M(t,n);var a=_s;if(a&&t){var h=qi(a).hoistableScripts,w=ws(t),E=h.get(w);E||(E=a.querySelector(Ca(w)),E||(t=m({src:t,async:!0,type:"module"},n),(n=Gn.get(w))&&pd(t,n),E=a.createElement("script"),Yt(E),an(E,"link",t),a.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},h.set(w,E))}}function qg(t,n,a,h){var w=(w=ee.current)?ul(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=Ss(a.href),a=qi(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=Ss(a.href);var E=qi(w).hoistableStyles,O=E.get(t);if(O||(w=w.ownerDocument||w,O={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},E.set(t,O),(E=w.querySelector(wa(t)))&&!E._p&&(O.instance=E,O.state.loading=5),Gn.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},Gn.set(t,a),E||w1(w,t,a,O.state))),n&&h===null)throw Error(s(528,""));return O}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=ws(a),a=qi(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 Ss(t){return'href="'+zn(t)+'"'}function wa(t){return'link[rel="stylesheet"]['+t+"]"}function Wg(t){return m({},t,{"data-precedence":t.precedence,precedence:null})}function w1(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}),an(n,"link",a),Yt(n),t.head.appendChild(n))}function ws(t){return'[src="'+zn(t)+'"]'}function Ca(t){return"script[async]"+t}function Gg(t,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var h=t.querySelector('style[data-href~="'+zn(a.href)+'"]');if(h)return n.instance=h,Yt(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"),Yt(h),an(h,"style",w),dl(h,a.precedence,t),n.instance=h;case"stylesheet":w=Ss(a.href);var E=t.querySelector(wa(w));if(E)return n.state.loading|=4,n.instance=E,Yt(E),E;h=Wg(a),(w=Gn.get(w))&&fd(h,w),E=(t.ownerDocument||t).createElement("link"),Yt(E);var O=E;return O._p=new Promise(function(G,J){O.onload=G,O.onerror=J}),an(E,"link",h),n.state.loading|=4,dl(E,a.precedence,t),n.instance=E;case"script":return E=ws(a.src),(w=t.querySelector(Ca(E)))?(n.instance=w,Yt(w),w):(h=a,(w=Gn.get(E))&&(h=m({},a),pd(h,w)),t=t.ownerDocument||t,w=t.createElement("script"),Yt(w),an(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,dl(h,a.precedence,t));return n.instance}function dl(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,O=0;O<h.length;O++){var G=h[O];if(G.dataset.precedence===n)E=G;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 fd(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function pd(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var hl=null;function Vg(t,n,a){if(hl===null){var h=new Map,w=hl=new Map;w.set(a,h)}else w=hl,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[Ps]||E[tn]||t==="link"&&E.getAttribute("rel")==="stylesheet")&&E.namespaceURI!=="http://www.w3.org/2000/svg"){var O=E.getAttribute(n)||"";O=t+O;var G=h.get(O);G?G.push(E):h.set(O,[E])}}return h}function Kg(t,n,a){t=t.ownerDocument||t,t.head.insertBefore(a,n==="title"?t.querySelector("head > title"):null)}function C1(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 Yg(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function k1(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=Ss(h.href),E=n.querySelector(wa(w));if(E){n=E._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=fl.bind(t),n.then(t,t)),a.state.loading|=4,a.instance=E,Yt(E);return}E=n.ownerDocument||n,h=Wg(h),(w=Gn.get(w))&&fd(h,w),E=E.createElement("link"),Yt(E);var O=E;O._p=new Promise(function(G,J){O.onload=G,O.onerror=J}),an(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=fl.bind(t),n.addEventListener("load",a),n.addEventListener("error",a))}}var md=0;function E1(t,n){return t.stylesheets&&t.count===0&&ml(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var h=setTimeout(function(){if(t.stylesheets&&ml(t,t.stylesheets),t.unsuspend){var E=t.unsuspend;t.unsuspend=null,E()}},6e4+n);0<t.imgBytes&&md===0&&(md=62500*a1());var w=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&ml(t,t.stylesheets),t.unsuspend)){var E=t.unsuspend;t.unsuspend=null,E()}},(t.imgBytes>md?50:800)+n);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(h),clearTimeout(w)}}:null}function fl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ml(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var pl=null;function ml(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,pl=new Map,n.forEach(j1,t),pl=null,fl.call(t))}function j1(t,n){if(!(n.state.loading&4)){var a=pl.get(t);if(a)var h=a.get(null);else{a=new Map,pl.set(t,a);for(var w=t.querySelectorAll("link[data-precedence],style[data-precedence]"),E=0;E<w.length;E++){var O=w[E];(O.nodeName==="LINK"||O.getAttribute("media")!=="not all")&&(a.set(O.dataset.precedence,O),h=O)}h&&a.set(null,h)}w=n.instance,O=w.getAttribute("data-precedence"),E=a.get(O)||h,E===h&&a.set(null,w),a.set(O,w),this.count++,h=fl.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 ka={$$typeof:S,Provider:null,Consumer:null,_currentValue:Z,_currentValue2:Z,_threadCount:0};function N1(t,n,a,h,w,E,O,G,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=st(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=st(0),this.hiddenUpdates=st(null),this.identifierPrefix=h,this.onUncaughtError=w,this.onCaughtError=E,this.onRecoverableError=O,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=J,this.incompleteTransitions=new Map}function Xg(t,n,a,h,w,E,O,G,J,le,he,xe){return t=new N1(t,n,a,O,J,le,he,xe,G),n=1,E===!0&&(n|=24),E=jn(3,null,null,n),t.current=E,E.stateNode=t,n=Kc(),n.refCount++,t.pooledCache=n,n.refCount++,E.memoizedState={element:h,isDehydrated:a,cache:n},Qc(E),t}function Zg(t){return t?(t=es,t):es}function Qg(t,n,a,h,w,E){w=Zg(w),h.context===null?h.context=w:h.pendingContext=w,h=Ur(n),h.payload={element:a},E=E===void 0?null:E,E!==null&&(h.callback=E),a=$r(t,h,n),a!==null&&(Sn(a,t,n),ra(a,t,n))}function Jg(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<n?a:n}}function gd(t,n){Jg(t,n),(t=t.alternate)&&Jg(t,n)}function ex(t){if(t.tag===13||t.tag===31){var n=pi(t,67108864);n!==null&&Sn(n,t,67108864),gd(t,67108864)}}function tx(t){if(t.tag===13||t.tag===31){var n=Ln();n=dc(n);var a=pi(t,n);a!==null&&Sn(a,t,n),gd(t,n)}}var gl=!0;function T1(t,n,a,h){var w=M.T;M.T=null;var E=Y.p;try{Y.p=2,xd(t,n,a,h)}finally{Y.p=E,M.T=w}}function A1(t,n,a,h){var w=M.T;M.T=null;var E=Y.p;try{Y.p=8,xd(t,n,a,h)}finally{Y.p=E,M.T=w}}function xd(t,n,a,h){if(gl){var w=vd(h);if(w===null)rd(t,n,h,xl,a),rx(t,h);else if(L1(w,t,n,a,h))h.stopPropagation();else if(rx(t,h),n&4&&-1<D1.indexOf(t)){for(;w!==null;){var E=$i(w);if(E!==null)switch(E.tag){case 3:if(E=E.stateNode,E.current.memoizedState.isDehydrated){var O=qe(E.pendingLanes);if(O!==0){var G=E;for(G.pendingLanes|=2,G.entangledLanes|=2;O;){var J=1<<31-lt(O);G.entanglements[1]|=J,O&=~J}ir(E),(dt&6)===0&&(Jo=Be()+500,ba(0))}}break;case 31:case 13:G=pi(E,2),G!==null&&Sn(G,E,2),tl(),gd(E,2)}if(E=vd(h),E===null&&rd(t,n,h,xl,a),E===w)break;w=E}w!==null&&h.stopPropagation()}else rd(t,n,h,null,a)}}function vd(t){return t=yc(t),bd(t)}var xl=null;function bd(t){if(xl=null,t=Ui(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=c(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 xl=t,null}function nx(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 Se:return 8;case je:case Ie:return 32;case Ge:return 268435456;default:return 32}default:return 32}}var yd=!1,ei=null,ti=null,ni=null,Ea=new Map,ja=new Map,ri=[],D1="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 rx(t,n){switch(t){case"focusin":case"focusout":ei=null;break;case"dragenter":case"dragleave":ti=null;break;case"mouseover":case"mouseout":ni=null;break;case"pointerover":case"pointerout":Ea.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":ja.delete(n.pointerId)}}function Na(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=$i(n),n!==null&&ex(n)),t):(t.eventSystemFlags|=h,n=t.targetContainers,w!==null&&n.indexOf(w)===-1&&n.push(w),t)}function L1(t,n,a,h,w){switch(n){case"focusin":return ei=Na(ei,t,n,a,h,w),!0;case"dragenter":return ti=Na(ti,t,n,a,h,w),!0;case"mouseover":return ni=Na(ni,t,n,a,h,w),!0;case"pointerover":var E=w.pointerId;return Ea.set(E,Na(Ea.get(E)||null,t,n,a,h,w)),!0;case"gotpointercapture":return E=w.pointerId,ja.set(E,Na(ja.get(E)||null,t,n,a,h,w)),!0}return!1}function ix(t){var n=Ui(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,vf(t.priority,function(){tx(a)});return}}else if(n===31){if(n=c(a),n!==null){t.blockedOn=n,vf(t.priority,function(){tx(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 vl(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var a=vd(t.nativeEvent);if(a===null){a=t.nativeEvent;var h=new a.constructor(a.type,a);bc=h,a.target.dispatchEvent(h),bc=null}else return n=$i(a),n!==null&&ex(n),t.blockedOn=a,!1;n.shift()}return!0}function sx(t,n,a){vl(t)&&a.delete(n)}function R1(){yd=!1,ei!==null&&vl(ei)&&(ei=null),ti!==null&&vl(ti)&&(ti=null),ni!==null&&vl(ni)&&(ni=null),Ea.forEach(sx),ja.forEach(sx)}function bl(t,n){t.blockedOn===n&&(t.blockedOn=null,yd||(yd=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,R1)))}var yl=null;function ax(t){yl!==t&&(yl=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){yl===t&&(yl=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(bd(h||a)===null)continue;break}var E=$i(a);E!==null&&(t.splice(n,3),n-=3,vu(E,{pending:!0,data:w,method:a.method,action:h},h,w))}}))}function Cs(t){function n(J){return bl(J,t)}ei!==null&&bl(ei,t),ti!==null&&bl(ti,t),ni!==null&&bl(ni,t),Ea.forEach(n),ja.forEach(n);for(var a=0;a<ri.length;a++){var h=ri[a];h.blockedOn===t&&(h.blockedOn=null)}for(;0<ri.length&&(a=ri[0],a.blockedOn===null);)ix(a),a.blockedOn===null&&ri.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],O=w[gn]||null;if(typeof E=="function")O||ax(a);else if(O){var G=null;if(E&&E.hasAttribute("formAction")){if(w=E,O=E[gn]||null)G=O.formAction;else if(bd(w)!==null)continue}else G=O.action;typeof G=="function"?a[h+1]=G:(a.splice(h,3),h-=3),ax(a)}}}function ox(){function t(E){E.canIntercept&&E.info==="react-transition"&&E.intercept({handler:function(){return new Promise(function(O){return w=O})},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 _d(t){this._internalRoot=t}_l.prototype.render=_d.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(s(409));var a=n.current,h=Ln();Qg(a,h,t,n,null,null)},_l.prototype.unmount=_d.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;Qg(t.current,2,null,t,null,null),tl(),n[Fi]=null}};function _l(t){this._internalRoot=t}_l.prototype.unstable_scheduleHydration=function(t){if(t){var n=xf();t={blockedOn:null,target:t,priority:n};for(var a=0;a<ri.length&&n!==0&&n<ri[a].priority;a++);ri.splice(a,0,t),a===0&&ix(t)}};var lx=r.version;if(lx!=="19.2.4")throw Error(s(527,lx,"19.2.4"));Y.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 O1={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Sl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Sl.isDisabled&&Sl.supportsFiber)try{Ot=Sl.inject(O1),Tt=Sl}catch{}}return Aa.createRoot=function(t,n){if(!l(t))throw Error(s(299));var a=!1,h="",w=mm,E=gm,O=xm;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&&(O=n.onRecoverableError)),n=Xg(t,1,!1,null,null,a,h,null,w,E,O,ox),t[Fi]=n.current,nd(t),new _d(n)},Aa.hydrateRoot=function(t,n,a){if(!l(t))throw Error(s(299));var h=!1,w="",E=mm,O=gm,G=xm,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&&(O=a.onCaughtError),a.onRecoverableError!==void 0&&(G=a.onRecoverableError),a.formState!==void 0&&(J=a.formState)),n=Xg(t,1,!0,n,a??null,h,w,J,E,O,G,ox),n.context=Zg(null),a=n.current,h=Ln(),h=dc(h),w=Ur(h),w.callback=null,$r(a,w,h),a=h,n.current.lanes=a,en(n,a),ir(n),t[Fi]=n.current,nd(t),new _l(n)},Aa.version="19.2.4",Aa}var vx;function V1(){if(vx)return Cd.exports;vx=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(),Cd.exports=G1(),Cd.exports}var K1=V1();const Y1=Gl(K1);function X1(e,r){if(e instanceof RegExp)return{keys:!1,pattern:e};var i,s,l,u,f=[],c="",d=e.split("/");for(d[0]||d.shift();l=d.shift();)i=l[0],i==="*"?(f.push(i),c+=l[1]==="?"?"(?:/(.*))?":"/(.*)"):i===":"?(s=l.indexOf("?",1),u=l.indexOf(".",1),f.push(l.substring(1,~s?s:~u?u:l.length)),c+=~s&&!~u?"(?:/([^/]+?))?":"/([^/]+?)",~u&&(c+=(~s?"?":"")+"\\"+l.substring(u))):c+="/"+l;return{keys:f,pattern:new RegExp("^"+c+(r?"(?=$|/)":"/?$"),"i")}}var Nd={exports:{}},Td={};/**
|
|
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 bx;function Z1(){if(bx)return Td;bx=1;var e=Vl();function r(m,x){return m===x&&(m!==0||1/m===1/x)||m!==m&&x!==x}var i=typeof Object.is=="function"?Object.is:r,s=e.useState,l=e.useEffect,u=e.useLayoutEffect,f=e.useDebugValue;function c(m,x){var _=x(),k=s({inst:{value:_,getSnapshot:x}}),C=k[0].inst,b=k[1];return u(function(){C.value=_,C.getSnapshot=x,d(C)&&b({inst:C})},[m,_,x]),l(function(){return d(C)&&b({inst:C}),m(function(){d(C)&&b({inst:C})})},[m]),f(_),_}function d(m){var x=m.getSnapshot;m=m.value;try{var _=x();return!i(m,_)}catch{return!0}}function p(m,x){return x()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:c;return Td.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,Td}var yx;function Q1(){return yx||(yx=1,Nd.exports=Z1()),Nd.exports}var J1=Q1();const eS=U1.useInsertionEffect,tS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",nS=tS?P.useLayoutEffect:P.useEffect,rS=eS||nS,hb=e=>{const r=P.useRef([e,(...i)=>r[0](...i)]).current;return rS(()=>{r[0]=e}),r[1]},iS="popstate",_h="pushState",Sh="replaceState",sS="hashchange",_x=[iS,_h,Sh,sS],aS=e=>{for(const r of _x)addEventListener(r,e);return()=>{for(const r of _x)removeEventListener(r,e)}},fb=(e,r)=>J1.useSyncExternalStore(aS,e,r),Sx=()=>location.search,oS=({ssrSearch:e}={})=>fb(Sx,e!=null?()=>e:Sx),wx=()=>location.pathname,lS=({ssrPath:e}={})=>fb(wx,e!=null?()=>e:wx),cS=(e,{replace:r=!1,state:i=null}={})=>history[r?Sh:_h](i,"",e),uS=(e={})=>[lS(e),cS],Cx=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[Cx]>"u"){for(const e of[_h,Sh]){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,Cx,{value:!0})}const dS=(e,r)=>r.toLowerCase().indexOf(e.toLowerCase())?"~"+r:r.slice(e.length)||"/",pb=(e="")=>e==="/"?"":e,hS=(e,r)=>e[0]==="~"?e.slice(1):pb(r)+e,fS=(e="",r)=>dS(kx(pb(e)),kx(r)),kx=e=>{try{return decodeURI(e)}catch{return e}},mb={hook:uS,searchHook:oS,parser:X1,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e,aroundNav:(e,r,i)=>e(r,i)},gb=P.createContext(mb),Ms=()=>P.useContext(gb),xb={},vb=P.createContext(xb),pS=()=>P.useContext(vb),Kl=e=>{const[r,i]=e.hook(e);return[fS(e.base,r),hb((s,l)=>e.aroundNav(i,hS(s,e.base),l))]},ur=()=>Kl(Ms()),wh=(e,r,i,s)=>{const{pattern:l,keys:u}=r instanceof RegExp?{keys:!1,pattern:r}:e(r||"*",s),f=l.exec(i)||[],[c,...d]=f;return c!==void 0?[!0,(()=>{const p=u!==!1?Object.fromEntries(u.map((m,x)=>[m,d[x]])):f.groups;let g={...d};return p&&Object.assign(g,p),g})(),...s?[c]:[]]:[!1,null]},Ch=e=>wh(Ms().parser,e,ur()[0]),mS=({children:e,...r})=>{var g,m,x;const i=Ms(),s=r.hook?mb:i;let l=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??((x=r.hook)==null?void 0:x.searchHook);let c=P.useRef({}),d=c.current,p=d;for(let _ in s){const k=_==="base"?s[_]+(r[_]??""):r[_]??s[_];d===p&&k!==p[_]&&(c.current=p={...p}),p[_]=k,(k!==s[_]||k!==l[_])&&(l=p)}return P.createElement(gb.Provider,{value:l,children:e})},Ex=({children:e,component:r},i)=>r?P.createElement(r,{params:i}):typeof e=="function"?e(i):e,gS=e=>{let r=P.useRef(xb);const i=r.current;return r.current=Object.keys(e).length!==Object.keys(i).length||Object.entries(e).some(([s,l])=>l!==i[s])?e:i},Da=({path:e,nest:r,match:i,...s})=>{const l=Ms(),[u]=Kl(l),[f,c,d]=i??wh(l.parser,e,u,r),p=gS({...pS(),...c});if(!f)return null;const g=d?P.createElement(mS,{base:d},Ex(s,p)):Ex(s,p);return P.createElement(vb.Provider,{value:p,children:g})},Mn=P.forwardRef((e,r)=>{const i=Ms(),[s,l]=Kl(i),{to:u="",href:f=u,onClick:c,asChild:d,children:p,className:g,replace:m,state:x,transition:_,...k}=e,C=hb(v=>{v.ctrlKey||v.metaKey||v.altKey||v.shiftKey||v.button!==0||(c==null||c(v),v.defaultPrevented||(v.preventDefault(),l(f,e)))}),b=i.hrefs(f[0]==="~"?f.slice(1):i.base+f,i);return d&&P.isValidElement(p)?P.cloneElement(p,{onClick:C,href:b}):P.createElement("a",{...k,onClick:C,href:b,className:g!=null&&g.call?g(s===f):g,children:p,ref:r})}),bb=e=>Array.isArray(e)?e.flatMap(r=>bb(r&&r.type===P.Fragment?r.props.children:r)):[e],xS=({children:e,location:r})=>{const i=Ms(),[s]=Kl(i);for(const l of bb(e)){let u=0;if(P.isValidElement(l)&&(u=wh(i.parser,l.props.path,r||s,l.props.nest))[0])return P.cloneElement(l,{match:u})}return null},jx=e=>{let r;const i=new Set,s=(p,g)=>{const m=typeof p=="function"?p(r):p;if(!Object.is(m,r)){const x=r;r=g??(typeof m!="object"||m===null)?m:Object.assign({},r,m),i.forEach(_=>_(r,x))}},l=()=>r,c={setState:s,getState:l,getInitialState:()=>d,subscribe:p=>(i.add(p),()=>i.delete(p))},d=r=e(s,l,c);return c},vS=(e=>e?jx(e):jx),bS=e=>e;function yS(e,r=bS){const i=dn.useSyncExternalStore(e.subscribe,dn.useCallback(()=>r(e.getState()),[e,r]),dn.useCallback(()=>r(e.getInitialState()),[e,r]));return dn.useDebugValue(i),i}const Nx=e=>{const r=vS(e),i=s=>yS(r,s);return Object.assign(i,r),i},Kn=(e=>e?Nx(e):Nx);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 _S(e){return typeof e=="object"&&e!==null&&"type"in e&&"payload"in e}function yb(){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 SS{constructor(r){sr(this,"ws",null);sr(this,"handlers",new Set);sr(this,"statusHandler",null);sr(this,"baseUrl");sr(this,"isReconnecting",!1);sr(this,"connectingPromise",null);sr(this,"lastCloseCode",0);sr(this,"reconnectAttempts",0);sr(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,l)=>{try{const u=this.getUrl();this.ws=new WebSocket(u);const f=setTimeout(()=>{var c;((c=this.ws)==null?void 0:c.readyState)===WebSocket.CONNECTING&&(this.ws.close(),l(new Error("Connection timeout")))},5e3);this.ws.onopen=()=>{var c;clearTimeout(f),this.isReconnecting=!1,this.connectingPromise=null,(c=this.statusHandler)==null||c.call(this,"connected"),s()},this.ws.onclose=c=>{var d,p,g;clearTimeout(f),this.lastCloseCode=c.code,((d=this.ws)==null?void 0:d.readyState)===WebSocket.CONNECTING?(this.connectingPromise=null,(p=this.statusHandler)==null||p.call(this,"disconnected"),l(new Error(`Connection closed: ${c.code}`))):(this.connectingPromise=null,(g=this.statusHandler)==null||g.call(this,"disconnected"),this.attemptReconnect())},this.ws.onerror=c=>{clearTimeout(f),console.error("WebSocket error:",c),this.connectingPromise=null,l(c)},this.ws.onmessage=c=>{try{const d=JSON.parse(c.data);_S(d)&&this.handlers.forEach(p=>p(d))}catch(d){console.error("Failed to parse WebSocket message:",d)}}}catch(u){this.connectingPromise=null,l(u)}}),this.connectingPromise))}attemptReconnect(){var l;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,(l=this.statusHandler)==null||l.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=yb(),l={id:s,type:r,payload:i};return this.ws.send(JSON.stringify(l)),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 wS=`ws://${window.location.hostname}:${window.location.port||"10469"}/ws`,$t=new SS(wS),li=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 _b(e){let r=null;function i(){r===null&&(r=requestAnimationFrame(()=>{r=null,e()}))}return i}let wl=[];const lr=Kn()((e,r)=>{function i(){if(wl.length===0)return;const l=wl;wl=[],e(u=>({logs:[...u.logs,...l]}))}const s=_b(i);return{workdir:null,status:null,logs:[],config:null,loading:!1,setWorkdir:l=>{r().workdir!==l&&(e({workdir:l,status:null,logs:[],config:null,loading:!0}),l&&(r().fetchStatus(),r().fetchConfig()))},fetchStatus:async()=>{const l=r().workdir;if(l)try{const f=await(await ke(`/api/dev-server?workdir=${encodeURIComponent(l)}`)).json();e({status:f,loading:!1})}catch{e({loading:!1})}},fetchConfig:async()=>{const l=r().workdir;if(l)try{const f=await(await ke(`/api/dev-server/config?workdir=${encodeURIComponent(l)}`)).json();e({config:f.config??null})}catch{}},fetchLogs:async()=>{const l=r().workdir;if(l)try{const c=(await(await ke(`/api/dev-server/logs?workdir=${encodeURIComponent(l)}`)).json()).logs.map(d=>({stream:d.stream,content:d.content}));e({logs:c})}catch{}},start:async()=>{const l=r().workdir;if(l)try{const f=await(await ke(`/api/dev-server/start?workdir=${encodeURIComponent(l)}`,{method:"POST"})).json();e({status:f,logs:[]})}catch{}},stop:async()=>{const l=r().workdir;if(l)try{const f=await(await ke(`/api/dev-server/stop?workdir=${encodeURIComponent(l)}`,{method:"POST"})).json();e({status:f})}catch{}},restart:async()=>{const l=r().workdir;if(l)try{const f=await(await ke(`/api/dev-server/restart?workdir=${encodeURIComponent(l)}`,{method:"POST"})).json();e({status:f,logs:[]})}catch{}},saveConfig:async l=>{const u=r().workdir;if(u)try{const c=await(await ke(`/api/dev-server/config?workdir=${encodeURIComponent(u)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})).json();e({config:c.config??l}),r().fetchStatus()}catch{}},handleMessage:l=>{const u=r().workdir;if(u)switch(l.type){case"devServer.output":{const f=l.payload;if(f.workdir!==u)return;wl.push({stream:f.stream,content:f.content}),s();break}case"devServer.state":{const f=l.payload;if(f.workdir!==u)return;e(c=>({status:c.status?{...c.status,state:f.state,errorMessage:f.errorMessage}:c.status}));break}}}}});function CS(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 Tx(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 l=await s.json();throw new Error(l.error??"Failed to update model")}return s.json()}function Ax(e,r,i,s){return e.map(l=>l.id===r?{...l,models:l.models.map(u=>u.id===i?{...u,...s,source:"user"}:u)}:l)}const kS=3e4;function ES(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 At=Kn((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=Ee.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:l}=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 c=await u.json();throw new Error(c.error??"Failed to activate provider")}const f=await u.json();return e({activeProviderId:f.activeProviderId,model:f.model,backend:f.backend,providers:l.map(c=>({...c,isActive:c.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:l}=r();e({activeProviderId:i,model:s,defaultModelSelection:`${i}/${s}`,providers:l.map(u=>({...u,isActive:u.id===i}))})},updateModelContext:async(i,s,l)=>{e({activating:!0,error:null});try{const u=await Tx(i,s,{contextWindow:l}),{providers:f}=r();return e({providers:Ax(f,i,s,{contextWindow:l}),activating:!1}),u.contextState&&Ee.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,l)=>{e({activating:!0,error:null});try{const u=await Tx(i,s,l),{providers:f}=r(),c={...l.contextWindow!==void 0&&{contextWindow:l.contextWindow},...CS({temperature:l.temperature??void 0,topP:l.topP??void 0,topK:l.topK??void 0,maxTokens:l.maxTokens??void 0})};return e({providers:Ax(f,i,s,c),activating:!1}),u.contextState&&Ee.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 l=await s.json(),{providers:u}=r();return e({providers:u.map(f=>f.id===i?{...f,models:l.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 l=setInterval(()=>{s()},kS);e({autoRefreshInterval:l})},stopAutoRefresh:()=>{const{autoRefreshInterval:i}=r();i&&(clearInterval(i),e({autoRefreshInterval:null}))},getActiveProvider:()=>{const{providers:i,activeProviderId:s}=r();return i.find(l=>l.id===s)},getModelContext:i=>{const{providers:s,activeProviderId:l}=r(),u=s.find(c=>c.id===l);if(!u)return 2e5;const f=u.models.find(c=>c.id===i);return(f==null?void 0:f.contextWindow)??2e5}})),Gt=Kn((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 l=await ke("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,workdir:s})});if(!l.ok)return null;const u=await l.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 l=await s.json();return e({currentProject:l.project}),r().projects.length===0&&await r().listProjects(),l.project}catch{return null}},updateProject:async(i,s)=>{var l;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((l=r().currentProject)==null?void 0:l.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 Cl=[];const qa=Kn()((e,r)=>{function i(){if(Cl.length===0)return;const l=Cl;Cl=[],e(u=>{const f={...u.logs};for(const c of l){const d=f[c.processId]??[];f[c.processId]=[...d,{offset:d.length,content:c.content,timestamp:Date.now(),stream:c.stream}]}return{logs:f}})}const s=_b(i);return{processes:[],logs:{},loading:!1,setProcesses:l=>e({processes:l}),addProcess:l=>e(u=>({processes:[...u.processes,l]})),updateProcess:(l,u)=>e(f=>({processes:f.processes.map(c=>c.id===l?{...c,...u}:c)})),removeProcess:l=>e(u=>({processes:u.processes.filter(f=>f.id!==l),logs:Object.fromEntries(Object.entries(u.logs).filter(([f])=>f!==l))})),stopProcess:async(l,u)=>{try{(await ke(`/api/sessions/${u}/background-process/${l}/stop`,{method:"POST"})).ok&&r().removeProcess(l)}catch{}},appendLog:(l,u,f)=>{Cl.push({processId:l,stream:u,content:f}),s()},setLogs:(l,u)=>e(f=>({logs:{...f.logs,[l]:u}})),clearLogs:l=>e(u=>({logs:{...u.logs,[l]:[]}})),handleMessage:(l,u)=>{switch(l){case"backgroundProcess.started":{const{processId:f,name:c,pid:d,status:p}=u;e(g=>({processes:[...g.processes,{id:f,sessionId:"",name:c,command:"",cwd:"",pid:d,status:p,exitCode:null,createdAt:Date.now(),startedAt:Date.now(),endedAt:null}]}));break}case"backgroundProcess.output":{const f=u.processId,c=u.stream,d=u.content;r().appendLog(f,c,d);break}case"backgroundProcess.exited":{const f=u.processId,c=u.exitCode;e(d=>({processes:d.processes.map(p=>p.id===f?{...p,status:"exited",exitCode:c}:p)}));break}case"backgroundProcess.removed":{const f=u.processId;r().removeProcess(f);break}}}}}),Et={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 kl(e,r){return i=>({loading:{...i.loading,[e]:r}})}function Dx(e,r){return i=>({settings:{...i.settings,[e]:r},loading:{...i.loading,[e]:!1}})}const jS=[Et.DISPLAY_SHOW_THINKING,Et.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT,Et.DISPLAY_SHOW_STATS,Et.DISPLAY_SHOW_AGENT_DEFINITIONS,Et.DISPLAY_SHOW_WORKFLOW_BARS];function Sb(){return{showThinking:Qt(e=>e.settings[Et.DISPLAY_SHOW_THINKING]??"true")==="true",showVerboseToolOutput:Qt(e=>e.settings[Et.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT]??"true")==="true",showStats:Qt(e=>e.settings[Et.DISPLAY_SHOW_STATS]??"true")==="true",showAgentDefinitions:Qt(e=>e.settings[Et.DISPLAY_SHOW_AGENT_DEFINITIONS]??"true")==="true",showWorkflowBars:Qt(e=>e.settings[Et.DISPLAY_SHOW_WORKFLOW_BARS]??"true")==="true"}}const Qt=Kn(e=>({settings:{},loading:{},getSetting:async r=>{e(kl(r,!0));try{const s=await(await ke(`/api/settings/${r}`)).json();return e(Dx(r,s.value??"")),s.value}catch{return e(kl(r,!1)),null}},setSetting:async(r,i)=>{e(kl(r,!0));try{const l=await(await ke(`/api/settings/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:i})})).json();e(Dx(r,l.value??""))}catch{e(kl(r,!1))}}})),NS=[{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"}],TS=[{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"}],wb={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"},ai={soundEnabled:!0,browserNotification:!1,customSoundUrl:null},Cb={soundEnabled:!1,browserNotification:!1,customSoundUrl:null},rh={soundEnabled:!0,browserNotificationEnabled:!1,events:{complete:{...ai},waiting_for_user:{...ai},phase_done:{...ai},phase_blocked:{...ai},new_message:{...Cb}},agentOverrides:{}};function kb(e,r,i){var u;const s=e.events[r];if(!i)return s;const l=(u=e.agentOverrides[i])==null?void 0:u[r];return l?{soundEnabled:l.soundEnabled??s.soundEnabled,browserNotification:l.browserNotification??s.browserNotification,customSoundUrl:l.customSoundUrl!==void 0?l.customSoundUrl:s.customSoundUrl}:s}const Di=Kn((e,r)=>({settings:rh,loaded:!1,load:()=>{Qt.getState().getSetting(Et.NOTIFICATION_SETTINGS);const s=Qt.subscribe(u=>{const f=u.settings[Et.NOTIFICATION_SETTINGS];if(f!==void 0)try{const c=JSON.parse(f);e({settings:Lx(c),loaded:!0})}catch{e({loaded:!0})}}),l=Qt.getState().settings[Et.NOTIFICATION_SETTINGS];if(l)try{const u=JSON.parse(l);e({settings:Lx(u),loaded:!0})}catch{e({loaded:!0})}return s},update:i=>{e({settings:i}),Ad(i)},updateEvent:(i,s)=>{const l=r().settings,u={...l,events:{...l.events,[i]:{...l.events[i],...s}}};e({settings:u}),Ad(u)},updateAgentOverride:(i,s,l)=>{var d;const u=r().settings,f={...u.agentOverrides};if(l===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])??{},...l}};const c={...u,agentOverrides:f};e({settings:c}),Ad(c)}}));function Ad(e){Qt.getState().setSetting(Et.NOTIFICATION_SETTINGS,JSON.stringify(e))}function Lx(e){var r,i,s,l,u;return{soundEnabled:e.soundEnabled??rh.soundEnabled,browserNotificationEnabled:e.browserNotificationEnabled??rh.browserNotificationEnabled,events:{complete:{...ai,...(r=e.events)==null?void 0:r.complete},waiting_for_user:{...ai,...(i=e.events)==null?void 0:i.waiting_for_user},phase_done:{...ai,...(s=e.events)==null?void 0:s.phase_done},phase_blocked:{...ai,...(l=e.events)==null?void 0:l.phase_blocked},new_message:{...Cb,...(u=e.events)==null?void 0:u.new_message}},agentOverrides:e.agentOverrides??{}}}const Rx=new Map;function AS(e){let r=Rx.get(e);return r||(r=new Audio(e),r.volume=.5,Rx.set(e,r)),r}let Eb=typeof Notification<"u"?Notification.permission:"denied";function DS(){return typeof Notification>"u"?Promise.resolve("denied"):Notification.requestPermission().then(e=>(Eb=e,e))}const LS={complete:"Task Complete",waiting_for_user:"Waiting for Input",phase_done:"Phase Complete",phase_blocked:"Phase Blocked",new_message:"New Message"},RS={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 OS(e){typeof Notification>"u"||Eb==="granted"&&(document.hasFocus()||new Notification(LS[e],{body:RS[e],icon:"/fox.svg",tag:`openfox-${e}`}))}function io(e,r){const{settings:i}=Di.getState(),s=kb(i,e,r);if(i.soundEnabled&&s.soundEnabled){const l=s.customSoundUrl??wb[e],u=AS(l);u.currentTime=0,u.play().catch(()=>{})}i.browserNotificationEnabled&&s.browserNotification&&OS(e)}const MS=e=>io("complete",e),IS=e=>io("phase_done",e),BS=e=>io("phase_blocked",e),Ox=e=>io("waiting_for_user",e),zS=e=>io("new_message",e);let La=!1,ar=null;const Dd=new Set,Ut={messageId:null,deltaContent:"",thinkingContent:"",toolOutput:[]};let Ls=null,un=null;function Ld(){Ls===null&&(Ls=requestAnimationFrame(()=>{Ls=null,un==null||un()}))}function ji(){Ls!==null&&(cancelAnimationFrame(Ls),Ls=null)}function Bt(e,r){return r!==null&&e.sessionId===r}function HS(e,r,i){return e.id!==void 0||Bt(e,r)||i===!0&&e.sessionId!==void 0}function PS(e,r){return e.includes(r)?e:[...e,r]}function Ra(e,r){return e.filter(i=>i!==r)}function FS(e,r){const i=e.find(l=>l.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(l=>l.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(l=>l.status.type==="passed").length,messageCount:r.messages.length};return i?e.map(l=>l.id===r.id?s:l):[s,...e]}function US(e,r,i){return e.map(s=>{const l=(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:(l==null?void 0:l.mode)??(u==null?void 0:u.mode)??s.mode,phase:(l==null?void 0:l.phase)??(u==null?void 0:u.phase)??s.phase,isRunning:(l==null?void 0:l.isRunning)??(u==null?void 0:u.isRunning)??s.isRunning,messageCount:s.messageCount,recentUserPrompts:s.recentUserPrompts}})}const Mx=new Map;function Ua(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),l=(i==null?void 0:i.mode)??(s==null?void 0:s.mode);return l==="planner"?"planner":l==="builder"?"build":"planner"}function $S(e,r){if(e.type==="chat.done"){const i=e.payload,s=Ua(r,e.sessionId),l=i.agentType??s;i.reason==="complete"&&MS(l),i.reason==="waiting_for_user"&&Ox(l);return}if(e.type==="chat.path_confirmation"){const i=Ua(r,e.sessionId);Ox(i);return}if(e.type==="task.completed"){const i=Ua(r,e.sessionId);IS(i);return}if(e.type==="phase.changed"&&e.sessionId){const i=e.payload,s=Mx.get(e.sessionId)??null;if(Mx.set(e.sessionId,i.phase),s===i.phase)return;const l=Ua(r,e.sessionId);i.phase==="blocked"&&BS(l)}}const Ee=Kn((e,r)=>(un=()=>{const i=Ut;if(!i.messageId)return;const s=i.deltaContent.length>0,l=i.thinkingContent.length>0,u=i.toolOutput.length>0;if(!s&&!l&&!u)return;const f=i.deltaContent,c=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 x={...g};if(s&&(x.content=x.content+f),l&&(x.thinkingContent=(x.thinkingContent??"")+c),u){const _=new Set;x.toolCalls=(m=x.toolCalls)==null?void 0:m.map(C=>{const b=d.filter(v=>v.callId===C.id);return b.length===0?C:(_.add(C.id),{...C,streamingOutput:[...C.streamingOutput??[],...b.map(v=>({stream:v.stream,content:v.content}))]})});const k=d.filter(C=>!_.has(C.callId));k.length>0&&Ut.toolOutput.push(...k)}return{streamingMessage:x}}if(u){const x=new Set,_=p.messages.map(C=>{var v;if(C.id!==i.messageId)return C;const b=(v=C.toolCalls)==null?void 0:v.map(y=>{const S=d.filter(j=>j.callId===y.id);return S.length===0?y:(x.add(y.id),{...y,streamingOutput:[...y.streamingOutput??[],...S.map(j=>({stream:j.stream,content:j.content}))]})});return{...C,toolCalls:b}}),k=d.filter(C=>!x.has(C.callId));return k.length>0&&Ut.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()=>{const i=r().connectionStatus;if(i==="connected"||i==="reconnecting")return;e({connectionStatus:"reconnecting"});let s=!1;try{s=(await(await ke("/api/auth")).json()).requiresAuth}catch{}if(s&&!$t.hasToken()){e({showPasswordModal:!0,passwordModalRetry:!1,connectionStatus:"reconnecting"});return}$t.onStatusChange(l=>{e({connectionStatus:l}),l==="connected"&&r().listSessions(void 0)});try{if(await $t.connect(),!La){La=!0;const l=r().handleServerMessage;ar=$t.subscribe(l)}}catch(l){console.error("Failed to connect:",l);const u=$t.getLastCloseCode();if(!$t.hasToken()&&(u===1006||u===4e3)){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}ar&&(ar(),ar=null),La=!1,e({connectionStatus:"disconnected"})}},reconnect:()=>{$t.disconnect(),ar&&(ar(),ar=null),La=!1,e({connectionStatus:"reconnecting"}),r().connect()},disconnect:()=>{$t.disconnect(),ar&&(ar(),ar=null),La=!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:l}=await s.json();$t.setToken(l),e({showPasswordModal:!1}),r().connect();const{listProjects:u}=Gt.getState(),{fetchConfig:f}=At.getState();u(),f(),r().connect()}catch{e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"})}},cancelPassword:()=>{$t.clearToken(),e({showPasswordModal:!1,connectionStatus:"disconnected"})},createSession:async(i,s)=>{try{e({pendingSessionCreate:!0});const l=await ke("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:i,title:s})});if(!l.ok)return e({pendingSessionCreate:!1}),null;const u=await l.json();return $t.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?(ji(),e({currentSession:null,unreadSessionIds:Ra(r().unreadSessionIds,i),subAgentContextStates:{},messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,pendingPathConfirmation:null,queuedMessages:[],abortInProgress:!1,error:null})):e({unreadSessionIds:Ra(r().unreadSessionIds,i)});const l=await ke(`/api/sessions/${i}`);if(!l.ok)return;const u=await l.json();e({currentSession:u.session,messages:u.messages??[],contextState:u.contextState,queuedMessages:u.queueState??[]}),$t.send("session.load",{sessionId:i});try{const f=await ke(`/api/sessions/${i}/background-processes`);if(f.ok){const c=await f.json();qa.getState().setProcesses(c.processes??[])}}catch{}}catch{}},listSessions:async(i,s=20)=>{try{const l=new URLSearchParams;l.set("limit",String(s)),i&&l.set("projectId",i);const f=await(await ke(`/api/sessions?${l.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 l=new URLSearchParams;l.set("limit","20"),l.set("offset",String(s.sessions.length)),l.set("projectId",i);const f=await(await ke(`/api/sessions?${l.toString()}`)).json();e(c=>({sessions:[...c.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:()=>{ji(),e(i=>({currentSession:null,messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,unreadSessionIds:i.currentSession?Ra(i.unreadSessionIds,i.currentSession.id):i.unreadSessionIds}))},sendMessage:async(i,s,l)=>{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:l==null?void 0:l.messageKind})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(c){console.error("Error sending message:",c)}}},stopGeneration:async()=>{var s;const i=(s=r().currentSession)==null?void 0:s.id;if(i&&!r().abortInProgress){ji(),un==null||un(),e({abortInProgress:!0});try{await ke(`/api/sessions/${i}/stop`,{method:"POST"})}catch(l){console.error("Error stopping generation:",l)}}},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(l){console.error("Error continuing generation:",l)}}},launchRunner:(i,s,l)=>{e({streamingMessageId:null});const u={};i!=null&&i.trim()&&(u.content=i),s&&s.length>0&&(u.attachments=s),l&&(u.workflowId=l),$t.send("runner.launch",u)},switchMode:async i=>{var l;const s=(l=r().currentSession)==null?void 0:l.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 l;const s=(l=r().currentSession)==null?void 0:l.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,l)=>{e({streamingMessageId:null});const u={};i&&(u.workflowId=i),s!=null&&s.trim()&&(u.content=s),l&&l.length>0&&(u.attachments=l),$t.send("mode.accept",u)},editCriteria:async i=>{var l;const s=(l=r().currentSession)==null?void 0:l.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:()=>{$t.send("context.compact",{})},setSessionProvider:async(i,s)=>{var l;try{const u=(l=r().currentSession)==null?void 0:l.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 c=await f.json();return e({currentSession:c.session,messages:c.messages??[],contextState:c.contextState}),c.session}catch{return null}},updateContextState:i=>{e({contextState:i})},updateSubAgentContextState:(i,s)=>{e(l=>({subAgentContextStates:{...l.subAgentContextStates,[i]:s}}))},clearSubAgentContextState:i=>{e(s=>{const l={...s.subAgentContextStates};return delete l[i],{subAgentContextStates:l}})},confirmPath:async(i,s,l=!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:l})})}catch(c){console.error("Error confirming path:",c)}},answerQuestion:async(i,s)=>{var u;const l=(u=r().currentSession)==null?void 0:u.id;if(l){try{await ke(`/api/sessions/${l}/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,l)=>{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:l})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(c){console.error("Error queueing ASAP message:",c)}},queueCompletion:async(i,s,l)=>{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:l})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(c){console.error("Error queueing completion message:",c)}},cancelQueued:async i=>{var l;const s=(l=r().currentSession)==null?void 0:l.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,c,d,p,g,m,x,_,k,C,b,v,y,S,j,A,N,D,T,B,H,W,K,q;const s=r();$S(i,s);const l=((f=s.currentSession)==null?void 0:f.id)??null,u=()=>{const R=i.sessionId;!R||R===l||e(U=>({unreadSessionIds:PS(U.unreadSessionIds,R)}))};switch(i.type){case"session.state":{const R=i.payload;if(!HS(i,l,s.pendingSessionCreate))break;ji();const U=R.messages.find(L=>L.isStreaming)??null,M=r().pendingSessionCreate===!0,Y=R.pendingConfirmations??[],z=s.pendingPathConfirmation??(Y.length>0?Y[0]??null:null);if(e({currentSession:R.session,sessions:FS(r().sessions,R.session),unreadSessionIds:Ra(r().unreadSessionIds,R.session.id),messages:R.messages,streamingMessageId:(U==null?void 0:U.id)??null,streamingMessage:U,currentTodos:[],pendingPathConfirmation:z,error:null,...M?{pendingSessionCreate:R.session.id}:{}}),R.session.providerId&&R.session.providerModel){const L=At.getState();L.providers.find(V=>V.id===R.session.providerId)&&L.syncFromSession(R.session.providerId,R.session.providerModel)}break}case"session.list":{const R=i.payload;e(U=>({sessions:US(R.sessions,U.sessions,U.currentSession)}));break}case"session.deleted":{const R=i.payload;e(U=>({unreadSessionIds:Ra(U.unreadSessionIds,R.sessionId)})),r().listSessions();break}case"session.deletedAll":{r().listSessions();break}case"session.running":{const R=i.payload,U=i.sessionId,M=(c=r().currentSession)==null?void 0:c.id,Y=U&&U!==M;e(Z=>({sessions:Z.sessions.map(z=>z.id===U?{...z,isRunning:R.isRunning}:z)})),Y||e(Z=>({currentSession:Z.currentSession?{...Z.currentSession,isRunning:R.isRunning}:null,...R.isRunning?{}:{abortInProgress:!1,queuedMessages:[]}}));break}case"chat.message":{if(!Bt(i,((d=r().currentSession)==null?void 0:d.id)??null)){u();break}const R=i.payload;e(U=>U.messages.some(M=>M.id===R.message.id)?U:{messages:[...U.messages,R.message],streamingMessageId:R.message.isStreaming?R.message.id:U.streamingMessageId,streamingMessage:R.message.isStreaming?R.message:U.streamingMessage});break}case"chat.message_updated":{if(!Bt(i,((p=r().currentSession)==null?void 0:p.id)??null)){u();break}const R=i.payload,U=R.updates.isStreaming===!1&&r().streamingMessageId===R.messageId;U&&(ji(),un==null||un()),e(M=>{const Y=M.streamingMessage,Z=U;if(Y&&Y.id===R.messageId){const z={...Y,...R.updates};return{messages:M.messages.map(L=>L.id===R.messageId?z:L),streamingMessageId:Z?null:M.streamingMessageId,streamingMessage:Z?null:{...Y,...R.updates}}}return{messages:M.messages.map(z=>z.id===R.messageId?{...z,...R.updates}:z),streamingMessageId:Z?null:M.streamingMessageId}});break}case"chat.delta":{if(!Bt(i,((g=r().currentSession)==null?void 0:g.id)??null)){u();break}const R=i.payload;if(!Dd.has(R.messageId)){Dd.add(R.messageId);const U=Ua(r(),i.sessionId);zS(U)}Ut.messageId=R.messageId,Ut.deltaContent+=R.content,Ld();break}case"chat.thinking":{if(!Bt(i,((m=r().currentSession)==null?void 0:m.id)??null)){u();break}const R=i.payload;Ut.messageId=R.messageId,Ut.thinkingContent+=R.content,Ld();break}case"chat.tool_preparing":{if(!Bt(i,((x=r().currentSession)==null?void 0:x.id)??null)){u();break}const R=i.payload;e(U=>{const M=U.streamingMessage;return M&&M.id===R.messageId?{streamingMessage:{...M,preparingToolCalls:[...M.preparingToolCalls??[],{index:R.index,name:R.name}]}}:{messages:U.messages.map(Y=>Y.id===R.messageId?{...Y,preparingToolCalls:[...Y.preparingToolCalls??[],{index:R.index,name:R.name}]}:Y)}});break}case"chat.tool_call":{if(!Bt(i,((_=r().currentSession)==null?void 0:_.id)??null)){u();break}const R=i.payload,U=M=>{var z;const Y=(z=M.preparingToolCalls)==null?void 0:z.filter((L,I)=>{var V;return L.name===R.tool?(V=M.preparingToolCalls)==null?void 0:V.slice(0,I).some(ie=>ie.name===R.tool):!0}),Z=Ut.toolOutput.filter(L=>L.callId===R.callId);return Z.length>0&&(Ut.toolOutput=Ut.toolOutput.filter(L=>L.callId!==R.callId)),{...M,toolCalls:[...M.toolCalls??[],{id:R.callId,name:R.tool,arguments:R.args,startedAt:Date.now(),...Z.length>0?{streamingOutput:Z.map(L=>({stream:L.stream,content:L.content}))}:{}}],...Y&&Y.length>0?{preparingToolCalls:Y}:{preparingToolCalls:void 0}}};e(M=>{const Y=M.streamingMessage;return Y&&Y.id===R.messageId?{streamingMessage:U(Y)}:{messages:M.messages.map(Z=>Z.id===R.messageId?U(Z):Z)}});break}case"chat.tool_output":{if(!Bt(i,((k=r().currentSession)==null?void 0:k.id)??null)){u();break}const R=i.payload;Ut.messageId=R.messageId,Ut.toolOutput.push({messageId:R.messageId,callId:R.callId,stream:R.stream,content:R.output}),Ld();break}case"chat.tool_result":{if(!Bt(i,((C=r().currentSession)==null?void 0:C.id)??null)){u();break}const R=i.payload,U=M=>{var Z;const Y=(Z=M.toolCalls)==null?void 0:Z.map(z=>z.id===R.callId?{...z,result:R.result}:z);return{...M,toolCalls:Y}};e(M=>{const Y=M.streamingMessage;return Y&&Y.id===R.messageId?{streamingMessage:U(Y)}:{messages:M.messages.map(Z=>Z.id===R.messageId?U(Z):Z)}});break}case"chat.vision_fallback":{if(!Bt(i,((b=r().currentSession)==null?void 0:b.id)??null)){u();break}const R=i.payload;e(U=>{const M=`${R.messageId}-${R.attachmentId}`,Y={...U.visionFallbackByMessage};return Y[M]={type:R.type,attachmentId:R.attachmentId,filename:R.filename,description:R.description},{visionFallbackByMessage:Y}});break}case"chat.todo":{if(!Bt(i,((v=r().currentSession)==null?void 0:v.id)??null)){u();break}const R=i.payload;e({currentTodos:R.todos});break}case"chat.summary":{if(!Bt(i,((y=r().currentSession)==null?void 0:y.id)??null)){u();break}const R=i.payload;e(U=>({currentSession:U.currentSession?{...U.currentSession,summary:R.summary}:null}));break}case"chat.progress":{if(!Bt(i,((S=r().currentSession)==null?void 0:S.id)??null)){u();break}const R=i.payload;console.log("Progress:",R.message,R.phase);break}case"chat.format_retry":{if(!Bt(i,((j=r().currentSession)==null?void 0:j.id)??null)){u();break}const R=i.payload;console.log("Format retry:",R.attempt,"/",R.maxAttempts);break}case"chat.done":{if(!Bt(i,((A=r().currentSession)==null?void 0:A.id)??null)){u();break}ji(),un==null||un();const R=i.payload,U=R.stats;Ut.messageId=null,Ut.deltaContent="",Ut.thinkingContent="",Ut.toolOutput=[],Dd.delete(R.messageId),e(M=>{const Y=M.streamingMessage,Z=Y&&Y.id===R.messageId?{...Y,isStreaming:!1,stats:U??Y.stats}:null;return{messages:M.messages.map(z=>z.id===R.messageId?Z??{...z,isStreaming:!1,stats:U??z.stats}:z),streamingMessageId:null,streamingMessage:null,visionFallbackByMessage:{}}});break}case"chat.error":{if(!Bt(i,((N=r().currentSession)==null?void 0:N.id)??null)){u();break}ji(),un==null||un();const R=i.payload;console.error("Chat error:",R.error,"recoverable:",R.recoverable),R.recoverable||(Ut.messageId=null,Ut.deltaContent="",Ut.thinkingContent="",Ut.toolOutput=[]),e(U=>({error:{code:"CHAT_ERROR",message:R.error},streamingMessageId:R.recoverable?U.streamingMessageId:null,...R.recoverable?{}:{messages:U.streamingMessage?U.messages.map(M=>M.id===U.streamingMessage.id?U.streamingMessage:M):U.messages,streamingMessage:null}}));break}case"chat.path_confirmation":{if(!Bt(i,((D=r().currentSession)==null?void 0:D.id)??null)){u();break}const R=i.payload;e({pendingPathConfirmation:{callId:R.callId,tool:R.tool,paths:R.paths,workdir:R.workdir,reason:R.reason}});break}case"chat.ask_user":{if(!Bt(i,((T=r().currentSession)==null?void 0:T.id)??null)){u();return}const R=i.payload;e({pendingQuestion:{callId:R.callId,question:R.question}});break}case"mode.changed":{if(!Bt(i,((B=r().currentSession)==null?void 0:B.id)??null)){u();break}const R=i.payload;e(U=>({currentSession:U.currentSession?{...U.currentSession,mode:R.mode}:null}));break}case"phase.changed":{const R=i.payload,U=i.sessionId,M=(H=r().currentSession)==null?void 0:H.id,Y=U&&U!==M;e(Z=>({sessions:Z.sessions.map(z=>z.id===U?{...z,phase:R.phase}:z)})),Y||e(Z=>({currentSession:Z.currentSession?{...Z.currentSession,phase:R.phase}:null}));break}case"criteria.updated":{if(!Bt(i,((W=r().currentSession)==null?void 0:W.id)??null)){u();break}const R=i.payload;e(U=>({currentSession:U.currentSession?{...U.currentSession,criteria:R.criteria}:null}));break}case"context.state":{const R=i.payload,U=Bt(i,((K=r().currentSession)==null?void 0:K.id)??null);R.subAgentId?U&&r().updateSubAgentContextState(R.subAgentId,R.context):U?e({contextState:R.context}):u();break}case"session.name_generated":{const R=i.payload,U=i.sessionId,M=(q=r().currentSession)==null?void 0:q.id;e(Y=>{const Z=Y.sessions.map(L=>L.id===U?{...L,title:R.name,updatedAt:new Date().toISOString()}:L),z=M===U?Y.currentSession?{...Y.currentSession,title:R.name,updatedAt:new Date().toISOString()}:null:Y.currentSession;return{sessions:Z,currentSession:z}});break}case"queue.state":{const R=i.payload;e({queuedMessages:R.messages});break}case"devServer.output":case"devServer.state":{lr.getState().handleMessage(i);break}case"backgroundProcess.started":case"backgroundProcess.output":case"backgroundProcess.exited":case"backgroundProcess.removed":{qa.getState().handleMessage(i.type,i.payload);break}case"error":{const R=i.payload;console.error("Server error:",R),e({error:{code:R.code,message:R.message},streamingMessageId:null});break}}}}));function jb(){return Ee(e=>{var r;return((r=e.currentSession)==null?void 0:r.isRunning)??!1})}function qS(){return Ee(e=>e.queuedMessages)}function WS(){return Ee(e=>e.abortInProgress)}function GS(){const e=Ee(s=>s.connect),r=Ee(s=>s.connectionStatus),i=Di(s=>s.load);return P.useEffect(()=>{e()},[e]),P.useEffect(()=>{r==="connected"&&i()},[r,i]),{connectionStatus:r}}function ih(){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 Ix(e,r){const i=$t.ws;!i||i.readyState!==WebSocket.OPEN||i.send(JSON.stringify({id:ih(),type:e,payload:r}))}const cr=Kn((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 l=$t.ws;if(l&&l.readyState===WebSocket.OPEN)for(const u of s)l.send(JSON.stringify({id:ih(),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 l=await s.json();e(f=>({sessions:[...f.sessions,l]}));const u=$t.ws;u&&u.readyState===WebSocket.OPEN&&u.send(JSON.stringify({id:ih(),type:"terminal.subscribe",payload:{sessionId:l.id}}))}}catch(s){console.error("Failed to create terminal:",s)}},writeSession:(i,s)=>{Ix("terminal.write",{sessionId:i,data:s})},resizeSession:(i,s,l)=>{Ix("terminal.resize",{sessionId:i,cols:s,rows:l})},killSession:async i=>{try{(await ke(`/api/terminals/${i}`,{method:"DELETE"})).ok&&e(l=>({sessions:l.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(l=>{const u=l.sessions.filter(f=>f.id!==s);return u.length===0&&l.isOpen?{sessions:[],isOpen:!1}:{sessions:u}});break}}}}));$t.subscribe(e=>{var r;(r=e.type)!=null&&r.startsWith("terminal.")&&cr.getState().handleMessage(e)});var Yl=db();const kh=P.forwardRef(({icon:e,iconSize:r="w-3.5 h-3.5",className:i="",...s},l)=>o.jsx("button",{ref:l,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})})}));kh.displayName="IconButton";const VS="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",Is=P.forwardRef((e,r)=>o.jsx(kh,{ref:r,icon:VS,title:"Edit",...e}));Is.displayName="EditButton";const KS="M6 18L18 6M6 6l12 12",Eh=P.forwardRef((e,r)=>o.jsx(kh,{ref:r,icon:KS,...e}));Eh.displayName="CloseButton";const YS={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 jt({label:e,title:r,size:i="md",minHeight:s,children:l,footer:u,className:f,onClose:c,isOpen:d,closeOnBackdropClick:p=!0,closeOnEscape:g=!0,showCloseButton:m=!0}){const[x,_]=P.useState(!1),k=d!==void 0,C=k?d:x,b=P.useCallback(()=>{k||_(!0)},[k]),v=P.useCallback(()=>{k||_(!1),c==null||c()},[k,c]);P.useEffect(()=>{if(!C||!g)return;const S=j=>{j.key==="Escape"&&v()};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[C,v,g]);const y=e&&(typeof e=="string"?o.jsx("button",{type:"button",onClick:b,className:f,children:e}):o.jsx("span",{onClick:b,className:f,style:{cursor:"pointer"},children:e}));return o.jsxs(o.Fragment,{children:[y,C&&(typeof document<"u"?Yl.createPortal(o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:p?v:void 0}),o.jsxs("div",{className:`relative w-full ${YS[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(Eh,{onClick:v,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:l}),u&&o.jsx("div",{className:"px-4 py-3 border-t border-border",children:u})]})]}),document.body):null)]})}const tt=P.forwardRef(({variant:e="secondary",size:r="md",className:i="",children:s,...l},u)=>{const f="rounded font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",c={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} ${c[e]} ${d[r]} ${i}`,...l,children:s})});tt.displayName="Button";function XS({value:e,defaultUrl:r,disabled:i,onChange:s}){const l=e??r;return o.jsxs("div",{className:"relative",children:[o.jsx("select",{value:l,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:TS.map(({url:u,label:f})=>o.jsx("option",{value:u,title:f,children:f.split(" ")[0]},u))}),o.jsx("svg",{className:"absolute right-0.5 top-1/2 -translate-y-1/2 w-3 h-3 pointer-events-none text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})}const Bx=[{key:"general",label:"General"},{key:"build",label:"Agent"},{key:"sub-agent",label:"Sub-agent"}];function ZS(){const e=Di(d=>d.settings),r=Di(d=>d.update),i=Di(d=>d.updateEvent),s=Di(d=>d.updateAgentOverride),l=Di(d=>d.load);P.useEffect(()=>{l()},[l]);const u=async()=>{await DS()==="granted"&&r({...e,browserNotificationEnabled:!0})},f=(d,p,g,m)=>{d==="general"?i(p,{[g]:m}):s(d,p,{[g]:m})},c=(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(zx,{label:"Sound notifications",description:"Play sounds when events occur",checked:e.soundEnabled,onChange:d=>r({...e,soundEnabled:d})}),o.jsx(zx,{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"}),Bx.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:NS.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})}),Bx.map(p=>{const g=kb(e,d.key,p.key==="general"?void 0:p.key),m=wb[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:x=>f(p.key,d.key,"soundEnabled",x.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:x=>f(p.key,d.key,"browserNotification",x.target.checked),disabled:!e.browserNotificationEnabled,className:"rounded border-border",title:"Browser"})})]}),g.soundEnabled&&e.soundEnabled&&o.jsx(XS,{value:g.customSoundUrl,defaultUrl:m,disabled:!e.soundEnabled,onChange:x=>c(p.key,d.key,x)})]})},p.key)})]},d.key))})]})})]})]})}function zx({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:l=>{l.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 jh(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 Ar=Kn((e,r)=>({defaults:[],userItems:[],loading:!1,fetchSkills:async()=>{await jh("/api/skills",e)},toggleSkill:async i=>{try{const l=await(await ke(`/api/skills/${i}/toggle`,{method:"POST"})).json();e(u=>({defaults:u.defaults.map(f=>f.id===i?{...f,enabled:l.enabled}:f),userItems:u.userItems.map(f=>f.id===i?{...f,enabled:l.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 li("POST","/api/skills",i);return s.success&&await r().fetchSkills(),s},updateSkill:async(i,s)=>{const l=await li("PUT",`/api/skills/${i}`,s);return l.success&&await r().fetchSkills(),l},deleteSkill:async i=>{try{const s=await ke(`/api/skills/${i}`,{method:"DELETE"}),l=await s.json();return s.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==i)})),{success:!0}):{success:!1,error:l.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"}),l=await s.json();return s.ok?(await r().fetchSkills(),{success:!0}):{success:!1,error:l.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}));function Nh(){const[e,r]=P.useState({id:null,type:null}),i=P.useCallback(u=>r({id:u,type:"delete"}),[]),s=P.useCallback(()=>r({id:null,type:null}),[]),l=P.useCallback((u,f)=>e.id===u&&e.type===f,[e.id,e.type]);return{requestDelete:i,clearConfirm:s,isConfirming:l}}function Th({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 Ah({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("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:"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 Ya({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("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:"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 Li({label:e,value:r,onChange:i,placeholder:s,readOnly:l,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:c=>i(c.target.value),readOnly:l,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":""} ${l?"opacity-60":""}`})]})}function QS({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(tt,{variant:"secondary",onClick:e,children:"Cancel"}),o.jsx(tt,{variant:"primary",onClick:r,disabled:i||s,children:i?"Saving...":"Save"})]})}function Dh({message:e}){return o.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded",children:e})}function Nb({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(tt,{variant:"primary",size:"sm",onClick:r,children:i})})]})}function Tb({isBuiltIn:e,isConfirmingDelete:r,onView:i,onEdit:s,onDuplicate:l,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("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:"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"})})}),o.jsx(Ya,{onClick:l}),!e&&s&&o.jsx(Is,{onClick:s}),!e&&(r?o.jsx(Th,{onConfirm:()=>{u==null||u()},onCancel:()=>{}}):o.jsx(Ah,{onClick:()=>u==null?void 0:u()}))]})]})}function JS({id:e,name:r,description:i,isBuiltIn:s,isConfirmingDelete:l,onView:u,onEdit:f,onDuplicate:c,onDelete:d}){return o.jsxs(Tb,{isBuiltIn:s,isConfirmingDelete:l,onView:u,onEdit:f,onDuplicate:c,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 Ab({loading:e,hasItems:r,loadingLabel:i,emptyLabel:s,children:l}){return e&&!r?o.jsx("div",{className:"text-text-muted text-sm",children:i}):r?o.jsx("div",{className:"space-y-4",children:l}):s?o.jsx("div",{className:"text-text-muted text-sm",children:s}):null}function Db({name:e,id:r,nameLabel:i="Name",idLabel:s="ID",namePlaceholder:l="My Item",idPlaceholder:u="my-item",nameHint:f,readOnlyId:c=!1,readOnlyHint:d="(read-only)",onNameChange:p,onIdChange:g}){return o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Li,{label:i,value:e,onChange:p,placeholder:l,hint:f}),o.jsx(Li,{label:s,value:r,onChange:g,readOnly:c,placeholder:u,hint:c?d:void 0,mono:!0})]})}function Lb(e={}){const{initialData:r={}}=e,[i,s]=P.useState("list"),[l,u]=P.useState(null),[f,c]=P.useState(""),[d,p]=P.useState(!1),[g,m]=P.useState(r),x=P.useCallback(()=>{m(r),c(""),u(null)},[r]),_=P.useCallback(v=>{s(v),v==="list"&&x()},[x]),k=P.useCallback(v=>{m(y=>typeof v=="function"?v(y):v)},[]),C=P.useCallback((v,y={})=>{u(v),s("edit"),m({...y}),c("")},[]),b=P.useCallback(()=>{u(null),s("edit"),m(r),c("")},[r]);return{view:i,editingId:l,formError:f,saving:d,formData:g,setView:_,setEditingId:u,setFormError:c,setFormData:k,setSaving:p,resetForm:x,startEditing:C,startNew:b}}function Hx({skill:e,isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:l,onDuplicate:u,onDelete:f}){return o.jsx(JS,{id:e.id,name:e.name,description:e.description,isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:l,onDuplicate:u,onDelete:f})}function ew({isOpen:e}){const r=Ar(R=>R.defaults),i=Ar(R=>R.userItems),s=Ar(R=>R.loading),l=Ar(R=>R.fetchSkills),u=Ar(R=>R.fetchSkill),f=Ar(R=>R.fetchDefaultContent),c=Ar(R=>R.createSkill),d=Ar(R=>R.updateSkill),p=Ar(R=>R.deleteSkill),{view:g,editingId:m,formError:x,saving:_,formData:k,setView:C,setEditingId:b,setFormError:v,setFormData:y,setSaving:S}=Lb(),{clearConfirm:j}=Nh();P.useEffect(()=>{e&&(l(),C("list"),b(null),j())},[e,l,j]);const A=(R,U,M,Y)=>{y({name:Y??R.metadata.name,id:M??R.metadata.id,description:R.metadata.description??"",version:R.metadata.version??"1.0.0",prompt:R.prompt,isReadOnly:U})},N=async R=>{if(r.some(M=>M.id===R)){const M=await f(R);if(!M)return;A(M,!0),b(R),v(""),C("edit")}else{const M=await u(R);if(!M)return;A(M,!0),b(R),v(""),C("edit")}},D=async R=>{const M=r.some(Z=>Z.id===R)?await f(R):await u(R);if(!M)return;const Y=`${R}-copy-${Date.now()}`;A(M,!1,Y,`${M.metadata.name} (copy)`),b(null),v(""),C("edit")},T=()=>{y({name:"",id:"",description:"",version:"1.0.0",prompt:"",isReadOnly:!1}),C("edit")},B=async R=>{const U=await u(R);U&&(A(U,!1),b(R),v(""),C("edit"))},H=async R=>{await p(R),j()},W=async()=>{const R=m??k.id;if(!R||!k.name||!k.prompt){v("Name, ID, and prompt are required.");return}S(!0),v("");const U={metadata:{id:R,name:k.name,description:k.description,version:k.version},prompt:k.prompt},M=m?await d(m,U):await c(U);if(S(!1),!M.success){v(M.error??"Failed to save skill.");return}C("list")},K=R=>{y(U=>({...U,name:R})),m||y(U=>({...U,id:R.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}))},q=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:q?k.name:m?"Edit Skill":"New Skill"}),o.jsx("button",{onClick:()=>C("list"),className:"text-text-muted hover:text-text-primary",children:"Cancel"})]}),x&&o.jsx(Dh,{message:x}),o.jsxs("div",{className:"space-y-3 mb-3",children:[o.jsx(Db,{name:k.name,id:k.id,nameLabel:"Name",idLabel:"ID",namePlaceholder:"My Skill",idPlaceholder:"my-skill",readOnlyId:!0,onNameChange:K,onIdChange:()=>{}}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Li,{label:"Description",value:k.description,onChange:R=>y(U=>({...U,description:R})),placeholder:"What this skill does...",readOnly:q}),o.jsx(Li,{label:"Version",value:k.version,onChange:R=>y(U=>({...U,version:R})),placeholder:"1.0.0",readOnly:q})]})]}),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:R=>y(U=>({...U,prompt:R.target.value})),readOnly:q,placeholder:"The system prompt for this skill...",className:"flex-1 w-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"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border flex-shrink-0",children:[o.jsx(tt,{variant:"secondary",onClick:()=>C("list"),children:"Cancel"}),q?o.jsx(tt,{variant:"primary",onClick:()=>{y(R=>({...R,name:R.name+" (copy)",id:`${m}-copy-${Date.now()}`,isReadOnly:!1})),b(null)},children:"Duplicate & Customize"}):o.jsx(tt,{variant:"primary",onClick:W,disabled:_||!k.name||!k.id||!k.prompt,children:_?"Saving...":"Save"})]})]}):o.jsxs("div",{children:[o.jsx(Nb,{description:"Skills provide domain-specific knowledge that agents can load on demand.",onNew:T}),o.jsxs(Ab,{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(R=>o.jsx(Hx,{skill:R,isBuiltIn:!0,isConfirmingDelete:!1,onView:()=>N(R.id),onDuplicate:()=>D(R.id)},R.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(R=>o.jsx(Hx,{skill:R,isBuiltIn:!1,isConfirmingDelete:!1,onView:()=>N(R.id),onEdit:()=>B(R.id),onDuplicate:()=>D(R.id),onDelete:()=>H(R.id)},R.id))})]})]})]})}function tw({isOpen:e,onClose:r}){const[i,s]=P.useState("instructions");return o.jsx(jt,{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(Oa,{label:"Instructions",active:i==="instructions",onClick:()=>s("instructions")}),o.jsx(Oa,{label:"Skills",active:i==="skills",onClick:()=>s("skills")}),o.jsx(Oa,{label:"Notifications",active:i==="notifications",onClick:()=>s("notifications")}),o.jsx(Oa,{label:"Display",active:i==="display",onClick:()=>s("display")}),o.jsx(Oa,{label:"Advanced",active:i==="advanced",onClick:()=>s("advanced")})]}),i==="instructions"&&o.jsx(iw,{isOpen:e}),i==="skills"&&o.jsx(ew,{isOpen:e}),i==="notifications"&&o.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:o.jsx(ZS,{})}),i==="display"&&o.jsx(rw,{}),i==="advanced"&&o.jsx(nw,{onClose:r})]})})}function nw({onClose:e}){const[,r]=ur();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(tt,{variant:"secondary",onClick:i,children:"Launch Onboarding"})]})})}function rw(){const e=Qt(g=>g.settings),r=Qt(g=>g.loading),i=Qt(g=>g.getSetting),s=Qt(g=>g.setSetting),l=r[Et.DISPLAY_SHOW_THINKING]??!1,u=[{key:Et.DISPLAY_SHOW_THINKING,label:"Show thinking blocks",description:"Display AI reasoning content in the feed"},{key:Et.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT,label:"Show expanded tool output",description:"Always show full tool call details instead of compact view"},{key:Et.DISPLAY_SHOW_STATS,label:"Show stats bar",description:"Display model, tokens, and timing information"},{key:Et.DISPLAY_SHOW_AGENT_DEFINITIONS,label:"Show agent definitions",description:"Display agent definition injections in the feed"},{key:Et.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"])),[c,d]=P.useState(()=>Object.fromEntries(u.map(g=>[g.key,f[g.key]==="true"])));P.useEffect(()=>{u.forEach(g=>i(g.key))},[i]),P.useEffect(()=>{d(Object.fromEntries(u.map(g=>[g.key,f[g.key]==="true"])))},[JSON.stringify(f)]);const p=async g=>{const m=String(!c[g]);d(x=>({...x,[g]:!x[g]})),await s(g,m)};return l?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:x})=>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:x})]}),o.jsx("button",{type:"button",onClick:()=>p(g),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${c[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 ${c[g]?"translate-x-6":"translate-x-1"}`})})]},g))})]})})}function Oa({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 iw({isOpen:e}){const r=Qt(b=>b.settings),i=Qt(b=>b.loading),s=Qt(b=>b.getSetting),l=Qt(b=>b.setSetting),u=r[Et.GLOBAL_INSTRUCTIONS]??"",f=i[Et.GLOBAL_INSTRUCTIONS]??!1,[c,d]=P.useState(u),[p,g]=P.useState(!1),[m,x]=P.useState(!1);P.useEffect(()=>{e&&s(Et.GLOBAL_INSTRUCTIONS)},[e,s]),P.useEffect(()=>{d(u),g(!1)},[u]);const _=async()=>{x(!0),l(Et.GLOBAL_INSTRUCTIONS,c),x(!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:c,onChange:b=>{d(b.target.value),g(!0)},placeholder:"Enter global instructions that apply to all projects...",className:"w-full h-64 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:C})]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(tt,{variant:"secondary",onClick:k,disabled:!p,children:"Discard"}),o.jsx(tt,{variant:"primary",onClick:_,disabled:!p||C,children:m?"Saving...":"Save"})]})]})}var Rd={exports:{}},Px;function sw(){return Px||(Px=1,(function(e,r){(function(i,s){e.exports=s()})(globalThis,(()=>(()=>{var i={4567:function(f,c,d){var p=this&&this.__decorate||function(y,S,j,A){var N,D=arguments.length,T=D<3?S:A===null?A=Object.getOwnPropertyDescriptor(S,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(y,S,j,A);else for(var B=y.length-1;B>=0;B--)(N=y[B])&&(T=(D<3?N(T):D>3?N(S,j,T):N(S,j))||T);return D>3&&T&&Object.defineProperty(S,j,T),T},g=this&&this.__param||function(y,S){return function(j,A){S(j,A,y)}};Object.defineProperty(c,"__esModule",{value:!0}),c.AccessibilityManager=void 0;const m=d(9042),x=d(9924),_=d(844),k=d(4725),C=d(2585),b=d(3656);let v=c.AccessibilityManager=class extends _.Disposable{constructor(y,S,j,A){super(),this._terminal=y,this._coreBrowserService=j,this._renderService=A,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 x.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,b.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(y){for(let S=0;S<y;S++)this._handleChar(" ")}_handleChar(y){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==y&&(this._charsToAnnounce+=y):this._charsToAnnounce+=y,y===`
|
|
59
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=m.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(y){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(y)||this._charsToConsume.push(y)}_refreshRows(y,S){this._liveRegionDebouncer.refresh(y,S,this._terminal.rows)}_renderRows(y,S){const j=this._terminal.buffer,A=j.lines.length.toString();for(let N=y;N<=S;N++){const D=j.lines.get(j.ydisp+N),T=[],B=(D==null?void 0:D.translateToString(!0,void 0,void 0,T))||"",H=(j.ydisp+N+1).toString(),W=this._rowElements[N];W&&(B.length===0?(W.innerText=" ",this._rowColumns.set(W,[0,1])):(W.textContent=B,this._rowColumns.set(W,T)),W.setAttribute("aria-posinset",H),W.setAttribute("aria-setsize",A))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(y,S){const j=y.target,A=this._rowElements[S===0?1:this._rowElements.length-2];if(j.getAttribute("aria-posinset")===(S===0?"1":`${this._terminal.buffer.lines.length}`)||y.relatedTarget!==A)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 T=this._createAccessibilityTreeNode();this._rowElements.unshift(T),this._rowContainer.insertAdjacentElement("afterbegin",T)}else{const T=this._createAccessibilityTreeNode();this._rowElements.push(T),this._rowContainer.appendChild(T)}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(),y.preventDefault(),y.stopImmediatePropagation()}_handleSelectionChange(){var B;if(this._rowElements.length===0)return;const y=document.getSelection();if(!y)return;if(y.isCollapsed)return void(this._rowContainer.contains(y.anchorNode)&&this._terminal.clearSelection());if(!y.anchorNode||!y.focusNode)return void console.error("anchorNode and/or focusNode are null");let S={node:y.anchorNode,offset:y.anchorOffset},j={node:y.focusNode,offset:y.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 A=this._rowElements.slice(-1)[0];if(j.node.compareDocumentPosition(A)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(j={node:A,offset:((B=A.textContent)==null?void 0:B.length)??0}),!this._rowContainer.contains(j.node))return;const N=({node:H,offset:W})=>{const K=H instanceof Text?H.parentNode:H;let q=parseInt(K==null?void 0:K.getAttribute("aria-posinset"),10)-1;if(isNaN(q))return console.warn("row is invalid. Race condition?"),null;const R=this._rowColumns.get(K);if(!R)return console.warn("columns is null. Race condition?"),null;let U=W<R.length?R[W]:R.slice(-1)[0]+1;return U>=this._terminal.cols&&(++q,U=0),{row:q,column:U}},D=N(S),T=N(j);if(D&&T){if(D.row>T.row||D.row===T.row&&D.column>=T.column)throw new Error("invalid range");this._terminal.select(D.column,D.row,(T.row-D.row)*this._terminal.cols-D.column+T.column)}}_handleResize(y){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>y;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const y=this._coreBrowserService.mainDocument.createElement("div");return y.setAttribute("role","listitem"),y.tabIndex=-1,this._refreshRowDimensions(y),y}_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 y=0;y<this._terminal.rows;y++)this._refreshRowDimensions(this._rowElements[y])}}_refreshRowDimensions(y){y.style.height=`${this._renderService.dimensions.css.cell.height}px`}};c.AccessibilityManager=v=p([g(1,C.IInstantiationService),g(2,k.ICoreBrowserService),g(3,k.IRenderService)],v)},3614:(f,c)=>{function d(x){return x.replace(/\r?\n/g,"\r")}function p(x,_){return _?"\x1B[200~"+x+"\x1B[201~":x}function g(x,_,k,C){x=p(x=d(x),k.decPrivateModes.bracketedPasteMode&&C.rawOptions.ignoreBracketedPasteMode!==!0),k.triggerDataEvent(x,!0),_.value=""}function m(x,_,k){const C=k.getBoundingClientRect(),b=x.clientX-C.left-10,v=x.clientY-C.top-10;_.style.width="20px",_.style.height="20px",_.style.left=`${b}px`,_.style.top=`${v}px`,_.style.zIndex="1000",_.focus()}Object.defineProperty(c,"__esModule",{value:!0}),c.rightClickHandler=c.moveTextAreaUnderMouseCursor=c.paste=c.handlePasteEvent=c.copyHandler=c.bracketTextForPaste=c.prepareTextForTerminal=void 0,c.prepareTextForTerminal=d,c.bracketTextForPaste=p,c.copyHandler=function(x,_){x.clipboardData&&x.clipboardData.setData("text/plain",_.selectionText),x.preventDefault()},c.handlePasteEvent=function(x,_,k,C){x.stopPropagation(),x.clipboardData&&g(x.clipboardData.getData("text/plain"),_,k,C)},c.paste=g,c.moveTextAreaUnderMouseCursor=m,c.rightClickHandler=function(x,_,k,C,b){m(x,_,k),b&&C.rightClickSelect(x),_.value=C.selectionText,_.select()}},7239:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ColorContrastCache=void 0;const p=d(1505);c.ColorContrastCache=class{constructor(){this._color=new p.TwoKeyMap,this._css=new p.TwoKeyMap}setCss(g,m,x){this._css.set(g,m,x)}getCss(g,m){return this._css.get(g,m)}setColor(g,m,x){this._color.set(g,m,x)}getColor(g,m){return this._color.get(g,m)}clear(){this._color.clear(),this._css.clear()}}},3656:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.addDisposableDomListener=void 0,c.addDisposableDomListener=function(d,p,g,m){d.addEventListener(p,g,m);let x=!1;return{dispose:()=>{x||(x=!0,d.removeEventListener(p,g,m))}}}},3551:function(f,c,d){var p=this&&this.__decorate||function(v,y,S,j){var A,N=arguments.length,D=N<3?y:j===null?j=Object.getOwnPropertyDescriptor(y,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(v,y,S,j);else for(var T=v.length-1;T>=0;T--)(A=v[T])&&(D=(N<3?A(D):N>3?A(y,S,D):A(y,S))||D);return N>3&&D&&Object.defineProperty(y,S,D),D},g=this&&this.__param||function(v,y){return function(S,j){y(S,j,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Linkifier=void 0;const m=d(3656),x=d(8460),_=d(844),k=d(2585),C=d(4725);let b=c.Linkifier=class extends _.Disposable{get currentLink(){return this._currentLink}constructor(v,y,S,j,A){super(),this._element=v,this._mouseService=y,this._renderService=S,this._bufferService=j,this._linkProviderService=A,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new x.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new x.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,_.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,_.toDisposable)((()=>{var N;this._lastMouseEvent=void 0,(N=this._activeProviderReplies)==null||N.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,m.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,m.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(v){this._lastMouseEvent=v;const y=this._positionFromMouseEvent(v,this._element,this._mouseService);if(!y)return;this._isMouseOut=!1;const S=v.composedPath();for(let j=0;j<S.length;j++){const A=S[j];if(A.classList.contains("xterm"))break;if(A.classList.contains("xterm-hover"))return}this._lastBufferCell&&y.x===this._lastBufferCell.x&&y.y===this._lastBufferCell.y||(this._handleHover(y),this._lastBufferCell=y)}_handleHover(v){if(this._activeLine!==v.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(v,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,v)||(this._clearCurrentLink(),this._askForLink(v,!0))}_askForLink(v,y){var j,A;this._activeProviderReplies&&y||((j=this._activeProviderReplies)==null||j.forEach((N=>{N==null||N.forEach((D=>{D.link.dispose&&D.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=v.y);let S=!1;for(const[N,D]of this._linkProviderService.linkProviders.entries())y?(A=this._activeProviderReplies)!=null&&A.get(N)&&(S=this._checkLinkProviderResult(N,v,S)):D.provideLinks(v.y,(T=>{var H,W;if(this._isMouseOut)return;const B=T==null?void 0:T.map((K=>({link:K})));(H=this._activeProviderReplies)==null||H.set(N,B),S=this._checkLinkProviderResult(N,v,S),((W=this._activeProviderReplies)==null?void 0:W.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(v.y,this._activeProviderReplies)}))}_removeIntersectingLinks(v,y){const S=new Set;for(let j=0;j<y.size;j++){const A=y.get(j);if(A)for(let N=0;N<A.length;N++){const D=A[N],T=D.link.range.start.y<v?0:D.link.range.start.x,B=D.link.range.end.y>v?this._bufferService.cols:D.link.range.end.x;for(let H=T;H<=B;H++){if(S.has(H)){A.splice(N--,1);break}S.add(H)}}}}_checkLinkProviderResult(v,y,S){var N;if(!this._activeProviderReplies)return S;const j=this._activeProviderReplies.get(v);let A=!1;for(let D=0;D<v;D++)this._activeProviderReplies.has(D)&&!this._activeProviderReplies.get(D)||(A=!0);if(!A&&j){const D=j.find((T=>this._linkAtPosition(T.link,y)));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 T=(N=this._activeProviderReplies.get(D))==null?void 0:N.find((B=>this._linkAtPosition(B.link,y)));if(T){S=!0,this._handleNewLink(T);break}}return S}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(v){if(!this._currentLink)return;const y=this._positionFromMouseEvent(v,this._element,this._mouseService);y&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,y)&&this._currentLink.link.activate(v,this._currentLink.link.text)}_clearCurrentLink(v,y){this._currentLink&&this._lastMouseEvent&&(!v||!y||this._currentLink.link.range.start.y>=v&&this._currentLink.link.range.end.y<=y)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,_.disposeArray)(this._linkCacheDisposables))}_handleNewLink(v){if(!this._lastMouseEvent)return;const y=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);y&&this._linkAtPosition(v.link,y)&&(this._currentLink=v,this._currentLink.state={decorations:{underline:v.link.decorations===void 0||v.link.decorations.underline,pointerCursor:v.link.decorations===void 0||v.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,v.link,this._lastMouseEvent),v.link.decorations={},Object.defineProperties(v.link.decorations,{pointerCursor:{get:()=>{var S,j;return(j=(S=this._currentLink)==null?void 0:S.state)==null?void 0:j.decorations.pointerCursor},set:S=>{var j;(j=this._currentLink)!=null&&j.state&&this._currentLink.state.decorations.pointerCursor!==S&&(this._currentLink.state.decorations.pointerCursor=S,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",S))}},underline:{get:()=>{var S,j;return(j=(S=this._currentLink)==null?void 0:S.state)==null?void 0:j.decorations.underline},set:S=>{var j,A,N;(j=this._currentLink)!=null&&j.state&&((N=(A=this._currentLink)==null?void 0:A.state)==null?void 0:N.decorations.underline)!==S&&(this._currentLink.state.decorations.underline=S,this._currentLink.state.isHovered&&this._fireUnderlineEvent(v.link,S))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((S=>{if(!this._currentLink)return;const j=S.start===0?0:S.start+1+this._bufferService.buffer.ydisp,A=this._bufferService.buffer.ydisp+1+S.end;if(this._currentLink.link.range.start.y>=j&&this._currentLink.link.range.end.y<=A&&(this._clearCurrentLink(j,A),this._lastMouseEvent)){const N=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);N&&this._askForLink(N,!1)}}))))}_linkHover(v,y,S){var j;(j=this._currentLink)!=null&&j.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(y,!0),this._currentLink.state.decorations.pointerCursor&&v.classList.add("xterm-cursor-pointer")),y.hover&&y.hover(S,y.text)}_fireUnderlineEvent(v,y){const S=v.range,j=this._bufferService.buffer.ydisp,A=this._createLinkUnderlineEvent(S.start.x-1,S.start.y-j-1,S.end.x,S.end.y-j-1,void 0);(y?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(A)}_linkLeave(v,y,S){var j;(j=this._currentLink)!=null&&j.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(y,!1),this._currentLink.state.decorations.pointerCursor&&v.classList.remove("xterm-cursor-pointer")),y.leave&&y.leave(S,y.text)}_linkAtPosition(v,y){const S=v.range.start.y*this._bufferService.cols+v.range.start.x,j=v.range.end.y*this._bufferService.cols+v.range.end.x,A=y.y*this._bufferService.cols+y.x;return S<=A&&A<=j}_positionFromMouseEvent(v,y,S){const j=S.getCoords(v,y,this._bufferService.cols,this._bufferService.rows);if(j)return{x:j[0],y:j[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(v,y,S,j,A){return{x1:v,y1:y,x2:S,y2:j,cols:this._bufferService.cols,fg:A}}};c.Linkifier=b=p([g(1,C.IMouseService),g(2,C.IRenderService),g(3,k.IBufferService),g(4,C.ILinkProviderService)],b)},9042:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.tooMuchOutput=c.promptLabel=void 0,c.promptLabel="Terminal input",c.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(f,c,d){var p=this&&this.__decorate||function(C,b,v,y){var S,j=arguments.length,A=j<3?b:y===null?y=Object.getOwnPropertyDescriptor(b,v):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,b,v,y);else for(var N=C.length-1;N>=0;N--)(S=C[N])&&(A=(j<3?S(A):j>3?S(b,v,A):S(b,v))||A);return j>3&&A&&Object.defineProperty(b,v,A),A},g=this&&this.__param||function(C,b){return function(v,y){b(v,y,C)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkProvider=void 0;const m=d(511),x=d(2585);let _=c.OscLinkProvider=class{constructor(C,b,v){this._bufferService=C,this._optionsService=b,this._oscLinkService=v}provideLinks(C,b){var B;const v=this._bufferService.buffer.lines.get(C-1);if(!v)return void b(void 0);const y=[],S=this._optionsService.rawOptions.linkHandler,j=new m.CellData,A=v.getTrimmedLength();let N=-1,D=-1,T=!1;for(let H=0;H<A;H++)if(D!==-1||v.hasContent(H)){if(v.loadCell(H,j),j.hasExtendedAttrs()&&j.extended.urlId){if(D===-1){D=H,N=j.extended.urlId;continue}T=j.extended.urlId!==N}else D!==-1&&(T=!0);if(T||D!==-1&&H===A-1){const W=(B=this._oscLinkService.getLinkData(N))==null?void 0:B.uri;if(W){const K={start:{x:D+1,y:C},end:{x:H+(T||H!==A-1?0:1),y:C}};let q=!1;if(!(S!=null&&S.allowNonHttpProtocols))try{const R=new URL(W);["http:","https:"].includes(R.protocol)||(q=!0)}catch{q=!0}q||y.push({text:W,range:K,activate:(R,U)=>S?S.activate(R,U,K):k(0,U),hover:(R,U)=>{var M;return(M=S==null?void 0:S.hover)==null?void 0:M.call(S,R,U,K)},leave:(R,U)=>{var M;return(M=S==null?void 0:S.leave)==null?void 0:M.call(S,R,U,K)}})}T=!1,j.hasExtendedAttrs()&&j.extended.urlId?(D=H,N=j.extended.urlId):(D=-1,N=-1)}}b(y)}};function k(C,b){if(confirm(`Do you want to navigate to ${b}?
|
|
60
|
+
|
|
61
|
+
WARNING: This link could potentially be dangerous`)){const v=window.open();if(v){try{v.opener=null}catch{}v.location.href=b}else console.warn("Opening link blocked as opener could not be cleared")}}c.OscLinkProvider=_=p([g(0,x.IBufferService),g(1,x.IOptionsService),g(2,x.IOscLinkService)],_)},6193:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.RenderDebouncer=void 0,c.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,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Terminal=void 0;const p=d(3614),g=d(3656),m=d(3551),x=d(9042),_=d(3730),k=d(1680),C=d(3107),b=d(5744),v=d(2950),y=d(1296),S=d(428),j=d(4269),A=d(5114),N=d(8934),D=d(3230),T=d(9312),B=d(4725),H=d(6731),W=d(8055),K=d(8969),q=d(8460),R=d(844),U=d(6114),M=d(8437),Y=d(2584),Z=d(7399),z=d(5941),L=d(9074),I=d(2585),V=d(5435),F=d(4567),ie=d(779);class Q extends K.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(X={}){super(X),this.browser=U,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new R.MutableDisposable),this._onCursorMove=this.register(new q.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new q.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new q.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new q.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new q.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new q.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new q.EventEmitter),this._onBlur=this.register(new q.EventEmitter),this._onA11yCharEmitter=this.register(new q.EventEmitter),this._onA11yTabEmitter=this.register(new q.EventEmitter),this._onWillOpen=this.register(new q.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(L.DecorationService),this._instantiationService.setService(I.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ie.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((($,oe)=>this.refresh($,oe)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport(($=>this._reportWindowsOptions($)))),this.register(this._inputHandler.onColor(($=>this._handleColorEvent($)))),this.register((0,q.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,q.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,q.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,q.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(($=>this._afterResize($.cols,$.rows)))),this.register((0,R.toDisposable)((()=>{var $,oe;this._customKeyEventHandler=void 0,(oe=($=this.element)==null?void 0:$.parentNode)==null||oe.removeChild(this.element)})))}_handleColorEvent(X){if(this._themeService)for(const $ of X){let oe,re="";switch($.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;"+$.index}switch($.type){case 0:const ve=W.color.toColorRGB(oe==="ansi"?this._themeService.colors.ansi[$.index]:this._themeService.colors[oe]);this.coreService.triggerDataEvent(`${Y.C0.ESC}]${re};${(0,z.toRgbString)(ve)}${Y.C1_ESCAPED.ST}`);break;case 1:if(oe==="ansi")this._themeService.modifyColors((be=>be.ansi[$.index]=W.channels.toColor(...$.color)));else{const be=oe;this._themeService.modifyColors((Le=>Le[be]=W.channels.toColor(...$.color)))}break;case 2:this._themeService.restoreColor($.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(X){X?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(F.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(X){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Y.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var X;return(X=this.textarea)==null?void 0:X.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Y.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 X=this.buffer.ybase+this.buffer.y,$=this.buffer.lines.get(X);if(!$)return;const oe=Math.min(this.buffer.x,this.cols-1),re=this._renderService.dimensions.css.cell.height,ve=$.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",($=>{this.hasSelection()&&(0,p.copyHandler)($,this._selectionService)})));const X=$=>(0,p.handlePasteEvent)($,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",X)),this.register((0,g.addDisposableDomListener)(this.element,"paste",X)),U.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",($=>{$.button===2&&(0,p.rightClickHandler)($,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",($=>{(0,p.rightClickHandler)($,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),U.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",($=>{$.button===1&&(0,p.moveTextAreaUnderMouseCursor)($,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,g.addDisposableDomListener)(this.textarea,"keyup",(X=>this._keyUp(X)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keydown",(X=>this._keyDown(X)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keypress",(X=>this._keyPress(X)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionupdate",(X=>this._compositionHelper.compositionupdate(X)))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,g.addDisposableDomListener)(this.textarea,"input",(X=>this._inputEvent(X)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(X){var oe;if(!X)throw new Error("Terminal requires a parent element.");if(X.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=X.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"),X.appendChild(this.element);const $=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),$.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),$.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",x.promptLabel),U.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(A.CoreBrowserService,this.textarea,X.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(H.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(v.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($);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(T.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(F.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(re=>this._handleScreenReaderModeOptionChange(re)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(b.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(re=>{!this._overviewRulerRenderer&&re&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(b.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(y.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const X=this,$=this.element;function oe(be){const Le=X._mouseService.getMouseReportCoords(be,X.screenElement);if(!Le)return!1;let Oe,He;switch(be.overrideType||be.type){case"mousemove":He=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":He=0,Oe=be.button<3?be.button:3;break;case"mousedown":He=1,Oe=be.button<3?be.button:3;break;case"wheel":if(X._customWheelEventHandler&&X._customWheelEventHandler(be)===!1||X.viewport.getLinesScrolled(be)===0)return!1;He=be.deltaY<0?0:1,Oe=4;break;default:return!1}return!(He===void 0||Oe===void 0||Oe>4)&&X.coreMouseService.triggerMouseEvent({col:Le.col,row:Le.row,x:Le.x,y:Le.y,button:Oe,action:He,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||($.addEventListener("mousemove",ve.mousemove),re.mousemove=ve.mousemove):($.removeEventListener("mousemove",re.mousemove),re.mousemove=null),16&be?re.wheel||($.addEventListener("wheel",ve.wheel,{passive:!1}),re.wheel=ve.wheel):($.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)($,"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)($,"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=Y.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(be.deltaY<0?"A":"B");let He="";for(let Ue=0;Ue<Math.abs(Le);Ue++)He+=Oe;return this.coreService.triggerDataEvent(He,!0),this.cancel(be,!0)}return this.viewport.handleWheel(be)?this.cancel(be):void 0}}),{passive:!1})),this.register((0,g.addDisposableDomListener)($,"touchstart",(be=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(be),this.cancel(be)}),{passive:!0})),this.register((0,g.addDisposableDomListener)($,"touchmove",(be=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(be)?void 0:this.cancel(be)}),{passive:!1}))}refresh(X,$){var oe;(oe=this._renderService)==null||oe.refreshRows(X,$)}updateCursorStyle(X){var $;($=this._selectionService)!=null&&$.shouldColumnSelect(X)?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(X,$,oe=0){var re;oe===1?(super.scrollLines(X,$,oe),this.refresh(0,this.rows-1)):(re=this.viewport)==null||re.scrollLines(X)}paste(X){(0,p.paste)(X,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(X){this._customKeyEventHandler=X}attachCustomWheelEventHandler(X){this._customWheelEventHandler=X}registerLinkProvider(X){return this._linkProviderService.registerLinkProvider(X)}registerCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const $=this._characterJoinerService.register(X);return this.refresh(0,this.rows-1),$}deregisterCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(X)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(X){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+X)}registerDecoration(X){return this._decorationService.registerDecoration(X)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(X,$,oe){this._selectionService.setSelection(X,$,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 X;(X=this._selectionService)==null||X.clearSelection()}selectAll(){var X;(X=this._selectionService)==null||X.selectAll()}selectLines(X,$){var oe;(oe=this._selectionService)==null||oe.selectLines(X,$)}_keyDown(X){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;const $=this.browser.isMac&&this.options.macOptionIsMeta&&X.altKey;if(!$&&!this._compositionHelper.keydown(X))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;$||X.key!=="Dead"&&X.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const oe=(0,Z.evaluateKeyboardEvent)(X,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(X),oe.type===3||oe.type===2){const re=this.rows-1;return this.scrollLines(oe.type===2?-re:re),this.cancel(X,!0)}return oe.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,X)||(oe.cancel&&this.cancel(X,!0),!oe.key||!!(X.key&&!X.ctrlKey&&!X.altKey&&!X.metaKey&&X.key.length===1&&X.key.charCodeAt(0)>=65&&X.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(oe.key!==Y.C0.ETX&&oe.key!==Y.C0.CR||(this.textarea.value=""),this._onKey.fire({key:oe.key,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(oe.key,!0),!this.optionsService.rawOptions.screenReaderMode||X.altKey||X.ctrlKey?this.cancel(X,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(X,$){const oe=X.isMac&&!this.options.macOptionIsMeta&&$.altKey&&!$.ctrlKey&&!$.metaKey||X.isWindows&&$.altKey&&$.ctrlKey&&!$.metaKey||X.isWindows&&$.getModifierState("AltGraph");return $.type==="keypress"?oe:oe&&(!$.keyCode||$.keyCode>47)}_keyUp(X){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1||((function($){return $.keyCode===16||$.keyCode===17||$.keyCode===18})(X)||this.focus(),this.updateCursorStyle(X),this._keyPressHandled=!1)}_keyPress(X){let $;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;if(this.cancel(X),X.charCode)$=X.charCode;else if(X.which===null||X.which===void 0)$=X.keyCode;else{if(X.which===0||X.charCode===0)return!1;$=X.which}return!(!$||(X.altKey||X.ctrlKey||X.metaKey)&&!this._isThirdLevelShift(this.browser,X)||($=String.fromCharCode($),this._onKey.fire({key:$,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent($,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(X){if(X.data&&X.inputType==="insertText"&&(!X.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const $=X.data;return this.coreService.triggerDataEvent($,!0),this.cancel(X),!0}return!1}resize(X,$){X!==this.cols||$!==this.rows?super.resize(X,$):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(X,$){var oe,re;(oe=this._charSizeService)==null||oe.measure(),(re=this.viewport)==null||re.syncScrollArea(!0)}clear(){var X;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 $=1;$<this.rows;$++)this.buffer.lines.push(this.buffer.getBlankLine(M.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(X=this.viewport)==null||X.reset(),this.refresh(0,this.rows-1)}}reset(){var $,oe;this.options.rows=this.rows,this.options.cols=this.cols;const X=this._customKeyEventHandler;this._setup(),super.reset(),($=this._selectionService)==null||$.reset(),this._decorationService.reset(),(oe=this.viewport)==null||oe.reset(),this._customKeyEventHandler=X,this.refresh(0,this.rows-1)}clearTextureAtlas(){var X;(X=this._renderService)==null||X.clearTextureAtlas()}_reportFocus(){var X;(X=this.element)!=null&&X.classList.contains("focus")?this.coreService.triggerDataEvent(Y.C0.ESC+"[I"):this.coreService.triggerDataEvent(Y.C0.ESC+"[O")}_reportWindowsOptions(X){if(this._renderService)switch(X){case V.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const $=this._renderService.dimensions.css.canvas.width.toFixed(0),oe=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Y.C0.ESC}[4;${oe};${$}t`);break;case V.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(`${Y.C0.ESC}[6;${ve};${re}t`)}}cancel(X,$){if(this.options.cancelEvents||$)return X.preventDefault(),X.stopPropagation(),!1}}c.Terminal=Q},9924:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TimeBasedDebouncer=void 0,c.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 x=m-this._lastRefreshMs,_=this._debounceThresholdMS-x;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,c,d){var p=this&&this.__decorate||function(v,y,S,j){var A,N=arguments.length,D=N<3?y:j===null?j=Object.getOwnPropertyDescriptor(y,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(v,y,S,j);else for(var T=v.length-1;T>=0;T--)(A=v[T])&&(D=(N<3?A(D):N>3?A(y,S,D):A(y,S))||D);return N>3&&D&&Object.defineProperty(y,S,D),D},g=this&&this.__param||function(v,y){return function(S,j){y(S,j,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Viewport=void 0;const m=d(3656),x=d(4725),_=d(8460),k=d(844),C=d(2585);let b=c.Viewport=class extends k.Disposable{constructor(v,y,S,j,A,N,D,T){super(),this._viewportElement=v,this._scrollArea=y,this._bufferService=S,this._optionsService=j,this._charSizeService=A,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(T.colors),this.register(T.onChangeColors((B=>this._handleThemeChange(B)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(v){this._viewportElement.style.backgroundColor=v.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(v){if(v)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const y=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==y&&(this._lastRecordedBufferHeight=y,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const v=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==v&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=v),this._refreshAnimationFrame=null}syncScrollArea(v=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(v);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(v)}_handleScroll(v){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const y=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:y,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const v=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(v*(this._smoothScrollState.target-this._smoothScrollState.origin)),v<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(v,y){const S=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(y<0&&this._viewportElement.scrollTop!==0||y>0&&S<this._lastRecordedBufferHeight)||(v.cancelable&&v.preventDefault(),!1)}handleWheel(v){const y=this._getPixelsScrolled(v);return y!==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+y:this._smoothScrollState.target+=y,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=y,this._bubbleScroll(v,y))}scrollLines(v){if(v!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const y=v*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+y,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:v,suppressScrollEvent:!1})}_getPixelsScrolled(v){if(v.deltaY===0||v.shiftKey)return 0;let y=this._applyScrollModifier(v.deltaY,v);return v.deltaMode===WheelEvent.DOM_DELTA_LINE?y*=this._currentRowHeight:v.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(y*=this._currentRowHeight*this._bufferService.rows),y}getBufferElements(v,y){var T;let S,j="";const A=[],N=y??this._bufferService.buffer.lines.length,D=this._bufferService.buffer.lines;for(let B=v;B<N;B++){const H=D.get(B);if(!H)continue;const W=(T=D.get(B+1))==null?void 0:T.isWrapped;if(j+=H.translateToString(!W),!W||B===D.length-1){const K=document.createElement("div");K.textContent=j,A.push(K),j.length>0&&(S=K),j=""}}return{bufferElements:A,cursorElement:S}}getLinesScrolled(v){if(v.deltaY===0||v.shiftKey)return 0;let y=this._applyScrollModifier(v.deltaY,v);return v.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(y/=this._currentRowHeight+0,this._wheelPartialScroll+=y,y=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):v.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(y*=this._bufferService.rows),y}_applyScrollModifier(v,y){const S=this._optionsService.rawOptions.fastScrollModifier;return S==="alt"&&y.altKey||S==="ctrl"&&y.ctrlKey||S==="shift"&&y.shiftKey?v*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:v*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(v){this._lastTouchY=v.touches[0].pageY}handleTouchMove(v){const y=this._lastTouchY-v.touches[0].pageY;return this._lastTouchY=v.touches[0].pageY,y!==0&&(this._viewportElement.scrollTop+=y,this._bubbleScroll(v,y))}};c.Viewport=b=p([g(2,C.IBufferService),g(3,C.IOptionsService),g(4,x.ICharSizeService),g(5,x.IRenderService),g(6,x.ICoreBrowserService),g(7,x.IThemeService)],b)},3107:function(f,c,d){var p=this&&this.__decorate||function(C,b,v,y){var S,j=arguments.length,A=j<3?b:y===null?y=Object.getOwnPropertyDescriptor(b,v):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,b,v,y);else for(var N=C.length-1;N>=0;N--)(S=C[N])&&(A=(j<3?S(A):j>3?S(b,v,A):S(b,v))||A);return j>3&&A&&Object.defineProperty(b,v,A),A},g=this&&this.__param||function(C,b){return function(v,y){b(v,y,C)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferDecorationRenderer=void 0;const m=d(4725),x=d(844),_=d(2585);let k=c.BufferDecorationRenderer=class extends x.Disposable{constructor(C,b,v,y,S){super(),this._screenElement=C,this._bufferService=b,this._coreBrowserService=v,this._decorationService=y,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,x.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const C of this._decorationService.decorations)this._renderDecoration(C);this._dimensionsChanged=!1}_renderDecoration(C){this._refreshStyle(C),this._dimensionsChanged&&this._refreshXPosition(C)}_createElement(C){var y;const b=this._coreBrowserService.mainDocument.createElement("div");b.classList.add("xterm-decoration"),b.classList.toggle("xterm-decoration-top-layer",((y=C==null?void 0:C.options)==null?void 0:y.layer)==="top"),b.style.width=`${Math.round((C.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,b.style.height=(C.options.height||1)*this._renderService.dimensions.css.cell.height+"px",b.style.top=(C.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",b.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const v=C.options.x??0;return v&&v>this._bufferService.cols&&(b.style.display="none"),this._refreshXPosition(C,b),b}_refreshStyle(C){const b=C.marker.line-this._bufferService.buffers.active.ydisp;if(b<0||b>=this._bufferService.rows)C.element&&(C.element.style.display="none",C.onRenderEmitter.fire(C.element));else{let v=this._decorationElements.get(C);v||(v=this._createElement(C),C.element=v,this._decorationElements.set(C,v),this._container.appendChild(v),C.onDispose((()=>{this._decorationElements.delete(C),v.remove()}))),v.style.top=b*this._renderService.dimensions.css.cell.height+"px",v.style.display=this._altBufferIsActive?"none":"block",C.onRenderEmitter.fire(v)}}_refreshXPosition(C,b=C.element){if(!b)return;const v=C.options.x??0;(C.options.anchor||"left")==="right"?b.style.right=v?v*this._renderService.dimensions.css.cell.width+"px":"":b.style.left=v?v*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(C){var b;(b=this._decorationElements.get(C))==null||b.remove(),this._decorationElements.delete(C),C.dispose()}};c.BufferDecorationRenderer=k=p([g(1,_.IBufferService),g(2,m.ICoreBrowserService),g(3,_.IDecorationService),g(4,m.IRenderService)],k)},5871:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ColorZoneStore=void 0,c.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,c,d){var p=this&&this.__decorate||function(S,j,A,N){var D,T=arguments.length,B=T<3?j:N===null?N=Object.getOwnPropertyDescriptor(j,A):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(S,j,A,N);else for(var H=S.length-1;H>=0;H--)(D=S[H])&&(B=(T<3?D(B):T>3?D(j,A,B):D(j,A))||B);return T>3&&B&&Object.defineProperty(j,A,B),B},g=this&&this.__param||function(S,j){return function(A,N){j(A,N,S)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OverviewRulerRenderer=void 0;const m=d(5871),x=d(4725),_=d(844),k=d(2585),C={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0},v={full:0,left:0,center:0,right:0};let y=c.OverviewRulerRenderer=class extends _.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(S,j,A,N,D,T,B){var W;super(),this._viewportElement=S,this._screenElement=j,this._bufferService=A,this._decorationService=N,this._renderService=D,this._optionsService=T,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(),(W=this._viewportElement.parentElement)==null||W.insertBefore(this._canvas,this._viewportElement);const H=this._canvas.getContext("2d");if(!H)throw new Error("Ctx cannot be null");this._ctx=H,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,_.toDisposable)((()=>{var K;(K=this._canvas)==null||K.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);b.full=this._canvas.width,b.left=S,b.center=j,b.right=S,this._refreshDrawHeightConstants(),v.full=0,v.left=0,v.center=b.left,v.right=b.left+b.center}_refreshDrawHeightConstants(){C.full=Math.round(2*this._coreBrowserService.dpr);const S=this._canvas.height/this._bufferService.buffer.lines.length,j=Math.round(Math.max(Math.min(S,12),6)*this._coreBrowserService.dpr);C.left=j,C.center=j,C.right=j}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const j of this._decorationService.decorations)this._colorZoneStore.addDecoration(j);this._ctx.lineWidth=1;const S=this._colorZoneStore.zones;for(const j of S)j.position!=="full"&&this._renderColorZone(j);for(const j of S)j.position==="full"&&this._renderColorZone(j);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(S){this._ctx.fillStyle=S.color,this._ctx.fillRect(v[S.position||"full"],Math.round((this._canvas.height-1)*(S.startBufferLine/this._bufferService.buffers.active.lines.length)-C[S.position||"full"]/2),b[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})))}};c.OverviewRulerRenderer=y=p([g(2,k.IBufferService),g(3,k.IDecorationService),g(4,x.IRenderService),g(5,k.IOptionsService),g(6,x.ICoreBrowserService)],y)},2950:function(f,c,d){var p=this&&this.__decorate||function(C,b,v,y){var S,j=arguments.length,A=j<3?b:y===null?y=Object.getOwnPropertyDescriptor(b,v):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,b,v,y);else for(var N=C.length-1;N>=0;N--)(S=C[N])&&(A=(j<3?S(A):j>3?S(b,v,A):S(b,v))||A);return j>3&&A&&Object.defineProperty(b,v,A),A},g=this&&this.__param||function(C,b){return function(v,y){b(v,y,C)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CompositionHelper=void 0;const m=d(4725),x=d(2585),_=d(2584);let k=c.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(C,b,v,y,S,j){this._textarea=C,this._compositionView=b,this._bufferService=v,this._optionsService=y,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 b={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let v;this._isSendingComposition=!1,b.start+=this._dataAlreadySent.length,v=this._isComposing?this._textarea.value.substring(b.start,b.end):this._textarea.value.substring(b.start),v.length>0&&this._coreService.triggerDataEvent(v,!0)}}),0)}else{this._isSendingComposition=!1;const b=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(b,!0)}}_handleAnyTextareaChanges(){const C=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const b=this._textarea.value,v=b.replace(C,"");this._dataAlreadySent=v,b.length>C.length?this._coreService.triggerDataEvent(v,!0):b.length<C.length?this._coreService.triggerDataEvent(`${_.C0.DEL}`,!0):b.length===C.length&&b!==C&&this._coreService.triggerDataEvent(b,!0)}}),0)}updateCompositionElements(C){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const b=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),v=this._renderService.dimensions.css.cell.height,y=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,S=b*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=S+"px",this._compositionView.style.top=y+"px",this._compositionView.style.height=v+"px",this._compositionView.style.lineHeight=v+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const j=this._compositionView.getBoundingClientRect();this._textarea.style.left=S+"px",this._textarea.style.top=y+"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)}}};c.CompositionHelper=k=p([g(2,x.IBufferService),g(3,x.IOptionsService),g(4,x.ICoreService),g(5,m.IRenderService)],k)},9806:(f,c)=>{function d(p,g,m){const x=m.getBoundingClientRect(),_=p.getComputedStyle(m),k=parseInt(_.getPropertyValue("padding-left")),C=parseInt(_.getPropertyValue("padding-top"));return[g.clientX-x.left-k,g.clientY-x.top-C]}Object.defineProperty(c,"__esModule",{value:!0}),c.getCoords=c.getCoordsRelativeToElement=void 0,c.getCoordsRelativeToElement=d,c.getCoords=function(p,g,m,x,_,k,C,b,v){if(!k)return;const y=d(p,g,m);return y?(y[0]=Math.ceil((y[0]+(v?C/2:0))/C),y[1]=Math.ceil(y[1]/b),y[0]=Math.min(Math.max(y[0],1),x+(v?1:0)),y[1]=Math.min(Math.max(y[1],1),_),y):void 0}},9504:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.moveToCellSequence=void 0;const p=d(2584);function g(b,v,y,S){const j=b-m(b,y),A=v-m(v,y),N=Math.abs(j-A)-(function(D,T,B){let H=0;const W=D-m(D,B),K=T-m(T,B);for(let q=0;q<Math.abs(W-K);q++){const R=x(D,T)==="A"?-1:1,U=B.buffer.lines.get(W+R*q);U!=null&&U.isWrapped&&H++}return H})(b,v,y);return C(N,k(x(b,v),S))}function m(b,v){let y=0,S=v.buffer.lines.get(b),j=S==null?void 0:S.isWrapped;for(;j&&b>=0&&b<v.rows;)y++,S=v.buffer.lines.get(--b),j=S==null?void 0:S.isWrapped;return y}function x(b,v){return b>v?"A":"B"}function _(b,v,y,S,j,A){let N=b,D=v,T="";for(;N!==y||D!==S;)N+=j?1:-1,j&&N>A.cols-1?(T+=A.buffer.translateBufferLineToString(D,!1,b,N),N=0,b=0,D++):!j&&N<0&&(T+=A.buffer.translateBufferLineToString(D,!1,0,b+1),N=A.cols-1,b=N,D--);return T+A.buffer.translateBufferLineToString(D,!1,b,N)}function k(b,v){const y=v?"O":"[";return p.C0.ESC+y+b}function C(b,v){b=Math.floor(b);let y="";for(let S=0;S<b;S++)y+=v;return y}c.moveToCellSequence=function(b,v,y,S){const j=y.buffer.x,A=y.buffer.y;if(!y.buffer.hasScrollback)return(function(T,B,H,W,K,q){return g(B,W,K,q).length===0?"":C(_(T,B,T,B-m(B,K),!1,K).length,k("D",q))})(j,A,0,v,y,S)+g(A,v,y,S)+(function(T,B,H,W,K,q){let R;R=g(B,W,K,q).length>0?W-m(W,K):B;const U=W,M=(function(Y,Z,z,L,I,V){let F;return F=g(z,L,I,V).length>0?L-m(L,I):Z,Y<z&&F<=L||Y>=z&&F<L?"C":"D"})(T,B,H,W,K,q);return C(_(T,R,H,U,M==="C",K).length,k(M,q))})(j,A,b,v,y,S);let N;if(A===v)return N=j>b?"D":"C",C(Math.abs(j-b),k(N,S));N=A>v?"D":"C";const D=Math.abs(A-v);return C((function(T,B){return B.cols-T})(A>v?b:j,y)+(D-1)*y.cols+1+((A>v?j:b)-1),k(N,S))}},1296:function(f,c,d){var p=this&&this.__decorate||function(q,R,U,M){var Y,Z=arguments.length,z=Z<3?R:M===null?M=Object.getOwnPropertyDescriptor(R,U):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(q,R,U,M);else for(var L=q.length-1;L>=0;L--)(Y=q[L])&&(z=(Z<3?Y(z):Z>3?Y(R,U,z):Y(R,U))||z);return Z>3&&z&&Object.defineProperty(R,U,z),z},g=this&&this.__param||function(q,R){return function(U,M){R(U,M,q)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRenderer=void 0;const m=d(3787),x=d(2550),_=d(2223),k=d(6171),C=d(6052),b=d(4725),v=d(8055),y=d(8460),S=d(844),j=d(2585),A="xterm-dom-renderer-owner-",N="xterm-rows",D="xterm-fg-",T="xterm-bg-",B="xterm-focus",H="xterm-selection";let W=1,K=c.DomRenderer=class extends S.Disposable{constructor(q,R,U,M,Y,Z,z,L,I,V,F,ie,Q){super(),this._terminal=q,this._document=R,this._element=U,this._screenElement=M,this._viewportElement=Y,this._helperContainer=Z,this._linkifier2=z,this._charSizeService=I,this._optionsService=V,this._bufferService=F,this._coreBrowserService=ie,this._themeService=Q,this._terminalClass=W++,this._rowElements=[],this._selectionRenderModel=(0,C.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new y.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(H),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=L.createInstance(m.DomRendererRowFactory,document),this._element.classList.add(A+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(A+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new x.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const q=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*q,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*q),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/q),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/q),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 U of this._rowElements)U.style.width=`${this.dimensions.css.canvas.width}px`,U.style.height=`${this.dimensions.css.cell.height}px`,U.style.lineHeight=`${this.dimensions.css.cell.height}px`,U.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const R=`${this._terminalSelector} .${N} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=R,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(q){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let R=`${this._terminalSelector} .${N} { color: ${q.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;R+=`${this._terminalSelector} .${N} .xterm-dim { color: ${v.color.multiplyOpacity(q.foreground,.5).css};}`,R+=`${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 U=`blink_underline_${this._terminalClass}`,M=`blink_bar_${this._terminalClass}`,Y=`blink_block_${this._terminalClass}`;R+=`@keyframes ${U} { 50% { border-bottom-style: hidden; }}`,R+=`@keyframes ${M} { 50% { box-shadow: none; }}`,R+=`@keyframes ${Y} { 0% { background-color: ${q.cursor.css}; color: ${q.cursorAccent.css}; } 50% { background-color: inherit; color: ${q.cursor.css}; }}`,R+=`${this._terminalSelector} .${N}.${B} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${N}.${B} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${M} 1s step-end infinite;}${this._terminalSelector} .${N}.${B} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${Y} 1s step-end infinite;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block { background-color: ${q.cursor.css}; color: ${q.cursorAccent.css};}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${q.cursor.css} !important; color: ${q.cursorAccent.css} !important;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${q.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${q.cursor.css} inset;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${q.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,R+=`${this._terminalSelector} .${H} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${H} div { position: absolute; background-color: ${q.selectionBackgroundOpaque.css};}${this._terminalSelector} .${H} div { position: absolute; background-color: ${q.selectionInactiveBackgroundOpaque.css};}`;for(const[Z,z]of q.ansi.entries())R+=`${this._terminalSelector} .${D}${Z} { color: ${z.css}; }${this._terminalSelector} .${D}${Z}.xterm-dim { color: ${v.color.multiplyOpacity(z,.5).css}; }${this._terminalSelector} .${T}${Z} { background-color: ${z.css}; }`;R+=`${this._terminalSelector} .${D}${_.INVERTED_DEFAULT_COLOR} { color: ${v.color.opaque(q.background).css}; }${this._terminalSelector} .${D}${_.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${v.color.multiplyOpacity(v.color.opaque(q.background),.5).css}; }${this._terminalSelector} .${T}${_.INVERTED_DEFAULT_COLOR} { background-color: ${q.foreground.css}; }`,this._themeStyleElement.textContent=R}_setDefaultSpacing(){const q=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${q}px`,this._rowFactory.defaultSpacing=q}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(q,R){for(let U=this._rowElements.length;U<=R;U++){const M=this._document.createElement("div");this._rowContainer.appendChild(M),this._rowElements.push(M)}for(;this._rowElements.length>R;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(q,R){this._refreshRowElements(q,R),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(q,R,U){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(q,R,U),this.renderRows(0,this._bufferService.rows-1),!q||!R)return;this._selectionRenderModel.update(this._terminal,q,R,U);const M=this._selectionRenderModel.viewportStartRow,Y=this._selectionRenderModel.viewportEndRow,Z=this._selectionRenderModel.viewportCappedStartRow,z=this._selectionRenderModel.viewportCappedEndRow;if(Z>=this._bufferService.rows||z<0)return;const L=this._document.createDocumentFragment();if(U){const I=q[0]>R[0];L.appendChild(this._createSelectionElement(Z,I?R[0]:q[0],I?q[0]:R[0],z-Z+1))}else{const I=M===Z?q[0]:0,V=Z===Y?R[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(Z,I,V));const F=z-Z-1;if(L.appendChild(this._createSelectionElement(Z+1,0,this._bufferService.cols,F)),Z!==z){const ie=Y===z?R[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(z,0,ie))}}this._selectionContainer.appendChild(L)}_createSelectionElement(q,R,U,M=1){const Y=this._document.createElement("div"),Z=R*this.dimensions.css.cell.width;let z=this.dimensions.css.cell.width*(U-R);return Z+z>this.dimensions.css.canvas.width&&(z=this.dimensions.css.canvas.width-Z),Y.style.height=M*this.dimensions.css.cell.height+"px",Y.style.top=q*this.dimensions.css.cell.height+"px",Y.style.left=`${Z}px`,Y.style.width=`${z}px`,Y}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 q of this._rowElements)q.replaceChildren()}renderRows(q,R){const U=this._bufferService.buffer,M=U.ybase+U.y,Y=Math.min(U.x,this._bufferService.cols-1),Z=this._optionsService.rawOptions.cursorBlink,z=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let I=q;I<=R;I++){const V=I+U.ydisp,F=this._rowElements[I],ie=U.lines.get(V);if(!F||!ie)break;F.replaceChildren(...this._rowFactory.createRow(ie,V,V===M,z,L,Y,Z,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${A}${this._terminalClass}`}_handleLinkHover(q){this._setCellUnderline(q.x1,q.x2,q.y1,q.y2,q.cols,!0)}_handleLinkLeave(q){this._setCellUnderline(q.x1,q.x2,q.y1,q.y2,q.cols,!1)}_setCellUnderline(q,R,U,M,Y,Z){U<0&&(q=0),M<0&&(R=0);const z=this._bufferService.rows-1;U=Math.max(Math.min(U,z),0),M=Math.max(Math.min(M,z),0),Y=Math.min(Y,this._bufferService.cols);const L=this._bufferService.buffer,I=L.ybase+L.y,V=Math.min(L.x,Y-1),F=this._optionsService.rawOptions.cursorBlink,ie=this._optionsService.rawOptions.cursorStyle,Q=this._optionsService.rawOptions.cursorInactiveStyle;for(let ee=U;ee<=M;++ee){const X=ee+L.ydisp,$=this._rowElements[ee],oe=L.lines.get(X);if(!$||!oe)break;$.replaceChildren(...this._rowFactory.createRow(oe,X,X===I,ie,Q,V,F,this.dimensions.css.cell.width,this._widthCache,Z?ee===U?q:0:-1,Z?(ee===M?R:Y)-1:-1))}}};c.DomRenderer=K=p([g(7,j.IInstantiationService),g(8,b.ICharSizeService),g(9,j.IOptionsService),g(10,j.IBufferService),g(11,b.ICoreBrowserService),g(12,b.IThemeService)],K)},3787:function(f,c,d){var p=this&&this.__decorate||function(N,D,T,B){var H,W=arguments.length,K=W<3?D:B===null?B=Object.getOwnPropertyDescriptor(D,T):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate(N,D,T,B);else for(var q=N.length-1;q>=0;q--)(H=N[q])&&(K=(W<3?H(K):W>3?H(D,T,K):H(D,T))||K);return W>3&&K&&Object.defineProperty(D,T,K),K},g=this&&this.__param||function(N,D){return function(T,B){D(T,B,N)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRendererRowFactory=void 0;const m=d(2223),x=d(643),_=d(511),k=d(2585),C=d(8055),b=d(4725),v=d(4269),y=d(6171),S=d(3734);let j=c.DomRendererRowFactory=class{constructor(N,D,T,B,H,W,K){this._document=N,this._characterJoinerService=D,this._optionsService=T,this._coreBrowserService=B,this._coreService=H,this._decorationService=W,this._themeService=K,this._workCell=new _.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(N,D,T){this._selectionStart=N,this._selectionEnd=D,this._columnSelectMode=T}createRow(N,D,T,B,H,W,K,q,R,U,M){const Y=[],Z=this._characterJoinerService.getJoinedCharacters(D),z=this._themeService.colors;let L,I=N.getNoBgTrimmedLength();T&&I<W+1&&(I=W+1);let V=0,F="",ie=0,Q=0,ee=0,X=!1,$=0,oe=!1,re=0;const ve=[],be=U!==-1&&M!==-1;for(let Le=0;Le<I;Le++){N.loadCell(Le,this._workCell);let Oe=this._workCell.getWidth();if(Oe===0)continue;let He=!1,Ue=Le,Ne=this._workCell;if(Z.length>0&&Le===Z[0][0]){He=!0;const Ze=Z.shift();Ne=new v.JoinedCellData(this._workCell,N.translateToString(!0,Ze[0],Ze[1]),Ze[1]-Ze[0]),Ue=Ze[1]-1,Oe=Ne.getWidth()}const me=this._isCellInSelection(Le,D),Te=T&&Le===W,$e=be&&Le>=U&&Le<=M;let Rt=!1;this._decorationService.forEachDecorationAtCell(Le,D,void 0,(Ze=>{Rt=!0}));let fe=Ne.getChars()||x.WHITESPACE_CELL_CHAR;if(fe===" "&&(Ne.isUnderline()||Ne.isOverline())&&(fe=" "),re=Oe*q-R.get(fe,Ne.isBold(),Ne.isItalic()),L){if(V&&(me&&oe||!me&&!oe&&Ne.bg===ie)&&(me&&oe&&z.selectionForeground||Ne.fg===Q)&&Ne.extended.ext===ee&&$e===X&&re===$&&!Te&&!He&&!Rt){Ne.isInvisible()?F+=x.WHITESPACE_CELL_CHAR:F+=fe,V++;continue}V&&(L.textContent=F),L=this._document.createElement("span"),V=0,F=""}else L=this._document.createElement("span");if(ie=Ne.bg,Q=Ne.fg,ee=Ne.extended.ext,X=$e,$=re,oe=me,He&&W>=Le&&W<=Ue&&(W=Le),!this._coreService.isCursorHidden&&Te&&this._coreService.isCursorInitialized){if(ve.push("xterm-cursor"),this._coreBrowserService.isFocused)K&&ve.push("xterm-cursor-blink"),ve.push(B==="bar"?"xterm-cursor-bar":B==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(H)switch(H){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(Ne.isBold()&&ve.push("xterm-bold"),Ne.isItalic()&&ve.push("xterm-italic"),Ne.isDim()&&ve.push("xterm-dim"),F=Ne.isInvisible()?x.WHITESPACE_CELL_CHAR:Ne.getChars()||x.WHITESPACE_CELL_CHAR,Ne.isUnderline()&&(ve.push(`xterm-underline-${Ne.extended.underlineStyle}`),F===" "&&(F=" "),!Ne.isUnderlineColorDefault()))if(Ne.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${S.AttributeData.toColorRGB(Ne.getUnderlineColor()).join(",")})`;else{let Ze=Ne.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Ne.isBold()&&Ze<8&&(Ze+=8),L.style.textDecorationColor=z.ansi[Ze].css}Ne.isOverline()&&(ve.push("xterm-overline"),F===" "&&(F=" ")),Ne.isStrikethrough()&&ve.push("xterm-strikethrough"),$e&&(L.style.textDecoration="underline");let Ae=Ne.getFgColor(),Be=Ne.getFgColorMode(),ot=Ne.getBgColor(),ue=Ne.getBgColorMode();const Se=!!Ne.isInverse();if(Se){const Ze=Ae;Ae=ot,ot=Ze;const Ot=Be;Be=ue,ue=Ot}let je,Ie,Ge,Nt=!1;switch(this._decorationService.forEachDecorationAtCell(Le,D,void 0,(Ze=>{Ze.options.layer!=="top"&&Nt||(Ze.backgroundColorRGB&&(ue=50331648,ot=Ze.backgroundColorRGB.rgba>>8&16777215,je=Ze.backgroundColorRGB),Ze.foregroundColorRGB&&(Be=50331648,Ae=Ze.foregroundColorRGB.rgba>>8&16777215,Ie=Ze.foregroundColorRGB),Nt=Ze.options.layer==="top")})),!Nt&&me&&(je=this._coreBrowserService.isFocused?z.selectionBackgroundOpaque:z.selectionInactiveBackgroundOpaque,ot=je.rgba>>8&16777215,ue=50331648,Nt=!0,z.selectionForeground&&(Be=50331648,Ae=z.selectionForeground.rgba>>8&16777215,Ie=z.selectionForeground)),Nt&&ve.push("xterm-decoration-top"),ue){case 16777216:case 33554432:Ge=z.ansi[ot],ve.push(`xterm-bg-${ot}`);break;case 50331648:Ge=C.channels.toColor(ot>>16,ot>>8&255,255&ot),this._addStyle(L,`background-color:#${A((ot>>>0).toString(16),"0",6)}`);break;default:Se?(Ge=z.foreground,ve.push(`xterm-bg-${m.INVERTED_DEFAULT_COLOR}`)):Ge=z.background}switch(je||Ne.isDim()&&(je=C.color.multiplyOpacity(Ge,.5)),Be){case 16777216:case 33554432:Ne.isBold()&&Ae<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Ae+=8),this._applyMinimumContrast(L,Ge,z.ansi[Ae],Ne,je,void 0)||ve.push(`xterm-fg-${Ae}`);break;case 50331648:const Ze=C.channels.toColor(Ae>>16&255,Ae>>8&255,255&Ae);this._applyMinimumContrast(L,Ge,Ze,Ne,je,Ie)||this._addStyle(L,`color:#${A(Ae.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,Ge,z.foreground,Ne,je,Ie)||Se&&ve.push(`xterm-fg-${m.INVERTED_DEFAULT_COLOR}`)}ve.length&&(L.className=ve.join(" "),ve.length=0),Te||He||Rt?L.textContent=F:V++,re!==this.defaultSpacing&&(L.style.letterSpacing=`${re}px`),Y.push(L),Le=Ue}return L&&V&&(L.textContent=F),Y}_applyMinimumContrast(N,D,T,B,H,W){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,y.treatGlyphAsBackgroundColor)(B.getCode()))return!1;const K=this._getContrastCache(B);let q;if(H||W||(q=K.getColor(D.rgba,T.rgba)),q===void 0){const R=this._optionsService.rawOptions.minimumContrastRatio/(B.isDim()?2:1);q=C.color.ensureContrastRatio(H||D,W||T,R),K.setColor((H||D).rgba,(W||T).rgba,q??null)}return!!q&&(this._addStyle(N,`color:${q.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 T=this._selectionStart,B=this._selectionEnd;return!(!T||!B)&&(this._columnSelectMode?T[0]<=B[0]?N>=T[0]&&D>=T[1]&&N<B[0]&&D<=B[1]:N<T[0]&&D>=T[1]&&N>=B[0]&&D<=B[1]:D>T[1]&&D<B[1]||T[1]===B[1]&&D===T[1]&&N>=T[0]&&N<B[0]||T[1]<B[1]&&D===B[1]&&N<B[0]||T[1]<B[1]&&D===T[1]&&N>=T[0])}};function A(N,D,T){for(;N.length<T;)N=D+N;return N}c.DomRendererRowFactory=j=p([g(1,b.ICharacterJoinerService),g(2,k.IOptionsService),g(3,b.ICoreBrowserService),g(4,k.ICoreService),g(5,k.IDecorationService),g(6,b.IThemeService)],j)},2550:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WidthCache=void 0,c.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 x=d.createElement("span");x.classList.add("xterm-char-measure-element"),x.style.fontStyle="italic";const _=d.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontWeight="bold",_.style.fontStyle="italic",this._measureElements=[g,m,x,_],this._container.appendChild(g),this._container.appendChild(m),this._container.appendChild(x),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 x=d;p&&(x+="B"),g&&(x+="I");let _=this._holey.get(x);if(_===void 0){let k=0;p&&(k|=1),g&&(k|=2),_=this._measure(d,k),_>0&&this._holey.set(x,_)}return _}_measure(d,p){const g=this._measureElements[p];return g.textContent=d.repeat(32),g.offsetWidth/32}}},2223:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TEXT_BASELINE=c.DIM_OPACITY=c.INVERTED_DEFAULT_COLOR=void 0;const p=d(6114);c.INVERTED_DEFAULT_COLOR=257,c.DIM_OPACITY=.5,c.TEXT_BASELINE=p.isFirefox||p.isLegacyEdge?"bottom":"ideographic"},6171:(f,c)=>{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(c,"__esModule",{value:!0}),c.computeNextVariantOffset=c.createRenderDimensions=c.treatGlyphAsBackgroundColor=c.allowRescaling=c.isEmoji=c.isRestrictedPowerlineGlyph=c.isPowerlineGlyph=c.throwIfFalsy=void 0,c.throwIfFalsy=function(g){if(!g)throw new Error("value must not be falsy");return g},c.isPowerlineGlyph=d,c.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},c.isEmoji=p,c.allowRescaling=function(g,m,x,_){return m===1&&x>Math.ceil(1.5*_)&&g!==void 0&&g>255&&!p(g)&&!d(g)&&!(function(k){return 57344<=k&&k<=63743})(g)},c.treatGlyphAsBackgroundColor=function(g){return d(g)||(function(m){return 9472<=m&&m<=9631})(g)},c.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}}}},c.computeNextVariantOffset=function(g,m,x=0){return(g-(2*Math.round(m)-x))%(2*Math.round(m))}},6052:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.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,x,_=!1){if(this.selectionStart=m,this.selectionEnd=x,!m||!x||m[0]===x[0]&&m[1]===x[1])return void this.clear();const k=g.buffers.active.ydisp,C=m[1]-k,b=x[1]-k,v=Math.max(C,0),y=Math.min(b,g.rows-1);v>=g.rows||y<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=_,this.viewportStartRow=C,this.viewportEndRow=b,this.viewportCappedStartRow=v,this.viewportCappedEndRow=y,this.startCol=m[0],this.endCol=x[0])}isCellSelected(g,m,x){return!!this.hasSelection&&(x-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?m>=this.startCol&&x>=this.viewportCappedStartRow&&m<this.endCol&&x<=this.viewportCappedEndRow:m<this.startCol&&x>=this.viewportCappedStartRow&&m>=this.endCol&&x<=this.viewportCappedEndRow:x>this.viewportStartRow&&x<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&x===this.viewportStartRow&&m>=this.startCol&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&x===this.viewportEndRow&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&x===this.viewportStartRow&&m>=this.startCol)}}c.createSelectionRenderModel=function(){return new d}},456:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.SelectionModel=void 0,c.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,c,d){var p=this&&this.__decorate||function(y,S,j,A){var N,D=arguments.length,T=D<3?S:A===null?A=Object.getOwnPropertyDescriptor(S,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(y,S,j,A);else for(var B=y.length-1;B>=0;B--)(N=y[B])&&(T=(D<3?N(T):D>3?N(S,j,T):N(S,j))||T);return D>3&&T&&Object.defineProperty(S,j,T),T},g=this&&this.__param||function(y,S){return function(j,A){S(j,A,y)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharSizeService=void 0;const m=d(2585),x=d(8460),_=d(844);let k=c.CharSizeService=class extends _.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(y,S,j){super(),this._optionsService=j,this.width=0,this.height=0,this._onCharSizeChange=this.register(new x.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new v(this._optionsService))}catch{this._measureStrategy=this.register(new b(y,S,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const y=this._measureStrategy.measure();y.width===this.width&&y.height===this.height||(this.width=y.width,this.height=y.height,this._onCharSizeChange.fire())}};c.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 b extends C{constructor(S,j,A){super(),this._document=S,this._parentElement=j,this._optionsService=A,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class v extends C{constructor(S){super(),this._optionsService=S,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const j=this._ctx.measureText("W");if(!("width"in j&&"fontBoundingBoxAscent"in j&&"fontBoundingBoxDescent"in j))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const S=this._ctx.measureText("W");return this._validateAndSet(S.width,S.fontBoundingBoxAscent+S.fontBoundingBoxDescent),this._result}}},4269:function(f,c,d){var p=this&&this.__decorate||function(v,y,S,j){var A,N=arguments.length,D=N<3?y:j===null?j=Object.getOwnPropertyDescriptor(y,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(v,y,S,j);else for(var T=v.length-1;T>=0;T--)(A=v[T])&&(D=(N<3?A(D):N>3?A(y,S,D):A(y,S))||D);return N>3&&D&&Object.defineProperty(y,S,D),D},g=this&&this.__param||function(v,y){return function(S,j){y(S,j,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharacterJoinerService=c.JoinedCellData=void 0;const m=d(3734),x=d(643),_=d(511),k=d(2585);class C extends m.AttributeData{constructor(y,S,j){super(),this.content=0,this.combinedData="",this.fg=y.fg,this.bg=y.bg,this.combinedData=S,this._width=j}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(y){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}c.JoinedCellData=C;let b=c.CharacterJoinerService=class Rb{constructor(y){this._bufferService=y,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _.CellData}register(y){const S={id:this._nextCharacterJoinerId++,handler:y};return this._characterJoiners.push(S),S.id}deregister(y){for(let S=0;S<this._characterJoiners.length;S++)if(this._characterJoiners[S].id===y)return this._characterJoiners.splice(S,1),!0;return!1}getJoinedCharacters(y){if(this._characterJoiners.length===0)return[];const S=this._bufferService.buffer.lines.get(y);if(!S||S.length===0)return[];const j=[],A=S.translateToString(!0);let N=0,D=0,T=0,B=S.getFg(0),H=S.getBg(0);for(let W=0;W<S.getTrimmedLength();W++)if(S.loadCell(W,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==B||this._workCell.bg!==H){if(W-N>1){const K=this._getJoinedRanges(A,T,D,S,N);for(let q=0;q<K.length;q++)j.push(K[q])}N=W,T=D,B=this._workCell.fg,H=this._workCell.bg}D+=this._workCell.getChars().length||x.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-N>1){const W=this._getJoinedRanges(A,T,D,S,N);for(let K=0;K<W.length;K++)j.push(W[K])}return j}_getJoinedRanges(y,S,j,A,N){const D=y.substring(S,j);let T=[];try{T=this._characterJoiners[0].handler(D)}catch(B){console.error(B)}for(let B=1;B<this._characterJoiners.length;B++)try{const H=this._characterJoiners[B].handler(D);for(let W=0;W<H.length;W++)Rb._mergeRanges(T,H[W])}catch(H){console.error(H)}return this._stringRangesToCellRanges(T,A,N),T}_stringRangesToCellRanges(y,S,j){let A=0,N=!1,D=0,T=y[A];if(T){for(let B=j;B<this._bufferService.cols;B++){const H=S.getWidth(B),W=S.getString(B).length||x.WHITESPACE_CELL_CHAR.length;if(H!==0){if(!N&&T[0]<=D&&(T[0]=B,N=!0),T[1]<=D){if(T[1]=B,T=y[++A],!T)break;T[0]<=D?(T[0]=B,N=!0):N=!1}D+=W}}T&&(T[1]=this._bufferService.cols)}}static _mergeRanges(y,S){let j=!1;for(let A=0;A<y.length;A++){const N=y[A];if(j){if(S[1]<=N[0])return y[A-1][1]=S[1],y;if(S[1]<=N[1])return y[A-1][1]=Math.max(S[1],N[1]),y.splice(A,1),y;y.splice(A,1),A--}else{if(S[1]<=N[0])return y.splice(A,0,S),y;if(S[1]<=N[1])return N[0]=Math.min(S[0],N[0]),y;S[0]<N[1]&&(N[0]=Math.min(S[0],N[0]),j=!0)}}return j?y[y.length-1][1]=S[1]:y.push(S),y}};c.CharacterJoinerService=b=p([g(0,k.IBufferService)],b)},5114:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreBrowserService=void 0;const p=d(844),g=d(8460),m=d(3656);class x extends p.Disposable{constructor(C,b,v){super(),this._textarea=C,this._window=b,this.mainDocument=v,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new _(this._window),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new g.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((y=>this._screenDprMonitor.setWindow(y)))),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}}c.CoreBrowserService=x;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,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.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(x){return this.linkProviders.push(x),{dispose:()=>{const _=this.linkProviders.indexOf(x);_!==-1&&this.linkProviders.splice(_,1)}}}}c.LinkProviderService=g},8934:function(f,c,d){var p=this&&this.__decorate||function(k,C,b,v){var y,S=arguments.length,j=S<3?C:v===null?v=Object.getOwnPropertyDescriptor(C,b):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(k,C,b,v);else for(var A=k.length-1;A>=0;A--)(y=k[A])&&(j=(S<3?y(j):S>3?y(C,b,j):y(C,b))||j);return S>3&&j&&Object.defineProperty(C,b,j),j},g=this&&this.__param||function(k,C){return function(b,v){C(b,v,k)}};Object.defineProperty(c,"__esModule",{value:!0}),c.MouseService=void 0;const m=d(4725),x=d(9806);let _=c.MouseService=class{constructor(k,C){this._renderService=k,this._charSizeService=C}getCoords(k,C,b,v,y){return(0,x.getCoords)(window,k,C,b,v,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,y)}getMouseReportCoords(k,C){const b=(0,x.getCoordsRelativeToElement)(window,k,C);if(this._charSizeService.hasValidSize)return b[0]=Math.min(Math.max(b[0],0),this._renderService.dimensions.css.canvas.width-1),b[1]=Math.min(Math.max(b[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(b[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(b[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(b[0]),y:Math.floor(b[1])}}};c.MouseService=_=p([g(0,m.IRenderService),g(1,m.ICharSizeService)],_)},3230:function(f,c,d){var p=this&&this.__decorate||function(y,S,j,A){var N,D=arguments.length,T=D<3?S:A===null?A=Object.getOwnPropertyDescriptor(S,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(y,S,j,A);else for(var B=y.length-1;B>=0;B--)(N=y[B])&&(T=(D<3?N(T):D>3?N(S,j,T):N(S,j))||T);return D>3&&T&&Object.defineProperty(S,j,T),T},g=this&&this.__param||function(y,S){return function(j,A){S(j,A,y)}};Object.defineProperty(c,"__esModule",{value:!0}),c.RenderService=void 0;const m=d(6193),x=d(4725),_=d(8460),k=d(844),C=d(7226),b=d(2585);let v=c.RenderService=class extends k.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(y,S,j,A,N,D,T,B){super(),this._rowCount=y,this._charSizeService=A,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(((H,W)=>this._renderRows(H,W)),T),this.register(this._renderDebouncer),this.register(T.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(D.onResize((()=>this._fullRefresh()))),this.register(D.buffers.onBufferActivate((()=>{var H;return(H=this._renderer.value)==null?void 0:H.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(T.window,S),this.register(T.onWindowChange((H=>this._registerIntersectionObserver(H,S))))}_registerIntersectionObserver(y,S){if("IntersectionObserver"in y){const j=new y.IntersectionObserver((A=>this._handleIntersectionChange(A[A.length-1])),{threshold:0});j.observe(S),this._observerDisposable.value=(0,k.toDisposable)((()=>j.disconnect()))}}_handleIntersectionChange(y){this._isPaused=y.isIntersecting===void 0?y.intersectionRatio===0:!y.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(y,S,j=!1){this._isPaused?this._needsFullRefresh=!0:(j||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(y,S,this._rowCount))}_renderRows(y,S){this._renderer.value&&(y=Math.min(y,this._rowCount-1),S=Math.min(S,this._rowCount-1),this._renderer.value.renderRows(y,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:y,end:S}),this._onRender.fire({start:y,end:S}),this._isNextRenderRedrawOnly=!0)}resize(y,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(y){this._renderer.value=y,this._renderer.value&&(this._renderer.value.onRequestRedraw((S=>this.refreshRows(S.start,S.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(y){return this._renderDebouncer.addRefreshCallback(y)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var y,S;this._renderer.value&&((S=(y=this._renderer.value).clearTextureAtlas)==null||S.call(y),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(y,S){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var j;return(j=this._renderer.value)==null?void 0:j.handleResize(y,S)})):this._renderer.value.handleResize(y,S),this._fullRefresh())}handleCharSizeChanged(){var y;(y=this._renderer.value)==null||y.handleCharSizeChanged()}handleBlur(){var y;(y=this._renderer.value)==null||y.handleBlur()}handleFocus(){var y;(y=this._renderer.value)==null||y.handleFocus()}handleSelectionChanged(y,S,j){var A;this._selectionState.start=y,this._selectionState.end=S,this._selectionState.columnSelectMode=j,(A=this._renderer.value)==null||A.handleSelectionChanged(y,S,j)}handleCursorMove(){var y;(y=this._renderer.value)==null||y.handleCursorMove()}clear(){var y;(y=this._renderer.value)==null||y.clear()}};c.RenderService=v=p([g(2,b.IOptionsService),g(3,x.ICharSizeService),g(4,b.IDecorationService),g(5,b.IBufferService),g(6,x.ICoreBrowserService),g(7,x.IThemeService)],v)},9312:function(f,c,d){var p=this&&this.__decorate||function(T,B,H,W){var K,q=arguments.length,R=q<3?B:W===null?W=Object.getOwnPropertyDescriptor(B,H):W;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(T,B,H,W);else for(var U=T.length-1;U>=0;U--)(K=T[U])&&(R=(q<3?K(R):q>3?K(B,H,R):K(B,H))||R);return q>3&&R&&Object.defineProperty(B,H,R),R},g=this&&this.__param||function(T,B){return function(H,W){B(H,W,T)}};Object.defineProperty(c,"__esModule",{value:!0}),c.SelectionService=void 0;const m=d(9806),x=d(9504),_=d(456),k=d(4725),C=d(8460),b=d(844),v=d(6114),y=d(4841),S=d(511),j=d(2585),A=" ",N=new RegExp(A,"g");let D=c.SelectionService=class extends b.Disposable{constructor(T,B,H,W,K,q,R,U,M){super(),this._element=T,this._screenElement=B,this._linkifier=H,this._bufferService=W,this._coreService=K,this._mouseService=q,this._optionsService=R,this._renderService=U,this._coreBrowserService=M,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=Y=>this._handleMouseMove(Y),this._mouseUpListener=Y=>this._handleMouseUp(Y),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((Y=>this._handleTrim(Y))),this.register(this._bufferService.buffers.onBufferActivate((Y=>this._handleBufferActivate(Y)))),this.enable(),this._model=new _.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,b.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 T=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!(!T||!B||T[0]===B[0]&&T[1]===B[1])}get selectionText(){const T=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;if(!T||!B)return"";const H=this._bufferService.buffer,W=[];if(this._activeSelectionMode===3){if(T[0]===B[0])return"";const K=T[0]<B[0]?T[0]:B[0],q=T[0]<B[0]?B[0]:T[0];for(let R=T[1];R<=B[1];R++){const U=H.translateBufferLineToString(R,!0,K,q);W.push(U)}}else{const K=T[1]===B[1]?B[0]:void 0;W.push(H.translateBufferLineToString(T[1],!0,T[0],K));for(let q=T[1]+1;q<=B[1]-1;q++){const R=H.lines.get(q),U=H.translateBufferLineToString(q,!0);R!=null&&R.isWrapped?W[W.length-1]+=U:W.push(U)}if(T[1]!==B[1]){const q=H.lines.get(B[1]),R=H.translateBufferLineToString(B[1],!0,0,B[0]);q&&q.isWrapped?W[W.length-1]+=R:W.push(R)}}return W.map((K=>K.replace(N," "))).join(v.isWindows?`\r
|
|
62
|
+
`:`
|
|
63
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(T){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),v.isLinux&&T&&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(T){const B=this._getMouseBufferCoords(T),H=this._model.finalSelectionStart,W=this._model.finalSelectionEnd;return!!(H&&W&&B)&&this._areCoordsInSelection(B,H,W)}isCellInSelection(T,B){const H=this._model.finalSelectionStart,W=this._model.finalSelectionEnd;return!(!H||!W)&&this._areCoordsInSelection([T,B],H,W)}_areCoordsInSelection(T,B,H){return T[1]>B[1]&&T[1]<H[1]||B[1]===H[1]&&T[1]===B[1]&&T[0]>=B[0]&&T[0]<H[0]||B[1]<H[1]&&T[1]===H[1]&&T[0]<H[0]||B[1]<H[1]&&T[1]===B[1]&&T[0]>=B[0]}_selectWordAtCursor(T,B){var K,q;const H=(q=(K=this._linkifier.currentLink)==null?void 0:K.link)==null?void 0:q.range;if(H)return this._model.selectionStart=[H.start.x-1,H.start.y-1],this._model.selectionStartLength=(0,y.getRangeLength)(H,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const W=this._getMouseBufferCoords(T);return!!W&&(this._selectWordAt(W,B),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(T,B){this._model.clearSelection(),T=Math.max(T,0),B=Math.min(B,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,T],this._model.selectionEnd=[this._bufferService.cols,B],this.refresh(),this._onSelectionChange.fire()}_handleTrim(T){this._model.handleTrim(T)&&this.refresh()}_getMouseBufferCoords(T){const B=this._mouseService.getCoords(T,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(B)return B[0]--,B[1]--,B[1]+=this._bufferService.buffer.ydisp,B}_getMouseEventScrollAmount(T){let B=(0,m.getCoordsRelativeToElement)(this._coreBrowserService.window,T,this._screenElement)[1];const H=this._renderService.dimensions.css.canvas.height;return B>=0&&B<=H?0:(B>H&&(B-=H),B=Math.min(Math.max(B,-50),50),B/=50,B/Math.abs(B)+Math.round(14*B))}shouldForceSelection(T){return v.isMac?T.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:T.shiftKey}handleMouseDown(T){if(this._mouseDownTimeStamp=T.timeStamp,(T.button!==2||!this.hasSelection)&&T.button===0){if(!this._enabled){if(!this.shouldForceSelection(T))return;T.stopPropagation()}T.preventDefault(),this._dragScrollAmount=0,this._enabled&&T.shiftKey?this._handleIncrementalClick(T):T.detail===1?this._handleSingleClick(T):T.detail===2?this._handleDoubleClick(T):T.detail===3&&this._handleTripleClick(T),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(T){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(T))}_handleSingleClick(T){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(T)?3:0,this._model.selectionStart=this._getMouseBufferCoords(T),!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(T){this._selectWordAtCursor(T,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(T){const B=this._getMouseBufferCoords(T);B&&(this._activeSelectionMode=2,this._selectLineAt(B[1]))}shouldColumnSelect(T){return T.altKey&&!(v.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(T){if(T.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(T),!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(T),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const H=this._bufferService.buffer;if(this._model.selectionEnd[1]<H.lines.length){const W=H.lines.get(this._model.selectionEnd[1]);W&&W.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 T=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(T.ydisp+this._bufferService.rows,T.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=T.ydisp),this.refresh()}}_handleMouseUp(T){const B=T.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&B<500&&T.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const H=this._mouseService.getCoords(T,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(H&&H[0]!==void 0&&H[1]!==void 0){const W=(0,x.moveToCellSequence)(H[0]-1,H[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(W,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const T=this._model.finalSelectionStart,B=this._model.finalSelectionEnd,H=!(!T||!B||T[0]===B[0]&&T[1]===B[1]);H?T&&B&&(this._oldSelectionStart&&this._oldSelectionEnd&&T[0]===this._oldSelectionStart[0]&&T[1]===this._oldSelectionStart[1]&&B[0]===this._oldSelectionEnd[0]&&B[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(T,B,H)):this._oldHasSelection&&this._fireOnSelectionChange(T,B,H)}_fireOnSelectionChange(T,B,H){this._oldSelectionStart=T,this._oldSelectionEnd=B,this._oldHasSelection=H,this._onSelectionChange.fire()}_handleBufferActivate(T){this.clearSelection(),this._trimListener.dispose(),this._trimListener=T.activeBuffer.lines.onTrim((B=>this._handleTrim(B)))}_convertViewportColToCharacterIndex(T,B){let H=B;for(let W=0;B>=W;W++){const K=T.loadCell(W,this._workCell).getChars().length;this._workCell.getWidth()===0?H--:K>1&&B!==W&&(H+=K-1)}return H}setSelection(T,B,H){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[T,B],this._model.selectionStartLength=H,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(T){this._isClickInSelection(T)||(this._selectWordAtCursor(T,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(T,B,H=!0,W=!0){if(T[0]>=this._bufferService.cols)return;const K=this._bufferService.buffer,q=K.lines.get(T[1]);if(!q)return;const R=K.translateBufferLineToString(T[1],!1);let U=this._convertViewportColToCharacterIndex(q,T[0]),M=U;const Y=T[0]-U;let Z=0,z=0,L=0,I=0;if(R.charAt(U)===" "){for(;U>0&&R.charAt(U-1)===" ";)U--;for(;M<R.length&&R.charAt(M+1)===" ";)M++}else{let ie=T[0],Q=T[0];q.getWidth(ie)===0&&(Z++,ie--),q.getWidth(Q)===2&&(z++,Q++);const ee=q.getString(Q).length;for(ee>1&&(I+=ee-1,M+=ee-1);ie>0&&U>0&&!this._isCharWordSeparator(q.loadCell(ie-1,this._workCell));){q.loadCell(ie-1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===0?(Z++,ie--):X>1&&(L+=X-1,U-=X-1),U--,ie--}for(;Q<q.length&&M+1<R.length&&!this._isCharWordSeparator(q.loadCell(Q+1,this._workCell));){q.loadCell(Q+1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===2?(z++,Q++):X>1&&(I+=X-1,M+=X-1),M++,Q++}}M++;let V=U+Y-Z+L,F=Math.min(this._bufferService.cols,M-U+Z+z-L-I);if(B||R.slice(U,M).trim()!==""){if(H&&V===0&&q.getCodePoint(0)!==32){const ie=K.lines.get(T[1]-1);if(ie&&q.isWrapped&&ie.getCodePoint(this._bufferService.cols-1)!==32){const Q=this._getWordAt([this._bufferService.cols-1,T[1]-1],!1,!0,!1);if(Q){const ee=this._bufferService.cols-Q.start;V-=ee,F+=ee}}}if(W&&V+F===this._bufferService.cols&&q.getCodePoint(this._bufferService.cols-1)!==32){const ie=K.lines.get(T[1]+1);if(ie!=null&&ie.isWrapped&&ie.getCodePoint(0)!==32){const Q=this._getWordAt([0,T[1]+1],!1,!1,!0);Q&&(F+=Q.length)}}return{start:V,length:F}}}_selectWordAt(T,B){const H=this._getWordAt(T,B);if(H){for(;H.start<0;)H.start+=this._bufferService.cols,T[1]--;this._model.selectionStart=[H.start,T[1]],this._model.selectionStartLength=H.length}}_selectToWordAt(T){const B=this._getWordAt(T,!0);if(B){let H=T[1];for(;B.start<0;)B.start+=this._bufferService.cols,H--;if(!this._model.areSelectionValuesReversed())for(;B.start+B.length>this._bufferService.cols;)B.length-=this._bufferService.cols,H++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?B.start:B.start+B.length,H]}}_isCharWordSeparator(T){return T.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(T.getChars())>=0}_selectLineAt(T){const B=this._bufferService.buffer.getWrappedRangeForLine(T),H={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,y.getRangeLength)(H,this._bufferService.cols)}};c.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,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ILinkProviderService=c.IThemeService=c.ICharacterJoinerService=c.ISelectionService=c.IRenderService=c.IMouseService=c.ICoreBrowserService=c.ICharSizeService=void 0;const p=d(8343);c.ICharSizeService=(0,p.createDecorator)("CharSizeService"),c.ICoreBrowserService=(0,p.createDecorator)("CoreBrowserService"),c.IMouseService=(0,p.createDecorator)("MouseService"),c.IRenderService=(0,p.createDecorator)("RenderService"),c.ISelectionService=(0,p.createDecorator)("SelectionService"),c.ICharacterJoinerService=(0,p.createDecorator)("CharacterJoinerService"),c.IThemeService=(0,p.createDecorator)("ThemeService"),c.ILinkProviderService=(0,p.createDecorator)("LinkProviderService")},6731:function(f,c,d){var p=this&&this.__decorate||function(D,T,B,H){var W,K=arguments.length,q=K<3?T:H===null?H=Object.getOwnPropertyDescriptor(T,B):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(D,T,B,H);else for(var R=D.length-1;R>=0;R--)(W=D[R])&&(q=(K<3?W(q):K>3?W(T,B,q):W(T,B))||q);return K>3&&q&&Object.defineProperty(T,B,q),q},g=this&&this.__param||function(D,T){return function(B,H){T(B,H,D)}};Object.defineProperty(c,"__esModule",{value:!0}),c.ThemeService=c.DEFAULT_ANSI_COLORS=void 0;const m=d(7239),x=d(8055),_=d(8460),k=d(844),C=d(2585),b=x.css.toColor("#ffffff"),v=x.css.toColor("#000000"),y=x.css.toColor("#ffffff"),S=x.css.toColor("#000000"),j={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};c.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const D=[x.css.toColor("#2e3436"),x.css.toColor("#cc0000"),x.css.toColor("#4e9a06"),x.css.toColor("#c4a000"),x.css.toColor("#3465a4"),x.css.toColor("#75507b"),x.css.toColor("#06989a"),x.css.toColor("#d3d7cf"),x.css.toColor("#555753"),x.css.toColor("#ef2929"),x.css.toColor("#8ae234"),x.css.toColor("#fce94f"),x.css.toColor("#729fcf"),x.css.toColor("#ad7fa8"),x.css.toColor("#34e2e2"),x.css.toColor("#eeeeec")],T=[0,95,135,175,215,255];for(let B=0;B<216;B++){const H=T[B/36%6|0],W=T[B/6%6|0],K=T[B%6];D.push({css:x.channels.toCss(H,W,K),rgba:x.channels.toRgba(H,W,K)})}for(let B=0;B<24;B++){const H=8+10*B;D.push({css:x.channels.toCss(H,H,H),rgba:x.channels.toRgba(H,H,H)})}return D})());let A=c.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:b,background:v,cursor:y,cursorAccent:S,selectionForeground:void 0,selectionBackgroundTransparent:j,selectionBackgroundOpaque:x.color.blend(v,j),selectionInactiveBackgroundTransparent:j,selectionInactiveBackgroundOpaque:x.color.blend(v,j),ansi:c.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 T=this._colors;if(T.foreground=N(D.foreground,b),T.background=N(D.background,v),T.cursor=N(D.cursor,y),T.cursorAccent=N(D.cursorAccent,S),T.selectionBackgroundTransparent=N(D.selectionBackground,j),T.selectionBackgroundOpaque=x.color.blend(T.background,T.selectionBackgroundTransparent),T.selectionInactiveBackgroundTransparent=N(D.selectionInactiveBackground,T.selectionBackgroundTransparent),T.selectionInactiveBackgroundOpaque=x.color.blend(T.background,T.selectionInactiveBackgroundTransparent),T.selectionForeground=D.selectionForeground?N(D.selectionForeground,x.NULL_COLOR):void 0,T.selectionForeground===x.NULL_COLOR&&(T.selectionForeground=void 0),x.color.isOpaque(T.selectionBackgroundTransparent)&&(T.selectionBackgroundTransparent=x.color.opacity(T.selectionBackgroundTransparent,.3)),x.color.isOpaque(T.selectionInactiveBackgroundTransparent)&&(T.selectionInactiveBackgroundTransparent=x.color.opacity(T.selectionInactiveBackgroundTransparent,.3)),T.ansi=c.DEFAULT_ANSI_COLORS.slice(),T.ansi[0]=N(D.black,c.DEFAULT_ANSI_COLORS[0]),T.ansi[1]=N(D.red,c.DEFAULT_ANSI_COLORS[1]),T.ansi[2]=N(D.green,c.DEFAULT_ANSI_COLORS[2]),T.ansi[3]=N(D.yellow,c.DEFAULT_ANSI_COLORS[3]),T.ansi[4]=N(D.blue,c.DEFAULT_ANSI_COLORS[4]),T.ansi[5]=N(D.magenta,c.DEFAULT_ANSI_COLORS[5]),T.ansi[6]=N(D.cyan,c.DEFAULT_ANSI_COLORS[6]),T.ansi[7]=N(D.white,c.DEFAULT_ANSI_COLORS[7]),T.ansi[8]=N(D.brightBlack,c.DEFAULT_ANSI_COLORS[8]),T.ansi[9]=N(D.brightRed,c.DEFAULT_ANSI_COLORS[9]),T.ansi[10]=N(D.brightGreen,c.DEFAULT_ANSI_COLORS[10]),T.ansi[11]=N(D.brightYellow,c.DEFAULT_ANSI_COLORS[11]),T.ansi[12]=N(D.brightBlue,c.DEFAULT_ANSI_COLORS[12]),T.ansi[13]=N(D.brightMagenta,c.DEFAULT_ANSI_COLORS[13]),T.ansi[14]=N(D.brightCyan,c.DEFAULT_ANSI_COLORS[14]),T.ansi[15]=N(D.brightWhite,c.DEFAULT_ANSI_COLORS[15]),D.extendedAnsi){const B=Math.min(T.ansi.length-16,D.extendedAnsi.length);for(let H=0;H<B;H++)T.ansi[H+16]=N(D.extendedAnsi[H],c.DEFAULT_ANSI_COLORS[H+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 T=0;T<this._restoreColors.ansi.length;++T)this._colors.ansi[T]=this._restoreColors.ansi[T]}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,T){if(D!==void 0)try{return x.css.toColor(D)}catch{}return T}c.ThemeService=A=p([g(0,C.IOptionsService)],A)},6349:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.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 b=_;b<this._length-k;b++)this._array[this._getCyclicIndex(b)]=this._array[this._getCyclicIndex(b+k)];this._length-=k,this.onDeleteEmitter.fire({index:_,amount:k})}for(let b=this._length-1;b>=_;b--)this._array[this._getCyclicIndex(b+C.length)]=this._array[this._getCyclicIndex(b)];for(let b=0;b<C.length;b++)this._array[this._getCyclicIndex(_+b)]=C[b];if(C.length&&this.onInsertEmitter.fire({index:_,amount:C.length}),this._length+C.length>this._maxLength){const b=this._length+C.length-this._maxLength;this._startIndex+=b,this._length=this._maxLength,this.onTrimEmitter.fire(b)}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 v=k-1;v>=0;v--)this.set(_+v+C,this.get(_+v));const b=_+k+C-this._length;if(b>0)for(this._length+=b;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let b=0;b<k;b++)this.set(_+b+C,this.get(_+b))}}_getCyclicIndex(_){return(this._startIndex+_)%this._maxLength}}c.CircularList=m},1439:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.clone=void 0,c.clone=function d(p,g=5){if(typeof p!="object")return p;const m=Array.isArray(p)?[]:{};for(const x in p)m[x]=g<=1?p[x]:p[x]&&d(p[x],g-1);return m}},8055:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.contrastRatio=c.toPaddedHex=c.rgba=c.rgb=c.css=c.color=c.channels=c.NULL_COLOR=void 0;let d=0,p=0,g=0,m=0;var x,_,k,C,b;function v(S){const j=S.toString(16);return j.length<2?"0"+j:j}function y(S,j){return S<j?(j+.05)/(S+.05):(S+.05)/(j+.05)}c.NULL_COLOR={css:"#00000000",rgba:0},(function(S){S.toCss=function(j,A,N,D){return D!==void 0?`#${v(j)}${v(A)}${v(N)}${v(D)}`:`#${v(j)}${v(A)}${v(N)}`},S.toRgba=function(j,A,N,D=255){return(j<<24|A<<16|N<<8|D)>>>0},S.toColor=function(j,A,N,D){return{css:S.toCss(j,A,N,D),rgba:S.toRgba(j,A,N,D)}}})(x||(c.channels=x={})),(function(S){function j(A,N){return m=Math.round(255*N),[d,p,g]=b.toChannels(A.rgba),{css:x.toCss(d,p,g,m),rgba:x.toRgba(d,p,g,m)}}S.blend=function(A,N){if(m=(255&N.rgba)/255,m===1)return{css:N.css,rgba:N.rgba};const D=N.rgba>>24&255,T=N.rgba>>16&255,B=N.rgba>>8&255,H=A.rgba>>24&255,W=A.rgba>>16&255,K=A.rgba>>8&255;return d=H+Math.round((D-H)*m),p=W+Math.round((T-W)*m),g=K+Math.round((B-K)*m),{css:x.toCss(d,p,g),rgba:x.toRgba(d,p,g)}},S.isOpaque=function(A){return(255&A.rgba)==255},S.ensureContrastRatio=function(A,N,D){const T=b.ensureContrastRatio(A.rgba,N.rgba,D);if(T)return x.toColor(T>>24&255,T>>16&255,T>>8&255)},S.opaque=function(A){const N=(255|A.rgba)>>>0;return[d,p,g]=b.toChannels(N),{css:x.toCss(d,p,g),rgba:N}},S.opacity=j,S.multiplyOpacity=function(A,N){return m=255&A.rgba,j(A,m*N/255)},S.toColorRGB=function(A){return[A.rgba>>24&255,A.rgba>>16&255,A.rgba>>8&255]}})(_||(c.color=_={})),(function(S){let j,A;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",A=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),x.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),x.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]))),x.toColor(d,p,g,m);if(!j||!A)throw new Error("css.toColor: Unsupported css format");if(j.fillStyle=A,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:x.toRgba(d,p,g,m),css:N}}})(k||(c.css=k={})),(function(S){function j(A,N,D){const T=A/255,B=N/255,H=D/255;return .2126*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))+.7152*(B<=.03928?B/12.92:Math.pow((B+.055)/1.055,2.4))+.0722*(H<=.03928?H/12.92:Math.pow((H+.055)/1.055,2.4))}S.relativeLuminance=function(A){return j(A>>16&255,A>>8&255,255&A)},S.relativeLuminance2=j})(C||(c.rgb=C={})),(function(S){function j(N,D,T){const B=N>>24&255,H=N>>16&255,W=N>>8&255;let K=D>>24&255,q=D>>16&255,R=D>>8&255,U=y(C.relativeLuminance2(K,q,R),C.relativeLuminance2(B,H,W));for(;U<T&&(K>0||q>0||R>0);)K-=Math.max(0,Math.ceil(.1*K)),q-=Math.max(0,Math.ceil(.1*q)),R-=Math.max(0,Math.ceil(.1*R)),U=y(C.relativeLuminance2(K,q,R),C.relativeLuminance2(B,H,W));return(K<<24|q<<16|R<<8|255)>>>0}function A(N,D,T){const B=N>>24&255,H=N>>16&255,W=N>>8&255;let K=D>>24&255,q=D>>16&255,R=D>>8&255,U=y(C.relativeLuminance2(K,q,R),C.relativeLuminance2(B,H,W));for(;U<T&&(K<255||q<255||R<255);)K=Math.min(255,K+Math.ceil(.1*(255-K))),q=Math.min(255,q+Math.ceil(.1*(255-q))),R=Math.min(255,R+Math.ceil(.1*(255-R))),U=y(C.relativeLuminance2(K,q,R),C.relativeLuminance2(B,H,W));return(K<<24|q<<16|R<<8|255)>>>0}S.blend=function(N,D){if(m=(255&D)/255,m===1)return D;const T=D>>24&255,B=D>>16&255,H=D>>8&255,W=N>>24&255,K=N>>16&255,q=N>>8&255;return d=W+Math.round((T-W)*m),p=K+Math.round((B-K)*m),g=q+Math.round((H-q)*m),x.toRgba(d,p,g)},S.ensureContrastRatio=function(N,D,T){const B=C.relativeLuminance(N>>8),H=C.relativeLuminance(D>>8);if(y(B,H)<T){if(H<B){const q=j(N,D,T),R=y(B,C.relativeLuminance(q>>8));if(R<T){const U=A(N,D,T);return R>y(B,C.relativeLuminance(U>>8))?q:U}return q}const W=A(N,D,T),K=y(B,C.relativeLuminance(W>>8));if(K<T){const q=j(N,D,T);return K>y(B,C.relativeLuminance(q>>8))?W:q}return W}},S.reduceLuminance=j,S.increaseLuminance=A,S.toChannels=function(N){return[N>>24&255,N>>16&255,N>>8&255,255&N]}})(b||(c.rgba=b={})),c.toPaddedHex=v,c.contrastRatio=y},8969:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreTerminal=void 0;const p=d(844),g=d(2585),m=d(4348),x=d(7866),_=d(744),k=d(7302),C=d(6975),b=d(8460),v=d(1753),y=d(1480),S=d(7994),j=d(9282),A=d(5435),N=d(5981),D=d(2660);let T=!1;class B extends p.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new b.EventEmitter),this._onScroll.event((W=>{var K;(K=this._onScrollApi)==null||K.fire(W.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(W){for(const K in W)this.optionsService.options[K]=W[K]}constructor(W){super(),this._windowsWrappingHeuristics=this.register(new p.MutableDisposable),this._onBinary=this.register(new b.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new b.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new b.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new b.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new b.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new b.EventEmitter),this._instantiationService=new m.InstantiationService,this.optionsService=this.register(new k.OptionsService(W)),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(x.LogService)),this._instantiationService.setService(g.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(C.CoreService)),this._instantiationService.setService(g.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(v.CoreMouseService)),this._instantiationService.setService(g.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(y.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 A.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,b.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,b.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,b.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,b.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((K=>{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((K=>{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(((K,q)=>this._inputHandler.parse(K,q)))),this.register((0,b.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(W,K){this._writeBuffer.write(W,K)}writeSync(W,K){this._logService.logLevel<=g.LogLevelEnum.WARN&&!T&&(this._logService.warn("writeSync is unreliable and will be removed soon."),T=!0),this._writeBuffer.writeSync(W,K)}input(W,K=!0){this.coreService.triggerDataEvent(W,K)}resize(W,K){isNaN(W)||isNaN(K)||(W=Math.max(W,_.MINIMUM_COLS),K=Math.max(K,_.MINIMUM_ROWS),this._bufferService.resize(W,K))}scroll(W,K=!1){this._bufferService.scroll(W,K)}scrollLines(W,K,q){this._bufferService.scrollLines(W,K,q)}scrollPages(W){this.scrollLines(W*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(W){const K=W-this._bufferService.buffer.ydisp;K!==0&&this.scrollLines(K)}registerEscHandler(W,K){return this._inputHandler.registerEscHandler(W,K)}registerDcsHandler(W,K){return this._inputHandler.registerDcsHandler(W,K)}registerCsiHandler(W,K){return this._inputHandler.registerCsiHandler(W,K)}registerOscHandler(W,K){return this._inputHandler.registerOscHandler(W,K)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let W=!1;const K=this.optionsService.rawOptions.windowsPty;K&&K.buildNumber!==void 0&&K.buildNumber!==void 0?W=K.backend==="conpty"&&K.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(W=!0),W?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const W=[];W.push(this.onLineFeed(j.updateWindowsModeWrappedState.bind(null,this._bufferService))),W.push(this.registerCsiHandler({final:"H"},(()=>((0,j.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,p.toDisposable)((()=>{for(const K of W)K.dispose()}))}}}c.CoreTerminal=B},8460:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.runAndSubscribe=c.forwardEvent=c.EventEmitter=void 0,c.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)}},c.forwardEvent=function(d,p){return d((g=>p.fire(g)))},c.runAndSubscribe=function(d,p){return p(void 0),d((g=>p(g)))}},5435:function(f,c,d){var p=this&&this.__decorate||function(Z,z,L,I){var V,F=arguments.length,ie=F<3?z:I===null?I=Object.getOwnPropertyDescriptor(z,L):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ie=Reflect.decorate(Z,z,L,I);else for(var Q=Z.length-1;Q>=0;Q--)(V=Z[Q])&&(ie=(F<3?V(ie):F>3?V(z,L,ie):V(z,L))||ie);return F>3&&ie&&Object.defineProperty(z,L,ie),ie},g=this&&this.__param||function(Z,z){return function(L,I){z(L,I,Z)}};Object.defineProperty(c,"__esModule",{value:!0}),c.InputHandler=c.WindowsOptionsReportType=void 0;const m=d(2584),x=d(7116),_=d(2015),k=d(844),C=d(482),b=d(8437),v=d(8460),y=d(643),S=d(511),j=d(3734),A=d(2585),N=d(1480),D=d(6242),T=d(6351),B=d(5941),H={"(":0,")":1,"*":2,"+":3,"-":1,".":2},W=131072;function K(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 q;(function(Z){Z[Z.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",Z[Z.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(q||(c.WindowsOptionsReportType=q={}));let R=0;class U extends k.Disposable{getAttrData(){return this._curAttrData}constructor(z,L,I,V,F,ie,Q,ee,X=new _.EscapeSequenceParser){super(),this._bufferService=z,this._charsetService=L,this._coreService=I,this._logService=V,this._optionsService=F,this._oscLinkService=ie,this._coreMouseService=Q,this._unicodeService=ee,this._parser=X,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=b.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=b.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new v.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new v.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new v.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new v.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new v.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new v.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new v.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new v.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new v.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new v.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new v.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new v.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new v.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new M(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(($=>this._activeBuffer=$.activeBuffer))),this._parser.setCsiHandlerFallback((($,oe)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString($),params:oe.toArray()})})),this._parser.setEscHandlerFallback(($=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString($)})})),this._parser.setExecuteHandlerFallback(($=>{this._logService.debug("Unknown EXECUTE code: ",{code:$})})),this._parser.setOscHandlerFallback((($,oe,re)=>{this._logService.debug("Unknown OSC code: ",{identifier:$,action:oe,data:re})})),this._parser.setDcsHandlerFallback((($,oe,re)=>{oe==="HOOK"&&(re=re.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString($),action:oe,payload:re})})),this._parser.setPrintHandler((($,oe,re)=>this.print($,oe,re))),this._parser.registerCsiHandler({final:"@"},($=>this.insertChars($))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},($=>this.scrollLeft($))),this._parser.registerCsiHandler({final:"A"},($=>this.cursorUp($))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},($=>this.scrollRight($))),this._parser.registerCsiHandler({final:"B"},($=>this.cursorDown($))),this._parser.registerCsiHandler({final:"C"},($=>this.cursorForward($))),this._parser.registerCsiHandler({final:"D"},($=>this.cursorBackward($))),this._parser.registerCsiHandler({final:"E"},($=>this.cursorNextLine($))),this._parser.registerCsiHandler({final:"F"},($=>this.cursorPrecedingLine($))),this._parser.registerCsiHandler({final:"G"},($=>this.cursorCharAbsolute($))),this._parser.registerCsiHandler({final:"H"},($=>this.cursorPosition($))),this._parser.registerCsiHandler({final:"I"},($=>this.cursorForwardTab($))),this._parser.registerCsiHandler({final:"J"},($=>this.eraseInDisplay($,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},($=>this.eraseInDisplay($,!0))),this._parser.registerCsiHandler({final:"K"},($=>this.eraseInLine($,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},($=>this.eraseInLine($,!0))),this._parser.registerCsiHandler({final:"L"},($=>this.insertLines($))),this._parser.registerCsiHandler({final:"M"},($=>this.deleteLines($))),this._parser.registerCsiHandler({final:"P"},($=>this.deleteChars($))),this._parser.registerCsiHandler({final:"S"},($=>this.scrollUp($))),this._parser.registerCsiHandler({final:"T"},($=>this.scrollDown($))),this._parser.registerCsiHandler({final:"X"},($=>this.eraseChars($))),this._parser.registerCsiHandler({final:"Z"},($=>this.cursorBackwardTab($))),this._parser.registerCsiHandler({final:"`"},($=>this.charPosAbsolute($))),this._parser.registerCsiHandler({final:"a"},($=>this.hPositionRelative($))),this._parser.registerCsiHandler({final:"b"},($=>this.repeatPrecedingCharacter($))),this._parser.registerCsiHandler({final:"c"},($=>this.sendDeviceAttributesPrimary($))),this._parser.registerCsiHandler({prefix:">",final:"c"},($=>this.sendDeviceAttributesSecondary($))),this._parser.registerCsiHandler({final:"d"},($=>this.linePosAbsolute($))),this._parser.registerCsiHandler({final:"e"},($=>this.vPositionRelative($))),this._parser.registerCsiHandler({final:"f"},($=>this.hVPosition($))),this._parser.registerCsiHandler({final:"g"},($=>this.tabClear($))),this._parser.registerCsiHandler({final:"h"},($=>this.setMode($))),this._parser.registerCsiHandler({prefix:"?",final:"h"},($=>this.setModePrivate($))),this._parser.registerCsiHandler({final:"l"},($=>this.resetMode($))),this._parser.registerCsiHandler({prefix:"?",final:"l"},($=>this.resetModePrivate($))),this._parser.registerCsiHandler({final:"m"},($=>this.charAttributes($))),this._parser.registerCsiHandler({final:"n"},($=>this.deviceStatus($))),this._parser.registerCsiHandler({prefix:"?",final:"n"},($=>this.deviceStatusPrivate($))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},($=>this.softReset($))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},($=>this.setCursorStyle($))),this._parser.registerCsiHandler({final:"r"},($=>this.setScrollRegion($))),this._parser.registerCsiHandler({final:"s"},($=>this.saveCursor($))),this._parser.registerCsiHandler({final:"t"},($=>this.windowOptions($))),this._parser.registerCsiHandler({final:"u"},($=>this.restoreCursor($))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},($=>this.insertColumns($))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},($=>this.deleteColumns($))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},($=>this.selectProtected($))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},($=>this.requestMode($,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},($=>this.requestMode($,!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(($=>(this.setTitle($),this.setIconName($),!0)))),this._parser.registerOscHandler(1,new D.OscHandler(($=>this.setIconName($)))),this._parser.registerOscHandler(2,new D.OscHandler(($=>this.setTitle($)))),this._parser.registerOscHandler(4,new D.OscHandler(($=>this.setOrReportIndexedColor($)))),this._parser.registerOscHandler(8,new D.OscHandler(($=>this.setHyperlink($)))),this._parser.registerOscHandler(10,new D.OscHandler(($=>this.setOrReportFgColor($)))),this._parser.registerOscHandler(11,new D.OscHandler(($=>this.setOrReportBgColor($)))),this._parser.registerOscHandler(12,new D.OscHandler(($=>this.setOrReportCursorColor($)))),this._parser.registerOscHandler(104,new D.OscHandler(($=>this.restoreIndexedColor($)))),this._parser.registerOscHandler(110,new D.OscHandler(($=>this.restoreFgColor($)))),this._parser.registerOscHandler(111,new D.OscHandler(($=>this.restoreBgColor($)))),this._parser.registerOscHandler(112,new D.OscHandler(($=>this.restoreCursorColor($)))),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 $ in x.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:$},(()=>this.selectCharset("("+$))),this._parser.registerEscHandler({intermediates:")",final:$},(()=>this.selectCharset(")"+$))),this._parser.registerEscHandler({intermediates:"*",final:$},(()=>this.selectCharset("*"+$))),this._parser.registerEscHandler({intermediates:"+",final:$},(()=>this.selectCharset("+"+$))),this._parser.registerEscHandler({intermediates:"-",final:$},(()=>this.selectCharset("-"+$))),this._parser.registerEscHandler({intermediates:".",final:$},(()=>this.selectCharset("."+$))),this._parser.registerEscHandler({intermediates:"/",final:$},(()=>this.selectCharset("/"+$)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler(($=>(this._logService.error("Parsing error: ",$),$))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new T.DcsHandler((($,oe)=>this.requestStatusString($,oe))))}_preserveStack(z,L,I,V){this._parseStack.paused=!0,this._parseStack.cursorStartX=z,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=I,this._parseStack.position=V}_logSlowResolvingAsync(z){this._logService.logLevel<=A.LogLevelEnum.WARN&&Promise.race([z,new Promise(((L,I)=>setTimeout((()=>I("#SLOW_TIMEOUT")),5e3)))]).catch((L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(z,L){let I,V=this._activeBuffer.x,F=this._activeBuffer.y,ie=0;const Q=this._parseStack.paused;if(Q){if(I=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(I),I;V=this._parseStack.cursorStartX,F=this._parseStack.cursorStartY,this._parseStack.paused=!1,z.length>W&&(ie=this._parseStack.position+W)}if(this._logService.logLevel<=A.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof z=="string"?` "${z}"`:` "${Array.prototype.map.call(z,($=>String.fromCharCode($))).join("")}"`),typeof z=="string"?z.split("").map(($=>$.charCodeAt(0))):z),this._parseBuffer.length<z.length&&this._parseBuffer.length<W&&(this._parseBuffer=new Uint32Array(Math.min(z.length,W))),Q||this._dirtyRowTracker.clearRange(),z.length>W)for(let $=ie;$<z.length;$+=W){const oe=$+W<z.length?$+W:z.length,re=typeof z=="string"?this._stringDecoder.decode(z.substring($,oe),this._parseBuffer):this._utf8Decoder.decode(z.subarray($,oe),this._parseBuffer);if(I=this._parser.parse(this._parseBuffer,re))return this._preserveStack(V,F,re,$),this._logSlowResolvingAsync(I),I}else if(!Q){const $=typeof z=="string"?this._stringDecoder.decode(z,this._parseBuffer):this._utf8Decoder.decode(z,this._parseBuffer);if(I=this._parser.parse(this._parseBuffer,$))return this._preserveStack(V,F,$,0),this._logSlowResolvingAsync(I),I}this._activeBuffer.x===V&&this._activeBuffer.y===F||this._onCursorMove.fire();const ee=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),X=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);X<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(X,this._bufferService.rows-1),Math.min(ee,this._bufferService.rows-1))}print(z,L,I){let V,F;const ie=this._charsetService.charset,Q=this._optionsService.rawOptions.screenReaderMode,ee=this._bufferService.cols,X=this._coreService.decPrivateModes.wraparound,$=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&&I-L>0&&re.getWidth(this._activeBuffer.x-1)===2&&re.setCellFromCodepoint(this._activeBuffer.x-1,0,1,oe);let ve=this._parser.precedingJoinState;for(let be=L;be<I;++be){if(V=z[be],V<127&&ie){const Ue=ie[String.fromCharCode(V)];Ue&&(V=Ue.charCodeAt(0))}const Le=this._unicodeService.charProperties(V,ve);F=N.UnicodeService.extractWidth(Le);const Oe=N.UnicodeService.extractShouldJoin(Le),He=Oe?N.UnicodeService.extractWidth(ve):0;if(ve=Le,Q&&this._onA11yChar.fire((0,C.stringFromCodePoint)(V)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+F-He>ee){if(X){const Ue=re;let Ne=this._activeBuffer.x-He;for(this._activeBuffer.x=He,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),He>0&&re instanceof b.BufferLine&&re.copyCellsFrom(Ue,Ne,0,He,!1);Ne<ee;)Ue.setCellFromCodepoint(Ne++,0,1,oe)}else if(this._activeBuffer.x=ee-1,F===2)continue}if(Oe&&this._activeBuffer.x){const Ue=re.getWidth(this._activeBuffer.x-1)?1:2;re.addCodepointToCell(this._activeBuffer.x-Ue,V,F);for(let Ne=F-He;--Ne>=0;)re.setCellFromCodepoint(this._activeBuffer.x++,0,0,oe)}else if($&&(re.insertCells(this._activeBuffer.x,F-He,this._activeBuffer.getNullCell(oe)),re.getWidth(ee-1)===2&&re.setCellFromCodepoint(ee-1,y.NULL_CELL_CODE,y.NULL_CELL_WIDTH,oe)),re.setCellFromCodepoint(this._activeBuffer.x++,V,F,oe),F>0)for(;--F;)re.setCellFromCodepoint(this._activeBuffer.x++,0,0,oe)}this._parser.precedingJoinState=ve,this._activeBuffer.x<ee&&I-L>0&&re.getWidth(this._activeBuffer.x)===0&&!re.hasContent(this._activeBuffer.x)&&re.setCellFromCodepoint(this._activeBuffer.x,0,1,oe),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(z,L){return z.final!=="t"||z.prefix||z.intermediates?this._parser.registerCsiHandler(z,L):this._parser.registerCsiHandler(z,(I=>!K(I.params[0],this._optionsService.rawOptions.windowOptions)||L(I)))}registerDcsHandler(z,L){return this._parser.registerDcsHandler(z,new T.DcsHandler(L))}registerEscHandler(z,L){return this._parser.registerEscHandler(z,L)}registerOscHandler(z,L){return this._parser.registerOscHandler(z,new D.OscHandler(L))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var 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 L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);L.hasWidth(this._activeBuffer.x)&&!L.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const 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,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=z,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=z,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(z,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+z,this._activeBuffer.y+L)}cursorUp(z){const L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,z.params[0]||1)):this._moveCursor(0,-(z.params[0]||1)),!0}cursorDown(z){const L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,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 L=z.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(z){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=z.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(z){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=z.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(z){const L=z.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(z,L,I,V=!1,F=!1){const ie=this._activeBuffer.lines.get(this._activeBuffer.ybase+z);ie.replaceCells(L,I,this._activeBuffer.getNullCell(this._eraseAttrData()),F),V&&(ie.isWrapped=!1)}_resetBufferLine(z,L=!1){const I=this._activeBuffer.lines.get(this._activeBuffer.ybase+z);I&&(I.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+z),I.isWrapped=!1)}eraseInDisplay(z,L=!1){let I;switch(this._restrictCursor(this._bufferService.cols),z.params[0]){case 0:for(I=this._activeBuffer.y,this._dirtyRowTracker.markDirty(I),this._eraseInBufferLine(I++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);I<this._bufferService.rows;I++)this._resetBufferLine(I,L);this._dirtyRowTracker.markDirty(I);break;case 1:for(I=this._activeBuffer.y,this._dirtyRowTracker.markDirty(I),this._eraseInBufferLine(I,0,this._activeBuffer.x+1,!0,L),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(I+1).isWrapped=!1);I--;)this._resetBufferLine(I,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(I=this._bufferService.rows,this._dirtyRowTracker.markDirty(I-1);I--;)this._resetBufferLine(I,L);this._dirtyRowTracker.markDirty(0);break;case 3:const V=this._activeBuffer.lines.length-this._bufferService.rows;V>0&&(this._activeBuffer.lines.trimStart(V),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-V,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-V,0),this._onScroll.fire(0))}return!0}eraseInLine(z,L=!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,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(z){this._restrictCursor();let L=z.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const I=this._activeBuffer.ybase+this._activeBuffer.y,V=this._bufferService.rows-1-this._activeBuffer.scrollBottom,F=this._bufferService.rows-1+this._activeBuffer.ybase-V+1;for(;L--;)this._activeBuffer.lines.splice(F-1,1),this._activeBuffer.lines.splice(I,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(z){this._restrictCursor();let L=z.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const I=this._activeBuffer.ybase+this._activeBuffer.y;let V;for(V=this._bufferService.rows-1-this._activeBuffer.scrollBottom,V=this._bufferService.rows-1+this._activeBuffer.ybase-V;L--;)this._activeBuffer.lines.splice(I,1),this._activeBuffer.lines.splice(V,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 L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.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 L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.deleteCells(this._activeBuffer.x,z.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(z){let L=z.params[0]||1;for(;L--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(z){let L=z.params[0]||1;for(;L--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(b.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 L=z.params[0]||1;for(let I=this._activeBuffer.scrollTop;I<=this._activeBuffer.scrollBottom;++I){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+I);V.deleteCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),V.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 L=z.params[0]||1;for(let I=this._activeBuffer.scrollTop;I<=this._activeBuffer.scrollBottom;++I){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+I);V.insertCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),V.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 L=z.params[0]||1;for(let I=this._activeBuffer.scrollTop;I<=this._activeBuffer.scrollBottom;++I){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+I);V.insertCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),V.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 L=z.params[0]||1;for(let I=this._activeBuffer.scrollTop;I<=this._activeBuffer.scrollBottom;++I){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+I);V.deleteCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),V.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(z){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.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 L=this._parser.precedingJoinState;if(!L)return!0;const I=z.params[0]||1,V=N.UnicodeService.extractWidth(L),F=this._activeBuffer.x-V,ie=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(F),Q=new Uint32Array(ie.length*I);let ee=0;for(let $=0;$<ie.length;){const oe=ie.codePointAt($)||0;Q[ee++]=oe,$+=oe>65535?2:1}let X=ee;for(let $=1;$<I;++$)Q.copyWithin(X,0,ee),X+=ee;return this.print(Q,0,X),!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 L=0;L<z.length;L++)switch(z.params[L]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(z){for(let L=0;L<z.length;L++)switch(z.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,x.DEFAULT_CHARSET),this._charsetService.setgCharset(1,x.DEFAULT_CHARSET),this._charsetService.setgCharset(2,x.DEFAULT_CHARSET),this._charsetService.setgCharset(3,x.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(z){for(let L=0;L<z.length;L++)switch(z.params[L]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(z){for(let L=0;L<z.length;L++)switch(z.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),z.params[L]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(z,L){const I=this._coreService.decPrivateModes,{activeProtocol:V,activeEncoding:F}=this._coreMouseService,ie=this._coreService,{buffers:Q,cols:ee}=this._bufferService,{active:X,alt:$}=Q,oe=this._optionsService.rawOptions,re=Oe=>Oe?1:2,ve=z.params[0];return be=ve,Le=L?ve===2?4:ve===4?re(ie.modes.insertMode):ve===12?3:ve===20?re(oe.convertEol):0:ve===1?re(I.applicationCursorKeys):ve===3?oe.windowOptions.setWinLines?ee===80?2:ee===132?1:0:0:ve===6?re(I.origin):ve===7?re(I.wraparound):ve===8?3:ve===9?re(V==="X10"):ve===12?re(oe.cursorBlink):ve===25?re(!ie.isCursorHidden):ve===45?re(I.reverseWraparound):ve===66?re(I.applicationKeypad):ve===67?4:ve===1e3?re(V==="VT200"):ve===1002?re(V==="DRAG"):ve===1003?re(V==="ANY"):ve===1004?re(I.sendFocus):ve===1005?4:ve===1006?re(F==="SGR"):ve===1015?4:ve===1016?re(F==="SGR_PIXELS"):ve===1048?1:ve===47||ve===1047||ve===1049?re(X===$):ve===2004?re(I.bracketedPasteMode):0,ie.triggerDataEvent(`${m.C0.ESC}[${L?"":"?"}${be};${Le}$y`),!0;var be,Le}_updateAttrColor(z,L,I,V,F){return L===2?(z|=50331648,z&=-16777216,z|=j.AttributeData.fromColorRGB([I,V,F])):L===5&&(z&=-50331904,z|=33554432|255&I),z}_extractColor(z,L,I){const V=[0,0,-1,0,0,0];let F=0,ie=0;do{if(V[ie+F]=z.params[L+ie],z.hasSubParams(L+ie)){const Q=z.getSubParams(L+ie);let ee=0;do V[1]===5&&(F=1),V[ie+ee+1+F]=Q[ee];while(++ee<Q.length&&ee+ie+1+F<V.length);break}if(V[1]===5&&ie+F>=2||V[1]===2&&ie+F>=5)break;V[1]&&(F=1)}while(++ie+L<z.length&&ie+F<V.length);for(let Q=2;Q<V.length;++Q)V[Q]===-1&&(V[Q]=0);switch(V[0]){case 38:I.fg=this._updateAttrColor(I.fg,V[1],V[3],V[4],V[5]);break;case 48:I.bg=this._updateAttrColor(I.bg,V[1],V[3],V[4],V[5]);break;case 58:I.extended=I.extended.clone(),I.extended.underlineColor=this._updateAttrColor(I.extended.underlineColor,V[1],V[3],V[4],V[5])}return ie}_processUnderline(z,L){L.extended=L.extended.clone(),(!~z||z>5)&&(z=1),L.extended.underlineStyle=z,L.fg|=268435456,z===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(z){z.fg=b.DEFAULT_ATTR_DATA.fg,z.bg=b.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 L=z.length;let I;const V=this._curAttrData;for(let F=0;F<L;F++)I=z.params[F],I>=30&&I<=37?(V.fg&=-50331904,V.fg|=16777216|I-30):I>=40&&I<=47?(V.bg&=-50331904,V.bg|=16777216|I-40):I>=90&&I<=97?(V.fg&=-50331904,V.fg|=16777224|I-90):I>=100&&I<=107?(V.bg&=-50331904,V.bg|=16777224|I-100):I===0?this._processSGR0(V):I===1?V.fg|=134217728:I===3?V.bg|=67108864:I===4?(V.fg|=268435456,this._processUnderline(z.hasSubParams(F)?z.getSubParams(F)[0]:1,V)):I===5?V.fg|=536870912:I===7?V.fg|=67108864:I===8?V.fg|=1073741824:I===9?V.fg|=2147483648:I===2?V.bg|=134217728:I===21?this._processUnderline(2,V):I===22?(V.fg&=-134217729,V.bg&=-134217729):I===23?V.bg&=-67108865:I===24?(V.fg&=-268435457,this._processUnderline(0,V)):I===25?V.fg&=-536870913:I===27?V.fg&=-67108865:I===28?V.fg&=-1073741825:I===29?V.fg&=2147483647:I===39?(V.fg&=-67108864,V.fg|=16777215&b.DEFAULT_ATTR_DATA.fg):I===49?(V.bg&=-67108864,V.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):I===38||I===48||I===58?F+=this._extractColor(z,F,V):I===53?V.bg|=1073741824:I===55?V.bg&=-1073741825:I===59?(V.extended=V.extended.clone(),V.extended.underlineColor=-1,V.updateExtended()):I===100?(V.fg&=-67108864,V.fg|=16777215&b.DEFAULT_ATTR_DATA.fg,V.bg&=-67108864,V.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",I);return!0}deviceStatus(z){switch(z.params[0]){case 5:this._coreService.triggerDataEvent(`${m.C0.ESC}[0n`);break;case 6:const L=this._activeBuffer.y+1,I=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[${L};${I}R`)}return!0}deviceStatusPrivate(z){if(z.params[0]===6){const L=this._activeBuffer.y+1,I=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[?${L};${I}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=b.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 L=z.params[0]||1;switch(L){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const I=L%2==1;return this._optionsService.options.cursorBlink=I,!0}setScrollRegion(z){const L=z.params[0]||1;let I;return(z.length<2||(I=z.params[1])>this._bufferService.rows||I===0)&&(I=this._bufferService.rows),I>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=I-1,this._setCursor(0,0)),!0}windowOptions(z){if(!K(z.params[0],this._optionsService.rawOptions.windowOptions))return!0;const L=z.length>1?z.params[1]:0;switch(z.params[0]){case 14:L!==2&&this._onRequestWindowsOptionsReport.fire(q.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(q.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${m.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(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 L=[],I=z.split(";");for(;I.length>1;){const V=I.shift(),F=I.shift();if(/^\d+$/.exec(V)){const ie=parseInt(V);if(Y(ie))if(F==="?")L.push({type:0,index:ie});else{const Q=(0,B.parseColor)(F);Q&&L.push({type:1,index:ie,color:Q})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(z){const L=z.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(z,L){this._getCurrentLinkId()&&this._finishHyperlink();const I=z.split(":");let V;const F=I.findIndex((ie=>ie.startsWith("id=")));return F!==-1&&(V=I[F].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:V,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(z,L){const I=z.split(";");for(let V=0;V<I.length&&!(L>=this._specialColors.length);++V,++L)if(I[V]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{const F=(0,B.parseColor)(I[V]);F&&this._onColor.fire([{type:1,index:this._specialColors[L],color:F}])}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 L=[],I=z.split(";");for(let V=0;V<I.length;++V)if(/^\d+$/.exec(I[V])){const F=parseInt(I[V]);Y(F)&&L.push({type:2,index:F})}return L.length&&this._onColor.fire(L),!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,x.DEFAULT_CHARSET),!0}selectCharset(z){return z.length!==2?(this.selectDefaultCharset(),!0):(z[0]==="/"||this._charsetService.setgCharset(H[z[0]],x.CHARSETS[z[1]]||x.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const 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=b.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=b.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 L=0;L<this._bufferService.rows;++L){const I=this._activeBuffer.ybase+this._activeBuffer.y+L,V=this._activeBuffer.lines.get(I);V&&(V.fill(z),V.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(z,L){const I=this._bufferService.buffer,V=this._optionsService.rawOptions;return(F=>(this._coreService.triggerDataEvent(`${m.C0.ESC}${F}${m.C0.ESC}\\`),!0))(z==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:z==='"p'?'P1$r61;1"p':z==="r"?`P1$r${I.scrollTop+1};${I.scrollBottom+1}r`:z==="m"?"P1$r0m":z===" q"?`P1$r${{block:2,underline:4,bar:6}[V.cursorStyle]-(V.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(z,L){this._dirtyRowTracker.markRangeDirty(z,L)}}c.InputHandler=U;let M=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&&(R=Z,Z=z,z=R),Z<this.start&&(this.start=Z),z>this.end&&(this.end=z)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function Y(Z){return 0<=Z&&Z<256}M=p([g(0,A.IBufferService)],M)},844:(f,c)=>{function d(p){for(const g of p)g.dispose();p.length=0}Object.defineProperty(c,"__esModule",{value:!0}),c.getDisposeArrayDisposable=c.disposeArray=c.toDisposable=c.MutableDisposable=c.Disposable=void 0,c.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)}},c.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}},c.toDisposable=function(p){return{dispose:p}},c.disposeArray=d,c.getDisposeArrayDisposable=function(p){return{dispose:()=>d(p)}}},1505:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.FourKeyMap=c.TwoKeyMap=void 0;class d{constructor(){this._data={}}set(g,m,x){this._data[g]||(this._data[g]={}),this._data[g][m]=x}get(g,m){return this._data[g]?this._data[g][m]:void 0}clear(){this._data={}}}c.TwoKeyMap=d,c.FourKeyMap=class{constructor(){this._data=new d}set(p,g,m,x,_){this._data.get(p,g)||this._data.set(p,g,new d),this._data.get(p,g).set(m,x,_)}get(p,g,m,x){var _;return(_=this._data.get(p,g))==null?void 0:_.get(m,x)}clear(){this._data.clear()}}},6114:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.isChromeOS=c.isLinux=c.isWindows=c.isIphone=c.isIpad=c.isMac=c.getSafariVersion=c.isSafari=c.isLegacyEdge=c.isFirefox=c.isNode=void 0,c.isNode=typeof process<"u"&&"title"in process;const d=c.isNode?"node":navigator.userAgent,p=c.isNode?"node":navigator.platform;c.isFirefox=d.includes("Firefox"),c.isLegacyEdge=d.includes("Edge"),c.isSafari=/^((?!chrome|android).)*safari/i.test(d),c.getSafariVersion=function(){if(!c.isSafari)return 0;const g=d.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},c.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(p),c.isIpad=p==="iPad",c.isIphone=p==="iPhone",c.isWindows=["Windows","Win16","Win32","WinCE"].includes(p),c.isLinux=p.indexOf("Linux")>=0,c.isChromeOS=/\bCrOS\b/.test(d)},6106:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.SortedList=void 0;let d=0;c.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 x=g+m>>1;const _=this._getKey(this._array[x]);if(_>p)m=x-1;else{if(!(_<p)){for(;x>0&&this._getKey(this._array[x-1])===p;)x--;return x}g=x+1}}return g}}},7226:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DebouncedIdleTask=c.IdleTaskQueue=c.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,b=_.timeRemaining(),v=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),v=_.timeRemaining(),1.5*C>v)return b-k<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(b-k))}ms`),void this._start();b=v}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())}}}c.PriorityTaskQueue=m,c.IdleTaskQueue=!p.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(x){return requestIdleCallback(x)}_cancelCallback(x){cancelIdleCallback(x)}}:m,c.DebouncedIdleTask=class{constructor(){this._queue=new c.IdleTaskQueue}set(x){this._queue.clear(),this._queue.enqueue(x)}flush(){this._queue.flush()}}},9282:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.updateWindowsModeWrappedState=void 0;const p=d(643);c.updateWindowsModeWrappedState=function(g){const m=g.buffer.lines.get(g.buffer.ybase+g.buffer.y-1),x=m==null?void 0:m.get(g.cols-1),_=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);_&&x&&(_.isWrapped=x[p.CHAR_DATA_CODE_INDEX]!==p.NULL_CELL_CODE&&x[p.CHAR_DATA_CODE_INDEX]!==p.WHITESPACE_CELL_CODE)}},3734:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ExtendedAttrs=c.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}}c.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,x=0){this._ext=0,this._urlId=0,this._ext=m,this._urlId=x}clone(){return new p(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}c.ExtendedAttrs=p},9092:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Buffer=c.MAX_BUFFER_SIZE=void 0;const p=d(6349),g=d(7226),m=d(3734),x=d(8437),_=d(4634),k=d(511),C=d(643),b=d(4863),v=d(7116);c.MAX_BUFFER_SIZE=4294967295,c.Buffer=class{constructor(y,S,j){this._hasScrollback=y,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=x.DEFAULT_ATTR_DATA.clone(),this.savedCharset=v.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(y){return y?(this._nullCell.fg=y.fg,this._nullCell.bg=y.bg,this._nullCell.extended=y.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new m.ExtendedAttrs),this._nullCell}getWhitespaceCell(y){return y?(this._whitespaceCell.fg=y.fg,this._whitespaceCell.bg=y.bg,this._whitespaceCell.extended=y.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new m.ExtendedAttrs),this._whitespaceCell}getBlankLine(y,S){return new x.BufferLine(this._bufferService.cols,this.getNullCell(y),S)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const y=this.ybase+this.y-this.ydisp;return y>=0&&y<this._rows}_getCorrectBufferLength(y){if(!this._hasScrollback)return y;const S=y+this._optionsService.rawOptions.scrollback;return S>c.MAX_BUFFER_SIZE?c.MAX_BUFFER_SIZE:S}fillViewportRows(y){if(this.lines.length===0){y===void 0&&(y=x.DEFAULT_ATTR_DATA);let S=this._rows;for(;S--;)this.lines.push(this.getBlankLine(y))}}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(y,S){const j=this.getNullCell(x.DEFAULT_ATTR_DATA);let A=0;const N=this._getCorrectBufferLength(S);if(N>this.lines.maxLength&&(this.lines.maxLength=N),this.lines.length>0){if(this._cols<y)for(let T=0;T<this.lines.length;T++)A+=+this.lines.get(T).resize(y,j);let D=0;if(this._rows<S)for(let T=this._rows;T<S;T++)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 x.BufferLine(y,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 x.BufferLine(y,j)));else for(let T=this._rows;T>S;T--)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 T=this.lines.length-N;T>0&&(this.lines.trimStart(T),this.ybase=Math.max(this.ybase-T,0),this.ydisp=Math.max(this.ydisp-T,0),this.savedY=Math.max(this.savedY-T,0)),this.lines.maxLength=N}this.x=Math.min(this.x,y-1),this.y=Math.min(this.y,S-1),D&&(this.y+=D),this.savedX=Math.min(this.savedX,y-1),this.scrollTop=0}if(this.scrollBottom=S-1,this._isReflowEnabled&&(this._reflow(y,S),this._cols>y))for(let D=0;D<this.lines.length;D++)A+=+this.lines.get(D).resize(y,j);this._cols=y,this._rows=S,this._memoryCleanupQueue.clear(),A>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let y=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,y=!1);let S=0;for(;this._memoryCleanupPosition<this.lines.length;)if(S+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),S>100)return!0;return y}get _isReflowEnabled(){const y=this._optionsService.rawOptions.windowsPty;return y&&y.buildNumber?this._hasScrollback&&y.backend==="conpty"&&y.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(y,S){this._cols!==y&&(y>this._cols?this._reflowLarger(y,S):this._reflowSmaller(y,S))}_reflowLarger(y,S){const j=(0,_.reflowLargerGetLinesToRemove)(this.lines,this._cols,y,this.ybase+this.y,this.getNullCell(x.DEFAULT_ATTR_DATA));if(j.length>0){const A=(0,_.reflowLargerCreateNewLayout)(this.lines,j);(0,_.reflowLargerApplyNewLayout)(this.lines,A.layout),this._reflowLargerAdjustViewport(y,S,A.countRemoved)}}_reflowLargerAdjustViewport(y,S,j){const A=this.getNullCell(x.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 x.BufferLine(y,A))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-j,0)}_reflowSmaller(y,S){const j=this.getNullCell(x.DEFAULT_ATTR_DATA),A=[];let N=0;for(let D=this.lines.length-1;D>=0;D--){let T=this.lines.get(D);if(!T||!T.isWrapped&&T.getTrimmedLength()<=y)continue;const B=[T];for(;T.isWrapped&&D>0;)T=this.lines.get(--D),B.unshift(T);const H=this.ybase+this.y;if(H>=D&&H<D+B.length)continue;const W=B[B.length-1].getTrimmedLength(),K=(0,_.reflowSmallerGetNewLineLengths)(B,this._cols,y),q=K.length-B.length;let R;R=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+q):Math.max(0,this.lines.length-this.lines.maxLength+q);const U=[];for(let I=0;I<q;I++){const V=this.getBlankLine(x.DEFAULT_ATTR_DATA,!0);U.push(V)}U.length>0&&(A.push({start:D+B.length+N,newLines:U}),N+=U.length),B.push(...U);let M=K.length-1,Y=K[M];Y===0&&(M--,Y=K[M]);let Z=B.length-q-1,z=W;for(;Z>=0;){const I=Math.min(z,Y);if(B[M]===void 0)break;if(B[M].copyCellsFrom(B[Z],z-I,Y-I,I,!0),Y-=I,Y===0&&(M--,Y=K[M]),z-=I,z===0){Z--;const V=Math.max(Z,0);z=(0,_.getWrappedLineTrimmedLength)(B,V,this._cols)}}for(let I=0;I<B.length;I++)K[I]<y&&B[I].setCell(K[I],j);let L=q-R;for(;L-- >0;)this.ybase===0?this.y<S-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+N)-S&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+q,this.ybase+S-1)}if(A.length>0){const D=[],T=[];for(let M=0;M<this.lines.length;M++)T.push(this.lines.get(M));const B=this.lines.length;let H=B-1,W=0,K=A[W];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+N);let q=0;for(let M=Math.min(this.lines.maxLength-1,B+N-1);M>=0;M--)if(K&&K.start>H+q){for(let Y=K.newLines.length-1;Y>=0;Y--)this.lines.set(M--,K.newLines[Y]);M++,D.push({index:H+1,amount:K.newLines.length}),q+=K.newLines.length,K=A[++W]}else this.lines.set(M,T[H--]);let R=0;for(let M=D.length-1;M>=0;M--)D[M].index+=R,this.lines.onInsertEmitter.fire(D[M]),R+=D[M].amount;const U=Math.max(0,B+N-this.lines.maxLength);U>0&&this.lines.onTrimEmitter.fire(U)}}translateBufferLineToString(y,S,j=0,A){const N=this.lines.get(y);return N?N.translateToString(S,j,A):""}getWrappedRangeForLine(y){let S=y,j=y;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(y){for(y!=null?this.tabs[y]||(y=this.prevStop(y)):(this.tabs={},y=0);y<this._cols;y+=this._optionsService.rawOptions.tabStopWidth)this.tabs[y]=!0}prevStop(y){for(y==null&&(y=this.x);!this.tabs[--y]&&y>0;);return y>=this._cols?this._cols-1:y<0?0:y}nextStop(y){for(y==null&&(y=this.x);!this.tabs[++y]&&y<this._cols;);return y>=this._cols?this._cols-1:y<0?0:y}clearMarkers(y){this._isClearing=!0;for(let S=0;S<this.markers.length;S++)this.markers[S].line===y&&(this.markers[S].dispose(),this.markers.splice(S--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let y=0;y<this.markers.length;y++)this.markers[y].dispose(),this.markers.splice(y--,1);this._isClearing=!1}addMarker(y){const S=new b.Marker(y);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(y){this._isClearing||this.markers.splice(this.markers.indexOf(y),1)}}},8437:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLine=c.DEFAULT_ATTR_DATA=void 0;const p=d(3734),g=d(511),m=d(643),x=d(482);c.DEFAULT_ATTR_DATA=Object.freeze(new p.AttributeData);let _=0;class k{constructor(b,v,y=!1){this.isWrapped=y,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*b);const S=v||g.CellData.fromCharData([0,m.NULL_CELL_CHAR,m.NULL_CELL_WIDTH,m.NULL_CELL_CODE]);for(let j=0;j<b;++j)this.setCell(j,S);this.length=b}get(b){const v=this._data[3*b+0],y=2097151&v;return[this._data[3*b+1],2097152&v?this._combined[b]:y?(0,x.stringFromCodePoint)(y):"",v>>22,2097152&v?this._combined[b].charCodeAt(this._combined[b].length-1):y]}set(b,v){this._data[3*b+1]=v[m.CHAR_DATA_ATTR_INDEX],v[m.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[b]=v[1],this._data[3*b+0]=2097152|b|v[m.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*b+0]=v[m.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|v[m.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(b){return this._data[3*b+0]>>22}hasWidth(b){return 12582912&this._data[3*b+0]}getFg(b){return this._data[3*b+1]}getBg(b){return this._data[3*b+2]}hasContent(b){return 4194303&this._data[3*b+0]}getCodePoint(b){const v=this._data[3*b+0];return 2097152&v?this._combined[b].charCodeAt(this._combined[b].length-1):2097151&v}isCombined(b){return 2097152&this._data[3*b+0]}getString(b){const v=this._data[3*b+0];return 2097152&v?this._combined[b]:2097151&v?(0,x.stringFromCodePoint)(2097151&v):""}isProtected(b){return 536870912&this._data[3*b+2]}loadCell(b,v){return _=3*b,v.content=this._data[_+0],v.fg=this._data[_+1],v.bg=this._data[_+2],2097152&v.content&&(v.combinedData=this._combined[b]),268435456&v.bg&&(v.extended=this._extendedAttrs[b]),v}setCell(b,v){2097152&v.content&&(this._combined[b]=v.combinedData),268435456&v.bg&&(this._extendedAttrs[b]=v.extended),this._data[3*b+0]=v.content,this._data[3*b+1]=v.fg,this._data[3*b+2]=v.bg}setCellFromCodepoint(b,v,y,S){268435456&S.bg&&(this._extendedAttrs[b]=S.extended),this._data[3*b+0]=v|y<<22,this._data[3*b+1]=S.fg,this._data[3*b+2]=S.bg}addCodepointToCell(b,v,y){let S=this._data[3*b+0];2097152&S?this._combined[b]+=(0,x.stringFromCodePoint)(v):2097151&S?(this._combined[b]=(0,x.stringFromCodePoint)(2097151&S)+(0,x.stringFromCodePoint)(v),S&=-2097152,S|=2097152):S=v|4194304,y&&(S&=-12582913,S|=y<<22),this._data[3*b+0]=S}insertCells(b,v,y){if((b%=this.length)&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,y),v<this.length-b){const S=new g.CellData;for(let j=this.length-b-v-1;j>=0;--j)this.setCell(b+v+j,this.loadCell(b+j,S));for(let j=0;j<v;++j)this.setCell(b+j,y)}else for(let S=b;S<this.length;++S)this.setCell(S,y);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,y)}deleteCells(b,v,y){if(b%=this.length,v<this.length-b){const S=new g.CellData;for(let j=0;j<this.length-b-v;++j)this.setCell(b+j,this.loadCell(b+v+j,S));for(let j=this.length-v;j<this.length;++j)this.setCell(j,y)}else for(let S=b;S<this.length;++S)this.setCell(S,y);b&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,y),this.getWidth(b)!==0||this.hasContent(b)||this.setCellFromCodepoint(b,0,1,y)}replaceCells(b,v,y,S=!1){if(S)for(b&&this.getWidth(b-1)===2&&!this.isProtected(b-1)&&this.setCellFromCodepoint(b-1,0,1,y),v<this.length&&this.getWidth(v-1)===2&&!this.isProtected(v)&&this.setCellFromCodepoint(v,0,1,y);b<v&&b<this.length;)this.isProtected(b)||this.setCell(b,y),b++;else for(b&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,y),v<this.length&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v,0,1,y);b<v&&b<this.length;)this.setCell(b++,y)}resize(b,v){if(b===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const y=3*b;if(b>this.length){if(this._data.buffer.byteLength>=4*y)this._data=new Uint32Array(this._data.buffer,0,y);else{const S=new Uint32Array(y);S.set(this._data),this._data=S}for(let S=this.length;S<b;++S)this.setCell(S,v)}else{this._data=this._data.subarray(0,y);const S=Object.keys(this._combined);for(let A=0;A<S.length;A++){const N=parseInt(S[A],10);N>=b&&delete this._combined[N]}const j=Object.keys(this._extendedAttrs);for(let A=0;A<j.length;A++){const N=parseInt(j[A],10);N>=b&&delete this._extendedAttrs[N]}}return this.length=b,4*y*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const b=new Uint32Array(this._data.length);return b.set(this._data),this._data=b,1}return 0}fill(b,v=!1){if(v)for(let y=0;y<this.length;++y)this.isProtected(y)||this.setCell(y,b);else{this._combined={},this._extendedAttrs={};for(let y=0;y<this.length;++y)this.setCell(y,b)}}copyFrom(b){this.length!==b.length?this._data=new Uint32Array(b._data):this._data.set(b._data),this.length=b.length,this._combined={};for(const v in b._combined)this._combined[v]=b._combined[v];this._extendedAttrs={};for(const v in b._extendedAttrs)this._extendedAttrs[v]=b._extendedAttrs[v];this.isWrapped=b.isWrapped}clone(){const b=new k(0);b._data=new Uint32Array(this._data),b.length=this.length;for(const v in this._combined)b._combined[v]=this._combined[v];for(const v in this._extendedAttrs)b._extendedAttrs[v]=this._extendedAttrs[v];return b.isWrapped=this.isWrapped,b}getTrimmedLength(){for(let b=this.length-1;b>=0;--b)if(4194303&this._data[3*b+0])return b+(this._data[3*b+0]>>22);return 0}getNoBgTrimmedLength(){for(let b=this.length-1;b>=0;--b)if(4194303&this._data[3*b+0]||50331648&this._data[3*b+2])return b+(this._data[3*b+0]>>22);return 0}copyCellsFrom(b,v,y,S,j){const A=b._data;if(j)for(let D=S-1;D>=0;D--){for(let T=0;T<3;T++)this._data[3*(y+D)+T]=A[3*(v+D)+T];268435456&A[3*(v+D)+2]&&(this._extendedAttrs[y+D]=b._extendedAttrs[v+D])}else for(let D=0;D<S;D++){for(let T=0;T<3;T++)this._data[3*(y+D)+T]=A[3*(v+D)+T];268435456&A[3*(v+D)+2]&&(this._extendedAttrs[y+D]=b._extendedAttrs[v+D])}const N=Object.keys(b._combined);for(let D=0;D<N.length;D++){const T=parseInt(N[D],10);T>=v&&(this._combined[T-v+y]=b._combined[T])}}translateToString(b,v,y,S){v=v??0,y=y??this.length,b&&(y=Math.min(y,this.getTrimmedLength())),S&&(S.length=0);let j="";for(;v<y;){const A=this._data[3*v+0],N=2097151&A,D=2097152&A?this._combined[v]:N?(0,x.stringFromCodePoint)(N):m.WHITESPACE_CELL_CHAR;if(j+=D,S)for(let T=0;T<D.length;++T)S.push(v);v+=A>>22||1}return S&&S.push(v),j}}c.BufferLine=k},4841:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.getRangeLength=void 0,c.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,c)=>{function d(p,g,m){if(g===p.length-1)return p[g].getTrimmedLength();const x=!p[g].hasContent(m-1)&&p[g].getWidth(m-1)===1,_=p[g+1].getWidth(0)===2;return x&&_?m-1:m}Object.defineProperty(c,"__esModule",{value:!0}),c.getWrappedLineTrimmedLength=c.reflowSmallerGetNewLineLengths=c.reflowLargerApplyNewLayout=c.reflowLargerCreateNewLayout=c.reflowLargerGetLinesToRemove=void 0,c.reflowLargerGetLinesToRemove=function(p,g,m,x,_){const k=[];for(let C=0;C<p.length-1;C++){let b=C,v=p.get(++b);if(!v.isWrapped)continue;const y=[p.get(C)];for(;b<p.length&&v.isWrapped;)y.push(v),v=p.get(++b);if(x>=C&&x<b){C+=y.length-1;continue}let S=0,j=d(y,S,g),A=1,N=0;for(;A<y.length;){const T=d(y,A,g),B=T-N,H=m-j,W=Math.min(B,H);y[S].copyCellsFrom(y[A],N,j,W,!1),j+=W,j===m&&(S++,j=0),N+=W,N===T&&(A++,N=0),j===0&&S!==0&&y[S-1].getWidth(m-1)===2&&(y[S].copyCellsFrom(y[S-1],m-1,j++,1,!1),y[S-1].setCell(m-1,_))}y[S].replaceCells(j,m,_);let D=0;for(let T=y.length-1;T>0&&(T>S||y[T].getTrimmedLength()===0);T--)D++;D>0&&(k.push(C+y.length-D),k.push(D)),C+=y.length-1}return k},c.reflowLargerCreateNewLayout=function(p,g){const m=[];let x=0,_=g[x],k=0;for(let C=0;C<p.length;C++)if(_===C){const b=g[++x];p.onDeleteEmitter.fire({index:C-k,amount:b}),C+=b-1,k+=b,_=g[++x]}else m.push(C);return{layout:m,countRemoved:k}},c.reflowLargerApplyNewLayout=function(p,g){const m=[];for(let x=0;x<g.length;x++)m.push(p.get(g[x]));for(let x=0;x<m.length;x++)p.set(x,m[x]);p.length=g.length},c.reflowSmallerGetNewLineLengths=function(p,g,m){const x=[],_=p.map(((v,y)=>d(p,y,g))).reduce(((v,y)=>v+y));let k=0,C=0,b=0;for(;b<_;){if(_-b<m){x.push(_-b);break}k+=m;const v=d(p,C,g);k>v&&(k-=v,C++);const y=p[C].getWidth(k-1)===2;y&&k--;const S=y?m-1:m;x.push(S),b+=S}return x},c.getWrappedLineTrimmedLength=d},5295:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferSet=void 0;const p=d(8460),g=d(844),m=d(9092);class x 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)}}c.BufferSet=x},511:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CellData=void 0;const p=d(482),g=d(643),m=d(3734);class x 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 x;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 b=k[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=b&&b<=56319){const v=k[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=v&&v<=57343?this.content=1024*(b-55296)+v-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()]}}c.CellData=x},643:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WHITESPACE_CELL_CODE=c.WHITESPACE_CELL_WIDTH=c.WHITESPACE_CELL_CHAR=c.NULL_CELL_CODE=c.NULL_CELL_WIDTH=c.NULL_CELL_CHAR=c.CHAR_DATA_CODE_INDEX=c.CHAR_DATA_WIDTH_INDEX=c.CHAR_DATA_CHAR_INDEX=c.CHAR_DATA_ATTR_INDEX=c.DEFAULT_EXT=c.DEFAULT_ATTR=c.DEFAULT_COLOR=void 0,c.DEFAULT_COLOR=0,c.DEFAULT_ATTR=256|c.DEFAULT_COLOR<<9,c.DEFAULT_EXT=0,c.CHAR_DATA_ATTR_INDEX=0,c.CHAR_DATA_CHAR_INDEX=1,c.CHAR_DATA_WIDTH_INDEX=2,c.CHAR_DATA_CODE_INDEX=3,c.NULL_CELL_CHAR="",c.NULL_CELL_WIDTH=1,c.NULL_CELL_CODE=0,c.WHITESPACE_CELL_CHAR=" ",c.WHITESPACE_CELL_WIDTH=1,c.WHITESPACE_CELL_CODE=32},4863:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.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(_),_}}c.Marker=m,m._nextId=1},7116:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DEFAULT_CHARSET=c.CHARSETS=void 0,c.CHARSETS={},c.DEFAULT_CHARSET=c.CHARSETS.B,c.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:"≥","{":"π","|":"≠","}":"£","~":"·"},c.CHARSETS.A={"#":"£"},c.CHARSETS.B=void 0,c.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},c.CHARSETS.C=c.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},c.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},c.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},c.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},c.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},c.CHARSETS.E=c.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},c.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},c.CHARSETS.H=c.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},c.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(f,c)=>{var d,p,g;Object.defineProperty(c,"__esModule",{value:!0}),c.C1_ESCAPED=c.C1=c.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||(c.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||(c.C1=p={})),(function(m){m.ST=`${d.ESC}\\`})(g||(c.C1_ESCAPED=g={}))},7399:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.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:["'",'"']};c.evaluateKeyboardEvent=function(m,x,_,k){const C={type:0,cancel:!1,key:void 0},b=(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=x?p.C0.ESC+"OA":p.C0.ESC+"[A":m.key==="UIKeyInputLeftArrow"?C.key=x?p.C0.ESC+"OD":p.C0.ESC+"[D":m.key==="UIKeyInputRightArrow"?C.key=x?p.C0.ESC+"OC":p.C0.ESC+"[C":m.key==="UIKeyInputDownArrow"&&(C.key=x?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;b?(C.key=p.C0.ESC+"[1;"+(b+1)+"D",C.key===p.C0.ESC+"[1;3D"&&(C.key=p.C0.ESC+(_?"b":"[1;5D"))):C.key=x?p.C0.ESC+"OD":p.C0.ESC+"[D";break;case 39:if(m.metaKey)break;b?(C.key=p.C0.ESC+"[1;"+(b+1)+"C",C.key===p.C0.ESC+"[1;3C"&&(C.key=p.C0.ESC+(_?"f":"[1;5C"))):C.key=x?p.C0.ESC+"OC":p.C0.ESC+"[C";break;case 38:if(m.metaKey)break;b?(C.key=p.C0.ESC+"[1;"+(b+1)+"A",_||C.key!==p.C0.ESC+"[1;3A"||(C.key=p.C0.ESC+"[1;5A")):C.key=x?p.C0.ESC+"OA":p.C0.ESC+"[A";break;case 40:if(m.metaKey)break;b?(C.key=p.C0.ESC+"[1;"+(b+1)+"B",_||C.key!==p.C0.ESC+"[1;3B"||(C.key=p.C0.ESC+"[1;5B")):C.key=x?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=b?p.C0.ESC+"[3;"+(b+1)+"~":p.C0.ESC+"[3~";break;case 36:C.key=b?p.C0.ESC+"[1;"+(b+1)+"H":x?p.C0.ESC+"OH":p.C0.ESC+"[H";break;case 35:C.key=b?p.C0.ESC+"[1;"+(b+1)+"F":x?p.C0.ESC+"OF":p.C0.ESC+"[F";break;case 33:m.shiftKey?C.type=2:m.ctrlKey?C.key=p.C0.ESC+"[5;"+(b+1)+"~":C.key=p.C0.ESC+"[5~";break;case 34:m.shiftKey?C.type=3:m.ctrlKey?C.key=p.C0.ESC+"[6;"+(b+1)+"~":C.key=p.C0.ESC+"[6~";break;case 112:C.key=b?p.C0.ESC+"[1;"+(b+1)+"P":p.C0.ESC+"OP";break;case 113:C.key=b?p.C0.ESC+"[1;"+(b+1)+"Q":p.C0.ESC+"OQ";break;case 114:C.key=b?p.C0.ESC+"[1;"+(b+1)+"R":p.C0.ESC+"OR";break;case 115:C.key=b?p.C0.ESC+"[1;"+(b+1)+"S":p.C0.ESC+"OS";break;case 116:C.key=b?p.C0.ESC+"[15;"+(b+1)+"~":p.C0.ESC+"[15~";break;case 117:C.key=b?p.C0.ESC+"[17;"+(b+1)+"~":p.C0.ESC+"[17~";break;case 118:C.key=b?p.C0.ESC+"[18;"+(b+1)+"~":p.C0.ESC+"[18~";break;case 119:C.key=b?p.C0.ESC+"[19;"+(b+1)+"~":p.C0.ESC+"[19~";break;case 120:C.key=b?p.C0.ESC+"[20;"+(b+1)+"~":p.C0.ESC+"[20~";break;case 121:C.key=b?p.C0.ESC+"[21;"+(b+1)+"~":p.C0.ESC+"[21~";break;case 122:C.key=b?p.C0.ESC+"[23;"+(b+1)+"~":p.C0.ESC+"[23~";break;case 123:C.key=b?p.C0.ESC+"[24;"+(b+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 v=g[m.keyCode],y=v==null?void 0:v[m.shiftKey?1:0];if(y)C.key=p.C0.ESC+y;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,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Utf8ToUtf32=c.StringToUtf32=c.utf32ToString=c.stringFromCodePoint=void 0,c.stringFromCodePoint=function(d){return d>65535?(d-=65536,String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):String.fromCharCode(d)},c.utf32ToString=function(d,p=0,g=d.length){let m="";for(let x=p;x<g;++x){let _=d[x];_>65535?(_-=65536,m+=String.fromCharCode(55296+(_>>10))+String.fromCharCode(_%1024+56320)):m+=String.fromCharCode(_)}return m},c.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(d,p){const g=d.length;if(!g)return 0;let m=0,x=0;if(this._interim){const _=d.charCodeAt(x++);56320<=_&&_<=57343?p[m++]=1024*(this._interim-55296)+_-56320+65536:(p[m++]=this._interim,p[m++]=_),this._interim=0}for(let _=x;_<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}},c.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,x,_,k,C=0,b=0,v=0;if(this.interim[0]){let j=!1,A=this.interim[0];A&=(224&A)==192?31:(240&A)==224?15:7;let N,D=0;for(;(N=63&this.interim[++D])&&D<4;)A<<=6,A|=N;const T=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,B=T-D;for(;v<B;){if(v>=g)return 0;if(N=d[v++],(192&N)!=128){v--,j=!0;break}this.interim[D++]=N,A<<=6,A|=63&N}j||(T===2?A<128?v--:p[C++]=A:T===3?A<2048||A>=55296&&A<=57343||A===65279||(p[C++]=A):A<65536||A>1114111||(p[C++]=A)),this.interim.fill(0)}const y=g-4;let S=v;for(;S<g;){for(;!(!(S<y)||128&(m=d[S])||128&(x=d[S+1])||128&(_=d[S+2])||128&(k=d[S+3]));)p[C++]=m,p[C++]=x,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(x=d[S++],(192&x)!=128){S--;continue}if(b=(31&m)<<6|63&x,b<128){S--;continue}p[C++]=b}else if((240&m)==224){if(S>=g)return this.interim[0]=m,C;if(x=d[S++],(192&x)!=128){S--;continue}if(S>=g)return this.interim[0]=m,this.interim[1]=x,C;if(_=d[S++],(192&_)!=128){S--;continue}if(b=(15&m)<<12|(63&x)<<6|63&_,b<2048||b>=55296&&b<=57343||b===65279)continue;p[C++]=b}else if((248&m)==240){if(S>=g)return this.interim[0]=m,C;if(x=d[S++],(192&x)!=128){S--;continue}if(S>=g)return this.interim[0]=m,this.interim[1]=x,C;if(_=d[S++],(192&_)!=128){S--;continue}if(S>=g)return this.interim[0]=m,this.interim[1]=x,this.interim[2]=_,C;if(k=d[S++],(192&k)!=128){S--;continue}if(b=(7&m)<<18|(63&x)<<12|(63&_)<<6|63&k,b<65536||b>1114111)continue;p[C++]=b}}return C}}},225:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.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 x;c.UnicodeV6=class{constructor(){if(this.version="6",!x){x=new Uint8Array(65536),x.fill(1),x[0]=0,x.fill(0,1,32),x.fill(0,127,160),x.fill(2,4352,4448),x[9001]=2,x[9002]=2,x.fill(2,11904,42192),x[12351]=1,x.fill(2,44032,55204),x.fill(2,63744,64256),x.fill(2,65040,65050),x.fill(2,65072,65136),x.fill(2,65280,65377),x.fill(2,65504,65511);for(let _=0;_<g.length;++_)x.fill(0,g[_][0],g[_][1]+1)}}wcwidth(_){return _<32?0:_<127?1:_<65536?x[_]:(function(k,C){let b,v=0,y=C.length-1;if(k<C[0][0]||k>C[y][1])return!1;for(;y>=v;)if(b=v+y>>1,k>C[b][1])v=b+1;else{if(!(k<C[b][0]))return!0;y=b-1}return!1})(_,m)?0:_>=131072&&_<=196605||_>=196608&&_<=262141?2:1}charProperties(_,k){let C=this.wcwidth(_),b=C===0&&k!==0;if(b){const v=p.UnicodeService.extractWidth(k);v===0?b=!1:v>C&&(C=v)}return p.UnicodeService.createPropertyValue(0,C,b)}}},5981:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.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 b=this._callbacks.shift();b&&b()}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 b=this._writeBuffer[this._bufferOffset],v=this._action(b,k);if(v){const S=j=>Date.now()-C>=12?setTimeout((()=>this._innerWrite(0,j))):this._innerWrite(C,j);return void v.catch((j=>(queueMicrotask((()=>{throw j})),Promise.resolve(!1)))).then(S)}const y=this._callbacks[this._bufferOffset];if(y&&y(),this._bufferOffset++,this._pendingData-=b.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()}}c.WriteBuffer=m},5941:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.toRgbString=c.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,x){const _=m.toString(16),k=_.length<2?"0"+_:_;switch(x){case 4:return _[0];case 8:return k;case 12:return(k+k).slice(0,3);default:return k+k}}c.parseColor=function(m){if(!m)return;let x=m.toLowerCase();if(x.indexOf("rgb:")===0){x=x.slice(4);const _=d.exec(x);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(x.indexOf("#")===0&&(x=x.slice(1),p.exec(x)&&[3,6,9,12].includes(x.length))){const _=x.length/3,k=[0,0,0];for(let C=0;C<3;++C){const b=parseInt(x.slice(_*C,_*C+_),16);k[C]=_===1?b<<4:_===2?b:_===3?b>>4:b>>8}return k}},c.toRgbString=function(m,x=16){const[_,k,C]=m;return`rgb:${g(_,x)}/${g(k,x)}/${g(C,x)}`}},5770:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.PAYLOAD_LIMIT=void 0,c.PAYLOAD_LIMIT=1e7},6351:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DcsHandler=c.DcsParser=void 0;const p=d(482),g=d(8742),m=d(5770),x=[];c.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=x,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=x}registerHandler(k,C){this._handlers[k]===void 0&&(this._handlers[k]=[]);const b=this._handlers[k];return b.push(C),{dispose:()=>{const v=b.indexOf(C);v!==-1&&b.splice(v,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=x,this._ident=0}hook(k,C){if(this.reset(),this._ident=k,this._active=this._handlers[k]||x,this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].hook(C);else this._handlerFb(this._ident,"HOOK",C)}put(k,C,b){if(this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].put(k,C,b);else this._handlerFb(this._ident,"PUT",(0,p.utf32ToString)(k,C,b))}unhook(k,C=!0){if(this._active.length){let b=!1,v=this._active.length-1,y=!1;if(this._stack.paused&&(v=this._stack.loopPosition-1,b=C,y=this._stack.fallThrough,this._stack.paused=!1),!y&&b===!1){for(;v>=0&&(b=this._active[v].unhook(k),b!==!0);v--)if(b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=v,this._stack.fallThrough=!1,b;v--}for(;v>=0;v--)if(b=this._active[v].unhook(!1),b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=v,this._stack.fallThrough=!0,b}else this._handlerFb(this._ident,"UNHOOK",k);this._active=x,this._ident=0}};const _=new g.Params;_.addParam(0),c.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,b){this._hitLimit||(this._data+=(0,p.utf32ToString)(k,C,b),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((b=>(this._params=_,this._data="",this._hitLimit=!1,b)));return this._params=_,this._data="",this._hitLimit=!1,C}}},2015:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.EscapeSequenceParser=c.VT500_TRANSITION_TABLE=c.TransitionTable=void 0;const p=d(844),g=d(8742),m=d(6242),x=d(6351);class _{constructor(v){this.table=new Uint8Array(v)}setDefault(v,y){this.table.fill(v<<4|y)}add(v,y,S,j){this.table[y<<8|v]=S<<4|j}addMany(v,y,S,j){for(let A=0;A<v.length;A++)this.table[y<<8|v[A]]=S<<4|j}}c.TransitionTable=_;const k=160;c.VT500_TRANSITION_TABLE=(function(){const b=new _(4095),v=Array.apply(null,Array(256)).map(((D,T)=>T)),y=(D,T)=>v.slice(D,T),S=y(32,127),j=y(0,24);j.push(25),j.push.apply(j,y(28,32));const A=y(0,14);let N;for(N in b.setDefault(1,0),b.addMany(S,0,2,0),A)b.addMany([24,26,153,154],N,3,0),b.addMany(y(128,144),N,3,0),b.addMany(y(144,152),N,3,0),b.add(156,N,0,0),b.add(27,N,11,1),b.add(157,N,4,8),b.addMany([152,158,159],N,0,7),b.add(155,N,11,3),b.add(144,N,11,9);return b.addMany(j,0,3,0),b.addMany(j,1,3,1),b.add(127,1,0,1),b.addMany(j,8,0,8),b.addMany(j,3,3,3),b.add(127,3,0,3),b.addMany(j,4,3,4),b.add(127,4,0,4),b.addMany(j,6,3,6),b.addMany(j,5,3,5),b.add(127,5,0,5),b.addMany(j,2,3,2),b.add(127,2,0,2),b.add(93,1,4,8),b.addMany(S,8,5,8),b.add(127,8,5,8),b.addMany([156,27,24,26,7],8,6,0),b.addMany(y(28,32),8,0,8),b.addMany([88,94,95],1,0,7),b.addMany(S,7,0,7),b.addMany(j,7,0,7),b.add(156,7,0,0),b.add(127,7,0,7),b.add(91,1,11,3),b.addMany(y(64,127),3,7,0),b.addMany(y(48,60),3,8,4),b.addMany([60,61,62,63],3,9,4),b.addMany(y(48,60),4,8,4),b.addMany(y(64,127),4,7,0),b.addMany([60,61,62,63],4,0,6),b.addMany(y(32,64),6,0,6),b.add(127,6,0,6),b.addMany(y(64,127),6,0,0),b.addMany(y(32,48),3,9,5),b.addMany(y(32,48),5,9,5),b.addMany(y(48,64),5,0,6),b.addMany(y(64,127),5,7,0),b.addMany(y(32,48),4,9,5),b.addMany(y(32,48),1,9,2),b.addMany(y(32,48),2,9,2),b.addMany(y(48,127),2,10,0),b.addMany(y(48,80),1,10,0),b.addMany(y(81,88),1,10,0),b.addMany([89,90,92],1,10,0),b.addMany(y(96,127),1,10,0),b.add(80,1,11,9),b.addMany(j,9,0,9),b.add(127,9,0,9),b.addMany(y(28,32),9,0,9),b.addMany(y(32,48),9,9,12),b.addMany(y(48,60),9,8,10),b.addMany([60,61,62,63],9,9,10),b.addMany(j,11,0,11),b.addMany(y(32,128),11,0,11),b.addMany(y(28,32),11,0,11),b.addMany(j,10,0,10),b.add(127,10,0,10),b.addMany(y(28,32),10,0,10),b.addMany(y(48,60),10,8,10),b.addMany([60,61,62,63],10,0,11),b.addMany(y(32,48),10,9,12),b.addMany(j,12,0,12),b.add(127,12,0,12),b.addMany(y(28,32),12,0,12),b.addMany(y(32,48),12,9,12),b.addMany(y(48,64),12,0,11),b.addMany(y(64,127),12,12,13),b.addMany(y(64,127),10,12,13),b.addMany(y(64,127),9,12,13),b.addMany(j,13,13,13),b.addMany(S,13,13,13),b.add(127,13,0,13),b.addMany([27,156,24,26],13,14,0),b.add(k,0,2,0),b.add(k,8,5,8),b.add(k,6,0,6),b.add(k,11,0,11),b.add(k,13,13,13),b})();class C extends p.Disposable{constructor(v=c.VT500_TRANSITION_TABLE){super(),this._transitions=v,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new g.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(y,S,j)=>{},this._executeHandlerFb=y=>{},this._csiHandlerFb=(y,S)=>{},this._escHandlerFb=y=>{},this._errorHandlerFb=y=>y,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 x.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(v,y=[64,126]){let S=0;if(v.prefix){if(v.prefix.length>1)throw new Error("only one byte as prefix supported");if(S=v.prefix.charCodeAt(0),S&&60>S||S>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(v.intermediates){if(v.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let A=0;A<v.intermediates.length;++A){const N=v.intermediates.charCodeAt(A);if(32>N||N>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");S<<=8,S|=N}}if(v.final.length!==1)throw new Error("final must be a single byte");const j=v.final.charCodeAt(0);if(y[0]>j||j>y[1])throw new Error(`final must be in range ${y[0]} .. ${y[1]}`);return S<<=8,S|=j,S}identToString(v){const y=[];for(;v;)y.push(String.fromCharCode(255&v)),v>>=8;return y.reverse().join("")}setPrintHandler(v){this._printHandler=v}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(v,y){const S=this._identifier(v,[48,126]);this._escHandlers[S]===void 0&&(this._escHandlers[S]=[]);const j=this._escHandlers[S];return j.push(y),{dispose:()=>{const A=j.indexOf(y);A!==-1&&j.splice(A,1)}}}clearEscHandler(v){this._escHandlers[this._identifier(v,[48,126])]&&delete this._escHandlers[this._identifier(v,[48,126])]}setEscHandlerFallback(v){this._escHandlerFb=v}setExecuteHandler(v,y){this._executeHandlers[v.charCodeAt(0)]=y}clearExecuteHandler(v){this._executeHandlers[v.charCodeAt(0)]&&delete this._executeHandlers[v.charCodeAt(0)]}setExecuteHandlerFallback(v){this._executeHandlerFb=v}registerCsiHandler(v,y){const S=this._identifier(v);this._csiHandlers[S]===void 0&&(this._csiHandlers[S]=[]);const j=this._csiHandlers[S];return j.push(y),{dispose:()=>{const A=j.indexOf(y);A!==-1&&j.splice(A,1)}}}clearCsiHandler(v){this._csiHandlers[this._identifier(v)]&&delete this._csiHandlers[this._identifier(v)]}setCsiHandlerFallback(v){this._csiHandlerFb=v}registerDcsHandler(v,y){return this._dcsParser.registerHandler(this._identifier(v),y)}clearDcsHandler(v){this._dcsParser.clearHandler(this._identifier(v))}setDcsHandlerFallback(v){this._dcsParser.setHandlerFallback(v)}registerOscHandler(v,y){return this._oscParser.registerHandler(v,y)}clearOscHandler(v){this._oscParser.clearHandler(v)}setOscHandlerFallback(v){this._oscParser.setHandlerFallback(v)}setErrorHandler(v){this._errorHandler=v}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(v,y,S,j,A){this._parseStack.state=v,this._parseStack.handlers=y,this._parseStack.handlerPos=S,this._parseStack.transition=j,this._parseStack.chunkPos=A}parse(v,y,S){let j,A=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 T=this._parseStack.handlers;let B=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(S===!1&&B>-1){for(;B>=0&&(j=T[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=T[B](),j!==!0);B--)if(j instanceof Promise)return this._parseStack.handlerPos=B,j}this._parseStack.handlers=[];break;case 6:if(A=v[this._parseStack.chunkPos],j=this._dcsParser.unhook(A!==24&&A!==26,S),j)return j;A===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(A=v[this._parseStack.chunkPos],j=this._oscParser.end(A!==24&&A!==26,S),j)return j;A===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 T=D;T<y;++T){switch(A=v[T],N=this._transitions.table[this.currentState<<8|(A<160?A:k)],N>>4){case 2:for(let q=T+1;;++q){if(q>=y||(A=v[q])<32||A>126&&A<k){this._printHandler(v,T,q),T=q-1;break}if(++q>=y||(A=v[q])<32||A>126&&A<k){this._printHandler(v,T,q),T=q-1;break}if(++q>=y||(A=v[q])<32||A>126&&A<k){this._printHandler(v,T,q),T=q-1;break}if(++q>=y||(A=v[q])<32||A>126&&A<k){this._printHandler(v,T,q),T=q-1;break}}break;case 3:this._executeHandlers[A]?this._executeHandlers[A]():this._executeHandlerFb(A),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:T,code:A,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const B=this._csiHandlers[this._collect<<8|A];let H=B?B.length-1:-1;for(;H>=0&&(j=B[H](this._params),j!==!0);H--)if(j instanceof Promise)return this._preserveStack(3,B,H,N,T),j;H<0&&this._csiHandlerFb(this._collect<<8|A,this._params),this.precedingJoinState=0;break;case 8:do switch(A){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(A-48)}while(++T<y&&(A=v[T])>47&&A<60);T--;break;case 9:this._collect<<=8,this._collect|=A;break;case 10:const W=this._escHandlers[this._collect<<8|A];let K=W?W.length-1:-1;for(;K>=0&&(j=W[K](),j!==!0);K--)if(j instanceof Promise)return this._preserveStack(4,W,K,N,T),j;K<0&&this._escHandlerFb(this._collect<<8|A),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|A,this._params);break;case 13:for(let q=T+1;;++q)if(q>=y||(A=v[q])===24||A===26||A===27||A>127&&A<k){this._dcsParser.put(v,T,q),T=q-1;break}break;case 14:if(j=this._dcsParser.unhook(A!==24&&A!==26),j)return this._preserveStack(6,[],0,N,T),j;A===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 q=T+1;;q++)if(q>=y||(A=v[q])<32||A>127&&A<k){this._oscParser.put(v,T,q),T=q-1;break}break;case 6:if(j=this._oscParser.end(A!==24&&A!==26),j)return this._preserveStack(5,[],0,N,T),j;A===27&&(N|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&N}}}c.EscapeSequenceParser=C},6242:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OscHandler=c.OscParser=void 0;const p=d(5770),g=d(482),m=[];c.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(x,_){this._handlers[x]===void 0&&(this._handlers[x]=[]);const k=this._handlers[x];return k.push(_),{dispose:()=>{const C=k.indexOf(_);C!==-1&&k.splice(C,1)}}}clearHandler(x){this._handlers[x]&&delete this._handlers[x]}setHandlerFallback(x){this._handlerFb=x}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=m}reset(){if(this._state===2)for(let x=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;x>=0;--x)this._active[x].end(!1);this._stack.paused=!1,this._active=m,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||m,this._active.length)for(let x=this._active.length-1;x>=0;x--)this._active[x].start();else this._handlerFb(this._id,"START")}_put(x,_,k){if(this._active.length)for(let C=this._active.length-1;C>=0;C--)this._active[C].put(x,_,k);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(x,_,k))}start(){this.reset(),this._state=1}put(x,_,k){if(this._state!==3){if(this._state===1)for(;_<k;){const C=x[_++];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(x,_,k)}}end(x,_=!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,b=!1;if(this._stack.paused&&(C=this._stack.loopPosition-1,k=_,b=this._stack.fallThrough,this._stack.paused=!1),!b&&k===!1){for(;C>=0&&(k=this._active[C].end(x),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",x);this._active=m,this._id=-1,this._state=0}}},c.OscHandler=class{constructor(x){this._handler=x,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(x,_,k){this._hitLimit||(this._data+=(0,g.utf32ToString)(x,_,k),this._data.length>p.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(x){let _=!1;if(this._hitLimit)_=!1;else if(x&&(_=this._handler(this._data),_ instanceof Promise))return _.then((k=>(this._data="",this._hitLimit=!1,k)));return this._data="",this._hitLimit=!1,_}}},8742:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Params=void 0;const d=2147483647;class p{static fromArray(m){const x=new p;if(!m.length)return x;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)x.addSubParam(k[C]);else x.addParam(k)}return x}constructor(m=32,x=32){if(this.maxLength=m,this.maxSubParamsLength=x,x>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(m),this.length=0,this._subParams=new Int32Array(x),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 x=0;x<this.length;++x){m.push(this.params[x]);const _=this._subParamsIdx[x]>>8,k=255&this._subParamsIdx[x];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 x=this._subParamsIdx[m]>>8,_=255&this._subParamsIdx[m];return _-x>0?this._subParams.subarray(x,_):null}getSubParamsAll(){const m={};for(let x=0;x<this.length;++x){const _=this._subParamsIdx[x]>>8,k=255&this._subParamsIdx[x];k-_>0&&(m[x]=this._subParams.slice(_,k))}return m}addDigit(m){let x;if(this._rejectDigits||!(x=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const _=this._digitIsSub?this._subParams:this.params,k=_[x-1];_[x-1]=~k?Math.min(10*k+m,d):m}}c.Params=p},5741:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.AddonManager=void 0,c.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,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferApiView=void 0;const p=d(3785),g=d(511);c.BufferApiView=class{constructor(m,x){this._buffer=m,this.type=x}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 x=this._buffer.lines.get(m);if(x)return new p.BufferLineApiView(x)}getNullCell(){return new g.CellData}}},3785:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLineApiView=void 0;const p=d(511);c.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,x){return this._line.translateToString(g,m,x)}}},8285:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferNamespaceApi=void 0;const p=d(8771),g=d(8460),m=d(844);class x 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)}}c.BufferNamespaceApi=x},7975:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ParserApi=void 0,c.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,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeApi=void 0,c.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,c,d){var p=this&&this.__decorate||function(b,v,y,S){var j,A=arguments.length,N=A<3?v:S===null?S=Object.getOwnPropertyDescriptor(v,y):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,v,y,S);else for(var D=b.length-1;D>=0;D--)(j=b[D])&&(N=(A<3?j(N):A>3?j(v,y,N):j(v,y))||N);return A>3&&N&&Object.defineProperty(v,y,N),N},g=this&&this.__param||function(b,v){return function(y,S){v(y,S,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferService=c.MINIMUM_ROWS=c.MINIMUM_COLS=void 0;const m=d(8460),x=d(844),_=d(5295),k=d(2585);c.MINIMUM_COLS=2,c.MINIMUM_ROWS=1;let C=c.BufferService=class extends x.Disposable{get buffer(){return this.buffers.active}constructor(b){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(b.rawOptions.cols||0,c.MINIMUM_COLS),this.rows=Math.max(b.rawOptions.rows||0,c.MINIMUM_ROWS),this.buffers=this.register(new _.BufferSet(b,this))}resize(b,v){this.cols=b,this.rows=v,this.buffers.resize(b,v),this._onResize.fire({cols:b,rows:v})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(b,v=!1){const y=this.buffer;let S;S=this._cachedBlankLine,S&&S.length===this.cols&&S.getFg(0)===b.fg&&S.getBg(0)===b.bg||(S=y.getBlankLine(b,v),this._cachedBlankLine=S),S.isWrapped=v;const j=y.ybase+y.scrollTop,A=y.ybase+y.scrollBottom;if(y.scrollTop===0){const N=y.lines.isFull;A===y.lines.length-1?N?y.lines.recycle().copyFrom(S):y.lines.push(S.clone()):y.lines.splice(A+1,0,S.clone()),N?this.isUserScrolling&&(y.ydisp=Math.max(y.ydisp-1,0)):(y.ybase++,this.isUserScrolling||y.ydisp++)}else{const N=A-j+1;y.lines.shiftElements(j+1,N-1,-1),y.lines.set(A,S.clone())}this.isUserScrolling||(y.ydisp=y.ybase),this._onScroll.fire(y.ydisp)}scrollLines(b,v,y){const S=this.buffer;if(b<0){if(S.ydisp===0)return;this.isUserScrolling=!0}else b+S.ydisp>=S.ybase&&(this.isUserScrolling=!1);const j=S.ydisp;S.ydisp=Math.max(Math.min(S.ydisp+b,S.ybase),0),j!==S.ydisp&&(v||this._onScroll.fire(S.ydisp))}};c.BufferService=C=p([g(0,k.IOptionsService)],C)},7994:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CharsetService=void 0,c.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,c,d){var p=this&&this.__decorate||function(S,j,A,N){var D,T=arguments.length,B=T<3?j:N===null?N=Object.getOwnPropertyDescriptor(j,A):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(S,j,A,N);else for(var H=S.length-1;H>=0;H--)(D=S[H])&&(B=(T<3?D(B):T>3?D(j,A,B):D(j,A))||B);return T>3&&B&&Object.defineProperty(j,A,B),B},g=this&&this.__param||function(S,j){return function(A,N){j(A,N,S)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreMouseService=void 0;const m=d(2585),x=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 A=(S.ctrl?16:0)|(S.shift?4:0)|(S.alt?8:0);return S.button===4?(A|=64,A|=S.action):(A|=3&S.button,4&S.button&&(A|=64),8&S.button&&(A|=128),S.action===32?A|=32:S.action!==0||j||(A|=3)),A}const b=String.fromCharCode,v={DEFAULT:S=>{const j=[C(S,!1)+32,S.col+32,S.row+32];return j[0]>255||j[1]>255||j[2]>255?"":`\x1B[M${b(j[0])}${b(j[1])}${b(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 y=c.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 x.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const A of Object.keys(k))this.addProtocol(A,k[A]);for(const A of Object.keys(v))this.addEncoding(A,v[A]);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,A){if(A){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}};c.CoreMouseService=y=p([g(0,m.IBufferService),g(1,m.ICoreService)],y)},6975:function(f,c,d){var p=this&&this.__decorate||function(y,S,j,A){var N,D=arguments.length,T=D<3?S:A===null?A=Object.getOwnPropertyDescriptor(S,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(y,S,j,A);else for(var B=y.length-1;B>=0;B--)(N=y[B])&&(T=(D<3?N(T):D>3?N(S,j,T):N(S,j))||T);return D>3&&T&&Object.defineProperty(S,j,T),T},g=this&&this.__param||function(y,S){return function(j,A){S(j,A,y)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreService=void 0;const m=d(1439),x=d(8460),_=d(844),k=d(2585),C=Object.freeze({insertMode:!1}),b=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let v=c.CoreService=class extends _.Disposable{constructor(y,S,j){super(),this._bufferService=y,this._logService=S,this._optionsService=j,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new x.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new x.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new x.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new x.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,m.clone)(C),this.decPrivateModes=(0,m.clone)(b)}reset(){this.modes=(0,m.clone)(C),this.decPrivateModes=(0,m.clone)(b)}triggerDataEvent(y,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 "${y}"`,(()=>y.split("").map((A=>A.charCodeAt(0))))),this._onData.fire(y)}triggerBinaryEvent(y){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${y}"`,(()=>y.split("").map((S=>S.charCodeAt(0))))),this._onBinary.fire(y))}};c.CoreService=v=p([g(0,k.IBufferService),g(1,k.ILogService),g(2,k.IOptionsService)],v)},9074:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DecorationService=void 0;const p=d(8055),g=d(8460),m=d(844),x=d(6106);let _=0,k=0;class C extends m.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new x.SortedList((y=>y==null?void 0:y.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(y){if(y.marker.isDisposed)return;const S=new b(y);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 y of this._decorations.values())y.dispose();this._decorations.clear()}*getDecorationsAtCell(y,S,j){let A=0,N=0;for(const D of this._decorations.getKeyIterator(S))A=D.options.x??0,N=A+(D.options.width??1),y>=A&&y<N&&(!j||(D.options.layer??"bottom")===j)&&(yield D)}forEachDecorationAtCell(y,S,j,A){this._decorations.forEachByKey(S,(N=>{_=N.options.x??0,k=_+(N.options.width??1),y>=_&&y<k&&(!j||(N.options.layer??"bottom")===j)&&A(N)}))}}c.DecorationService=C;class b 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(y){super(),this.options=y,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=y.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.InstantiationService=c.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(_)}}c.ServiceCollection=m,c.InstantiationService=class{constructor(){this._services=new m,this._services.set(p.IInstantiationService,this)}setService(x,_){this._services.set(x,_)}getService(x){return this._services.get(x)}createInstance(x,..._){const k=(0,g.getServiceDependencies)(x).sort(((v,y)=>v.index-y.index)),C=[];for(const v of k){const y=this._services.get(v.id);if(!y)throw new Error(`[createInstance] ${x.name} depends on UNKNOWN service ${v.id}.`);C.push(y)}const b=k.length>0?k[0].index:_.length;if(_.length!==b)throw new Error(`[createInstance] First service dependency of ${x.name} at position ${b+1} conflicts with ${_.length} static arguments`);return new x(..._,...C)}}},7866:function(f,c,d){var p=this&&this.__decorate||function(b,v,y,S){var j,A=arguments.length,N=A<3?v:S===null?S=Object.getOwnPropertyDescriptor(v,y):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,v,y,S);else for(var D=b.length-1;D>=0;D--)(j=b[D])&&(N=(A<3?j(N):A>3?j(v,y,N):j(v,y))||N);return A>3&&N&&Object.defineProperty(v,y,N),N},g=this&&this.__param||function(b,v){return function(y,S){v(y,S,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.traceCall=c.setTraceLogger=c.LogService=void 0;const m=d(844),x=d(2585),_={trace:x.LogLevelEnum.TRACE,debug:x.LogLevelEnum.DEBUG,info:x.LogLevelEnum.INFO,warn:x.LogLevelEnum.WARN,error:x.LogLevelEnum.ERROR,off:x.LogLevelEnum.OFF};let k,C=c.LogService=class extends m.Disposable{get logLevel(){return this._logLevel}constructor(b){super(),this._optionsService=b,this._logLevel=x.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),k=this}_updateLogLevel(){this._logLevel=_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(b){for(let v=0;v<b.length;v++)typeof b[v]=="function"&&(b[v]=b[v]())}_log(b,v,y){this._evalLazyOptionalParams(y),b.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+v,...y)}trace(b,...v){var y;this._logLevel<=x.LogLevelEnum.TRACE&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.trace.bind(this._optionsService.options.logger))??console.log,b,v)}debug(b,...v){var y;this._logLevel<=x.LogLevelEnum.DEBUG&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.debug.bind(this._optionsService.options.logger))??console.log,b,v)}info(b,...v){var y;this._logLevel<=x.LogLevelEnum.INFO&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.info.bind(this._optionsService.options.logger))??console.info,b,v)}warn(b,...v){var y;this._logLevel<=x.LogLevelEnum.WARN&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.warn.bind(this._optionsService.options.logger))??console.warn,b,v)}error(b,...v){var y;this._logLevel<=x.LogLevelEnum.ERROR&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.error.bind(this._optionsService.options.logger))??console.error,b,v)}};c.LogService=C=p([g(0,x.IOptionsService)],C),c.setTraceLogger=function(b){k=b},c.traceCall=function(b,v,y){if(typeof y.value!="function")throw new Error("not supported");const S=y.value;y.value=function(...j){if(k.logLevel!==x.LogLevelEnum.TRACE)return S.apply(this,j);k.trace(`GlyphRenderer#${S.name}(${j.map((N=>JSON.stringify(N))).join(", ")})`);const A=S.apply(this,j);return k.trace(`GlyphRenderer#${S.name} return`,A),A}}},7302:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OptionsService=c.DEFAULT_OPTIONS=void 0;const p=d(8460),g=d(844),m=d(6114);c.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 x=["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 b={...c.DEFAULT_OPTIONS};for(const v in C)if(v in b)try{const y=C[v];b[v]=this._sanitizeAndValidateOption(v,y)}catch(y){console.error(y)}this.rawOptions=b,this.options={...b},this._setupOptions(),this.register((0,g.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(C,b){return this.onOptionChange((v=>{v===C&&b(this.rawOptions[C])}))}onMultipleOptionChange(C,b){return this.onOptionChange((v=>{C.indexOf(v)!==-1&&b()}))}_setupOptions(){const C=v=>{if(!(v in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${v}"`);return this.rawOptions[v]},b=(v,y)=>{if(!(v in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${v}"`);y=this._sanitizeAndValidateOption(v,y),this.rawOptions[v]!==y&&(this.rawOptions[v]=y,this._onOptionChange.fire(v))};for(const v in this.rawOptions){const y={get:C.bind(this,v),set:b.bind(this,v)};Object.defineProperty(this.options,v,y)}}_sanitizeAndValidateOption(C,b){switch(C){case"cursorStyle":if(b||(b=c.DEFAULT_OPTIONS[C]),!(function(v){return v==="block"||v==="underline"||v==="bar"})(b))throw new Error(`"${b}" is not a valid value for ${C}`);break;case"wordSeparator":b||(b=c.DEFAULT_OPTIONS[C]);break;case"fontWeight":case"fontWeightBold":if(typeof b=="number"&&1<=b&&b<=1e3)break;b=x.includes(b)?b:c.DEFAULT_OPTIONS[C];break;case"cursorWidth":b=Math.floor(b);case"lineHeight":case"tabStopWidth":if(b<1)throw new Error(`${C} cannot be less than 1, value: ${b}`);break;case"minimumContrastRatio":b=Math.max(1,Math.min(21,Math.round(10*b)/10));break;case"scrollback":if((b=Math.min(b,4294967295))<0)throw new Error(`${C} cannot be less than 0, value: ${b}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(b<=0)throw new Error(`${C} cannot be less than or equal to 0, value: ${b}`);break;case"rows":case"cols":if(!b&&b!==0)throw new Error(`${C} must be numeric, value: ${b}`);break;case"windowsPty":b=b??{}}return b}}c.OptionsService=_},2660:function(f,c,d){var p=this&&this.__decorate||function(_,k,C,b){var v,y=arguments.length,S=y<3?k:b===null?b=Object.getOwnPropertyDescriptor(k,C):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(_,k,C,b);else for(var j=_.length-1;j>=0;j--)(v=_[j])&&(S=(y<3?v(S):y>3?v(k,C,S):v(k,C))||S);return y>3&&S&&Object.defineProperty(k,C,S),S},g=this&&this.__param||function(_,k){return function(C,b){k(C,b,_)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkService=void 0;const m=d(2585);let x=c.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),A={data:_,id:this._nextId++,lines:[j]};return j.onDispose((()=>this._removeMarkerFromLink(A,j))),this._dataByLinkId.set(A.id,A),A.id}const C=_,b=this._getEntryIdKey(C),v=this._entriesWithId.get(b);if(v)return this.addLineToLink(v.id,k.ybase+k.y),v.id;const y=k.addMarker(k.ybase+k.y),S={id:this._nextId++,key:this._getEntryIdKey(C),data:C,lines:[y]};return y.onDispose((()=>this._removeMarkerFromLink(S,y))),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((b=>b.line!==k))){const b=this._bufferService.buffer.addMarker(k);C.lines.push(b),b.onDispose((()=>this._removeMarkerFromLink(C,b)))}}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)))}};c.OscLinkService=x=p([g(0,m.IBufferService)],x)},8343:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createDecorator=c.getServiceDependencies=c.serviceRegistry=void 0;const d="di$target",p="di$dependencies";c.serviceRegistry=new Map,c.getServiceDependencies=function(g){return g[p]||[]},c.createDecorator=function(g){if(c.serviceRegistry.has(g))return c.serviceRegistry.get(g);const m=function(x,_,k){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(C,b,v){b[d]===b?b[p].push({id:C,index:v}):(b[p]=[{id:C,index:v}],b[d]=b)})(m,x,k)};return m.toString=()=>g,c.serviceRegistry.set(g,m),m}},2585:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.IDecorationService=c.IUnicodeService=c.IOscLinkService=c.IOptionsService=c.ILogService=c.LogLevelEnum=c.IInstantiationService=c.ICharsetService=c.ICoreService=c.ICoreMouseService=c.IBufferService=void 0;const p=d(8343);var g;c.IBufferService=(0,p.createDecorator)("BufferService"),c.ICoreMouseService=(0,p.createDecorator)("CoreMouseService"),c.ICoreService=(0,p.createDecorator)("CoreService"),c.ICharsetService=(0,p.createDecorator)("CharsetService"),c.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||(c.LogLevelEnum=g={})),c.ILogService=(0,p.createDecorator)("LogService"),c.IOptionsService=(0,p.createDecorator)("OptionsService"),c.IOscLinkService=(0,p.createDecorator)("OscLinkService"),c.IUnicodeService=(0,p.createDecorator)("UnicodeService"),c.IDecorationService=(0,p.createDecorator)("DecorationService")},1480:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.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 b=_.length;for(let v=0;v<b;++v){let y=_.charCodeAt(v);if(55296<=y&&y<=56319){if(++v>=b)return k+this.wcwidth(y);const A=_.charCodeAt(v);56320<=A&&A<=57343?y=1024*(y-55296)+A-56320+65536:k+=this.wcwidth(A)}const S=this.charProperties(y,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)}}c.UnicodeService=m}},s={};function l(f){var c=s[f];if(c!==void 0)return c.exports;var d=s[f]={exports:{}};return i[f].call(d.exports,d,d.exports,l),d.exports}var u={};return(()=>{var f=u;Object.defineProperty(f,"__esModule",{value:!0}),f.Terminal=void 0;const c=l(9042),d=l(3236),p=l(844),g=l(5741),m=l(8285),x=l(7975),_=l(7090),k=["cols","rows"];class C extends p.Disposable{constructor(v){super(),this._core=this.register(new d.Terminal(v)),this._addonManager=this.register(new g.AddonManager),this._publicOptions={...this._core.options};const y=j=>this._core.options[j],S=(j,A)=>{this._checkReadonlyOptions(j),this._core.options[j]=A};for(const j in this._core.options){const A={get:y.bind(this,j),set:S.bind(this,j)};Object.defineProperty(this._publicOptions,j,A)}}_checkReadonlyOptions(v){if(k.includes(v))throw new Error(`Option "${v}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new x.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new _.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new m.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const v=this._core.coreService.decPrivateModes;let y="none";switch(this._core.coreMouseService.activeProtocol){case"X10":y="x10";break;case"VT200":y="vt200";break;case"DRAG":y="drag";break;case"ANY":y="any"}return{applicationCursorKeysMode:v.applicationCursorKeys,applicationKeypadMode:v.applicationKeypad,bracketedPasteMode:v.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:y,originMode:v.origin,reverseWraparoundMode:v.reverseWraparound,sendFocusMode:v.sendFocus,wraparoundMode:v.wraparound}}get options(){return this._publicOptions}set options(v){for(const y in v)this._publicOptions[y]=v[y]}blur(){this._core.blur()}focus(){this._core.focus()}input(v,y=!0){this._core.input(v,y)}resize(v,y){this._verifyIntegers(v,y),this._core.resize(v,y)}open(v){this._core.open(v)}attachCustomKeyEventHandler(v){this._core.attachCustomKeyEventHandler(v)}attachCustomWheelEventHandler(v){this._core.attachCustomWheelEventHandler(v)}registerLinkProvider(v){return this._core.registerLinkProvider(v)}registerCharacterJoiner(v){return this._checkProposedApi(),this._core.registerCharacterJoiner(v)}deregisterCharacterJoiner(v){this._checkProposedApi(),this._core.deregisterCharacterJoiner(v)}registerMarker(v=0){return this._verifyIntegers(v),this._core.registerMarker(v)}registerDecoration(v){return this._checkProposedApi(),this._verifyPositiveIntegers(v.x??0,v.width??0,v.height??0),this._core.registerDecoration(v)}hasSelection(){return this._core.hasSelection()}select(v,y,S){this._verifyIntegers(v,y,S),this._core.select(v,y,S)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(v,y){this._verifyIntegers(v,y),this._core.selectLines(v,y)}dispose(){super.dispose()}scrollLines(v){this._verifyIntegers(v),this._core.scrollLines(v)}scrollPages(v){this._verifyIntegers(v),this._core.scrollPages(v)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(v){this._verifyIntegers(v),this._core.scrollToLine(v)}clear(){this._core.clear()}write(v,y){this._core.write(v,y)}writeln(v,y){this._core.write(v),this._core.write(`\r
|
|
65
|
+
`,y)}paste(v){this._core.paste(v)}refresh(v,y){this._verifyIntegers(v,y),this._core.refresh(v,y)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(v){this._addonManager.loadAddon(this,v)}static get strings(){return c}_verifyIntegers(...v){for(const y of v)if(y===1/0||isNaN(y)||y%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...v){for(const y of v)if(y&&(y===1/0||isNaN(y)||y%1!=0||y<0))throw new Error("This API only accepts positive integers")}}f.Terminal=C})(),u})()))})(Rd)),Rd.exports}var aw=sw();/**
|
|
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 ow=2,lw=1,cw=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")),l=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"))},c=f.top+f.bottom,d=f.right+f.left,p=s-c,g=l-d-r;return{cols:Math.max(ow,Math.floor(g/e.css.cell.width)),rows:Math.max(lw,Math.floor(p/e.css.cell.height))}}};function uw({sessionId:e,onClose:r,onEscape:i,autoFocus:s}){const l=P.useRef(null),u=P.useRef(e),f=P.useRef(null),c=P.useRef(null),d=cr(g=>g.writeSession),p=cr(g=>g.resizeSession);return P.useEffect(()=>{u.current=e},[e]),P.useEffect(()=>{if(!i)return;const g=m=>{(m.key==="²"||m.key==="`")&&(m.preventDefault(),m.stopPropagation(),i())};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[i]),P.useEffect(()=>{if(!l.current)return;const g=new aw.Terminal({fontFamily:'"JetBrains Mono", monospace',fontSize:13,theme:{background:"#1a1a1a",foreground:"#e0e0e0",cursor:"#ffffff",cursorAccent:"#1a1a1a"},cursorBlink:!0,cursorStyle:"bar",convertEol:!0}),m=new cw;g.loadAddon(m),f.current={term:g,fitAddon:m},l.current.addEventListener("keydown",C=>{(C.key==="²"||C.key==="`")&&i&&(C.preventDefault(),C.stopPropagation(),i())}),g.open(l.current);const x=l.current.querySelector(".xterm");x&&(x.style.padding="8px"),m.fit(),s&&setTimeout(()=>{g.focus()},150);const _=new ResizeObserver(()=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{requestAnimationFrame(()=>{var b;m.fit&&m.fit();const C=(b=f.current)==null?void 0:b.term;C&&C.cols>0&&C.rows>0&&p(u.current,C.cols,C.rows)})},100)});_.observe(l.current),g.onData(C=>{if((C==="\x1B"||C==="²"||C==="`")&&i){i();return}d(u.current,C)}),g.onKey(C=>{(C.key==="\x1B"||C.key==="²"||C.key==="`")&&i&&(C.domEvent.stopPropagation(),i())});const k=$t.subscribe(C=>{var b,v;if(C.type==="terminal.output"&&((b=C.payload)==null?void 0:b.sessionId)===u.current){const y=(v=C.payload)==null?void 0:v.data;y&&g.write(y)}});return()=>{k(),_.disconnect(),c.current&&clearTimeout(c.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("svg",{className:"w-4 h-4",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.5 0 0 1 0-.708z"})})})]}),o.jsx("div",{ref:l,className:"flex-1 relative overflow-hidden",tabIndex:0,onKeyDown:g=>{(g.key==="²"||g.key==="`")&&i&&(g.preventDefault(),g.stopPropagation(),i())}})]})}function dw(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 hw({isOpen:e,onClose:r,onFocusChat:i}){const s=cr(C=>C.createSession),l=cr(C=>C.killSession),u=cr(C=>C.sessions),f=cr(C=>C.setWorkdir),c=cr(C=>C.fetchSessions),d=Gt(C=>C.currentProject),[p,g]=P.useState(!0),m=P.useRef(null),x=P.useRef(!1),_=P.useRef(!1),k=P.useCallback(()=>{r(),i()},[r,i]);return P.useEffect(()=>{d!=null&&d.workdir&&f(d.workdir)},[d==null?void 0:d.workdir,f]),P.useEffect(()=>{e&&(g(!0),c().finally(()=>g(!1)))},[e,c]),P.useEffect(()=>{e&&u.length===0&&!p&&!_.current&&(_.current=!0,s())},[e,u.length,p,s]),P.useEffect(()=>{e?(x.current=!0,setTimeout(()=>{var C;(C=m.current)==null||C.focus(),setTimeout(()=>{x.current=!1},200)},100)):_.current=!1},[e]),P.useEffect(()=>{if(!e)return;const C=b=>{x.current||(b.key==="Escape"||b.key==="²"||b.key==="`")&&(b.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.key==="²"||C.key==="`")&&(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("svg",{className:"w-5 h-5",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"})})}),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("svg",{className:"w-5 h-5",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"})})})]})]}),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 ${dw(u.length)} gap-2 h-full auto-rows-fr`,children:u.map(C=>o.jsx(uw,{sessionId:C.id,onClose:()=>l(C.id),onEscape:k,autoFocus:u.length===1},C.id))})})]})]}):null}function so({items:e,trigger:r,minWidth:i="120px"}){const[s,l]=P.useState(!1),[u,f]=P.useState(null),c=P.useRef(null),d=P.useRef(null);P.useEffect(()=>{function x(_){d.current&&!d.current.contains(_.target)&&l(!1)}return s&&document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x)}},[s]);const p=P.useCallback(()=>{if(!c.current)return;const x=c.current.getBoundingClientRect(),_=200,C=window.innerHeight-x.bottom<_;f({top:C?x.top-_-4:x.bottom+4,left:x.left,alignToTop:C})},[]),g=x=>{x.stopPropagation(),s||p(),l(!s)},m=u&&o.jsx("div",{ref:d,"data-testid":"session-dropdown-menu",className:`fixed bg-bg-secondary border border-border rounded shadow-lg z-50 ${u.alignToTop?"mb-1":"mt-1"}`,style:{top:u.top,left:u.left,minWidth:i},children:e.map((x,_)=>{const k=o.jsxs(o.Fragment,{children:[x.icon&&o.jsx("span",{className:"w-4 h-4 flex-shrink-0",children:x.icon}),x.label]});return x.href?o.jsx(Mn,{href:x.href,onClick:C=>{var b;(b=x.onClick)==null||b.call(x,C),l(!1)},className:`w-full px-3 py-2 text-left text-sm hover:bg-bg-tertiary transition-colors flex items-center gap-2 ${x.danger?"text-accent-error hover:bg-accent-error/10":"text-text-primary"} ${_!==e.length-1?"border-b border-border":""}`,children:k},_):o.jsx("button",{onClick:C=>{var b;(b=x.onClick)==null||b.call(x,C),x.closeOnClick!==!1&&l(!1)},className:`w-full px-3 py-2 text-left text-sm hover:bg-bg-tertiary transition-colors flex items-center gap-2 ${x.danger?"text-accent-error hover:bg-accent-error/10":"text-text-primary"} ${_!==e.length-1?"border-b border-border":""}`,children:k},_)})});return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"relative",children:o.jsx("div",{ref:c,onClick:g,children:r})}),s&&Yl.createPortal(m,document.body)]})}function Ob({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:"M19 9l-7 7-7-7"})})}function Xl({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:"M5 13l4 4L19 7"})})}function Mb(e){const r=new Date(e),s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][r.getDay()],l=r.getFullYear(),u=String(r.getMonth()+1).padStart(2,"0"),f=String(r.getDate()).padStart(2,"0");return`${s} ${l}/${u}/${f}`}function Zl(e){const r=new Date(e),i=String(r.getHours()).padStart(2,"0"),s=String(r.getMinutes()).padStart(2,"0");return`${i}:${s}`}function fw(e){const r=new Date(e),i=new Date,s=new Date(i.getFullYear(),i.getMonth(),i.getDate()),l=new Date(r.getFullYear(),r.getMonth(),r.getDate()),u=Math.floor((s.getTime()-l.getTime())/(1e3*60*60*24)),f=Zl(e);if(u===0)return`today ${f}`;if(u===1)return`yesterday ${f}`;if(u<7)return`${u} days ago ${f}`;{const c=r.getFullYear(),d=String(r.getMonth()+1).padStart(2,"0"),p=String(r.getDate()).padStart(2,"0");return`${c}/${d}/${p} ${f}`}}function Ib(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 pw(e){const{year:r,month:i,day:s}=Ib(e);return`${r}-${i}-${s}`}function Bb(e){const r=new Map;for(const l of e){const u=pw(l.updatedAt);r.has(u)||r.set(u,[]),r.get(u).push(l)}for(const[l,u]of r)u.sort((f,c)=>{const d=new Date(f.updatedAt).getTime();return new Date(c.updatedAt).getTime()-d});const i=Array.from(r.keys()).sort((l,u)=>u.localeCompare(l)),s=new Map;for(const l of i)s.set(l,r.get(l));return s}const Fx=()=>o.jsx("svg",{className:"w-4 h-4",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 mw({items:e,trigger:r,isActive:i=!1}){const[s,l]=P.useState(!1),u=P.useRef(null);return P.useEffect(()=>{function f(c){u.current&&!u.current.contains(c.target)&&l(!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:()=>l(!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("svg",{className:"w-3 h-3 text-text-muted flex-shrink-0 transition-transform",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,style:{transform:s?"rotate(180deg)":void 0},children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),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,c)=>{const d=f.label&&typeof f.label=="object"&&f.label.type===Mn?f.label:null;if(d){const p=d.props.href||"";return o.jsxs(Mn,{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]},c)}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]},c):o.jsxs("button",{type:"button",onClick:()=>{var p;(p=f.onClick)==null||p.call(f),l(!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]},c)})})]})}function gw({projects:e,currentProject:r}){const i=Gt(u=>u.loadProject),l=[...e].sort((u,f)=>u.name.localeCompare(f.name)).map(u=>({label:u.name,icon:u.id===r.id?o.jsx(Xl,{}):void 0,href:`/p/${u.id}`,onClick:()=>{i(u.id)}}));return o.jsx(so,{items:l,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(Ob,{})]}),minWidth:"250px"})}function xw({currentProject:e,sessions:r,currentSession:i,projectIdFromUrl:s}){if(!(e!=null&&e.id)||e.id!==s)return null;const l=r.filter(f=>f.projectId===e.id).sort((f,c)=>new Date(c.updatedAt).getTime()-new Date(f.updatedAt).getTime()).slice(0,5),u=[{label:o.jsxs(Mn,{href:`/p/${e.id}/new`,className:"flex items-center gap-2",children:[o.jsx("svg",{className:"w-3 h-3 text-accent-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),o.jsx("span",{className:"text-sm",children:"New Session"})]})},...l.map(f=>({label:o.jsx(Mn,{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("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):void 0})),{label:o.jsxs(Mn,{href:"/",className:"flex items-center gap-2 text-text-muted hover:text-text-primary",children:[o.jsx("svg",{className:"w-3 h-3",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"})}),o.jsx("span",{className:"text-sm",children:"Projects"})]})}];return o.jsx(mw,{items:u,trigger:o.jsx("span",{className:"text-sm text-text-secondary font-medium",children:e.name})})}function vw({sessions:e,currentProject:r,currentSession:i}){var d;const s=Ee(p=>p.loadSession),l=e.filter(p=>p.projectId===r.id).slice(0,15),u=Bb(l),f=[];f.push({label:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4 text-accent-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),o.jsx("span",{className:"text-sm",children:"New session"})]}),href:`/p/${r.id}/new`,onClick:()=>{}});for(const[p,g]of u){const m=g[0];if(m){f.push({label:o.jsx("div",{className:"px-3 py-2 text-text-muted text-xs font-medium cursor-default",children:Mb(m.updatedAt)}),onClick:()=>{}});for(const x of g)f.push({label:o.jsxs("div",{className:"min-w-[160px]",children:[o.jsx("div",{className:"truncate text-sm",children:x.title??x.id.slice(0,8)}),o.jsx("div",{className:"text-text-muted text-xs",children:Zl(x.updatedAt)})]}),icon:x.id===(i==null?void 0:i.id)?o.jsx(Xl,{}):void 0,href:`/p/${r.id}/s/${x.id}`,onClick:()=>{s(x.id)}})}}const c=i?((d=i.metadata)==null?void 0:d.title)??i.id.slice(0,8):"No session selected";return o.jsx(so,{items:f,trigger:o.jsxs("button",{className:"text-text-secondary hover:text-text-primary hover:underline text-sm truncate flex items-center gap-1",title:c,"data-testid":"header-session-dropdown",children:[c,o.jsx(Ob,{})]}),minWidth:"280px"})}function bw({onMenuClick:e,onCriteriaToggle:r}){const[i,s]=P.useState(!1),[l]=ur(),u=l.startsWith("/p/"),f=/^\/p\/[^/]+\/s\/[^/]+$/.test(l),c=Ee(b=>b.currentSession),d=Ee(b=>b.sessions),p=Gt(b=>b.currentProject),g=Gt(b=>b.projects),m=At(b=>b.startAutoRefresh),x=At(b=>b.stopAutoRefresh),_=cr(b=>b.setOpen),k=cr(b=>b.isOpen),C=P.useCallback(()=>{const b=document.querySelector('textarea[placeholder*="What would you like to build"], textarea[placeholder*="Send a message"]');b&&b.focus()},[]);return P.useEffect(()=>{const b=v=>{(v.ctrlKey||v.metaKey)&&v.code==="Backquote"&&(v.preventDefault(),k||_(!0))};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[k,_]),P.useEffect(()=>(m(),()=>x()),[m,x]),o.jsxs("header",{className:"h-8 bg-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&&u&&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(Fx,{})}),o.jsx(Mn,{href:"/",className:"text-accent-primary font-semibold text-base hover:underline flex-shrink-0 hidden md:inline",children:"OpenFox"}),p&&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(gw,{projects:g,currentProject:p})}),o.jsx("span",{className:"md:hidden",children:o.jsx(xw,{currentProject:p,sessions:d,currentSession:c,projectIdFromUrl:u&&l.split("/")[2]||null},p==null?void 0:p.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(vw,{sessions:d,currentProject:p,currentSession:c})})]})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[u&&o.jsx("button",{onClick:()=>_(!k),className:`p-2.5 rounded hover:bg-bg-tertiary transition-colors ${k?"text-accent-primary":"text-text-muted hover:text-text-primary"}`,title:"Toggle terminal (Ctrl+\\`)",children:o.jsx("svg",{className:"w-4 h-4",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"})})}),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.jsxs("svg",{className:"w-4 h-4",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"})]})}),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("svg",{className:"w-4 h-4",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"})})}),r&&f&&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(Fx,{})})]}),o.jsx(tw,{isOpen:i,onClose:()=>s(!1)}),o.jsx(hw,{isOpen:k,onClose:()=>_(!1),onFocusChat:C})]})}function yw({isOpen:e,onClose:r,title:i,label:s,description:l,placeholder:u,value:f,isLoading:c=!1,onSave:d}){const[p,g]=P.useState(f),[m,x]=P.useState(!1),[_,k]=P.useState(!1);P.useEffect(()=>{g(f),x(!1)},[f]);const C=S=>{g(S.target.value),x(!0)},b=async()=>{k(!0),await d(p),k(!1),x(!1),r()},v=()=>{g(f),x(!1),r()},y=c||_;return o.jsx(jt,{isOpen:e,onClose:v,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:l}),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:y})}),o.jsxs("div",{className:"flex justify-end gap-2 pt-2 mt-3 border-t border-border flex-shrink-0",children:[o.jsx(tt,{variant:"secondary",onClick:v,children:"Cancel"}),o.jsx(tt,{variant:"primary",onClick:b,disabled:!m||y,children:_?"Saving...":"Save"})]})]})})}function _w({isOpen:e,onClose:r,project:i}){const s=Gt(u=>u.updateProject),l=async u=>{s(i.id,{customInstructions:u||null}),await new Promise(f=>setTimeout(f,100))};return o.jsx(yw,{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:l})}const Sw={sm:"w-3 h-3",md:"w-4 h-4",lg:"w-5 h-5",xl:"w-6 h-6"};function Xa({onClick:e,className:r="",size:i="md",variant:s="default"}){const l=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("button",{onClick:e,className:`${l} ${r}`,title:"Close",children:o.jsx("svg",{className:Sw[i],fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})}function zb({projectId:e,isOpen:r=!0,onClose:i}){const[,s]=ur(),[l,u]=P.useState(!1),f=Ee(j=>j.sessions),c=Ee(j=>j.currentSession),d=Ee(j=>j.unreadSessionIds),p=Ee(j=>j.deleteSession),g=Ee(j=>j.deleteAllSessions),m=Ee(j=>j.loadMoreSessions),x=Ee(j=>j.sessionsHasMore),_=Ee(j=>j.sessionsPaginationLoading),k=Gt(j=>j.currentProject),C=P.useRef(null),b=P.useCallback(()=>{x&&!_&&k&&m(k.id)},[x,_,k,m]);P.useEffect(()=>{if(!C.current||!x)return;const j=new IntersectionObserver(A=>{const N=A[0];N&&N.isIntersecting&&b()},{threshold:.1});return j.observe(C.current),()=>j.disconnect()},[x,b]);const v=f.filter(j=>j.projectId===(k==null?void 0:k.id)),y=(j,A)=>{A==null||A.stopPropagation(),confirm("Delete this session?")&&(p(j),(c==null?void 0:c.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-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(Mn,{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(so,{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.jsxs("svg",{className:"w-4 h-4",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"})]})})}),i&&o.jsx(Xa,{onClick:i,className:"md:hidden",variant:"sidebar",size:"md"})]}),k&&o.jsx(_w,{isOpen:l,onClose:()=>u(!1),project:k}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:v.length===0?o.jsx("div",{className:"p-4 text-center text-text-muted text-xs",children:"No sessions"}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"divide-y divide-border",children:ww(v,c,d,y,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 ww(e,r,i,s,l){const u=Bb(e);return Array.from(u).map(([f,c])=>{const d=c[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:Mb(d.updatedAt)}),c.map(p=>{const g=(r==null?void 0:r.id)===p.id,m=i.includes(p.id),x=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(Mn,{href:`/p/${l}/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(so,{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.jsxs("svg",{className:"w-4 h-4",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"})]})})})]}),o.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[x?o.jsxs("svg",{"aria-label":"Session running",className:"w-3 h-3 text-blue-400 animate-spin flex-shrink-0",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"})]}):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:Zl(p.updatedAt)}),o.jsxs("span",{className:"text-text-muted text-xs flex-shrink-0",children:[p.messageCount," messages"]})]})]})},p.id)})]},f):null})}const Ux=["⠋","⠙","⠹","⠸","⠼","⠴"];function Cw(){var c;const e=Gt(d=>d.currentProject),r=Ee(d=>d.currentSession),i=jb(),s=!1,l=P.useRef(0),u=P.useRef(null);P.useEffect(()=>(i?(u.current=window.setInterval(()=>{l.current=(l.current+1)%Ux.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?`${Ux[l.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"&&((c=r==null?void 0:r.metadata)!=null&&c.title)&&window.document.documentElement.setAttribute("data-session-title",r.metadata.title),null}const Ql=P.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}));Ql.displayName="Input";function kw({isOpen:e,onClose:r,projectName:i,onConfirm:s}){const l=()=>{s(),r()};return o.jsx(jt,{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(tt,{variant:"secondary",onClick:r,children:"Cancel"}),o.jsx(tt,{variant:"danger",onClick:l,children:"Delete"})]})]})})}function Ew(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 jw({isOpen:e,onClose:r}){const[,i]=ur(),[s,l]=P.useState(""),[u,f]=P.useState(null),[c,d]=P.useState(!1),[p,g]=P.useState(""),m=P.useRef(null);P.useEffect(()=>{e&&(ke("/api/config").then(C=>C.json()).then(C=>{C.workdir&&g(C.workdir)}),l(""),f(null),d(!1),setTimeout(()=>{var C;(C=m.current)==null||C.focus()},100))},[e]);const x=P.useCallback(async C=>{C.preventDefault();const b=Ew(s);if(!b.valid){f(b.error);return}d(!0),f(null);const v=`${p}/${s}`;try{const y=await ke("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,workdir:v})});if(!y.ok){const A=await y.json().catch(()=>({}));throw new Error(A.error||"Failed to create project")}const j=(await y.json()).project;r(),i(`/p/${j.id}`)}catch(y){f(y instanceof Error?y.message:"Failed to create project"),d(!1)}},[s,i,r,p]),_=P.useCallback(()=>{l(""),f(null),r()},[r]),k=s?`${p}/${s}`:"";return o.jsx(jt,{isOpen:e,onClose:_,title:"Create New Project",size:"sm",children:o.jsxs("form",{onSubmit:x,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(Ql,{ref:m,id:"project-name",value:s,onChange:C=>{l(C.target.value),f(null)},placeholder:"my-project",disabled:c,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(tt,{type:"button",variant:"secondary",onClick:_,disabled:c,children:"Cancel"}),o.jsx(tt,{type:"submit",variant:"primary",disabled:c||!s.trim(),className:"min-w-[100px]",children:c?o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsxs("svg",{className:"animate-spin h-4 w-4",fill:"none",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"})]}),"Creating..."]}):"Create"})]})]})})}const Nw={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};function Jl({size:e="md",className:r=""}){return o.jsx("div",{className:`animate-spin border-2 border-accent-primary border-t-transparent rounded-full ${Nw[e]} ${r}`})}function Tw({text:e,...r}){return o.jsxs("div",{className:"text-center",children:[o.jsx(Jl,{...r,className:"mx-auto mb-4"}),e&&o.jsx("div",{className:"text-text-secondary",children:e})]})}function Hb({onSelect:e,onClose:r,initialPath:i}){const[s,l]=P.useState(null),[u,f]=P.useState(!0),c=P.useCallback(async p=>{f(!0);try{const g=p?`/api/directories?path=${encodeURIComponent(p)}`:"/api/directories",x=await(await ke(g)).json();l(x)}catch(g){console.error("Failed to load directories:",g)}finally{f(!1)}},[]);P.useEffect(()=>{c(i)},[i,c]);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(jt,{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:()=>c(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:()=>c("/"),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(Jl,{size:"sm"})}):o.jsxs("div",{className:"divide-y divide-border",children:[(s==null?void 0:s.parent)&&o.jsxs("button",{onClick:()=>c(s.parent),className:"w-full p-3 flex items-center gap-3 hover:bg-bg-tertiary/50 text-text-muted",children:[o.jsx("svg",{className:"w-5 h-5",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"})}),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:()=>c(p.path),className:"flex-1 p-3 flex items-center gap-3 text-left",children:[o.jsx("svg",{className:"w-5 h-5 text-accent-primary",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"})}),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 Od(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 Aw({isOpen:e,onClose:r}){const[,i]=ur(),[s,l]=P.useState(!1),[u,f]=P.useState(""),[c,d]=P.useState(null),[p,g]=P.useState(!1),[m,x]=P.useState(null),_=Gt(Z=>Z.projects),k=Gt(Z=>Z.createProject),C=Gt(Z=>Z.listProjects),b=Gt(Z=>Z.deleteProject),[v,y]=P.useState(null),[S,j]=P.useState(-1),[A,N]=P.useState(null),[D,T]=P.useState(!1),B=P.useRef([]);P.useEffect(()=>{ke("/api/config").then(Z=>Z.json()).then(Z=>{Z.workdir&&x(Z.workdir)})},[]);const H=P.useCallback(async Z=>{g(!0);try{const z=await Od(Z,m??void 0);d(z)}catch(z){console.error("Failed to load directories:",z)}finally{g(!1)}},[m]);P.useEffect(()=>{e&&m&&(Od(m),C())},[e,m,H,C]);const W=(c==null?void 0:c.directories.filter(Z=>u===""||Z.name.toLowerCase().includes(u.toLowerCase())))??[],K=[...c!=null&&c.parent&&!u?[{type:"parent",path:c.parent,name:".."}]:[],...W.map(Z=>({type:"directory",path:Z.path,name:Z.name}))],q=Z=>{i(`/p/${Z}`),r()},R=(Z,z)=>{z.stopPropagation(),N(Z)},U=()=>{A&&(b(A.id),N(null))},M=Z=>{const z=Z.split("/").filter(Boolean).pop()??"";k(z,Z),C(),y(Z)};P.useEffect(()=>{if(v){const Z=_.find(z=>z.workdir===v);Z&&(i(`/p/${Z.id}`),r(),y(null))}},[_,v,i,r]),P.useEffect(()=>{j(K.length>0?0:-1)},[u,K.length]);const Y=Z=>{f(""),Od(Z)};return P.useEffect(()=>{S>=0&&B.current[S]&&B.current[S].scrollIntoView({behavior:"smooth",block:"nearest"})},[S]),e?o.jsxs(jt,{isOpen:e,onClose:r,title:"Open Project",size:"xl",footer:o.jsxs("div",{className:"flex justify-between gap-2",children:[o.jsx(tt,{variant:"secondary",onClick:()=>l(!0),children:"Create Project"}),o.jsx(tt,{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:()=>q(Z.id),className:"flex-1 flex items-center gap-3 text-left",children:[o.jsx("svg",{className:"w-5 h-5 text-accent-primary",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"})}),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=>R(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("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},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:()=>T(!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(Ql,{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"})}):K.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:K.map((Z,z)=>o.jsxs("button",{ref:L=>{L&&(B.current[z]=L)},onClick:()=>Z.type==="parent"?Y(Z.path):M(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("svg",{className:"w-5 h-5",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"})}),o.jsx("span",{className:"flex-1",children:Z.name})]},Z.path))})})]})]}),s&&o.jsx(jw,{isOpen:s,onClose:()=>l(!1)}),A&&o.jsx(kw,{isOpen:!0,onClose:()=>N(null),projectName:A.name,onConfirm:U}),D&&o.jsx(Hb,{initialPath:m??void 0,onSelect:Z=>{M(Z),T(!1)},onClose:()=>T(!1)})]}):null}function Dw(){const[e,r]=P.useState(!1),i=Ee(g=>g.sessions),s=Gt(g=>g.projects),l=Gt(g=>g.listProjects),u=Ee(g=>g.listSessions),f=Ee(g=>g.connectionStatus);P.useEffect(()=>{f==="connected"&&(l(),u())},[f,l,u]);const c=[...s].sort((g,m)=>{const x=i.filter(b=>b.workdir.startsWith(g.workdir)),_=i.filter(b=>b.workdir.startsWith(m.workdir)),k=x.length>0?new Date(x.reduce((b,v)=>new Date(v.updatedAt)>new Date(b.updatedAt)?v:b).updatedAt).getTime():new Date(g.updatedAt).getTime();return(_.length>0?new Date(_.reduce((b,v)=>new Date(v.updatedAt)>new Date(b.updatedAt)?v:b).updatedAt).getTime():new Date(m.updatedAt).getTime())-k}),d=g=>{const m=s.find(x=>x.id===g);return m?i.filter(x=>x.workdir.startsWith(m.workdir)).sort((x,_)=>new Date(_.updatedAt).getTime()-new Date(x.updatedAt).getTime()).slice(0,5):[]},p=()=>{r(!0)};return o.jsxs("div",{className:"flex-1 flex flex-col overflow-y-auto",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(tt,{variant:"primary",onClick:p,children:"Open Project"})]}),c.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(Mn,{href:`/p/${g.id}`,className:"flex items-center gap-2 cursor-pointer hover:opacity-80 transition-opacity flex-1",children:[o.jsx("svg",{className:"w-5 h-5 text-accent-primary flex-shrink-0",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"})}),o.jsx("span",{className:"text-text-primary font-semibold",children:g.name})]}),o.jsx(Mn,{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(x=>{const _=s.find(C=>x.workdir.startsWith(C.workdir)),k=_?`/p/${_.id}/s/${x.id}`:"#";return o.jsx(Mn,{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:x.title??x.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:fw(x.updatedAt)}),o.jsxs("span",{className:"text-text-muted text-xs",children:[x.messageCount," msgs"]})]})]})},x.id)}):o.jsx("div",{className:"p-3 md:p-4 text-text-muted text-sm",children:"No sessions yet"})})]})},g.id)}),c.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(Aw,{isOpen:e,onClose:()=>r(!1)})]})}function Lw(){const[,e]=Ch("/p/:projectId/new"),[,r]=ur(),i=e==null?void 0:e.projectId,s=Ee(l=>l.createSession);return P.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(Jl,{})})}function Rw(){const e=Gt(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(Mn,{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 Ma=e=>Math.round(e*10)/10;function sh(e){return{providerId:e.providerId,providerName:e.providerName,backend:e.backend,model:e.model}}function Ow(e){return`${e.providerId}::${e.model}`}function Mw(e){return`${e.providerName} > ${e.model}`}function $x(e){let r=0,i=0,s=0,l=0,u=0,f=0;const c=[],d=[];let p=0;for(const[x,_]of e.entries()){const k=_.stats,C=sh(k);r+=k.totalTime,i+=k.toolTime,s+=k.prefillTokens,l+=k.generationTokens;const b=k.prefillSpeed>0?k.prefillTokens/k.prefillSpeed:0,v=k.generationSpeed>0?k.generationTokens/k.generationSpeed:0;u+=b,f+=v,c.push({messageId:_.id,timestamp:_.timestamp,...C,mode:k.mode,responseIndex:x+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 y=k.llmCalls??[];for(const S of y)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:x+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?Ma(s/u):0,m=f>0?Ma(l/f):0;return{totalTime:Ma(r),aiTime:Ma(r-i),toolTime:Ma(i),prefillTokens:s,generationTokens:l,avgPrefillSpeed:g,avgGenerationSpeed:m,responseCount:e.length,llmCallCount:d.length,dataPoints:c,callDataPoints:d}}function Iw(e){const r=e.filter(l=>l.stats!==void 0&&l.stats!==null).sort((l,u)=>new Date(l.timestamp).getTime()-new Date(u.timestamp).getTime());if(r.length===0)return null;const i=new Map;for(const l of r){const u=Ow(sh(l.stats)),f=i.get(u)??[];i.set(u,[...f,l])}const s=Array.from(i.entries()).map(([l,u])=>{const f=sh(u[0].stats),c=$x(u);return{...f,key:l,label:Mw(f),...c}});return{...$x(r),modelGroups:s}}function Bw(e){return P.useMemo(()=>Iw(e),[e])}function zw(e){const[r,i]=P.useState(null),[s,l]=P.useState(!0),[u,f]=P.useState(null),c=e||"";return P.useEffect(()=>{if(!c){l(!1);return}let d=!0,p=null;const g=async()=>{try{const x=await(await ke(`/api/branch?workdir=${encodeURIComponent(c)}`)).json();d&&(i(x.branch),f(x.error||null),l(!1))}catch(m){d&&(f(m instanceof Error?m.message:"Failed to fetch branch"),l(!1))}};return g(),p=setInterval(g,3e3),()=>{d=!1,p&&clearInterval(p)}},[c]),{branch:r,loading:s,error:u}}function zl(e){return e.toLocaleString("en-US").replace(/,/g," ")}function qx(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Hw(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 Pw="modulepreload",Fw=function(e){return"/"+e},Wx={},Uw=function(r,i,s){let l=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 c=document.querySelector("meta[property=csp-nonce]"),d=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));l=f(i.map(p=>{if(p=Fw(p),p in Wx)return;Wx[p]=!0;const g=p.endsWith(".css"),m=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${m}`))return;const x=document.createElement("link");if(x.rel=g?"stylesheet":Pw,g||(x.as="script"),x.crossOrigin="",x.href=p,d&&x.setAttribute("nonce",d),document.head.appendChild(x),g)return new Promise((_,k)=>{x.addEventListener("load",_),x.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${p}`)))})}))}function u(f){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=f,window.dispatchEvent(c),!c.defaultPrevented)throw f}return l.then(f=>{for(const c of f||[])c.status==="rejected"&&u(c.reason);return r().catch(u)})},Gx=["▁","▂","▃","▄","▅","▆","▇","█"];function $w(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 qw(e,r){if(e===r){const l=Math.max(Math.abs(e)*.05,1);return{minY:e-l,maxY:r+l}}const i=r-e,s=Math.max(i*.1,.1);return{minY:e-s,maxY:r+s}}function Ww(e,r){if(e.length===0||r<=0)return{blocks:"",minX:0,maxX:0,minY:0,maxY:0};const i=[...e].sort((m,x)=>m.x-x.x),s=i[0].x,l=i[i.length-1].x,u=Math.min(...i.map(m=>m.y)),f=Math.max(...i.map(m=>m.y)),{minY:c,maxY:d}=qw(u,f),p=Array.from({length:r},()=>" "),g=new Map;for(const m of i){const x=l===s?0:Math.round((m.x-s)/(l-s)*(r-1)),_=g.get(x)??[];g.set(x,[..._,m.y])}for(const[m,x]of g){const _=Math.max(...x);p[m]=Gx[$w(_,c,d)]??Gx[0]}return{blocks:p.join(""),minX:s,maxX:l,minY:c,maxY:d}}function Vx(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Kx({data:e,width:r=60,height:i=78,label:s,xLabel:l,yLabel:u,showAxes:f=!0,formatY:c=Vx,formatX:d=Vx}){const p=P.useMemo(()=>{const g=Ww(e,r),m=Math.max(r*6,240),x=10,_=8,C=[...e].sort((S,j)=>S.x-j.x).map(S=>{const j=g.maxX===g.minX?m/2:x+(S.x-g.minX)/(g.maxX-g.minX)*(m-x*2),A=g.maxY===g.minY?i/2:_+(g.maxY-S.y)/(g.maxY-g.minY)*(i-_*2);return{...S,cx:j,cy:A,leftPercent:j/m*100,topPercent:A/i*100}}),b=C.map((S,j)=>`${j===0?"M":"L"} ${S.cx.toFixed(1)} ${S.cy.toFixed(1)}`).join(" "),y=[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:b,gridLines:y}},[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:c(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)} -> ${c(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:l}),o.jsx("span",{children:d(p.maxX)})]})]}),u&&f&&o.jsx("div",{className:"text-text-muted mt-1 text-center",children:u})]})}function Gw({data:e,prefillLabel:r="Prefill Speed (tok/s) by Response",generationLabel:i="Generation Speed (tok/s) by Response",xLabel:s="response",width:l=60}){const u=e.map(c=>({x:c.x,y:c.ppSpeed})),f=e.map(c=>({x:c.x,y:c.tgSpeed}));return o.jsxs("div",{className:"space-y-5",children:[o.jsx(Kx,{data:u,width:l,label:r,xLabel:s}),o.jsx(Kx,{data:f,width:l,label:i,xLabel:s})]})}function Vw(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((l,u)=>l.callIndex-u.callIndex);return{...i,callCount:s.length,calls:s,isExpandable:s.length>1}})}function Kw(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 Yw(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 Xw(e){return e.callDataPoints.length>0?Yw(e):Kw(e)}function Md(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 Ri(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toString()}function $a(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Zw(e){if(e.length===0)return"0 ctx";const r=Math.min(...e),i=Math.max(...e);return r===i?`${Ri(r)} ctx`:`${Ri(r)}-${Ri(i)} ctx`}function Hl(e){return`${$a(e)} t/s`}function Pb(e){try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}catch{return e}}function Qw(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 Jw({isOpen:e,onClose:r,stats:i}){const s=P.useRef(null),[l,u]=P.useState({}),[f,c]=P.useState(()=>{var k;return((k=i.modelGroups[0])==null?void 0:k.key)??""});P.useEffect(()=>{var k;i.modelGroups.some(C=>C.key===f)||c(((k=i.modelGroups[0])==null?void 0:k.key)??"")},[f,i.modelGroups]);const d=P.useMemo(()=>i.modelGroups.find(k=>k.key===f)??i.modelGroups[0],[f,i.modelGroups]),p=P.useMemo(()=>d?Vw(d):[],[d]),g=P.useMemo(()=>d?Xw(d):{mode:"responses",xLabel:"response",prefillLabel:"",generationLabel:"",points:[]},[d]),m=P.useCallback(k=>{u(C=>({...C,[k]:!C[k]}))},[]),x=P.useCallback(()=>{if(!d)return;const k=Qw(d);navigator.clipboard.writeText(JSON.stringify(k,null,2)).catch(C=>console.error("Failed to copy:",C))},[d]),_=P.useCallback(async()=>{if(s.current)try{const k=(await Uw(async()=>{const{default:v}=await import("./html2canvas.esm-QH1iLAAe.js");return{default:v}},[])).default,C=await k(s.current,{backgroundColor:"#1a1a1a",scale:2}),b=document.createElement("a");b.download=`openfox-stats-${new Date().toISOString().slice(0,10)}.png`,b.href=C.toDataURL("image/png"),b.click()}catch(k){console.error("Failed to export PNG:",k),x()}},[x]);return o.jsx(jt,{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:()=>c(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(Dr,{label:"AI Time",value:Md(d.aiTime)}),o.jsx(Dr,{label:"Total Time",value:Md(d.totalTime)}),o.jsx(Dr,{label:"Tool Time",value:Md(d.toolTime)}),o.jsx(Dr,{label:"Responses",value:d.responseCount.toString()}),o.jsx(Dr,{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(Dr,{label:"Prefill Tokens",value:Ri(d.prefillTokens),subValue:`@ ${$a(d.avgPrefillSpeed)} tok/s`}),o.jsx(Dr,{label:"Gen Tokens",value:Ri(d.generationTokens),subValue:`@ ${$a(d.avgGenerationSpeed)} tok/s`}),o.jsx(Dr,{label:"Avg PP Speed",value:`${$a(d.avgPrefillSpeed)}`,subValue:"tok/s"}),o.jsx(Dr,{label:"Avg TG Speed",value:`${$a(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:x,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(Gw,{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(P.Fragment,{children:[o.jsx(eC,{row:k,index:C,isExpanded:l[k.messageId]??!1,onToggle:k.isExpandable?()=>m(k.messageId):void 0}),(l[k.messageId]??!1)&&k.calls.map((b,v)=>o.jsx(tC,{dataPoint:b,index:v},`${b.messageId}-${b.callIndex}`))]},k.messageId))})]})})]})]})})}function Dr({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 eC({row:e,index:r,isExpanded:i,onToggle:s}){const l=e.calls.length>0?Zw(e.calls.map(u=>u.promptTokens)):`${Ri(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:Pb(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:l.replace(/ ctx$/,"")}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Hl(e.prefillSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Hl(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 tC({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:Pb(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:Ri(e.promptTokens)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Hl(e.prefillSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Hl(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 nC={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"}},rC=P.memo(function({criteria:r}){if(r.length===0)return o.jsx("div",{className:"text-text-muted text-sm text-center py-2",children:"No criteria yet"});const i={pending:0,in_progress:0,completed:0,passed:0,failed:0};for(const l of r){const u=l.status.type;u in i&&i[u]++}const s=Object.keys(i).filter(l=>i[l]>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(l=>{const u=nC[l];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[l]})]},l)})})]})});function iC({isOpen:e,onClose:r}){const i=lr(_=>_.config),s=lr(_=>_.saveConfig),[l,u]=P.useState(""),[f,c]=P.useState(""),[d,p]=P.useState(!1),[g,m]=P.useState(!1);P.useEffect(()=>{e&&(u((i==null?void 0:i.command)??""),c((i==null?void 0:i.url)??""),p((i==null?void 0:i.hotReload)??!1))},[e,i]);const x=async()=>{!l.trim()||!f.trim()||(m(!0),await s({command:l.trim(),url:f.trim(),hotReload:d}),m(!1),r())};return o.jsx(jt,{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:l,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:_=>c(_.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:x,disabled:g||!l.trim()||!f.trim(),children:g?"Saving...":"Save"})]})]})})}const Yx={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"},sC={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"},Xx={1:"font-bold",2:"opacity-75",4:"underline",7:"bg-bg-secondary"},aC="text-text-primary";function oC(e){const r=[],i=/\x1b\[([0-9;]+)m/g;let s=0,l="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:l})}const f=u[1];if(!f)continue;const c=f.split(";").map(Number);if(c.length===0||c[0]===0){l="text-text-primary";continue}const d=[];for(const p of c)if(p>=30&&p<=37){const g=Yx[p];g&&d.push(g)}else if(p>=40&&p<=47){const g=sC[p];g&&d.push(g)}else if(p>=90&&p<=97){const g=Yx[p];g&&d.push(g)}else if(p in Xx){const g=Xx[p];g&&d.push(g)}else p===39?d.push(aC):p===49&&(l=l.split(" ").filter(g=>!g.startsWith("bg-")).join(" "));d.length>0&&(l=d.join(" ")),s=i.lastIndex}if(s<e.length){const f=e.slice(s);f&&r.push({text:f,className:l})}return r}catch(f){return console.warn("ANSI parsing failed, stripping codes:",f),[{text:lC(e),className:"text-text-primary"}]}}function lC(e){return e.replace(/\x1b\[([0-9;]+)m/g,"")}function Za(e){const r=oC(e),i=[];return r.forEach((s,l)=>{const u=s.text.split(`
|
|
85
|
+
`);u.forEach((f,c)=>{i.push(dn.createElement("span",{key:`${l}-${c}`,className:s.className,style:{display:"inline-block",whiteSpace:"pre-wrap"}},f)),c<u.length-1&&i.push(dn.createElement("br",{key:`${l}-${c}-br`}))})}),i.length===1?i[0]:i}const cC=P.memo(function({title:r,logs:i,onClose:s,preClassName:l}){const u=P.useRef(null);return P.useEffect(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[i]),o.jsx(jt,{isOpen:!0,onClose:s,title:r,size:"full",children:o.jsx("pre",{ref:u,className:l,children:i.length===0?o.jsx("span",{className:"text-text-muted",children:"No output yet"}):i.map((f,c)=>o.jsx("span",{className:f.stream==="stderr"?"text-accent-warning":"",children:Za(f.content)},c))})})}),uC=P.memo(function({logs:r,anchorRef:i,isHiding:s,onExpand:l,onClose:u}){const[f,c]=P.useState(null),d=P.useRef(null);return P.useEffect(()=>{var g;const p=(g=i.current)==null?void 0:g.getBoundingClientRect();p&&c({bottom:window.innerHeight-p.bottom,right:window.innerWidth-p.right,width:p.width,height:p.height})},[i]),P.useEffect(()=>{d.current&&(d.current.scrollTop=d.current.scrollHeight)},[r]),f?o.jsxs("div",{className:"relative",children:[o.jsx("pre",{ref:d,className:"fixed z-50 text-sm font-mono text-text-primary bg-bg-primary p-2 rounded border border-border overflow-auto transition-all duration-150 ease-out select-text",style:{bottom:f.bottom,right:f.right,width:f.width*2,maxHeight:f.height*3,transformOrigin:"bottom right",transform: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:Za(p.content)},g))}),o.jsx("button",{onClick:()=>{u(),l()},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}),dC=P.memo(function({workdir:r}){const i=lr(H=>H.setWorkdir),s=lr(H=>H.status),l=lr(H=>H.config),u=lr(H=>H.logs),f=lr(H=>H.start),c=lr(H=>H.stop),d=lr(H=>H.fetchLogs),[p,g]=P.useState(!1),[m,x]=P.useState(!1),[_,k]=P.useState(!1),[C,b]=P.useState(!1),v=P.useRef(null),y=P.useRef(null),S=P.useRef(null),j=P.useRef(null),A=(s==null?void 0:s.state)??"off",N=l!==null,D=A==="running"||A==="warning";P.useEffect(()=>{i(r??null)},[r,i]),P.useEffect(()=>{D&&d()},[D,d]),P.useEffect(()=>{S.current&&D&&(S.current.scrollTop=S.current.scrollHeight)},[u,D]);const T=()=>{D?c():f()},B=o.jsx("svg",{className:"w-4 h-4",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"})});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 ${A==="running"?"bg-accent-success":A==="warning"?"bg-accent-warning":A==="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:B})]}),N?o.jsxs(o.Fragment,{children:[A==="running"||A==="warning"?o.jsxs("div",{className:"flex gap-2",children:[o.jsxs("button",{onClick:T,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("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})}),"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.jsxs("svg",{className:"w-4 h-4",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"})]}),"Open"]})]}):o.jsx("button",{onClick:T,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:()=>{y.current&&clearTimeout(y.current),v.current=setTimeout(()=>{k(!0),b(!1)},500)},onMouseLeave:()=>{v.current&&clearTimeout(v.current),b(!0),y.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((H,W)=>o.jsx("span",{className:H.stream==="stderr"?"text-accent-warning":"",children:Za(H.content)},W))}),(_||C)&&j.current&&Yl.createPortal(o.jsx(uC,{logs:u,anchorRef:j,isHiding:C,onExpand:()=>x(!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(iC,{isOpen:p,onClose:()=>g(!1)}),m&&o.jsx(cC,{title:"Dev Server Logs",logs:u,onClose:()=>x(!1)})]})});function hC({isOpen:e,onClose:r,processName:i,logs:s}){return e?o.jsx(jt,{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((l,u)=>o.jsx("span",{className:l.stream==="stderr"?"text-accent-error":"",children:l.content},u))})}):null}const fC=P.memo(function({sessionId:r}){var _;const i=qa(k=>k.processes),s=qa(k=>k.stopProcess),[l,u]=P.useState(null),[f,c]=P.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=qa.getState().logs[k]??[];c(C.map(b=>({content:b.content,stream:b.stream}))),u(k)},x=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:()=>x(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))}),l&&o.jsx(hC,{isOpen:!!l,onClose:()=>{u(null),c([])},processName:((_=d.find(k=>k.id===l))==null?void 0:_.name)??"",logs:f})]})});function Zx({summary:e,messages:r,workdir:i}){const[s,l]=P.useState(!1),u=Bw(r),{branch:f}=zw(i),c=At(p=>p.version),d=Ee(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:()=>l(!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:Hw(u.aiTime)}),o.jsx("span",{className:"w-px h-3 bg-border"}),o.jsx("span",{className:"text-text-secondary",children:qx(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:qx(u.avgGenerationSpeed)}),o.jsx("span",{children:"tg"})]})}),o.jsx(Jw,{isOpen:s,onClose:()=>l(!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(rC,{criteria:(d==null?void 0:d.criteria)??[]})]})]}),f&&o.jsxs("div",{className:"mt-4 flex items-center gap-2 text-sm",children:[o.jsx("svg",{className:"w-4 h-4 flex-shrink-0 text-text-muted",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"})}),o.jsx("span",{className:"truncate text-text-secondary",title:f,children:f})]}),o.jsx(dC,{workdir:i}),o.jsx(fC,{sessionId:d==null?void 0:d.id}),c&&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",c]})]})]})}function pC({children:e,criteriaSidebarOpen:r=!0,onCriteriaSidebarToggle:i,messages:s}){const l=Ee(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-black/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",children:e}),r?o.jsx("aside",{className:"hidden md:block w-[320px] shrink-0 border-l border-border p-4 overflow-y-auto bg-bg-secondary",children:o.jsx(Zx,{summary:(l==null?void 0:l.summary)??null,messages:s,workdir:l==null?void 0:l.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-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(Zx,{summary:(l==null?void 0:l.summary)??null,messages:s,workdir:l==null?void 0:l.workdir})})]})]})}function mC(e,r){return r||e>85?"bg-accent-error":e>60?"bg-accent-warning":"bg-accent-success"}function Fb({percent:e,dangerZone:r=!1,size:i="md",className:s=""}){const l=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 ${l} ${s}`,children:o.jsx("div",{className:`h-full transition-all duration-300 ${mC(e,r)}`,style:{width:`${Math.min(e,100)}%`}})})}function gC({dangerZone:e,size:r="md"}){return e?o.jsx("span",{className:"text-accent-error animate-pulse text-[10px] font-medium",children:"Low!"}):null}function Qx(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function xC(){const e=Ee(p=>p.contextState),r=Ee(p=>p.currentSession),i=Ee(p=>p.compactContext);if(!e||!r)return null;const{currentTokens:s,maxTokens:l,compactionCount:u,dangerZone:f}=e,c=Math.round(s/l*100),d=r.isRunning;return o.jsx("div",{className:"flex-shrink-0 px-4 py-1.5 border-b border-border bg-bg-secondary/50",children:o.jsx("div",{className:"flex items-center justify-between gap-4",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[o.jsx("span",{className:"text-text-muted",children:"Context:"}),o.jsxs("span",{className:Qx(c,f),children:[zl(s)," / ",zl(l)]}),o.jsxs("span",{className:Qx(c,f),children:["(",c,"%)"]})]}),o.jsx(Fb,{percent:c,dangerZone:f}),o.jsx(gC,{dangerZone:f}),u>0&&o.jsxs("span",{className:"text-[10px] text-text-muted bg-bg-tertiary px-1 py-0.5 rounded",children:[u,"x"]}),o.jsx(tt,{variant:"secondary",size:"md",onClick:i,disabled:d,title:d?"Cannot compact while running":"Compact context",className:f?"border-accent-error text-accent-error hover:bg-accent-error/10":"",children:"Compact"})]})})})}function Jx(e){const r=[],i=String(e||"");let s=i.indexOf(","),l=0,u=!1;for(;!u;){s===-1&&(s=i.length,u=!0);const f=i.slice(l,s).trim();(f||!u)&&r.push(f),l=s+1,s=i.indexOf(",",l)}return r}function vC(e,r){const i={};return(e[e.length-1]===""?[...e,""]:e).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const bC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,yC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_C={};function ev(e,r){return(_C.jsx?yC:bC).test(e)}const SC=/[ \t\n\f\r]/g;function wC(e){return typeof e=="object"?e.type==="text"?tv(e.value):!1:tv(e)}function tv(e){return e.replace(SC,"")===""}class ao{constructor(r,i,s){this.normal=i,this.property=r,s&&(this.space=s)}}ao.prototype.normal={};ao.prototype.property={};ao.prototype.space=void 0;function Ub(e,r){const i={},s={};for(const l of e)Object.assign(i,l.property),Object.assign(s,l.normal);return new ao(i,s,r)}function Qa(e){return e.toLowerCase()}class Cn{constructor(r,i){this.attribute=i,this.property=r}}Cn.prototype.attribute="";Cn.prototype.booleanish=!1;Cn.prototype.boolean=!1;Cn.prototype.commaOrSpaceSeparated=!1;Cn.prototype.commaSeparated=!1;Cn.prototype.defined=!1;Cn.prototype.mustUseProperty=!1;Cn.prototype.number=!1;Cn.prototype.overloadedBoolean=!1;Cn.prototype.property="";Cn.prototype.spaceSeparated=!1;Cn.prototype.space=void 0;let CC=0;const Xe=Ii(),qt=Ii(),ah=Ii(),we=Ii(),yt=Ii(),Rs=Ii(),On=Ii();function Ii(){return 2**++CC}const oh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Xe,booleanish:qt,commaOrSpaceSeparated:On,commaSeparated:Rs,number:we,overloadedBoolean:ah,spaceSeparated:yt},Symbol.toStringTag,{value:"Module"})),Id=Object.keys(oh);class Lh extends Cn{constructor(r,i,s,l){let u=-1;if(super(r,i),nv(this,"space",l),typeof s=="number")for(;++u<Id.length;){const f=Id[u];nv(this,Id[u],(s&oh[f])===oh[f])}}}Lh.prototype.defined=!0;function nv(e,r,i){i&&(e[r]=i)}function Bs(e){const r={},i={};for(const[s,l]of Object.entries(e.properties)){const u=new Lh(s,e.transform(e.attributes||{},s),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(u.mustUseProperty=!0),r[s]=u,i[Qa(s)]=s,i[Qa(u.attribute)]=s}return new ao(r,i,e.space)}const $b=Bs({properties:{ariaActiveDescendant:null,ariaAtomic:qt,ariaAutoComplete:null,ariaBusy:qt,ariaChecked:qt,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:yt,ariaCurrent:null,ariaDescribedBy:yt,ariaDetails:null,ariaDisabled:qt,ariaDropEffect:yt,ariaErrorMessage:null,ariaExpanded:qt,ariaFlowTo:yt,ariaGrabbed:qt,ariaHasPopup:null,ariaHidden:qt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:yt,ariaLevel:we,ariaLive:null,ariaModal:qt,ariaMultiLine:qt,ariaMultiSelectable:qt,ariaOrientation:null,ariaOwns:yt,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:qt,ariaReadOnly:qt,ariaRelevant:null,ariaRequired:qt,ariaRoleDescription:yt,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:qt,ariaSetSize:we,ariaSort:null,ariaValueMax:we,ariaValueMin:we,ariaValueNow:we,ariaValueText:null,role:null},transform(e,r){return r==="role"?r:"aria-"+r.slice(4).toLowerCase()}});function qb(e,r){return r in e?e[r]:r}function Wb(e,r){return qb(e,r.toLowerCase())}const kC=Bs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Rs,acceptCharset:yt,accessKey:yt,action:null,allow:null,allowFullScreen:Xe,allowPaymentRequest:Xe,allowUserMedia:Xe,alt:null,as:null,async:Xe,autoCapitalize:null,autoComplete:yt,autoFocus:Xe,autoPlay:Xe,blocking:yt,capture:null,charSet:null,checked:Xe,cite:null,className:yt,cols:we,colSpan:null,content:null,contentEditable:qt,controls:Xe,controlsList:yt,coords:we|Rs,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Xe,defer:Xe,dir:null,dirName:null,disabled:Xe,download:ah,draggable:qt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Xe,formTarget:null,headers:yt,height:we,hidden:ah,high:we,href:null,hrefLang:null,htmlFor:yt,httpEquiv:yt,id:null,imageSizes:null,imageSrcSet:null,inert:Xe,inputMode:null,integrity:null,is:null,isMap:Xe,itemId:null,itemProp:yt,itemRef:yt,itemScope:Xe,itemType:yt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Xe,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:Xe,muted:Xe,name:null,nonce:null,noModule:Xe,noValidate:Xe,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:Xe,optimum:we,pattern:null,ping:yt,placeholder:null,playsInline:Xe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Xe,referrerPolicy:null,rel:yt,required:Xe,reversed:Xe,rows:we,rowSpan:we,sandbox:yt,scope:null,scoped:Xe,seamless:Xe,selected:Xe,shadowRootClonable:Xe,shadowRootDelegatesFocus:Xe,shadowRootMode:null,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:qt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:we,step:null,style:null,tabIndex:we,target:null,title:null,translate:null,type:null,typeMustMatch:Xe,useMap:null,value:qt,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:yt,axis:null,background:null,bgColor:null,border:we,borderColor:null,bottomMargin:we,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Xe,declare:Xe,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:Xe,noHref:Xe,noShade:Xe,noWrap:Xe,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:qt,standby:null,summary:null,text:null,topMargin:we,valueType:null,version:null,vAlign:null,vLink:null,vSpace:we,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Xe,disableRemotePlayback:Xe,prefix:null,property:null,results:we,security:null,unselectable:null},space:"html",transform:Wb}),EC=Bs({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:On,accentHeight:we,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:we,amplitude:we,arabicForm:null,ascent:we,attributeName:null,attributeType:null,azimuth:we,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:we,by:null,calcMode:null,capHeight:we,className:yt,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:we,diffuseConstant:we,direction:null,display:null,dur:null,divisor:we,dominantBaseline:null,download:Xe,dx:null,dy:null,edgeMode:null,editable:null,elevation:we,enableBackground:null,end:null,event:null,exponent:we,externalResourcesRequired:null,fill:null,fillOpacity:we,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:Rs,g2:Rs,glyphName:Rs,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:we,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:we,horizOriginX:we,horizOriginY:we,id:null,ideographic:we,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:we,k:we,k1:we,k2:we,k3:we,k4:we,kernelMatrix:On,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:we,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:we,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:we,overlineThickness:we,paintOrder:null,panose1:null,path:null,pathLength:we,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:yt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:we,pointsAtY:we,pointsAtZ:we,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:On,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:On,rev:On,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:On,requiredFeatures:On,requiredFonts:On,requiredFormats:On,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:we,specularExponent:we,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:we,strikethroughThickness:we,string:null,stroke:null,strokeDashArray:On,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:we,strokeOpacity:we,strokeWidth:null,style:null,surfaceScale:we,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:On,tabIndex:we,tableValues:null,target:null,targetX:we,targetY:we,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:On,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:we,underlineThickness:we,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:we,values:null,vAlphabetic:we,vMathematical:we,vectorEffect:null,vHanging:we,vIdeographic:we,version:null,vertAdvY:we,vertOriginX:we,vertOriginY:we,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:we,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:qb}),Gb=Bs({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()}}),Vb=Bs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Wb}),Kb=Bs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,r){return"xml:"+r.slice(3).toLowerCase()}}),jC={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"},NC=/[A-Z]/g,rv=/-[a-z]/g,TC=/^data[-\w.:]+$/i;function Yb(e,r){const i=Qa(r);let s=r,l=Cn;if(i in e.normal)return e.property[e.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&TC.test(r)){if(r.charAt(4)==="-"){const u=r.slice(5).replace(rv,DC);s="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=r.slice(4);if(!rv.test(u)){let f=u.replace(NC,AC);f.charAt(0)!=="-"&&(f="-"+f),r="data"+f}}l=Lh}return new l(s,r)}function AC(e){return"-"+e.toLowerCase()}function DC(e){return e.charAt(1).toUpperCase()}const Xb=Ub([$b,kC,Gb,Vb,Kb],"html"),ec=Ub([$b,EC,Gb,Vb,Kb],"svg");function iv(e){const r=String(e||"").trim();return r?r.split(/[ \t\n\r\f]+/g):[]}function LC(e){return e.join(" ").trim()}var ks={},Bd,sv;function RC(){if(sv)return Bd;sv=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,f=/^[;\s]*/,c=/^\s+|\s+$/g,d=`
|
|
92
|
+
`,p="/",g="*",m="",x="comment",_="declaration";function k(b,v){if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];v=v||{};var y=1,S=1;function j(R){var U=R.match(r);U&&(y+=U.length);var M=R.lastIndexOf(d);S=~M?R.length-M:S+R.length}function A(){var R={line:y,column:S};return function(U){return U.position=new N(R),B(),U}}function N(R){this.start=R,this.end={line:y,column:S},this.source=v.source}N.prototype.content=b;function D(R){var U=new Error(v.source+":"+y+":"+S+": "+R);if(U.reason=R,U.filename=v.source,U.line=y,U.column=S,U.source=b,!v.silent)throw U}function T(R){var U=R.exec(b);if(U){var M=U[0];return j(M),b=b.slice(M.length),U}}function B(){T(i)}function H(R){var U;for(R=R||[];U=W();)U!==!1&&R.push(U);return R}function W(){var R=A();if(!(p!=b.charAt(0)||g!=b.charAt(1))){for(var U=2;m!=b.charAt(U)&&(g!=b.charAt(U)||p!=b.charAt(U+1));)++U;if(U+=2,m===b.charAt(U-1))return D("End of comment missing");var M=b.slice(2,U-2);return S+=2,j(M),b=b.slice(U),S+=2,R({type:x,comment:M})}}function K(){var R=A(),U=T(s);if(U){if(W(),!T(l))return D("property missing ':'");var M=T(u),Y=R({type:_,property:C(U[0].replace(e,m)),value:M?C(M[0].replace(e,m)):m});return T(f),Y}}function q(){var R=[];H(R);for(var U;U=K();)U!==!1&&(R.push(U),H(R));return R}return B(),q()}function C(b){return b?b.replace(c,m):m}return Bd=k,Bd}var av;function OC(){if(av)return ks;av=1;var e=ks&&ks.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ks,"__esModule",{value:!0}),ks.default=i;const r=e(RC());function i(s,l){let u=null;if(!s||typeof s!="string")return u;const f=(0,r.default)(s),c=typeof l=="function";return f.forEach(d=>{if(d.type!=="declaration")return;const{property:p,value:g}=d;c?l(p,g,d):g&&(u=u||{},u[p]=g)}),u}return ks}var Ia={},ov;function MC(){if(ov)return Ia;ov=1,Object.defineProperty(Ia,"__esModule",{value:!0}),Ia.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,i=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,u=function(p){return!p||i.test(p)||e.test(p)},f=function(p,g){return g.toUpperCase()},c=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(l,c):p=p.replace(s,c),p.replace(r,f))};return Ia.camelCase=d,Ia}var Ba,lv;function IC(){if(lv)return Ba;lv=1;var e=Ba&&Ba.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},r=e(OC()),i=MC();function s(l,u){var f={};return!l||typeof l!="string"||(0,r.default)(l,function(c,d){c&&d&&(f[(0,i.camelCase)(c,u)]=d)}),f}return s.default=s,Ba=s,Ba}var BC=IC();const zC=Gl(BC),Zb=Qb("end"),Rh=Qb("start");function Qb(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 HC(e){const r=Rh(e),i=Zb(e);if(r&&i)return{start:r,end:i}}function Wa(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?cv(e.position):"start"in e||"end"in e?cv(e):"line"in e||"column"in e?lh(e):""}function lh(e){return uv(e&&e.line)+":"+uv(e&&e.column)}function cv(e){return lh(e&&e.start)+"-"+lh(e&&e.end)}function uv(e){return e&&typeof e=="number"?e:1}class fn extends Error{constructor(r,i,s){super(),typeof i=="string"&&(s=i,i=void 0);let l="",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"?l=r:!u.cause&&r&&(f=!0,l=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 c=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=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=c?c.line:void 0,this.name=Wa(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}}fn.prototype.file="";fn.prototype.name="";fn.prototype.reason="";fn.prototype.message="";fn.prototype.stack="";fn.prototype.column=void 0;fn.prototype.line=void 0;fn.prototype.ancestors=void 0;fn.prototype.cause=void 0;fn.prototype.fatal=void 0;fn.prototype.place=void 0;fn.prototype.ruleId=void 0;fn.prototype.source=void 0;const Oh={}.hasOwnProperty,PC=new Map,FC=/[A-Z]/g,UC=new Set(["table","tbody","thead","tfoot","tr"]),$C=new Set(["td","th"]),Jb="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function qC(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=QC(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=ZC(i,r.jsx,r.jsxs)}const l={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"?ec:Xb,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},u=ey(l,e,void 0);return u&&typeof u!="string"?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}function ey(e,r,i){if(r.type==="element")return WC(e,r,i);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return GC(e,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return KC(e,r,i);if(r.type==="mdxjsEsm")return VC(e,r);if(r.type==="root")return YC(e,r,i);if(r.type==="text")return XC(e,r)}function WC(e,r,i){const s=e.schema;let l=s;r.tagName.toLowerCase()==="svg"&&s.space==="html"&&(l=ec,e.schema=l),e.ancestors.push(r);const u=ny(e,r.tagName,!1),f=JC(e,r);let c=Ih(e,r);return UC.has(r.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!wC(d):!0})),ty(e,f,u,r),Mh(f,c),e.ancestors.pop(),e.schema=s,e.create(r,u,f,i)}function GC(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)}Ja(e,r.position)}function VC(e,r){if(r.data&&r.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(r.data.estree);Ja(e,r.position)}function KC(e,r,i){const s=e.schema;let l=s;r.name==="svg"&&s.space==="html"&&(l=ec,e.schema=l),e.ancestors.push(r);const u=r.name===null?e.Fragment:ny(e,r.name,!0),f=e2(e,r),c=Ih(e,r);return ty(e,f,u,r),Mh(f,c),e.ancestors.pop(),e.schema=s,e.create(r,u,f,i)}function YC(e,r,i){const s={};return Mh(s,Ih(e,r)),e.create(r,e.Fragment,s,i)}function XC(e,r){return r.value}function ty(e,r,i,s){typeof i!="string"&&i!==e.Fragment&&e.passNode&&(r.node=s)}function Mh(e,r){if(r.length>0){const i=r.length>1?r:r[0];i&&(e.children=i)}}function ZC(e,r,i){return s;function s(l,u,f,c){const p=Array.isArray(f.children)?i:r;return c?p(u,f,c):p(u,f)}}function QC(e,r){return i;function i(s,l,u,f){const c=Array.isArray(u.children),d=Rh(s);return r(l,u,f,c,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function JC(e,r){const i={};let s,l;for(l in r.properties)if(l!=="children"&&Oh.call(r.properties,l)){const u=t2(e,l,r.properties[l]);if(u){const[f,c]=u;e.tableCellAlignToStyle&&f==="align"&&typeof c=="string"&&$C.has(r.tagName)?s=c:i[f]=c}}if(s){const u=i.style||(i.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return i}function e2(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 c=f.properties[0];c.type,Object.assign(i,e.evaluater.evaluateExpression(c.argument))}else Ja(e,r.position);else{const l=s.name;let u;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const c=s.value.data.estree.body[0];c.type,u=e.evaluater.evaluateExpression(c.expression)}else Ja(e,r.position);else u=s.value===null?!0:s.value;i[l]=u}return i}function Ih(e,r){const i=[];let s=-1;const l=e.passKeys?new Map:PC;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=l.get(d)||0;f=d+"-"+p,l.set(d,p+1)}}const c=ey(e,u,f);c!==void 0&&i.push(c)}return i}function t2(e,r,i){const s=Yb(e.schema,r);if(!(i==null||typeof i=="number"&&Number.isNaN(i))){if(Array.isArray(i)&&(i=s.commaSeparated?vC(i):LC(i)),s.property==="style"){let l=typeof i=="object"?i:n2(e,String(i));return e.stylePropertyNameCase==="css"&&(l=r2(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&s.space?jC[s.property]||s.property:s.attribute,i]}}function n2(e,r){try{return zC(r,{reactCompat:!0})}catch(i){if(e.ignoreInvalidStyle)return{};const s=i,l=new fn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=Jb+"#cannot-parse-style-attribute",l}}function ny(e,r,i){let s;if(!i)s={type:"Literal",value:r};else if(r.includes(".")){const l=r.split(".");let u=-1,f;for(;++u<l.length;){const c=ev(l[u])?{type:"Identifier",name:l[u]}:{type:"Literal",value:l[u]};f=f?{type:"MemberExpression",object:f,property:c,computed:!!(u&&c.type==="Literal"),optional:!1}:c}s=f}else s=ev(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(s.type==="Literal"){const l=s.value;return Oh.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(s);Ja(e)}function Ja(e,r){const i=new fn("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=Jb+"#cannot-handle-mdx-estrees-without-createevaluater",i}function r2(e){const r={};let i;for(i in e)Oh.call(e,i)&&(r[i2(i)]=e[i]);return r}function i2(e){let r=e.replace(FC,s2);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function s2(e){return"-"+e.toLowerCase()}const zd={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"]},a2={};function Bh(e,r){const i=a2,s=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,l=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return ry(e,s,l)}function ry(e,r,i){if(o2(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 dv(e.children,r,i)}return Array.isArray(e)?dv(e,r,i):""}function dv(e,r,i){const s=[];let l=-1;for(;++l<e.length;)s[l]=ry(e[l],r,i);return s.join("")}function o2(e){return!!(e&&typeof e=="object")}const hv=document.createElement("i");function eo(e){const r="&"+e+";";hv.innerHTML=r;const i=hv.textContent;return i.charCodeAt(i.length-1)===59&&e!=="semi"||i===r?!1:i}function In(e,r,i,s){const l=e.length;let u=0,f;if(r<0?r=-r>l?0:l+r:r=r>l?l: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 Vn(e,r){return e.length>0?(In(e,e.length,0,r),e):r}const fv={}.hasOwnProperty;function iy(e){const r={};let i=-1;for(;++i<e.length;)l2(r,e[i]);return r}function l2(e,r){let i;for(i in r){const l=(fv.call(e,i)?e[i]:void 0)||(e[i]={}),u=r[i];let f;if(u)for(f in u){fv.call(l,f)||(l[f]=[]);const c=u[f];c2(l[f],Array.isArray(c)?c:c?[c]:[])}}}function c2(e,r){let i=-1;const s=[];for(;++i<r.length;)(r[i].add==="after"?e:s).push(r[i]);In(e,0,0,s)}function sy(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 Jn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const mn=ci(/[A-Za-z]/),hn=ci(/[\dA-Za-z]/),u2=ci(/[#-'*+\--9=?A-Z^-~]/);function Pl(e){return e!==null&&(e<32||e===127)}const ch=ci(/\d/),d2=ci(/[\dA-Fa-f]/),h2=ci(/[!-/:-@[-`{-~]/);function Pe(e){return e!==null&&e<-2}function bt(e){return e!==null&&(e<0||e===32)}function et(e){return e===-2||e===-1||e===32}const tc=ci(new RegExp("\\p{P}|\\p{S}","u")),Mi=ci(/\s/);function ci(e){return r;function r(i){return i!==null&&i>-1&&e.test(String.fromCharCode(i))}}function zs(e){const r=[];let i=-1,s=0,l=0;for(;++i<e.length;){const u=e.charCodeAt(i);let f="";if(u===37&&hn(e.charCodeAt(i+1))&&hn(e.charCodeAt(i+2)))l=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(f=String.fromCharCode(u));else if(u>55295&&u<57344){const c=e.charCodeAt(i+1);u<56320&&c>56319&&c<57344?(f=String.fromCharCode(u,c),l=1):f="�"}else f=String.fromCharCode(u);f&&(r.push(e.slice(s,i),encodeURIComponent(f)),s=i+l+1,f=""),l&&(i+=l,l=0)}return r.join("")+e.slice(s)}function at(e,r,i,s){const l=s?s-1:Number.POSITIVE_INFINITY;let u=0;return f;function f(d){return et(d)?(e.enter(i),c(d)):r(d)}function c(d){return et(d)&&u++<l?(e.consume(d),c):(e.exit(i),r(d))}}const f2={tokenize:p2};function p2(e){const r=e.attempt(this.parser.constructs.contentInitial,s,l);let i;return r;function s(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),at(e,r,"linePrefix")}function l(c){return e.enter("paragraph"),u(c)}function u(c){const d=e.enter("chunkText",{contentType:"text",previous:i});return i&&(i.next=d),i=d,f(c)}function f(c){if(c===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(c);return}return Pe(c)?(e.consume(c),e.exit("chunkText"),u):(e.consume(c),f)}}const m2={tokenize:g2},pv={tokenize:x2};function g2(e){const r=this,i=[];let s=0,l,u,f;return c;function c(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,l&&y();const j=r.events.length;let A=j,N;for(;A--;)if(r.events[A][0]==="exit"&&r.events[A][1].type==="chunkFlow"){N=r.events[A][1].end;break}v(s);let D=j;for(;D<r.events.length;)r.events[D][1].end={...N},D++;return In(r.events,A+1,0,r.events.slice(j)),r.events.length=D,p(S)}return c(S)}function p(S){if(s===i.length){if(!l)return x(S);if(l.currentConstruct&&l.currentConstruct.concrete)return k(S);r.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return r.containerState={},e.check(pv,g,m)(S)}function g(S){return l&&y(),v(s),x(S)}function m(S){return r.parser.lazy[r.now().line]=s!==i.length,f=r.now().offset,k(S)}function x(S){return r.containerState={},e.attempt(pv,_,k)(S)}function _(S){return s++,i.push([r.currentConstruct,r.containerState]),x(S)}function k(S){if(S===null){l&&y(),v(0),e.consume(S);return}return l=l||r.parser.flow(r.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:u}),C(S)}function C(S){if(S===null){b(e.exit("chunkFlow"),!0),v(0),e.consume(S);return}return Pe(S)?(e.consume(S),b(e.exit("chunkFlow")),s=0,r.interrupt=void 0,c):(e.consume(S),C)}function b(S,j){const A=r.sliceStream(S);if(j&&A.push(null),S.previous=u,u&&(u.next=S),u=S,l.defineSkip(S.start),l.write(A),r.parser.lazy[S.start.line]){let N=l.events.length;for(;N--;)if(l.events[N][1].start.offset<f&&(!l.events[N][1].end||l.events[N][1].end.offset>f))return;const D=r.events.length;let T=D,B,H;for(;T--;)if(r.events[T][0]==="exit"&&r.events[T][1].type==="chunkFlow"){if(B){H=r.events[T][1].end;break}B=!0}for(v(s),N=D;N<r.events.length;)r.events[N][1].end={...H},N++;In(r.events,T+1,0,r.events.slice(D)),r.events.length=N}}function v(S){let j=i.length;for(;j-- >S;){const A=i[j];r.containerState=A[1],A[0].exit.call(r,e)}i.length=S}function y(){l.write([null]),u=void 0,l=void 0,r.containerState._closeFlow=void 0}}function x2(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 Os(e){if(e===null||bt(e)||Mi(e))return 1;if(tc(e))return 2}function nc(e,r,i){const s=[];let l=-1;for(;++l<e.length;){const u=e[l].resolveAll;u&&!s.includes(u)&&(r=u(r,i),s.push(u))}return r}const uh={name:"attention",resolveAll:v2,tokenize:b2};function v2(e,r){let i=-1,s,l,u,f,c,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},x={...e[i][1].start};mv(m,-d),mv(x,d),f={type:d>1?"strongSequence":"emphasisSequence",start:m,end:{...e[s][1].end}},c={type:d>1?"strongSequence":"emphasisSequence",start:{...e[i][1].start},end:x},u={type:d>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[i][1].start}},l={type:d>1?"strong":"emphasis",start:{...f.start},end:{...c.end}},e[s][1].end={...f.start},e[i][1].start={...c.end},p=[],e[s][1].end.offset-e[s][1].start.offset&&(p=Vn(p,[["enter",e[s][1],r],["exit",e[s][1],r]])),p=Vn(p,[["enter",l,r],["enter",f,r],["exit",f,r],["enter",u,r]]),p=Vn(p,nc(r.parser.constructs.insideSpan.null,e.slice(s+1,i),r)),p=Vn(p,[["exit",u,r],["enter",c,r],["exit",c,r],["exit",l,r]]),e[i][1].end.offset-e[i][1].start.offset?(g=2,p=Vn(p,[["enter",e[i][1],r],["exit",e[i][1],r]])):g=0,In(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 b2(e,r){const i=this.parser.constructs.attentionMarkers.null,s=this.previous,l=Os(s);let u;return f;function f(d){return u=d,e.enter("attentionSequence"),c(d)}function c(d){if(d===u)return e.consume(d),c;const p=e.exit("attentionSequence"),g=Os(d),m=!g||g===2&&l||i.includes(d),x=!l||l===2&&g||i.includes(s);return p._open=!!(u===42?m:m&&(l||!x)),p._close=!!(u===42?x:x&&(g||!m)),r(d)}}function mv(e,r){e.column+=r,e.offset+=r,e._bufferIndex+=r}const y2={name:"autolink",tokenize:_2};function _2(e,r,i){let s=0;return l;function l(_){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(_){return mn(_)?(e.consume(_),f):_===64?i(_):p(_)}function f(_){return _===43||_===45||_===46||hn(_)?(s=1,c(_)):p(_)}function c(_){return _===58?(e.consume(_),s=0,d):(_===43||_===45||_===46||hn(_))&&s++<32?(e.consume(_),c):(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||Pl(_)?i(_):(e.consume(_),d)}function p(_){return _===64?(e.consume(_),g):u2(_)?(e.consume(_),p):i(_)}function g(_){return hn(_)?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):x(_)}function x(_){if((_===45||hn(_))&&s++<63){const k=_===45?x:m;return e.consume(_),k}return i(_)}}const oo={partial:!0,tokenize:S2};function S2(e,r,i){return s;function s(u){return et(u)?at(e,l,"linePrefix")(u):l(u)}function l(u){return u===null||Pe(u)?r(u):i(u)}}const ay={continuation:{tokenize:C2},exit:k2,name:"blockQuote",tokenize:w2};function w2(e,r,i){const s=this;return l;function l(f){if(f===62){const c=s.containerState;return c.open||(e.enter("blockQuote",{_container:!0}),c.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(f),e.exit("blockQuoteMarker"),u}return i(f)}function u(f){return et(f)?(e.enter("blockQuotePrefixWhitespace"),e.consume(f),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),r):(e.exit("blockQuotePrefix"),r(f))}}function C2(e,r,i){const s=this;return l;function l(f){return et(f)?at(e,u,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f):u(f)}function u(f){return e.attempt(ay,r,i)(f)}}function k2(e){e.exit("blockQuote")}const oy={name:"characterEscape",tokenize:E2};function E2(e,r,i){return s;function s(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),l}function l(u){return h2(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),r):i(u)}}const ly={name:"characterReference",tokenize:j2};function j2(e,r,i){const s=this;let l=0,u,f;return c;function c(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=hn,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=d2,g):(e.enter("characterReferenceValue"),u=7,f=ch,g(m))}function g(m){if(m===59&&l){const x=e.exit("characterReferenceValue");return f===hn&&!eo(s.sliceSerialize(x))?i(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),r)}return f(m)&&l++<u?(e.consume(m),g):i(m)}}const gv={partial:!0,tokenize:T2},xv={concrete:!0,name:"codeFenced",tokenize:N2};function N2(e,r,i){const s=this,l={partial:!0,tokenize:A};let u=0,f=0,c;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,c=N,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(N)}function g(N){return N===c?(f++,e.consume(N),g):f<3?i(N):(e.exit("codeFencedFenceSequence"),et(N)?at(e,m,"whitespace")(N):m(N))}function m(N){return N===null||Pe(N)?(e.exit("codeFencedFence"),s.interrupt?r(N):e.check(gv,C,j)(N)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),x(N))}function x(N){return N===null||Pe(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(N)):et(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),at(e,_,"whitespace")(N)):N===96&&N===c?i(N):(e.consume(N),x)}function _(N){return N===null||Pe(N)?m(N):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(N))}function k(N){return N===null||Pe(N)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(N)):N===96&&N===c?i(N):(e.consume(N),k)}function C(N){return e.attempt(l,j,b)(N)}function b(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),v}function v(N){return u>0&&et(N)?at(e,y,"linePrefix",u+1)(N):y(N)}function y(N){return N===null||Pe(N)?e.check(gv,C,j)(N):(e.enter("codeFlowValue"),S(N))}function S(N){return N===null||Pe(N)?(e.exit("codeFlowValue"),y(N)):(e.consume(N),S)}function j(N){return e.exit("codeFenced"),r(N)}function A(N,D,T){let B=0;return H;function H(U){return N.enter("lineEnding"),N.consume(U),N.exit("lineEnding"),W}function W(U){return N.enter("codeFencedFence"),et(U)?at(N,K,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):K(U)}function K(U){return U===c?(N.enter("codeFencedFenceSequence"),q(U)):T(U)}function q(U){return U===c?(B++,N.consume(U),q):B>=f?(N.exit("codeFencedFenceSequence"),et(U)?at(N,R,"whitespace")(U):R(U)):T(U)}function R(U){return U===null||Pe(U)?(N.exit("codeFencedFence"),D(U)):T(U)}}}function T2(e,r,i){const s=this;return l;function l(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 Hd={name:"codeIndented",tokenize:D2},A2={partial:!0,tokenize:L2};function D2(e,r,i){const s=this;return l;function l(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):Pe(p)?e.attempt(A2,f,d)(p):(e.enter("codeFlowValue"),c(p))}function c(p){return p===null||Pe(p)?(e.exit("codeFlowValue"),f(p)):(e.consume(p),c)}function d(p){return e.exit("codeIndented"),r(p)}}function L2(e,r,i){const s=this;return l;function l(f){return s.parser.lazy[s.now().line]?i(f):Pe(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),l):at(e,u,"linePrefix",5)(f)}function u(f){const c=s.events[s.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?r(f):Pe(f)?l(f):i(f)}}const R2={name:"codeText",previous:M2,resolve:O2,tokenize:I2};function O2(e){let r=e.length-4,i=3,s,l;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;)l===void 0?s!==r&&e[s][1].type!=="lineEnding"&&(l=s):(s===r||e[s][1].type==="lineEnding")&&(e[l][1].type="codeTextData",s!==l+2&&(e[l][1].end=e[s-1][1].end,e.splice(l+2,s-l-2),r-=s-l-2,s=l+2),l=void 0);return e}function M2(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function I2(e,r,i){let s=0,l,u;return f;function f(m){return e.enter("codeText"),e.enter("codeTextSequence"),c(m)}function c(m){return m===96?(e.consume(m),s++,c):(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"),l=0,g(m)):Pe(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||Pe(m)?(e.exit("codeTextData"),d(m)):(e.consume(m),p)}function g(m){return m===96?(e.consume(m),l++,g):l===s?(e.exit("codeTextSequence"),e.exit("codeText"),r(m)):(u.type="codeTextData",p(m))}}class B2{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 l=i||0;this.setCursor(Math.trunc(r));const u=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return s&&za(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),za(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),za(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);za(this.right,i.reverse())}else{const i=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);za(this.left,i.reverse())}}}function za(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,l,u,f,c,d,p;const g=new B2(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,z2(g,i)),i=r[i],p=!0);else if(s[1]._container){for(u=i,l=void 0;u--;)if(f=g.get(u),f[1].type==="lineEnding"||f[1].type==="lineEndingBlank")f[0]==="enter"&&(l&&(g.get(l)[1].type="lineEndingBlank"),f[1].type="lineEnding",l=u);else if(!(f[1].type==="linePrefix"||f[1].type==="listItemIndent"))break;l&&(s[1].end={...g.get(l)[1].start},c=g.slice(l,i),c.unshift(s),g.splice(l,i-l+1,c))}}return In(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!p}function z2(e,r){const i=e.get(r)[1],s=e.get(r)[2];let l=r-1;const u=[];let f=i._tokenizer;f||(f=s.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(f._contentTypeTextTrailing=!0));const c=f.events,d=[],p={};let g,m,x=-1,_=i,k=0,C=0;const b=[C];for(;_;){for(;e.get(++l)[1]!==_;);u.push(l),_._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;++x<c.length;)c[x][0]==="exit"&&c[x-1][0]==="enter"&&c[x][1].type===c[x-1][1].type&&c[x][1].start.line!==c[x][1].end.line&&(C=x+1,b.push(C),_._tokenizer=void 0,_.previous=void 0,_=_.next);for(f.events=[],_?(_._tokenizer=void 0,_.previous=void 0):b.pop(),x=b.length;x--;){const v=c.slice(b[x],b[x+1]),y=u.pop();d.push([y,y+v.length-1]),e.splice(y,2,v)}for(d.reverse(),x=-1;++x<d.length;)p[k+d[x][0]]=k+d[x][1],k+=d[x][1]-d[x][0]-1;return p}const H2={resolve:F2,tokenize:U2},P2={partial:!0,tokenize:$2};function F2(e){return cy(e),e}function U2(e,r){let i;return s;function s(c){return e.enter("content"),i=e.enter("chunkContent",{contentType:"content"}),l(c)}function l(c){return c===null?u(c):Pe(c)?e.check(P2,f,u)(c):(e.consume(c),l)}function u(c){return e.exit("chunkContent"),e.exit("content"),r(c)}function f(c){return e.consume(c),e.exit("chunkContent"),i.next=e.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,l}}function $2(e,r,i){const s=this;return l;function l(f){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),at(e,u,"linePrefix")}function u(f){if(f===null||Pe(f))return i(f);const c=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?r(f):e.interrupt(s.parser.constructs.flow,i,r)(f)}}function uy(e,r,i,s,l,u,f,c,d){const p=d||Number.POSITIVE_INFINITY;let g=0;return m;function m(v){return v===60?(e.enter(s),e.enter(l),e.enter(u),e.consume(v),e.exit(u),x):v===null||v===32||v===41||Pl(v)?i(v):(e.enter(s),e.enter(f),e.enter(c),e.enter("chunkString",{contentType:"string"}),C(v))}function x(v){return v===62?(e.enter(u),e.consume(v),e.exit(u),e.exit(l),e.exit(s),r):(e.enter(c),e.enter("chunkString",{contentType:"string"}),_(v))}function _(v){return v===62?(e.exit("chunkString"),e.exit(c),x(v)):v===null||v===60||Pe(v)?i(v):(e.consume(v),v===92?k:_)}function k(v){return v===60||v===62||v===92?(e.consume(v),_):_(v)}function C(v){return!g&&(v===null||v===41||bt(v))?(e.exit("chunkString"),e.exit(c),e.exit(f),e.exit(s),r(v)):g<p&&v===40?(e.consume(v),g++,C):v===41?(e.consume(v),g--,C):v===null||v===32||v===40||Pl(v)?i(v):(e.consume(v),v===92?b:C)}function b(v){return v===40||v===41||v===92?(e.consume(v),C):C(v)}}function dy(e,r,i,s,l,u){const f=this;let c=0,d;return p;function p(_){return e.enter(s),e.enter(l),e.consume(_),e.exit(l),e.enter(u),g}function g(_){return c>999||_===null||_===91||_===93&&!d||_===94&&!c&&"_hiddenFootnoteSupport"in f.parser.constructs?i(_):_===93?(e.exit(u),e.enter(l),e.consume(_),e.exit(l),e.exit(s),r):Pe(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),m(_))}function m(_){return _===null||_===91||_===93||Pe(_)||c++>999?(e.exit("chunkString"),g(_)):(e.consume(_),d||(d=!et(_)),_===92?x:m)}function x(_){return _===91||_===92||_===93?(e.consume(_),c++,m):m(_)}}function hy(e,r,i,s,l,u){let f;return c;function c(x){return x===34||x===39||x===40?(e.enter(s),e.enter(l),e.consume(x),e.exit(l),f=x===40?41:x,d):i(x)}function d(x){return x===f?(e.enter(l),e.consume(x),e.exit(l),e.exit(s),r):(e.enter(u),p(x))}function p(x){return x===f?(e.exit(u),d(f)):x===null?i(x):Pe(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),at(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===f||x===null||Pe(x)?(e.exit("chunkString"),p(x)):(e.consume(x),x===92?m:g)}function m(x){return x===f||x===92?(e.consume(x),g):g(x)}}function Ga(e,r){let i;return s;function s(l){return Pe(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i=!0,s):et(l)?at(e,s,i?"linePrefix":"lineSuffix")(l):r(l)}}const q2={name:"definition",tokenize:G2},W2={partial:!0,tokenize:V2};function G2(e,r,i){const s=this;let l;return u;function u(_){return e.enter("definition"),f(_)}function f(_){return dy.call(s,e,c,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(_)}function c(_){return l=Jn(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 bt(_)?Ga(e,p)(_):p(_)}function p(_){return uy(e,g,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(_)}function g(_){return e.attempt(W2,m,m)(_)}function m(_){return et(_)?at(e,x,"whitespace")(_):x(_)}function x(_){return _===null||Pe(_)?(e.exit("definition"),s.parser.defined.push(l),r(_)):i(_)}}function V2(e,r,i){return s;function s(c){return bt(c)?Ga(e,l)(c):i(c)}function l(c){return hy(e,u,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function u(c){return et(c)?at(e,f,"whitespace")(c):f(c)}function f(c){return c===null||Pe(c)?r(c):i(c)}}const K2={name:"hardBreakEscape",tokenize:Y2};function Y2(e,r,i){return s;function s(u){return e.enter("hardBreakEscape"),e.consume(u),l}function l(u){return Pe(u)?(e.exit("hardBreakEscape"),r(u)):i(u)}}const X2={name:"headingAtx",resolve:Z2,tokenize:Q2};function Z2(e,r){let i=e.length-2,s=3,l,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&&(l={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"},In(e,s,i-s+1,[["enter",l,r],["enter",u,r],["exit",u,r],["exit",l,r]])),e}function Q2(e,r,i){let s=0;return l;function l(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||bt(g)?(e.exit("atxHeadingSequence"),c(g)):i(g)}function c(g){return g===35?(e.enter("atxHeadingSequence"),d(g)):g===null||Pe(g)?(e.exit("atxHeading"),r(g)):et(g)?at(e,c,"whitespace")(g):(e.enter("atxHeadingText"),p(g))}function d(g){return g===35?(e.consume(g),d):(e.exit("atxHeadingSequence"),c(g))}function p(g){return g===null||g===35||bt(g)?(e.exit("atxHeadingText"),c(g)):(e.consume(g),p)}}const J2=["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"],vv=["pre","script","style","textarea"],ek={concrete:!0,name:"htmlFlow",resolveTo:rk,tokenize:ik},tk={partial:!0,tokenize:ak},nk={partial:!0,tokenize:sk};function rk(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 ik(e,r,i){const s=this;let l,u,f,c,d;return p;function p(F){return g(F)}function g(F){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(F),m}function m(F){return F===33?(e.consume(F),x):F===47?(e.consume(F),u=!0,C):F===63?(e.consume(F),l=3,s.interrupt?r:L):mn(F)?(e.consume(F),f=String.fromCharCode(F),b):i(F)}function x(F){return F===45?(e.consume(F),l=2,_):F===91?(e.consume(F),l=5,c=0,k):mn(F)?(e.consume(F),l=4,s.interrupt?r:L):i(F)}function _(F){return F===45?(e.consume(F),s.interrupt?r:L):i(F)}function k(F){const ie="CDATA[";return F===ie.charCodeAt(c++)?(e.consume(F),c===ie.length?s.interrupt?r:K:k):i(F)}function C(F){return mn(F)?(e.consume(F),f=String.fromCharCode(F),b):i(F)}function b(F){if(F===null||F===47||F===62||bt(F)){const ie=F===47,Q=f.toLowerCase();return!ie&&!u&&vv.includes(Q)?(l=1,s.interrupt?r(F):K(F)):J2.includes(f.toLowerCase())?(l=6,ie?(e.consume(F),v):s.interrupt?r(F):K(F)):(l=7,s.interrupt&&!s.parser.lazy[s.now().line]?i(F):u?y(F):S(F))}return F===45||hn(F)?(e.consume(F),f+=String.fromCharCode(F),b):i(F)}function v(F){return F===62?(e.consume(F),s.interrupt?r:K):i(F)}function y(F){return et(F)?(e.consume(F),y):H(F)}function S(F){return F===47?(e.consume(F),H):F===58||F===95||mn(F)?(e.consume(F),j):et(F)?(e.consume(F),S):H(F)}function j(F){return F===45||F===46||F===58||F===95||hn(F)?(e.consume(F),j):A(F)}function A(F){return F===61?(e.consume(F),N):et(F)?(e.consume(F),A):S(F)}function N(F){return F===null||F===60||F===61||F===62||F===96?i(F):F===34||F===39?(e.consume(F),d=F,D):et(F)?(e.consume(F),N):T(F)}function D(F){return F===d?(e.consume(F),d=null,B):F===null||Pe(F)?i(F):(e.consume(F),D)}function T(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||bt(F)?A(F):(e.consume(F),T)}function B(F){return F===47||F===62||et(F)?S(F):i(F)}function H(F){return F===62?(e.consume(F),W):i(F)}function W(F){return F===null||Pe(F)?K(F):et(F)?(e.consume(F),W):i(F)}function K(F){return F===45&&l===2?(e.consume(F),M):F===60&&l===1?(e.consume(F),Y):F===62&&l===4?(e.consume(F),I):F===63&&l===3?(e.consume(F),L):F===93&&l===5?(e.consume(F),z):Pe(F)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(tk,V,q)(F)):F===null||Pe(F)?(e.exit("htmlFlowData"),q(F)):(e.consume(F),K)}function q(F){return e.check(nk,R,V)(F)}function R(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),U}function U(F){return F===null||Pe(F)?q(F):(e.enter("htmlFlowData"),K(F))}function M(F){return F===45?(e.consume(F),L):K(F)}function Y(F){return F===47?(e.consume(F),f="",Z):K(F)}function Z(F){if(F===62){const ie=f.toLowerCase();return vv.includes(ie)?(e.consume(F),I):K(F)}return mn(F)&&f.length<8?(e.consume(F),f+=String.fromCharCode(F),Z):K(F)}function z(F){return F===93?(e.consume(F),L):K(F)}function L(F){return F===62?(e.consume(F),I):F===45&&l===2?(e.consume(F),L):K(F)}function I(F){return F===null||Pe(F)?(e.exit("htmlFlowData"),V(F)):(e.consume(F),I)}function V(F){return e.exit("htmlFlow"),r(F)}}function sk(e,r,i){const s=this;return l;function l(f){return Pe(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 ak(e,r,i){return s;function s(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(oo,r,i)}}const ok={name:"htmlText",tokenize:lk};function lk(e,r,i){const s=this;let l,u,f;return c;function c(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),d}function d(L){return L===33?(e.consume(L),p):L===47?(e.consume(L),A):L===63?(e.consume(L),S):mn(L)?(e.consume(L),T):i(L)}function p(L){return L===45?(e.consume(L),g):L===91?(e.consume(L),u=0,k):mn(L)?(e.consume(L),y):i(L)}function g(L){return L===45?(e.consume(L),_):i(L)}function m(L){return L===null?i(L):L===45?(e.consume(L),x):Pe(L)?(f=m,Y(L)):(e.consume(L),m)}function x(L){return L===45?(e.consume(L),_):m(L)}function _(L){return L===62?M(L):L===45?x(L):m(L)}function k(L){const I="CDATA[";return L===I.charCodeAt(u++)?(e.consume(L),u===I.length?C:k):i(L)}function C(L){return L===null?i(L):L===93?(e.consume(L),b):Pe(L)?(f=C,Y(L)):(e.consume(L),C)}function b(L){return L===93?(e.consume(L),v):C(L)}function v(L){return L===62?M(L):L===93?(e.consume(L),v):C(L)}function y(L){return L===null||L===62?M(L):Pe(L)?(f=y,Y(L)):(e.consume(L),y)}function S(L){return L===null?i(L):L===63?(e.consume(L),j):Pe(L)?(f=S,Y(L)):(e.consume(L),S)}function j(L){return L===62?M(L):S(L)}function A(L){return mn(L)?(e.consume(L),N):i(L)}function N(L){return L===45||hn(L)?(e.consume(L),N):D(L)}function D(L){return Pe(L)?(f=D,Y(L)):et(L)?(e.consume(L),D):M(L)}function T(L){return L===45||hn(L)?(e.consume(L),T):L===47||L===62||bt(L)?B(L):i(L)}function B(L){return L===47?(e.consume(L),M):L===58||L===95||mn(L)?(e.consume(L),H):Pe(L)?(f=B,Y(L)):et(L)?(e.consume(L),B):M(L)}function H(L){return L===45||L===46||L===58||L===95||hn(L)?(e.consume(L),H):W(L)}function W(L){return L===61?(e.consume(L),K):Pe(L)?(f=W,Y(L)):et(L)?(e.consume(L),W):B(L)}function K(L){return L===null||L===60||L===61||L===62||L===96?i(L):L===34||L===39?(e.consume(L),l=L,q):Pe(L)?(f=K,Y(L)):et(L)?(e.consume(L),K):(e.consume(L),R)}function q(L){return L===l?(e.consume(L),l=void 0,U):L===null?i(L):Pe(L)?(f=q,Y(L)):(e.consume(L),q)}function R(L){return L===null||L===34||L===39||L===60||L===61||L===96?i(L):L===47||L===62||bt(L)?B(L):(e.consume(L),R)}function U(L){return L===47||L===62||bt(L)?B(L):i(L)}function M(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),r):i(L)}function Y(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),Z}function Z(L){return et(L)?at(e,z,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):z(L)}function z(L){return e.enter("htmlTextData"),f(L)}}const zh={name:"labelEnd",resolveAll:hk,resolveTo:fk,tokenize:pk},ck={tokenize:mk},uk={tokenize:gk},dk={tokenize:xk};function hk(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 l=s.type==="labelImage"?4:2;s.type="data",r+=l}}return e.length!==i.length&&In(e,0,e.length,i),e}function fk(e,r){let i=e.length,s=0,l,u,f,c;for(;i--;)if(l=e[i][1],u){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;e[i][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(f){if(e[i][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(u=i,l.type!=="labelLink")){s=2;break}}else l.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 c=[["enter",d,r],["enter",p,r]],c=Vn(c,e.slice(u+1,u+s+3)),c=Vn(c,[["enter",g,r]]),c=Vn(c,nc(r.parser.constructs.insideSpan.null,e.slice(u+s+4,f-3),r)),c=Vn(c,[["exit",g,r],e[f-2],e[f-1],["exit",p,r]]),c=Vn(c,e.slice(f+1)),c=Vn(c,[["exit",d,r]]),In(e,u,e.length,c),e}function pk(e,r,i){const s=this;let l=s.events.length,u,f;for(;l--;)if((s.events[l][1].type==="labelImage"||s.events[l][1].type==="labelLink")&&!s.events[l][1]._balanced){u=s.events[l][1];break}return c;function c(x){return u?u._inactive?m(x):(f=s.parser.defined.includes(Jn(s.sliceSerialize({start:u.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(x),e.exit("labelMarker"),e.exit("labelEnd"),d):i(x)}function d(x){return x===40?e.attempt(ck,g,f?g:m)(x):x===91?e.attempt(uk,g,f?p:m)(x):f?g(x):m(x)}function p(x){return e.attempt(dk,g,m)(x)}function g(x){return r(x)}function m(x){return u._balanced=!0,i(x)}}function mk(e,r,i){return s;function s(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),l}function l(m){return bt(m)?Ga(e,u)(m):u(m)}function u(m){return m===41?g(m):uy(e,f,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function f(m){return bt(m)?Ga(e,d)(m):g(m)}function c(m){return i(m)}function d(m){return m===34||m===39||m===40?hy(e,p,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):g(m)}function p(m){return bt(m)?Ga(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 gk(e,r,i){const s=this;return l;function l(c){return dy.call(s,e,u,f,"reference","referenceMarker","referenceString")(c)}function u(c){return s.parser.defined.includes(Jn(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?r(c):i(c)}function f(c){return i(c)}}function xk(e,r,i){return s;function s(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),l}function l(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),r):i(u)}}const vk={name:"labelStartImage",resolveAll:zh.resolveAll,tokenize:bk};function bk(e,r,i){const s=this;return l;function l(c){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(c),e.exit("labelImageMarker"),u}function u(c){return c===91?(e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelImage"),f):i(c)}function f(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?i(c):r(c)}}const yk={name:"labelStartLink",resolveAll:zh.resolveAll,tokenize:_k};function _k(e,r,i){const s=this;return l;function l(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 Pd={name:"lineEnding",tokenize:Sk};function Sk(e,r){return i;function i(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),at(e,r,"linePrefix")}}const Ol={name:"thematicBreak",tokenize:wk};function wk(e,r,i){let s=0,l;return u;function u(p){return e.enter("thematicBreak"),f(p)}function f(p){return l=p,c(p)}function c(p){return p===l?(e.enter("thematicBreakSequence"),d(p)):s>=3&&(p===null||Pe(p))?(e.exit("thematicBreak"),r(p)):i(p)}function d(p){return p===l?(e.consume(p),s++,d):(e.exit("thematicBreakSequence"),et(p)?at(e,c,"whitespace")(p):c(p))}}const wn={continuation:{tokenize:jk},exit:Tk,name:"list",tokenize:Ek},Ck={partial:!0,tokenize:Ak},kk={partial:!0,tokenize:Nk};function Ek(e,r,i){const s=this,l=s.events[s.events.length-1];let u=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,f=0;return c;function c(_){const k=s.containerState.type||(_===42||_===43||_===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!s.containerState.marker||_===s.containerState.marker:ch(_)){if(s.containerState.type||(s.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),_===42||_===45?e.check(Ol,i,p)(_):p(_);if(!s.interrupt||_===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(_)}return i(_)}function d(_){return ch(_)&&++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(oo,s.interrupt?i:g,e.attempt(Ck,x,m))}function g(_){return s.containerState.initialBlankLine=!0,u++,x(_)}function m(_){return et(_)?(e.enter("listItemPrefixWhitespace"),e.consume(_),e.exit("listItemPrefixWhitespace"),x):i(_)}function x(_){return s.containerState.size=u+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,r(_)}}function jk(e,r,i){const s=this;return s.containerState._closeFlow=void 0,e.check(oo,l,u);function l(c){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,at(e,r,"listItemIndent",s.containerState.size+1)(c)}function u(c){return s.containerState.furtherBlankLines||!et(c)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,f(c)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(kk,r,f)(c))}function f(c){return s.containerState._closeFlow=!0,s.interrupt=void 0,at(e,e.attempt(wn,r,i),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function Nk(e,r,i){const s=this;return at(e,l,"listItemIndent",s.containerState.size+1);function l(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 Tk(e){e.exit(this.containerState.type)}function Ak(e,r,i){const s=this;return at(e,l,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(u){const f=s.events[s.events.length-1];return!et(u)&&f&&f[1].type==="listItemPrefixWhitespace"?r(u):i(u)}}const bv={name:"setextUnderline",resolveTo:Dk,tokenize:Lk};function Dk(e,r){let i=e.length,s,l,u;for(;i--;)if(e[i][0]==="enter"){if(e[i][1].type==="content"){s=i;break}e[i][1].type==="paragraph"&&(l=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[l][1].type="setextHeadingText",u?(e.splice(l,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 Lk(e,r,i){const s=this;let l;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"),l=p,f(p)):i(p)}function f(p){return e.enter("setextHeadingLineSequence"),c(p)}function c(p){return p===l?(e.consume(p),c):(e.exit("setextHeadingLineSequence"),et(p)?at(e,d,"lineSuffix")(p):d(p))}function d(p){return p===null||Pe(p)?(e.exit("setextHeadingLine"),r(p)):i(p)}}const Rk={tokenize:Ok};function Ok(e){const r=this,i=e.attempt(oo,s,e.attempt(this.parser.constructs.flowInitial,l,at(e,e.attempt(this.parser.constructs.flow,l,e.attempt(H2,l)),"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 l(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),r.currentConstruct=void 0,i}}const Mk={resolveAll:py()},Ik=fy("string"),Bk=fy("text");function fy(e){return{resolveAll:py(e==="text"?zk:void 0),tokenize:r};function r(i){const s=this,l=this.parser.constructs[e],u=i.attempt(l,f,c);return f;function f(g){return p(g)?u(g):c(g)}function c(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=l[g];let x=-1;if(m)for(;++x<m.length;){const _=m[x];if(!_.previous||_.previous.call(s,s.previous))return!0}return!1}}}function py(e){return r;function r(i,s){let l=-1,u;for(;++l<=i.length;)u===void 0?i[l]&&i[l][1].type==="data"&&(u=l,l++):(!i[l]||i[l][1].type!=="data")&&(l!==u+2&&(i[u][1].end=i[l-1][1].end,i.splice(u+2,l-u-2),l=u+2),u=void 0);return e?e(i,s):i}}function zk(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],l=r.sliceStream(s);let u=l.length,f=-1,c=0,d;for(;u--;){const p=l[u];if(typeof p=="string"){for(f=p.length;p.charCodeAt(f-1)===32;)c++,f--;if(f)break;f=-1}else if(p===-2)d=!0,c++;else if(p!==-1){u++;break}}if(r._contentTypeTextTrailing&&i===e.length&&(c=0),c){const p={type:i===e.length||d||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?f:s.start._bufferIndex+f,_index:s.start._index+u,line:s.end.line,column:s.end.column-c,offset:s.end.offset-c},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 Hk={42:wn,43:wn,45:wn,48:wn,49:wn,50:wn,51:wn,52:wn,53:wn,54:wn,55:wn,56:wn,57:wn,62:ay},Pk={91:q2},Fk={[-2]:Hd,[-1]:Hd,32:Hd},Uk={35:X2,42:Ol,45:[bv,Ol],60:ek,61:bv,95:Ol,96:xv,126:xv},$k={38:ly,92:oy},qk={[-5]:Pd,[-4]:Pd,[-3]:Pd,33:vk,38:ly,42:uh,60:[y2,ok],91:yk,92:[K2,oy],93:zh,95:uh,96:R2},Wk={null:[uh,Mk]},Gk={null:[42,95]},Vk={null:[]},Kk=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Gk,contentInitial:Pk,disable:Vk,document:Hk,flow:Uk,flowInitial:Fk,insideSpan:Wk,string:$k,text:qk},Symbol.toStringTag,{value:"Module"}));function Yk(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 l={},u=[];let f=[],c=[];const d={attempt:D(A),check:D(N),consume:y,enter:S,exit:j,interrupt:D(N,{interrupt:!0})},p={code:null,containerState:{},defineSkip:C,events:[],now:k,parser:e,previous:null,sliceSerialize:x,sliceStream:_,write:m};let g=r.tokenize.call(p,d);return r.resolveAll&&u.push(r),p;function m(W){return f=Vn(f,W),b(),f[f.length-1]!==null?[]:(T(r,0),p.events=nc(u,p.events,p),p.events)}function x(W,K){return Zk(_(W),K)}function _(W){return Xk(f,W)}function k(){const{_bufferIndex:W,_index:K,line:q,column:R,offset:U}=s;return{_bufferIndex:W,_index:K,line:q,column:R,offset:U}}function C(W){l[W.line]=W.column,H()}function b(){let W;for(;s._index<f.length;){const K=f[s._index];if(typeof K=="string")for(W=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===W&&s._bufferIndex<K.length;)v(K.charCodeAt(s._bufferIndex));else v(K)}}function v(W){g=g(W)}function y(W){Pe(W)?(s.line++,s.column=1,s.offset+=W===-3?2:1,H()):W!==-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=W}function S(W,K){const q=K||{};return q.type=W,q.start=k(),p.events.push(["enter",q,p]),c.push(q),q}function j(W){const K=c.pop();return K.end=k(),p.events.push(["exit",K,p]),K}function A(W,K){T(W,K.from)}function N(W,K){K.restore()}function D(W,K){return q;function q(R,U,M){let Y,Z,z,L;return Array.isArray(R)?V(R):"tokenize"in R?V([R]):I(R);function I(ee){return X;function X($){const oe=$!==null&&ee[$],re=$!==null&&ee.null,ve=[...Array.isArray(oe)?oe:oe?[oe]:[],...Array.isArray(re)?re:re?[re]:[]];return V(ve)($)}}function V(ee){return Y=ee,Z=0,ee.length===0?M:F(ee[Z])}function F(ee){return X;function X($){return L=B(),z=ee,ee.partial||(p.currentConstruct=ee),ee.name&&p.parser.constructs.disable.null.includes(ee.name)?Q():ee.tokenize.call(K?Object.assign(Object.create(p),K):p,d,ie,Q)($)}}function ie(ee){return W(z,L),U}function Q(ee){return L.restore(),++Z<Y.length?F(Y[Z]):M}}}function T(W,K){W.resolveAll&&!u.includes(W)&&u.push(W),W.resolve&&In(p.events,K,p.events.length-K,W.resolve(p.events.slice(K),p)),W.resolveTo&&(p.events=W.resolveTo(p.events,p))}function B(){const W=k(),K=p.previous,q=p.currentConstruct,R=p.events.length,U=Array.from(c);return{from:R,restore:M};function M(){s=W,p.previous=K,p.currentConstruct=q,p.events.length=R,c=U,H()}}function H(){s.line in l&&s.column<2&&(s.column=l[s.line],s.offset+=l[s.line]-1)}}function Xk(e,r){const i=r.start._index,s=r.start._bufferIndex,l=r.end._index,u=r.end._bufferIndex;let f;if(i===l)f=[e[i].slice(s,u)];else{if(f=e.slice(i,l),s>-1){const c=f[0];typeof c=="string"?f[0]=c.slice(s):f.shift()}u>0&&f.push(e[l].slice(0,u))}return f}function Zk(e,r){let i=-1;const s=[];let l;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&&l)continue;f=" ";break}default:f=String.fromCharCode(u)}l=u===-2,s.push(f)}return s.join("")}function Qk(e){const s={constructs:iy([Kk,...(e||{}).extensions||[]]),content:l(f2),defined:[],document:l(m2),flow:l(Rk),lazy:{},string:l(Ik),text:l(Bk)};return s;function l(u){return f;function f(c){return Yk(s,u,c)}}}function Jk(e){for(;!cy(e););return e}const yv=/[\0\t\n\r]/g;function eE(){let e=1,r="",i=!0,s;return l;function l(u,f,c){const d=[];let p,g,m,x,_;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(yv.lastIndex=m,p=yv.exec(u),x=p&&p.index!==void 0?p.index:u.length,_=u.charCodeAt(x),!p){r=u.slice(m);break}if(_===10&&m===x&&s)d.push(-3),s=void 0;else switch(s&&(d.push(-5),s=void 0),m<x&&(d.push(u.slice(m,x)),e+=x-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=x+1}return c&&(s&&d.push(-5),r&&d.push(r),d.push(null)),d}}const tE=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function nE(e){return e.replace(tE,rE)}function rE(e,r,i){if(r)return r;if(i.charCodeAt(0)===35){const l=i.charCodeAt(1),u=l===120||l===88;return sy(i.slice(u?2:1),u?16:10)}return eo(i)||e}const my={}.hasOwnProperty;function iE(e,r,i){return r&&typeof r=="object"&&(i=r,r=void 0),sE(i)(Jk(Qk(i).document().write(eE()(e,r,!0))))}function sE(e){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Te),autolinkProtocol:B,autolinkEmail:B,atxHeading:u(He),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(Ue),hardBreakTrailing:u(Ue),htmlFlow:u(Ne,f),htmlFlowData:B,htmlText:u(Ne,f),htmlTextData:B,image:u(me),label:f,link:u(Te),listItem:u(Rt),listItemValue:x,listOrdered:u($e,m),listUnordered:u($e),paragraph:u(fe),reference:F,referenceString:f,resourceDestinationString:f,resourceTitleString:f,setextHeading:u(He),strong:u(Ae),thematicBreak:u(ot)},exit:{atxHeading:d(),atxHeadingSequence:A,autolink:d(),autolinkEmail:oe,autolinkProtocol:$,blockQuote:d(),characterEscapeValue:H,characterReferenceMarkerHexadecimal:Q,characterReferenceMarkerNumeric:Q,characterReferenceValue:ee,characterReference:X,codeFenced:d(b),codeFencedFence:C,codeFencedFenceInfo:_,codeFencedFenceMeta:k,codeFlowValue:H,codeIndented:d(v),codeText:d(U),codeTextData:H,data:H,definition:d(),definitionDestinationString:j,definitionLabelString:y,definitionTitleString:S,emphasis:d(),hardBreakEscape:d(K),hardBreakTrailing:d(K),htmlFlow:d(q),htmlFlowData:H,htmlText:d(R),htmlTextData:H,image:d(Y),label:z,labelText:Z,lineEnding:W,link:d(M),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:ie,resourceDestinationString:L,resourceTitleString:I,resource:V,setextHeading:d(T),setextHeadingLineSequence:D,setextHeadingText:N,strong:d(),thematicBreak:d()}};gy(r,(e||{}).mdastExtensions||[]);const i={};return s;function s(ue){let Se={type:"root",children:[]};const je={stack:[Se],tokenStack:[],config:r,enter:c,exit:p,buffer:f,resume:g,data:i},Ie=[];let Ge=-1;for(;++Ge<ue.length;)if(ue[Ge][1].type==="listOrdered"||ue[Ge][1].type==="listUnordered")if(ue[Ge][0]==="enter")Ie.push(Ge);else{const Nt=Ie.pop();Ge=l(ue,Nt,Ge)}for(Ge=-1;++Ge<ue.length;){const Nt=r[ue[Ge][0]];my.call(Nt,ue[Ge][1].type)&&Nt[ue[Ge][1].type].call(Object.assign({sliceSerialize:ue[Ge][2].sliceSerialize},je),ue[Ge][1])}if(je.tokenStack.length>0){const Nt=je.tokenStack[je.tokenStack.length-1];(Nt[1]||_v).call(je,void 0,Nt[0])}for(Se.position={start:si(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:si(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},Ge=-1;++Ge<r.transforms.length;)Se=r.transforms[Ge](Se)||Se;return Se}function l(ue,Se,je){let Ie=Se-1,Ge=-1,Nt=!1,Ze,Ot,Tt,Kt;for(;++Ie<=je;){const lt=ue[Ie];switch(lt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{lt[0]==="enter"?Ge++:Ge--,Kt=void 0;break}case"lineEndingBlank":{lt[0]==="enter"&&(Ze&&!Kt&&!Ge&&!Tt&&(Tt=Ie),Kt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Kt=void 0}if(!Ge&<[0]==="enter"&<[1].type==="listItemPrefix"||Ge===-1&<[0]==="exit"&&(lt[1].type==="listUnordered"||lt[1].type==="listOrdered")){if(Ze){let kn=Ie;for(Ot=void 0;kn--;){const Jt=ue[kn];if(Jt[1].type==="lineEnding"||Jt[1].type==="lineEndingBlank"){if(Jt[0]==="exit")continue;Ot&&(ue[Ot][1].type="lineEndingBlank",Nt=!0),Jt[1].type="lineEnding",Ot=kn}else if(!(Jt[1].type==="linePrefix"||Jt[1].type==="blockQuotePrefix"||Jt[1].type==="blockQuotePrefixWhitespace"||Jt[1].type==="blockQuoteMarker"||Jt[1].type==="listItemIndent"))break}Tt&&(!Ot||Tt<Ot)&&(Ze._spread=!0),Ze.end=Object.assign({},Ot?ue[Ot][1].start:lt[1].end),ue.splice(Ot||Ie,0,["exit",Ze,lt[2]]),Ie++,je++}if(lt[1].type==="listItemPrefix"){const kn={type:"listItem",_spread:!1,start:Object.assign({},lt[1].start),end:void 0};Ze=kn,ue.splice(Ie,0,["enter",kn,lt[2]]),Ie++,je++,Tt=void 0,Kt=!0}}}return ue[Se][1]._spread=Nt,je}function u(ue,Se){return je;function je(Ie){c.call(this,ue(Ie),Ie),Se&&Se.call(this,Ie)}}function f(){this.stack.push({type:"fragment",children:[]})}function c(ue,Se,je){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([Se,je||void 0]),ue.position={start:si(Se.start),end:void 0}}function d(ue){return Se;function Se(je){ue&&ue.call(this,je),p.call(this,je)}}function p(ue,Se){const je=this.stack.pop(),Ie=this.tokenStack.pop();if(Ie)Ie[0].type!==ue.type&&(Se?Se.call(this,ue,Ie[0]):(Ie[1]||_v).call(this,ue,Ie[0]));else throw new Error("Cannot close `"+ue.type+"` ("+Wa({start:ue.start,end:ue.end})+"): it’s not open");je.position.end=si(ue.end)}function g(){return Bh(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function x(ue){if(this.data.expectingFirstListItemValue){const Se=this.stack[this.stack.length-2];Se.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function _(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.lang=ue}function k(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.meta=ue}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ue.replace(/(\r?\n|\r)$/g,"")}function y(ue){const Se=this.resume(),je=this.stack[this.stack.length-1];je.label=Se,je.identifier=Jn(this.sliceSerialize(ue)).toLowerCase()}function S(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.title=ue}function j(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.url=ue}function A(ue){const Se=this.stack[this.stack.length-1];if(!Se.depth){const je=this.sliceSerialize(ue).length;Se.depth=je}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function D(ue){const Se=this.stack[this.stack.length-1];Se.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function B(ue){const je=this.stack[this.stack.length-1].children;let Ie=je[je.length-1];(!Ie||Ie.type!=="text")&&(Ie=Be(),Ie.position={start:si(ue.start),end:void 0},je.push(Ie)),this.stack.push(Ie)}function H(ue){const Se=this.stack.pop();Se.value+=this.sliceSerialize(ue),Se.position.end=si(ue.end)}function W(ue){const Se=this.stack[this.stack.length-1];if(this.data.atHardBreak){const je=Se.children[Se.children.length-1];je.position.end=si(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(Se.type)&&(B.call(this,ue),H.call(this,ue))}function K(){this.data.atHardBreak=!0}function q(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ue}function R(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ue}function U(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ue}function M(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const Se=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=Se,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function Y(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const Se=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=Se,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function Z(ue){const Se=this.sliceSerialize(ue),je=this.stack[this.stack.length-2];je.label=nE(Se),je.identifier=Jn(Se).toLowerCase()}function z(){const ue=this.stack[this.stack.length-1],Se=this.resume(),je=this.stack[this.stack.length-1];if(this.data.inReference=!0,je.type==="link"){const Ie=ue.children;je.children=Ie}else je.alt=Se}function L(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.url=ue}function I(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.title=ue}function V(){this.data.inReference=void 0}function F(){this.data.referenceType="collapsed"}function ie(ue){const Se=this.resume(),je=this.stack[this.stack.length-1];je.label=Se,je.identifier=Jn(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function Q(ue){this.data.characterReferenceType=ue.type}function ee(ue){const Se=this.sliceSerialize(ue),je=this.data.characterReferenceType;let Ie;je?(Ie=sy(Se,je==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ie=eo(Se);const Ge=this.stack[this.stack.length-1];Ge.value+=Ie}function X(ue){const Se=this.stack.pop();Se.position.end=si(ue.end)}function $(ue){H.call(this,ue);const Se=this.stack[this.stack.length-1];Se.url=this.sliceSerialize(ue)}function oe(ue){H.call(this,ue);const Se=this.stack[this.stack.length-1];Se.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 He(){return{type:"heading",depth:0,children:[]}}function Ue(){return{type:"break"}}function Ne(){return{type:"html",value:""}}function me(){return{type:"image",title:null,url:"",alt:null}}function Te(){return{type:"link",title:null,url:"",children:[]}}function $e(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function Rt(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function fe(){return{type:"paragraph",children:[]}}function Ae(){return{type:"strong",children:[]}}function Be(){return{type:"text",value:""}}function ot(){return{type:"thematicBreak"}}}function si(e){return{line:e.line,column:e.column,offset:e.offset}}function gy(e,r){let i=-1;for(;++i<r.length;){const s=r[i];Array.isArray(s)?gy(e,s):aE(e,s)}}function aE(e,r){let i;for(i in r)if(my.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 _v(e,r){throw e?new Error("Cannot close `"+e.type+"` ("+Wa({start:e.start,end:e.end})+"): a different token (`"+r.type+"`, "+Wa({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+Wa({start:r.start,end:r.end})+") is still open")}function oE(e){const r=this;r.parser=i;function i(s){return iE(s,{...r.data("settings"),...e,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function lE(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 cE(e,r){const i={type:"element",tagName:"br",properties:{},children:[]};return e.patch(r,i),[e.applyData(r,i),{type:"text",value:`
|
|
95
|
+
`}]}function uE(e,r){const i=r.value?r.value+`
|
|
96
|
+
`:"",s={},l=r.lang?r.lang.split(/\s+/):[];l.length>0&&(s.className=["language-"+l[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 dE(e,r){const i={type:"element",tagName:"del",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function hE(e,r){const i={type:"element",tagName:"em",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function fE(e,r){const i=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(r.identifier).toUpperCase(),l=zs(s.toLowerCase()),u=e.footnoteOrder.indexOf(s);let f,c=e.footnoteCounts.get(s);c===void 0?(c=0,e.footnoteOrder.push(s),f=e.footnoteOrder.length):f=u+1,c+=1,e.footnoteCounts.set(s,c);const d={type:"element",tagName:"a",properties:{href:"#"+i+"fn-"+l,id:i+"fnref-"+l+(c>1?"-"+c:""),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 pE(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 mE(e,r){if(e.options.allowDangerousHtml){const i={type:"raw",value:r.value};return e.patch(r,i),e.applyData(r,i)}}function xy(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 l=e.all(r),u=l[0];u&&u.type==="text"?u.value="["+u.value:l.unshift({type:"text",value:"["});const f=l[l.length-1];return f&&f.type==="text"?f.value+=s:l.push({type:"text",value:s}),l}function gE(e,r){const i=String(r.identifier).toUpperCase(),s=e.definitionById.get(i);if(!s)return xy(e,r);const l={src:zs(s.url||""),alt:r.alt};s.title!==null&&s.title!==void 0&&(l.title=s.title);const u={type:"element",tagName:"img",properties:l,children:[]};return e.patch(r,u),e.applyData(r,u)}function xE(e,r){const i={src:zs(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 vE(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 bE(e,r){const i=String(r.identifier).toUpperCase(),s=e.definitionById.get(i);if(!s)return xy(e,r);const l={href:zs(s.url||"")};s.title!==null&&s.title!==void 0&&(l.title=s.title);const u={type:"element",tagName:"a",properties:l,children:e.all(r)};return e.patch(r,u),e.applyData(r,u)}function yE(e,r){const i={href:zs(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 _E(e,r,i){const s=e.all(r),l=i?SE(i):vy(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 c=-1;for(;++c<s.length;){const g=s[c];(l||c!==0||g.type!=="element"||g.tagName!=="p")&&f.push({type:"text",value:`
|
|
97
|
+
`}),g.type==="element"&&g.tagName==="p"&&!l?f.push(...g.children):f.push(g)}const d=s[s.length-1];d&&(l||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 SE(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=vy(i[s])}return r}function vy(e){const r=e.spread;return r??e.children.length>1}function wE(e,r){const i={},s=e.all(r);let l=-1;for(typeof r.start=="number"&&r.start!==1&&(i.start=r.start);++l<s.length;){const f=s[l];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 CE(e,r){const i={type:"element",tagName:"p",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function kE(e,r){const i={type:"root",children:e.wrap(e.all(r))};return e.patch(r,i),e.applyData(r,i)}function EE(e,r){const i={type:"element",tagName:"strong",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function jE(e,r){const i=e.all(r),s=i.shift(),l=[];if(s){const f={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(r.children[0],f),l.push(f)}if(i.length>0){const f={type:"element",tagName:"tbody",properties:{},children:e.wrap(i,!0)},c=Rh(r.children[1]),d=Zb(r.children[r.children.length-1]);c&&d&&(f.position={start:c,end:d}),l.push(f)}const u={type:"element",tagName:"table",properties:{},children:e.wrap(l,!0)};return e.patch(r,u),e.applyData(r,u)}function NE(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,c=f?f.length:r.children.length;let d=-1;const p=[];for(;++d<c;){const m=r.children[d],x={},_=f?f[d]:void 0;_&&(x.align=_);let k={type:"element",tagName:u,properties:x,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 TE(e,r){const i={type:"element",tagName:"td",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}const Sv=9,wv=32;function AE(e){const r=String(e),i=/\r?\n|\r/g;let s=i.exec(r),l=0;const u=[];for(;s;)u.push(Cv(r.slice(l,s.index),l>0,!0),s[0]),l=s.index+s[0].length,s=i.exec(r);return u.push(Cv(r.slice(l),l>0,!1)),u.join("")}function Cv(e,r,i){let s=0,l=e.length;if(r){let u=e.codePointAt(s);for(;u===Sv||u===wv;)s++,u=e.codePointAt(s)}if(i){let u=e.codePointAt(l-1);for(;u===Sv||u===wv;)l--,u=e.codePointAt(l-1)}return l>s?e.slice(s,l):""}function DE(e,r){const i={type:"text",value:AE(String(r.value))};return e.patch(r,i),e.applyData(r,i)}function LE(e,r){const i={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(r,i),e.applyData(r,i)}const RE={blockquote:lE,break:cE,code:uE,delete:dE,emphasis:hE,footnoteReference:fE,heading:pE,html:mE,imageReference:gE,image:xE,inlineCode:vE,linkReference:bE,link:yE,listItem:_E,list:wE,paragraph:CE,root:kE,strong:EE,table:jE,tableCell:TE,tableRow:NE,text:DE,thematicBreak:LE,toml:El,yaml:El,definition:El,footnoteDefinition:El};function El(){}const by=-1,rc=0,Va=1,Fl=2,Hh=3,Ph=4,Fh=5,Uh=6,yy=7,_y=8,kv=typeof self=="object"?self:globalThis,OE=(e,r)=>{const i=(l,u)=>(e.set(u,l),l),s=l=>{if(e.has(l))return e.get(l);const[u,f]=r[l];switch(u){case rc:case by:return i(f,l);case Va:{const c=i([],l);for(const d of f)c.push(s(d));return c}case Fl:{const c=i({},l);for(const[d,p]of f)c[s(d)]=s(p);return c}case Hh:return i(new Date(f),l);case Ph:{const{source:c,flags:d}=f;return i(new RegExp(c,d),l)}case Fh:{const c=i(new Map,l);for(const[d,p]of f)c.set(s(d),s(p));return c}case Uh:{const c=i(new Set,l);for(const d of f)c.add(s(d));return c}case yy:{const{name:c,message:d}=f;return i(new kv[c](d),l)}case _y:return i(BigInt(f),l);case"BigInt":return i(Object(BigInt(f)),l);case"ArrayBuffer":return i(new Uint8Array(f).buffer,f);case"DataView":{const{buffer:c}=new Uint8Array(f);return i(new DataView(c),f)}}return i(new kv[u](f),l)};return s},Ev=e=>OE(new Map,e)(0),Es="",{toString:ME}={},{keys:IE}=Object,Ha=e=>{const r=typeof e;if(r!=="object"||!e)return[rc,r];const i=ME.call(e).slice(8,-1);switch(i){case"Array":return[Va,Es];case"Object":return[Fl,Es];case"Date":return[Hh,Es];case"RegExp":return[Ph,Es];case"Map":return[Fh,Es];case"Set":return[Uh,Es];case"DataView":return[Va,i]}return i.includes("Array")?[Va,i]:i.includes("Error")?[yy,i]:[Fl,i]},jl=([e,r])=>e===rc&&(r==="function"||r==="symbol"),BE=(e,r,i,s)=>{const l=(f,c)=>{const d=s.push(f)-1;return i.set(c,d),d},u=f=>{if(i.has(f))return i.get(f);let[c,d]=Ha(f);switch(c){case rc:{let g=f;switch(d){case"bigint":c=_y,g=f.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);g=null;break;case"undefined":return l([by],f)}return l([c,g],f)}case Va:{if(d){let x=f;return d==="DataView"?x=new Uint8Array(f.buffer):d==="ArrayBuffer"&&(x=new Uint8Array(f)),l([d,[...x]],f)}const g=[],m=l([c,g],f);for(const x of f)g.push(u(x));return m}case Fl:{if(d)switch(d){case"BigInt":return l([d,f.toString()],f);case"Boolean":case"Number":case"String":return l([d,f.valueOf()],f)}if(r&&"toJSON"in f)return u(f.toJSON());const g=[],m=l([c,g],f);for(const x of IE(f))(e||!jl(Ha(f[x])))&&g.push([u(x),u(f[x])]);return m}case Hh:return l([c,f.toISOString()],f);case Ph:{const{source:g,flags:m}=f;return l([c,{source:g,flags:m}],f)}case Fh:{const g=[],m=l([c,g],f);for(const[x,_]of f)(e||!(jl(Ha(x))||jl(Ha(_))))&&g.push([u(x),u(_)]);return m}case Uh:{const g=[],m=l([c,g],f);for(const x of f)(e||!jl(Ha(x)))&&g.push(u(x));return m}}const{message:p}=f;return l([c,{name:d,message:p}],f)};return u},jv=(e,{json:r,lossy:i}={})=>{const s=[];return BE(!(r||i),!!r,new Map,s)(e),s},Ul=typeof structuredClone=="function"?(e,r)=>r&&("json"in r||"lossy"in r)?Ev(jv(e,r)):structuredClone(e):(e,r)=>Ev(jv(e,r));function zE(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 HE(e,r){return"Back to reference "+(e+1)+(r>1?"-"+r:"")}function PE(e){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=e.options.footnoteBackContent||zE,s=e.options.footnoteBackLabel||HE,l=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",f=e.options.footnoteLabelProperties||{className:["sr-only"]},c=[];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(),x=zs(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 y=typeof i=="string"?i:i(d,_);typeof y=="string"&&(y={type:"text",value:y}),k.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+x+(_>1?"-"+_:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(d,_),className:["data-footnote-backref"]},children:Array.isArray(y)?y:[y]})}const b=g[g.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const y=b.children[b.children.length-1];y&&y.type==="text"?y.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...k)}else g.push(...k);const v={type:"element",tagName:"li",properties:{id:r+"fn-"+x},children:e.wrap(g,!0)};e.patch(p,v),c.push(v)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Ul(f),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
|
|
99
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(c,!0)},{type:"text",value:`
|
|
100
|
+
`}]}}const ic=(function(e){if(e==null)return qE;if(typeof e=="function")return sc(e);if(typeof e=="object")return Array.isArray(e)?FE(e):UE(e);if(typeof e=="string")return $E(e);throw new Error("Expected function, string, or object as test")});function FE(e){const r=[];let i=-1;for(;++i<e.length;)r[i]=ic(e[i]);return sc(s);function s(...l){let u=-1;for(;++u<r.length;)if(r[u].apply(this,l))return!0;return!1}}function UE(e){const r=e;return sc(i);function i(s){const l=s;let u;for(u in e)if(l[u]!==r[u])return!1;return!0}}function $E(e){return sc(r);function r(i){return i&&i.type===e}}function sc(e){return r;function r(i,s,l){return!!(WE(i)&&e.call(this,i,typeof s=="number"?s:void 0,l||void 0))}}function qE(){return!0}function WE(e){return e!==null&&typeof e=="object"&&"type"in e}const Sy=[],GE=!0,dh=!1,VE="skip";function wy(e,r,i,s){let l;typeof r=="function"&&typeof i!="function"?(s=i,i=r):l=r;const u=ic(l),f=s?-1:1;c(e,void 0,[])();function c(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(x,"name",{value:"node ("+(d.type+(_?"<"+_+">":""))+")"})}return x;function x(){let _=Sy,k,C,b;if((!r||u(d,p,g[g.length-1]||void 0))&&(_=KE(i(d,g)),_[0]===dh))return _;if("children"in d&&d.children){const v=d;if(v.children&&_[0]!==VE)for(C=(s?v.children.length:-1)+f,b=g.concat(v);C>-1&&C<v.children.length;){const y=v.children[C];if(k=c(y,C,b)(),k[0]===dh)return k;C=typeof k[1]=="number"?k[1]:C+f}}return _}}}function KE(e){return Array.isArray(e)?e:typeof e=="number"?[GE,e]:e==null?Sy:[e]}function $h(e,r,i,s){let l,u,f;typeof r=="function"&&typeof i!="function"?(u=void 0,f=r,l=i):(u=r,f=i,l=s),wy(e,u,c,l);function c(d,p){const g=p[p.length-1],m=g?g.children.indexOf(d):void 0;return f(d,m,g)}}const hh={}.hasOwnProperty,YE={};function XE(e,r){const i=r||YE,s=new Map,l=new Map,u=new Map,f={...RE,...i.handlers},c={all:p,applyData:QE,definitionById:s,footnoteById:l,footnoteCounts:u,footnoteOrder:[],handlers:f,one:d,options:i,patch:ZE,wrap:ej};return $h(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const m=g.type==="definition"?s:l,x=String(g.identifier).toUpperCase();m.has(x)||m.set(x,g)}}),c;function d(g,m){const x=g.type,_=c.handlers[x];if(hh.call(c.handlers,x)&&_)return _(c,g,m);if(c.options.passThrough&&c.options.passThrough.includes(x)){if("children"in g){const{children:C,...b}=g,v=Ul(b);return v.children=c.all(g),v}return Ul(g)}return(c.options.unknownHandler||JE)(c,g,m)}function p(g){const m=[];if("children"in g){const x=g.children;let _=-1;for(;++_<x.length;){const k=c.one(x[_],g);if(k){if(_&&x[_-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=Nv(k.value)),!Array.isArray(k)&&k.type==="element")){const C=k.children[0];C&&C.type==="text"&&(C.value=Nv(C.value))}Array.isArray(k)?m.push(...k):m.push(k)}}}return m}}function ZE(e,r){e.position&&(r.position=HC(e))}function QE(e,r){let i=r;if(e&&e.data){const s=e.data.hName,l=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,Ul(u)),"children"in i&&i.children&&l!==null&&l!==void 0&&(i.children=l)}return i}function JE(e,r){const i=r.data||{},s="value"in r&&!(hh.call(i,"hProperties")||hh.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 ej(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 Nv(e){let r=0,i=e.charCodeAt(r);for(;i===9||i===32;)r++,i=e.charCodeAt(r);return e.slice(r)}function Tv(e,r){const i=XE(e,r),s=i.one(e,void 0),l=PE(i),u=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return l&&u.children.push({type:"text",value:`
|
|
104
|
+
`},l),u}function tj(e,r){return e&&"run"in e?async function(i,s){const l=Tv(i,{file:s,...r});await e.run(l,s)}:function(i,s){return Tv(i,{file:s,...e||r})}}function Av(e){if(e)throw e}var Fd,Dv;function nj(){if(Dv)return Fd;Dv=1;var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,s=Object.getOwnPropertyDescriptor,l=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 x;for(x in p);return typeof x>"u"||e.call(p,x)},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},c=function(p,g){if(g==="__proto__")if(e.call(p,g)){if(s)return s(p,g).value}else return;return p[g]};return Fd=function d(){var p,g,m,x,_,k,C=arguments[0],b=1,v=arguments.length,y=!1;for(typeof C=="boolean"&&(y=C,C=arguments[1]||{},b=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});b<v;++b)if(p=arguments[b],p!=null)for(g in p)m=c(C,g),x=c(p,g),C!==x&&(y&&x&&(u(x)||(_=l(x)))?(_?(_=!1,k=m&&l(m)?m:[]):k=m&&u(m)?m:{},f(C,{name:g,newValue:d(y,k,x)})):typeof x<"u"&&f(C,{name:g,newValue:x}));return C},Fd}var rj=nj();const Ud=Gl(rj);function fh(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 ij(){const e=[],r={run:i,use:s};return r;function i(...l){let u=-1;const f=l.pop();if(typeof f!="function")throw new TypeError("Expected function as last argument, not "+f);c(null,...l);function c(d,...p){const g=e[++u];let m=-1;if(d){f(d);return}for(;++m<l.length;)(p[m]===null||p[m]===void 0)&&(p[m]=l[m]);l=p,g?sj(g,c)(...p):f(null,...p)}}function s(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),r}}function sj(e,r){let i;return s;function s(...f){const c=e.length>f.length;let d;c&&f.push(l);try{d=e.apply(this,f)}catch(p){const g=p;if(c&&i)throw g;return l(g)}c||(d&&d.then&&typeof d.then=="function"?d.then(u,l):d instanceof Error?l(d):u(d))}function l(f,...c){i||(i=!0,r(f,...c))}function u(f){l(null,f)}}const or={basename:aj,dirname:oj,extname:lj,join:cj,sep:"/"};function aj(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');lo(e);let i=0,s=-1,l=e.length,u;if(r===void 0||r.length===0||r.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(u){i=l+1;break}}else s<0&&(u=!0,s=l+1);return s<0?"":e.slice(i,s)}if(r===e)return"";let f=-1,c=r.length-1;for(;l--;)if(e.codePointAt(l)===47){if(u){i=l+1;break}}else f<0&&(u=!0,f=l+1),c>-1&&(e.codePointAt(l)===r.codePointAt(c--)?c<0&&(s=l):(c=-1,s=f));return i===s?s=f:s<0&&(s=e.length),e.slice(i,s)}function oj(e){if(lo(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 lj(e){lo(e);let r=e.length,i=-1,s=0,l=-1,u=0,f;for(;r--;){const c=e.codePointAt(r);if(c===47){if(f){s=r+1;break}continue}i<0&&(f=!0,i=r+1),c===46?l<0?l=r:u!==1&&(u=1):l>-1&&(u=-1)}return l<0||i<0||u===0||u===1&&l===i-1&&l===s+1?"":e.slice(l,i)}function cj(...e){let r=-1,i;for(;++r<e.length;)lo(e[r]),e[r]&&(i=i===void 0?e[r]:i+"/"+e[r]);return i===void 0?".":uj(i)}function uj(e){lo(e);const r=e.codePointAt(0)===47;let i=dj(e,!r);return i.length===0&&!r&&(i="."),i.length>0&&e.codePointAt(e.length-1)===47&&(i+="/"),r?"/"+i:i}function dj(e,r){let i="",s=0,l=-1,u=0,f=-1,c,d;for(;++f<=e.length;){if(f<e.length)c=e.codePointAt(f);else{if(c===47)break;c=47}if(c===47){if(!(l===f-1||u===1))if(l!==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("/")),l=f,u=0;continue}}else if(i.length>0){i="",s=0,l=f,u=0;continue}}r&&(i=i.length>0?i+"/..":"..",s=2)}else i.length>0?i+="/"+e.slice(l+1,f):i=e.slice(l+1,f),s=f-l-1;l=f,u=0}else c===46&&u>-1?u++:u=-1}return i}function lo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const hj={cwd:fj};function fj(){return"/"}function ph(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function pj(e){if(typeof e=="string")e=new URL(e);else if(!ph(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 mj(e)}function mj(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 l=new TypeError("File URL path must not include encoded / characters");throw l.code="ERR_INVALID_FILE_URL_PATH",l}}return decodeURIComponent(r)}const $d=["history","path","basename","stem","extname","dirname"];class Cy{constructor(r){let i;r?ph(r)?i={path:r}:typeof r=="string"||gj(r)?i={value:r}:i=r:i={},this.cwd="cwd"in i?"":hj.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<$d.length;){const u=$d[s];u in i&&i[u]!==void 0&&i[u]!==null&&(this[u]=u==="history"?[...i[u]]:i[u])}let l;for(l in i)$d.includes(l)||(this[l]=i[l])}get basename(){return typeof this.path=="string"?or.basename(this.path):void 0}set basename(r){Wd(r,"basename"),qd(r,"basename"),this.path=or.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?or.dirname(this.path):void 0}set dirname(r){Lv(this.basename,"dirname"),this.path=or.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?or.extname(this.path):void 0}set extname(r){if(qd(r,"extname"),Lv(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=or.join(this.dirname,this.stem+(r||""))}get path(){return this.history[this.history.length-1]}set path(r){ph(r)&&(r=pj(r)),Wd(r,"path"),this.path!==r&&this.history.push(r)}get stem(){return typeof this.path=="string"?or.basename(this.path,this.extname):void 0}set stem(r){Wd(r,"stem"),qd(r,"stem"),this.path=or.join(this.dirname||"",r+(this.extname||""))}fail(r,i,s){const l=this.message(r,i,s);throw l.fatal=!0,l}info(r,i,s){const l=this.message(r,i,s);return l.fatal=void 0,l}message(r,i,s){const l=new fn(r,i,s);return this.path&&(l.name=this.path+":"+l.name,l.file=this.path),l.fatal=!1,this.messages.push(l),l}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(or.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+or.sep+"`")}function Wd(e,r){if(!e)throw new Error("`"+r+"` cannot be empty")}function Lv(e,r){if(!e)throw new Error("Setting `"+r+"` requires `path` to be set too")}function gj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const xj=(function(e){const s=this.constructor.prototype,l=s[e],u=function(){return l.apply(u,arguments)};return Object.setPrototypeOf(u,s),u}),vj={}.hasOwnProperty;class qh extends xj{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=ij()}copy(){const r=new qh;let i=-1;for(;++i<this.attachers.length;){const s=this.attachers[i];r.use(...s)}return r.data(Ud(!0,{},this.namespace)),r}data(r,i){return typeof r=="string"?arguments.length===2?(Kd("data",this.frozen),this.namespace[r]=i,this):vj.call(this.namespace,r)&&this.namespace[r]||void 0:r?(Kd("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 l=i.call(r,...s);typeof l=="function"&&this.transformers.use(l)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(r){this.freeze();const i=Nl(r),s=this.parser||this.Parser;return Gd("parse",s),s(String(i),i)}process(r,i){const s=this;return this.freeze(),Gd("process",this.parser||this.Parser),Vd("process",this.compiler||this.Compiler),i?l(void 0,i):new Promise(l);function l(u,f){const c=Nl(r),d=s.parse(c);s.run(d,c,function(g,m,x){if(g||!m||!x)return p(g);const _=m,k=s.stringify(_,x);_j(k)?x.value=k:x.result=k,p(g,x)});function p(g,m){g||!m?f(g):u?u(m):i(void 0,m)}}}processSync(r){let i=!1,s;return this.freeze(),Gd("processSync",this.parser||this.Parser),Vd("processSync",this.compiler||this.Compiler),this.process(r,l),Ov("processSync","process",i),s;function l(u,f){i=!0,Av(u),s=f}}run(r,i,s){Rv(r),this.freeze();const l=this.transformers;return!s&&typeof i=="function"&&(s=i,i=void 0),s?u(void 0,s):new Promise(u);function u(f,c){const d=Nl(i);l.run(r,d,p);function p(g,m,x){const _=m||r;g?c(g):f?f(_):s(void 0,_,x)}}}runSync(r,i){let s=!1,l;return this.run(r,i,u),Ov("runSync","run",s),l;function u(f,c){Av(f),l=c,s=!0}}stringify(r,i){this.freeze();const s=Nl(i),l=this.compiler||this.Compiler;return Vd("stringify",l),Rv(r),l(r,s)}use(r,...i){const s=this.attachers,l=this.namespace;if(Kd("use",this.frozen),r!=null)if(typeof r=="function")d(r,i);else if(typeof r=="object")Array.isArray(r)?c(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");c(p.plugins),p.settings&&(l.settings=Ud(!0,l.settings,p.settings))}function c(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,x=-1;for(;++m<s.length;)if(s[m][0]===p){x=m;break}if(x===-1)s.push([p,...g]);else if(g.length>0){let[_,...k]=g;const C=s[x][1];fh(C)&&fh(_)&&(_=Ud(!0,C,_)),s[x]=[p,_,...k]}}}}const bj=new qh().freeze();function Gd(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Vd(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Kd(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 Rv(e){if(!fh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Ov(e,r,i){if(!i)throw new Error("`"+e+"` finished async. Use `"+r+"` instead")}function Nl(e){return yj(e)?e:new Cy(e)}function yj(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function _j(e){return typeof e=="string"||Sj(e)}function Sj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const wj="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Mv=[],Iv={allowDangerousHtml:!0},Cj=/^(https?|ircs?|mailto|xmpp)$/i,kj=[{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 Ej(e){const r=jj(e),i=Nj(e);return Tj(r.runSync(r.parse(i),i),e)}function jj(e){const r=e.rehypePlugins||Mv,i=e.remarkPlugins||Mv,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Iv}:Iv;return bj().use(oE).use(i).use(tj,s).use(r)}function Nj(e){const r=e.children||"",i=new Cy;return typeof r=="string"&&(i.value=r),i}function Tj(e,r){const i=r.allowedElements,s=r.allowElement,l=r.components,u=r.disallowedElements,f=r.skipHtml,c=r.unwrapDisallowed,d=r.urlTransform||Aj;for(const g of kj)Object.hasOwn(r,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+wj+g.id,void 0);return $h(e,p),qC(e,{Fragment:o.Fragment,components:l,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function p(g,m,x){if(g.type==="raw"&&x&&typeof m=="number")return f?x.children.splice(m,1):x.children[m]={type:"text",value:g.value},m;if(g.type==="element"){let _;for(_ in zd)if(Object.hasOwn(zd,_)&&Object.hasOwn(g.properties,_)){const k=g.properties[_],C=zd[_];(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,x)),_&&x&&typeof m=="number")return c&&g.children?x.children.splice(m,1,...g.children):x.children.splice(m,1),m}}}function Aj(e){const r=e.indexOf(":"),i=e.indexOf("?"),s=e.indexOf("#"),l=e.indexOf("/");return r===-1||l!==-1&&r>l||i!==-1&&r>i||s!==-1&&r>s||Cj.test(e.slice(0,r))?e:""}function Bv(e,r){const i=String(e);if(typeof r!="string")throw new TypeError("Expected character");let s=0,l=i.indexOf(r);for(;l!==-1;)s++,l=i.indexOf(r,l+r.length);return s}function Dj(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Lj(e,r,i){const l=ic((i||{}).ignore||[]),u=Rj(r);let f=-1;for(;++f<u.length;)wy(e,"text",c);function c(p,g){let m=-1,x;for(;++m<g.length;){const _=g[m],k=x?x.children:void 0;if(l(_,k?k.indexOf(_):void 0,x))return;x=_}if(x)return d(p,g)}function d(p,g){const m=g[g.length-1],x=u[f][0],_=u[f][1];let k=0;const b=m.children.indexOf(p);let v=!1,y=[];x.lastIndex=0;let S=x.exec(p.value);for(;S;){const j=S.index,A={index:S.index,input:S.input,stack:[...g,p]};let N=_(...S,A);if(typeof N=="string"&&(N=N.length>0?{type:"text",value:N}:void 0),N===!1?x.lastIndex=j+1:(k!==j&&y.push({type:"text",value:p.value.slice(k,j)}),Array.isArray(N)?y.push(...N):N&&y.push(N),k=j+S[0].length,v=!0),!x.global)break;S=x.exec(p.value)}return v?(k<p.value.length&&y.push({type:"text",value:p.value.slice(k)}),m.children.splice(b,1,...y)):y=[p],b+y.length}}function Rj(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 l=i[s];r.push([Oj(l[0]),Mj(l[1])])}return r}function Oj(e){return typeof e=="string"?new RegExp(Dj(e),"g"):e}function Mj(e){return typeof e=="function"?e:function(){return e}}const Yd="phrasing",Xd=["autolink","link","image","label"];function Ij(){return{transforms:[$j],enter:{literalAutolink:zj,literalAutolinkEmail:Zd,literalAutolinkHttp:Zd,literalAutolinkWww:Zd},exit:{literalAutolink:Uj,literalAutolinkEmail:Fj,literalAutolinkHttp:Hj,literalAutolinkWww:Pj}}}function Bj(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Yd,notInConstruct:Xd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Yd,notInConstruct:Xd},{character:":",before:"[ps]",after:"\\/",inConstruct:Yd,notInConstruct:Xd}]}}function zj(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Zd(e){this.config.enter.autolinkProtocol.call(this,e)}function Hj(e){this.config.exit.autolinkProtocol.call(this,e)}function Pj(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 Fj(e){this.config.exit.autolinkEmail.call(this,e)}function Uj(e){this.exit(e)}function $j(e){Lj(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,qj],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Wj]],{ignore:["link","linkReference"]})}function qj(e,r,i,s,l){let u="";if(!ky(l)||(/^w/i.test(r)&&(i=r+i,r="",u="http://"),!Gj(i)))return!1;const f=Vj(i+s);if(!f[0])return!1;const c={type:"link",title:null,url:u+r+f[0],children:[{type:"text",value:r+f[0]}]};return f[1]?[c,{type:"text",value:f[1]}]:c}function Wj(e,r,i,s){return!ky(s,!0)||/[-\d_]$/.test(i)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+i,children:[{type:"text",value:r+"@"+i}]}}function Gj(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 Vj(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 l=Bv(e,"(");let u=Bv(e,")");for(;s!==-1&&l>u;)e+=i.slice(0,s+1),i=i.slice(s+1),s=i.indexOf(")"),u++;return[e,i]}function ky(e,r){const i=e.input.charCodeAt(e.index-1);return(e.index===0||Mi(i)||tc(i))&&(!r||i!==47)}Ey.peek=nN;function Kj(){this.buffer()}function Yj(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Xj(){this.buffer()}function Zj(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Qj(e){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Jn(this.sliceSerialize(e)).toLowerCase(),i.label=r}function Jj(e){this.exit(e)}function eN(e){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Jn(this.sliceSerialize(e)).toLowerCase(),i.label=r}function tN(e){this.exit(e)}function nN(){return"["}function Ey(e,r,i,s){const l=i.createTracker(s);let u=l.move("[^");const f=i.enter("footnoteReference"),c=i.enter("reference");return u+=l.move(i.safe(i.associationId(e),{after:"]",before:u})),c(),f(),u+=l.move("]"),u}function rN(){return{enter:{gfmFootnoteCallString:Kj,gfmFootnoteCall:Yj,gfmFootnoteDefinitionLabelString:Xj,gfmFootnoteDefinition:Zj},exit:{gfmFootnoteCallString:Qj,gfmFootnoteCall:Jj,gfmFootnoteDefinitionLabelString:eN,gfmFootnoteDefinition:tN}}}function iN(e){let r=!1;return e&&e.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:i,footnoteReference:Ey},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function i(s,l,u,f){const c=u.createTracker(f);let d=c.move("[^");const p=u.enter("footnoteDefinition"),g=u.enter("label");return d+=c.move(u.safe(u.associationId(s),{before:d,after:"]"})),g(),d+=c.move("]:"),s.children&&s.children.length>0&&(c.shift(4),d+=c.move((r?`
|
|
105
|
+
`:" ")+u.indentLines(u.containerFlow(s,c.current()),r?jy:sN))),p(),d}}function sN(e,r,i){return r===0?e:jy(e,r,i)}function jy(e,r,i){return(i?"":" ")+e}const aN=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Ny.peek=dN;function oN(){return{canContainEols:["delete"],enter:{strikethrough:cN},exit:{strikethrough:uN}}}function lN(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:aN}],handlers:{delete:Ny}}}function cN(e){this.enter({type:"delete",children:[]},e)}function uN(e){this.exit(e)}function Ny(e,r,i,s){const l=i.createTracker(s),u=i.enter("strikethrough");let f=l.move("~~");return f+=i.containerPhrasing(e,{...l.current(),before:f,after:"~"}),f+=l.move("~~"),u(),f}function dN(){return"~"}function hN(e){return e.length}function fN(e,r){const i=r||{},s=(i.align||[]).concat(),l=i.stringLength||hN,u=[],f=[],c=[],d=[];let p=0,g=-1;for(;++g<e.length;){const C=[],b=[];let v=-1;for(e[g].length>p&&(p=e[g].length);++v<e[g].length;){const y=pN(e[g][v]);if(i.alignDelimiters!==!1){const S=l(y);b[v]=S,(d[v]===void 0||S>d[v])&&(d[v]=S)}C.push(y)}f[g]=C,c[g]=b}let m=-1;if(typeof s=="object"&&"length"in s)for(;++m<p;)u[m]=zv(s[m]);else{const C=zv(s);for(;++m<p;)u[m]=C}m=-1;const x=[],_=[];for(;++m<p;){const C=u[m];let b="",v="";C===99?(b=":",v=":"):C===108?b=":":C===114&&(v=":");let y=i.alignDelimiters===!1?1:Math.max(1,d[m]-b.length-v.length);const S=b+"-".repeat(y)+v;i.alignDelimiters!==!1&&(y=b.length+y+v.length,y>d[m]&&(d[m]=y),_[m]=y),x[m]=S}f.splice(1,0,x),c.splice(1,0,_),g=-1;const k=[];for(;++g<f.length;){const C=f[g],b=c[g];m=-1;const v=[];for(;++m<p;){const y=C[m]||"";let S="",j="";if(i.alignDelimiters!==!1){const A=d[m]-(b[m]||0),N=u[m];N===114?S=" ".repeat(A):N===99?A%2?(S=" ".repeat(A/2+.5),j=" ".repeat(A/2-.5)):(S=" ".repeat(A/2),j=S):j=" ".repeat(A)}i.delimiterStart!==!1&&!m&&v.push("|"),i.padding!==!1&&!(i.alignDelimiters===!1&&y==="")&&(i.delimiterStart!==!1||m)&&v.push(" "),i.alignDelimiters!==!1&&v.push(S),v.push(y),i.alignDelimiters!==!1&&v.push(j),i.padding!==!1&&v.push(" "),(i.delimiterEnd!==!1||m!==p-1)&&v.push("|")}k.push(i.delimiterEnd===!1?v.join("").replace(/ +$/,""):v.join(""))}return k.join(`
|
|
106
|
+
`)}function pN(e){return e==null?"":String(e)}function zv(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 mN(e,r,i,s){const l=i.enter("blockquote"),u=i.createTracker(s);u.move("> "),u.shift(2);const f=i.indentLines(i.containerFlow(e,u.current()),gN);return l(),f}function gN(e,r,i){return">"+(i?"":" ")+e}function xN(e,r){return Hv(e,r.inConstruct,!0)&&!Hv(e,r.notInConstruct,!1)}function Hv(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 Pv(e,r,i,s){let l=-1;for(;++l<i.unsafe.length;)if(i.unsafe[l].character===`
|
|
107
|
+
`&&xN(i.stack,i.unsafe[l]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
108
|
+
`}function vN(e,r){const i=String(e);let s=i.indexOf(r),l=s,u=0,f=0;if(typeof r!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===l?++u>f&&(f=u):u=1,l=s+r.length,s=i.indexOf(r,l);return f}function bN(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 yN(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 _N(e,r,i,s){const l=yN(i),u=e.value||"",f=l==="`"?"GraveAccent":"Tilde";if(bN(e,i)){const m=i.enter("codeIndented"),x=i.indentLines(u,SN);return m(),x}const c=i.createTracker(s),d=l.repeat(Math.max(vN(u,l)+1,3)),p=i.enter("codeFenced");let g=c.move(d);if(e.lang){const m=i.enter(`codeFencedLang${f}`);g+=c.move(i.safe(e.lang,{before:g,after:" ",encode:["`"],...c.current()})),m()}if(e.lang&&e.meta){const m=i.enter(`codeFencedMeta${f}`);g+=c.move(" "),g+=c.move(i.safe(e.meta,{before:g,after:`
|
|
109
|
+
`,encode:["`"],...c.current()})),m()}return g+=c.move(`
|
|
110
|
+
`),u&&(g+=c.move(u+`
|
|
111
|
+
`)),g+=c.move(d),p(),g}function SN(e,r,i){return(i?"":" ")+e}function Wh(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 wN(e,r,i,s){const l=Wh(i),u=l==='"'?"Quote":"Apostrophe",f=i.enter("definition");let c=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("]: "),c(),!e.url||/[\0- \u007F]/.test(e.url)?(c=i.enter("destinationLiteral"),p+=d.move("<"),p+=d.move(i.safe(e.url,{before:p,after:">",...d.current()})),p+=d.move(">")):(c=i.enter("destinationRaw"),p+=d.move(i.safe(e.url,{before:p,after:e.title?" ":`
|
|
112
|
+
`,...d.current()}))),c(),e.title&&(c=i.enter(`title${u}`),p+=d.move(" "+l),p+=d.move(i.safe(e.title,{before:p,after:l,...d.current()})),p+=d.move(l),c()),f(),p}function CN(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 to(e){return"&#x"+e.toString(16).toUpperCase()+";"}function $l(e,r,i){const s=Os(e),l=Os(r);return s===void 0?l===void 0?i==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Ty.peek=kN;function Ty(e,r,i,s){const l=CN(i),u=i.enter("emphasis"),f=i.createTracker(s),c=f.move(l);let d=f.move(i.containerPhrasing(e,{after:l,before:c,...f.current()}));const p=d.charCodeAt(0),g=$l(s.before.charCodeAt(s.before.length-1),p,l);g.inside&&(d=to(p)+d.slice(1));const m=d.charCodeAt(d.length-1),x=$l(s.after.charCodeAt(0),m,l);x.inside&&(d=d.slice(0,-1)+to(m));const _=f.move(l);return u(),i.attentionEncodeSurroundingInfo={after:x.outside,before:g.outside},c+d+_}function kN(e,r,i){return i.options.emphasis||"*"}function EN(e,r){let i=!1;return $h(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return i=!0,dh}),!!((!e.depth||e.depth<3)&&Bh(e)&&(r.options.setext||i))}function jN(e,r,i,s){const l=Math.max(Math.min(6,e.depth||1),1),u=i.createTracker(s);if(EN(e,i)){const g=i.enter("headingSetext"),m=i.enter("phrasing"),x=i.containerPhrasing(e,{...u.current(),before:`
|
|
113
|
+
`,after:`
|
|
114
|
+
`});return m(),g(),x+`
|
|
115
|
+
`+(l===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(`
|
|
116
|
+
`))+1))}const f="#".repeat(l),c=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=to(p.charCodeAt(0))+p.slice(1)),p=p?f+" "+p:f,i.options.closeAtx&&(p+=" "+f),d(),c(),p}Ay.peek=NN;function Ay(e){return e.value||""}function NN(){return"<"}Dy.peek=TN;function Dy(e,r,i,s){const l=Wh(i),u=l==='"'?"Quote":"Apostrophe",f=i.enter("image");let c=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("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=i.enter("destinationLiteral"),p+=d.move("<"),p+=d.move(i.safe(e.url,{before:p,after:">",...d.current()})),p+=d.move(">")):(c=i.enter("destinationRaw"),p+=d.move(i.safe(e.url,{before:p,after:e.title?" ":")",...d.current()}))),c(),e.title&&(c=i.enter(`title${u}`),p+=d.move(" "+l),p+=d.move(i.safe(e.title,{before:p,after:l,...d.current()})),p+=d.move(l),c()),p+=d.move(")"),f(),p}function TN(){return"!"}Ly.peek=AN;function Ly(e,r,i,s){const l=e.referenceType,u=i.enter("imageReference");let f=i.enter("label");const c=i.createTracker(s);let d=c.move("![");const p=i.safe(e.alt,{before:d,after:"]",...c.current()});d+=c.move(p+"]["),f();const g=i.stack;i.stack=[],f=i.enter("reference");const m=i.safe(i.associationId(e),{before:d,after:"]",...c.current()});return f(),i.stack=g,u(),l==="full"||!p||p!==m?d+=c.move(m+"]"):l==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function AN(){return"!"}Ry.peek=DN;function Ry(e,r,i){let s=e.value||"",l="`",u=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(s);)l+="`";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],c=i.compilePattern(f);let d;if(f.atBreak)for(;d=c.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 l+s+l}function DN(){return"`"}function Oy(e,r){const i=Bh(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))}My.peek=LN;function My(e,r,i,s){const l=Wh(i),u=l==='"'?"Quote":"Apostrophe",f=i.createTracker(s);let c,d;if(Oy(e,i)){const g=i.stack;i.stack=[],c=i.enter("autolink");let m=f.move("<");return m+=f.move(i.containerPhrasing(e,{before:m,after:">",...f.current()})),m+=f.move(">"),c(),i.stack=g,m}c=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(" "+l),p+=f.move(i.safe(e.title,{before:p,after:l,...f.current()})),p+=f.move(l),d()),p+=f.move(")"),c(),p}function LN(e,r,i){return Oy(e,i)?"<":"["}Iy.peek=RN;function Iy(e,r,i,s){const l=e.referenceType,u=i.enter("linkReference");let f=i.enter("label");const c=i.createTracker(s);let d=c.move("[");const p=i.containerPhrasing(e,{before:d,after:"]",...c.current()});d+=c.move(p+"]["),f();const g=i.stack;i.stack=[],f=i.enter("reference");const m=i.safe(i.associationId(e),{before:d,after:"]",...c.current()});return f(),i.stack=g,u(),l==="full"||!p||p!==m?d+=c.move(m+"]"):l==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function RN(){return"["}function Gh(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 ON(e){const r=Gh(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 MN(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 By(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 IN(e,r,i,s){const l=i.enter("list"),u=i.bulletCurrent;let f=e.ordered?MN(i):Gh(i);const c=e.ordered?f==="."?")":".":ON(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),By(i)===f&&g){let m=-1;for(;++m<e.children.length;){const x=e.children[m];if(x&&x.type==="listItem"&&x.children&&x.children[0]&&x.children[0].type==="thematicBreak"){d=!0;break}}}}d&&(f=c),i.bulletCurrent=f;const p=i.containerFlow(e,s);return i.bulletLastUsed=f,i.bulletCurrent=u,l(),p}function BN(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 zN(e,r,i,s){const l=BN(i);let u=i.bulletCurrent||Gh(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;(l==="tab"||l==="mixed"&&(r&&r.type==="list"&&r.spread||e.spread))&&(f=Math.ceil(f/4)*4);const c=i.createTracker(s);c.move(u+" ".repeat(f-u.length)),c.shift(f);const d=i.enter("listItem"),p=i.indentLines(i.containerFlow(e,c.current()),g);return d(),p;function g(m,x,_){return x?(_?"":" ".repeat(f))+m:(_?u:u+" ".repeat(f-u.length))+m}}function HN(e,r,i,s){const l=i.enter("paragraph"),u=i.enter("phrasing"),f=i.containerPhrasing(e,s);return u(),l(),f}const PN=ic(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function FN(e,r,i,s){return(e.children.some(function(f){return PN(f)})?i.containerPhrasing:i.containerFlow).call(i,e,s)}function UN(e){const r=e.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}zy.peek=$N;function zy(e,r,i,s){const l=UN(i),u=i.enter("strong"),f=i.createTracker(s),c=f.move(l+l);let d=f.move(i.containerPhrasing(e,{after:l,before:c,...f.current()}));const p=d.charCodeAt(0),g=$l(s.before.charCodeAt(s.before.length-1),p,l);g.inside&&(d=to(p)+d.slice(1));const m=d.charCodeAt(d.length-1),x=$l(s.after.charCodeAt(0),m,l);x.inside&&(d=d.slice(0,-1)+to(m));const _=f.move(l+l);return u(),i.attentionEncodeSurroundingInfo={after:x.outside,before:g.outside},c+d+_}function $N(e,r,i){return i.options.strong||"*"}function qN(e,r,i,s){return i.safe(e.value,s)}function WN(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 GN(e,r,i){const s=(By(i)+(i.options.ruleSpaces?" ":"")).repeat(WN(i));return i.options.ruleSpaces?s.slice(0,-1):s}const Hy={blockquote:mN,break:Pv,code:_N,definition:wN,emphasis:Ty,hardBreak:Pv,heading:jN,html:Ay,image:Dy,imageReference:Ly,inlineCode:Ry,link:My,linkReference:Iy,list:IN,listItem:zN,paragraph:HN,root:FN,strong:zy,text:qN,thematicBreak:GN};function VN(){return{enter:{table:KN,tableData:Fv,tableHeader:Fv,tableRow:XN},exit:{codeText:ZN,table:YN,tableData:Qd,tableHeader:Qd,tableRow:Qd}}}function KN(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 YN(e){this.exit(e),this.data.inTable=void 0}function XN(e){this.enter({type:"tableRow",children:[]},e)}function Qd(e){this.exit(e)}function Fv(e){this.enter({type:"tableCell",children:[]},e)}function ZN(e){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,QN));const i=this.stack[this.stack.length-1];i.type,i.value=r,this.exit(e)}function QN(e,r){return r==="|"?r:e}function JN(e){const r=e||{},i=r.tableCellPadding,s=r.tablePipeAlign,l=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:x,table:f,tableCell:d,tableRow:c}};function f(_,k,C,b){return p(g(_,C,b),_.align)}function c(_,k,C,b){const v=m(_,C,b),y=p([v]);return y.slice(0,y.indexOf(`
|
|
119
|
+
`))}function d(_,k,C,b){const v=C.enter("tableCell"),y=C.enter("phrasing"),S=C.containerPhrasing(_,{...b,before:u,after:u});return y(),v(),S}function p(_,k){return fN(_,{align:k,alignDelimiters:s,padding:i,stringLength:l})}function g(_,k,C){const b=_.children;let v=-1;const y=[],S=k.enter("table");for(;++v<b.length;)y[v]=m(b[v],k,C);return S(),y}function m(_,k,C){const b=_.children;let v=-1;const y=[],S=k.enter("tableRow");for(;++v<b.length;)y[v]=d(b[v],_,k,C);return S(),y}function x(_,k,C){let b=Hy.inlineCode(_,k,C);return C.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function eT(){return{exit:{taskListCheckValueChecked:Uv,taskListCheckValueUnchecked:Uv,paragraph:nT}}}function tT(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:rT}}}function Uv(e){const r=this.stack[this.stack.length-2];r.type,r.checked=e.type==="taskListCheckValueChecked"}function nT(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 l=r.children;let u=-1,f;for(;++u<l.length;){const c=l[u];if(c.type==="paragraph"){f=c;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 rT(e,r,i,s){const l=e.children[0],u=typeof e.checked=="boolean"&&l&&l.type==="paragraph",f="["+(e.checked?"x":" ")+"] ",c=i.createTracker(s);u&&c.move(f);let d=Hy.listItem(e,r,i,{...s,...c.current()});return u&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),d;function p(g){return g+f}}function iT(){return[Ij(),rN(),oN(),VN(),eT()]}function sT(e){return{extensions:[Bj(),iN(e),lN(),JN(e),tT()]}}const aT={tokenize:hT,partial:!0},Py={tokenize:fT,partial:!0},Fy={tokenize:pT,partial:!0},Uy={tokenize:mT,partial:!0},oT={tokenize:gT,partial:!0},$y={name:"wwwAutolink",tokenize:uT,previous:Wy},qy={name:"protocolAutolink",tokenize:dT,previous:Gy},Rr={name:"emailAutolink",tokenize:cT,previous:Vy},dr={};function lT(){return{text:dr}}let Ni=48;for(;Ni<123;)dr[Ni]=Rr,Ni++,Ni===58?Ni=65:Ni===91&&(Ni=97);dr[43]=Rr;dr[45]=Rr;dr[46]=Rr;dr[95]=Rr;dr[72]=[Rr,qy];dr[104]=[Rr,qy];dr[87]=[Rr,$y];dr[119]=[Rr,$y];function cT(e,r,i){const s=this;let l,u;return f;function f(m){return!mh(m)||!Vy.call(s,s.previous)||Vh(s.events)?i(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(m))}function c(m){return mh(m)?(e.consume(m),c):m===64?(e.consume(m),d):i(m)}function d(m){return m===46?e.check(oT,g,p)(m):m===45||m===95||hn(m)?(u=!0,e.consume(m),d):g(m)}function p(m){return e.consume(m),l=!0,d}function g(m){return u&&l&&mn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),r(m)):i(m)}}function uT(e,r,i){const s=this;return l;function l(f){return f!==87&&f!==119||!Wy.call(s,s.previous)||Vh(s.events)?i(f):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(aT,e.attempt(Py,e.attempt(Fy,u),i),i)(f))}function u(f){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),r(f)}}function dT(e,r,i){const s=this;let l="",u=!1;return f;function f(m){return(m===72||m===104)&&Gy.call(s,s.previous)&&!Vh(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(m),e.consume(m),c):i(m)}function c(m){if(mn(m)&&l.length<5)return l+=String.fromCodePoint(m),e.consume(m),c;if(m===58){const x=l.toLowerCase();if(x==="http"||x==="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||Pl(m)||bt(m)||Mi(m)||tc(m)?i(m):e.attempt(Py,e.attempt(Fy,g),i)(m)}function g(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),r(m)}}function hT(e,r,i){let s=0;return l;function l(f){return(f===87||f===119)&&s<3?(s++,e.consume(f),l):f===46&&s===3?(e.consume(f),u):i(f)}function u(f){return f===null?i(f):r(f)}}function fT(e,r,i){let s,l,u;return f;function f(p){return p===46||p===95?e.check(Uy,d,c)(p):p===null||bt(p)||Mi(p)||p!==45&&tc(p)?d(p):(u=!0,e.consume(p),f)}function c(p){return p===95?s=!0:(l=s,s=void 0),e.consume(p),f}function d(p){return l||s||!u?i(p):r(p)}}function pT(e,r){let i=0,s=0;return l;function l(f){return f===40?(i++,e.consume(f),l):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(Uy,r,u)(f):f===null||bt(f)||Mi(f)?r(f):(e.consume(f),l)}function u(f){return f===41&&s++,e.consume(f),l}}function mT(e,r,i){return s;function s(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(e.consume(c),s):c===38?(e.consume(c),u):c===93?(e.consume(c),l):c===60||c===null||bt(c)||Mi(c)?r(c):i(c)}function l(c){return c===null||c===40||c===91||bt(c)||Mi(c)?r(c):s(c)}function u(c){return mn(c)?f(c):i(c)}function f(c){return c===59?(e.consume(c),s):mn(c)?(e.consume(c),f):i(c)}}function gT(e,r,i){return s;function s(u){return e.consume(u),l}function l(u){return hn(u)?i(u):r(u)}}function Wy(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||bt(e)}function Gy(e){return!mn(e)}function Vy(e){return!(e===47||mh(e))}function mh(e){return e===43||e===45||e===46||e===95||hn(e)}function Vh(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 xT={tokenize:kT,partial:!0};function vT(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:ST,continuation:{tokenize:wT},exit:CT}},text:{91:{name:"gfmFootnoteCall",tokenize:_T},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:bT,resolveTo:yT}}}}function bT(e,r,i){const s=this;let l=s.events.length;const u=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let f;for(;l--;){const d=s.events[l][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 c;function c(d){if(!f||!f._balanced)return i(d);const p=Jn(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 yT(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)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},e[i+3][1].end),end:Object.assign({},e[i+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},l.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)},c=[e[i+1],e[i+2],["enter",s,r],e[i+3],e[i+4],["enter",l,r],["exit",l,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,...c),e}function _T(e,r,i){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u=0,f;return c;function c(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||bt(m))return i(m);if(m===93){e.exit("chunkString");const x=e.exit("gfmFootnoteCallString");return l.includes(Jn(s.sliceSerialize(x)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),r):i(m)}return bt(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 ST(e,r,i){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u,f=0,c;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&&!c||k===null||k===91||bt(k))return i(k);if(k===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return u=Jn(s.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),x}return bt(k)||(c=!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 x(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),l.includes(u)||l.push(u),at(e,_,"gfmFootnoteDefinitionWhitespace")):i(k)}function _(k){return r(k)}}function wT(e,r,i){return e.check(oo,r,e.attempt(xT,r,i))}function CT(e){e.exit("gfmFootnoteDefinition")}function kT(e,r,i){const s=this;return at(e,l,"gfmFootnoteDefinitionIndent",5);function l(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 ET(e){let i=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:u,resolveAll:l};return i==null&&(i=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function l(f,c){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)},x=[["enter",g,c],["enter",f[p][1],c],["exit",f[p][1],c],["enter",m,c]],_=c.parser.constructs.insideSpan.null;_&&In(x,x.length,0,nc(_,f.slice(p+1,d),c)),In(x,x.length,0,[["exit",m,c],["enter",f[d][1],c],["exit",f[d][1],c],["exit",g,c]]),In(f,p-1,d-p+3,x),d=p+x.length-2;break}}for(d=-1;++d<f.length;)f[d][1].type==="strikethroughSequenceTemporary"&&(f[d][1].type="data");return f}function u(f,c,d){const p=this.previous,g=this.events;let m=0;return x;function x(k){return p===126&&g[g.length-1][1].type!=="characterEscape"?d(k):(f.enter("strikethroughSequenceTemporary"),_(k))}function _(k){const C=Os(p);if(k===126)return m>1?d(k):(f.consume(k),m++,_);if(m<2&&!i)return d(k);const b=f.exit("strikethroughSequenceTemporary"),v=Os(k);return b._open=!v||v===2&&!!C,b._close=!C||C===2&&!!v,c(k)}}}class jT{constructor(){this.map=[]}add(r,i,s){NT(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 l=s.pop();for(;l;){for(const u of l)r.push(u);l=s.pop()}this.map.length=0}}function NT(e,r,i,s){let l=0;if(!(i===0&&s.length===0)){for(;l<e.map.length;){if(e.map[l][0]===r){e.map[l][1]+=i,e.map[l][2].push(...s);return}l+=1}e.map.push([r,i,s])}}function TT(e,r){let i=!1;const s=[];for(;r<e.length;){const l=e[r];if(i){if(l[0]==="enter")l[1].type==="tableContent"&&s.push(e[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(l[1].type==="tableContent"){if(e[r-1][1].type==="tableDelimiterMarker"){const u=s.length-1;s[u]=s[u]==="left"?"center":"right"}}else if(l[1].type==="tableDelimiterRow")break}else l[0]==="enter"&&l[1].type==="tableDelimiterRow"&&(i=!0);r+=1}return s}function AT(){return{flow:{null:{name:"table",tokenize:DT,resolveAll:LT}}}}function DT(e,r,i){const s=this;let l=0,u=0,f;return c;function c(H){let W=s.events.length-1;for(;W>-1;){const R=s.events[W][1].type;if(R==="lineEnding"||R==="linePrefix")W--;else break}const K=W>-1?s.events[W][1].type:null,q=K==="tableHead"||K==="tableRow"?N:d;return q===N&&s.parser.lazy[s.now().line]?i(H):q(H)}function d(H){return e.enter("tableHead"),e.enter("tableRow"),p(H)}function p(H){return H===124||(f=!0,u+=1),g(H)}function g(H){return H===null?i(H):Pe(H)?u>1?(u=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(H),e.exit("lineEnding"),_):i(H):et(H)?at(e,g,"whitespace")(H):(u+=1,f&&(f=!1,l+=1),H===124?(e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),f=!0,g):(e.enter("data"),m(H)))}function m(H){return H===null||H===124||bt(H)?(e.exit("data"),g(H)):(e.consume(H),H===92?x:m)}function x(H){return H===92||H===124?(e.consume(H),m):m(H)}function _(H){return s.interrupt=!1,s.parser.lazy[s.now().line]?i(H):(e.enter("tableDelimiterRow"),f=!1,et(H)?at(e,k,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):k(H))}function k(H){return H===45||H===58?b(H):H===124?(f=!0,e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),C):A(H)}function C(H){return et(H)?at(e,b,"whitespace")(H):b(H)}function b(H){return H===58?(u+=1,f=!0,e.enter("tableDelimiterMarker"),e.consume(H),e.exit("tableDelimiterMarker"),v):H===45?(u+=1,v(H)):H===null||Pe(H)?j(H):A(H)}function v(H){return H===45?(e.enter("tableDelimiterFiller"),y(H)):A(H)}function y(H){return H===45?(e.consume(H),y):H===58?(f=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(H),e.exit("tableDelimiterMarker"),S):(e.exit("tableDelimiterFiller"),S(H))}function S(H){return et(H)?at(e,j,"whitespace")(H):j(H)}function j(H){return H===124?k(H):H===null||Pe(H)?!f||l!==u?A(H):(e.exit("tableDelimiterRow"),e.exit("tableHead"),r(H)):A(H)}function A(H){return i(H)}function N(H){return e.enter("tableRow"),D(H)}function D(H){return H===124?(e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),D):H===null||Pe(H)?(e.exit("tableRow"),r(H)):et(H)?at(e,D,"whitespace")(H):(e.enter("data"),T(H))}function T(H){return H===null||H===124||bt(H)?(e.exit("data"),D(H)):(e.consume(H),H===92?B:T)}function B(H){return H===92||H===124?(e.consume(H),T):T(H)}}function LT(e,r){let i=-1,s=!0,l=0,u=[0,0,0,0],f=[0,0,0,0],c=!1,d=0,p,g,m;const x=new jT;for(;++i<e.length;){const _=e[i],k=_[1];_[0]==="enter"?k.type==="tableHead"?(c=!1,d!==0&&($v(x,r,d,p,g),g=void 0,d=0),p={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},x.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],c&&(c=!1,g={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},x.add(i,0,[["enter",g,r]])),l=k.type==="tableDelimiterRow"?2:g?3:1):l&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(s=!1,f[2]===0&&(u[1]!==0&&(f[0]=f[1],m=Tl(x,r,u,l,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=Tl(x,r,u,l,void 0,m)),u=f,f=[u[1],i,0,0])):k.type==="tableHead"?(c=!0,d=i):k.type==="tableRow"||k.type==="tableDelimiterRow"?(d=i,u[1]!==0?(f[0]=f[1],m=Tl(x,r,u,l,i,m)):f[1]!==0&&(m=Tl(x,r,f,l,i,m)),l=0):l&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(f[3]=i)}for(d!==0&&$v(x,r,d,p,g),x.consume(r.events),i=-1;++i<r.events.length;){const _=r.events[i];_[0]==="enter"&&_[1].type==="table"&&(_[1]._align=TT(r.events,i))}return e}function Tl(e,r,i,s,l,u){const f=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",c="tableContent";i[0]!==0&&(u.end=Object.assign({},As(r.events,i[0])),e.add(i[0],0,[["exit",u,r]]));const d=As(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=As(r.events,i[2]),g=As(r.events,i[3]),m={type:c,start:Object.assign({},p),end:Object.assign({},g)};if(e.add(i[2],0,[["enter",m,r]]),s!==2){const x=r.events[i[2]],_=r.events[i[3]];if(x[1].end=Object.assign({},_[1].end),x[1].type="chunkText",x[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 l!==void 0&&(u.end=Object.assign({},As(r.events,l)),e.add(l,0,[["exit",u,r]]),u=void 0),u}function $v(e,r,i,s,l){const u=[],f=As(r.events,i);l&&(l.end=Object.assign({},f),u.push(["exit",l,r])),s.end=Object.assign({},f),u.push(["exit",s,r]),e.add(i+1,0,u)}function As(e,r){const i=e[r],s=i[0]==="enter"?"start":"end";return i[1][s]}const RT={name:"tasklistCheck",tokenize:MT};function OT(){return{text:{91:RT}}}function MT(e,r,i){const s=this;return l;function l(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 bt(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"),c):i(d)}function c(d){return Pe(d)?r(d):et(d)?e.check({tokenize:IT},r,i)(d):i(d)}}function IT(e,r,i){return at(e,s,"whitespace");function s(l){return l===null?i(l):r(l)}}function BT(e){return iy([lT(),vT(),ET(e),AT(),OT()])}const zT={};function HT(e){const r=this,i=e||zT,s=r.data(),l=s.micromarkExtensions||(s.micromarkExtensions=[]),u=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),f=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);l.push(BT(i)),u.push(iT()),f.push(sT(i))}function PT(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 FT(e,r){if(e==null)return{};var i,s,l=PT(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)&&(l[i]=e[i])}return l}function gh(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 UT(e){if(Array.isArray(e))return gh(e)}function $T(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function qT(e,r){if(e){if(typeof e=="string")return gh(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)?gh(e,r):void 0}}function WT(){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 xh(e){return UT(e)||$T(e)||qT(e)||WT()}function no(e){"@babel/helpers - typeof";return no=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},no(e)}function GT(e,r){if(no(e)!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var s=i.call(e,r);if(no(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function VT(e){var r=GT(e,"string");return no(r)=="symbol"?r:r+""}function Ky(e,r,i){return(r=VT(r))in e?Object.defineProperty(e,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[r]=i,e}function vh(){return vh=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},vh.apply(null,arguments)}function qv(e,r){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),i.push.apply(i,s)}return i}function Ds(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){Ky(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}function KT(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 Jd={};function YT(e){if(e.length===0||e.length===1)return e;var r=e.join(".");return Jd[r]||(Jd[r]=KT(e)),Jd[r]}function XT(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"}),l=YT(s);return l.reduce(function(u,f){return Ds(Ds({},u),i[f])},r)}function Wv(e){return e.join(" ")}function ZT(e,r){var i=0;return function(s){return i+=1,s.map(function(l,u){return Yy({node:l,stylesheet:e,useInlineStyles:r,key:"code-segment-".concat(i,"-").concat(u)})})}}function Yy(e){var r=e.node,i=e.stylesheet,s=e.style,l=s===void 0?{}:s,u=e.useInlineStyles,f=e.key,c=r.properties,d=r.type,p=r.tagName,g=r.value;if(d==="text")return g;if(p){var m=ZT(i,u),x;if(!u)x=Ds(Ds({},c),{},{className:Wv(c.className)});else{var _=Object.keys(i).reduce(function(v,y){return y.split(".").forEach(function(S){v.includes(S)||v.push(S)}),v},[]),k=c.className&&c.className.includes("token")?["token"]:[],C=c.className&&k.concat(c.className.filter(function(v){return!_.includes(v)}));x=Ds(Ds({},c),{},{className:Wv(C)||void 0,style:XT(c.className,Object.assign({},c.style,l),i)})}var b=m(r.children);return dn.createElement(p,vh({key:f},x),b)}}const QT=(function(e,r){var i=e.listLanguages();return i.indexOf(r)!==-1});var JT=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function Gv(e,r){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),i.push.apply(i,s)}return i}function oi(e){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{};r%2?Gv(Object(i),!0).forEach(function(s){Ky(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Gv(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}var e3=/\n/g;function t3(e){return e.match(e3)}function n3(e){var r=e.lines,i=e.startingLineNumber,s=e.style;return r.map(function(l,u){var f=u+i;return dn.createElement("span",{key:"line-".concat(u),className:"react-syntax-highlighter-line-number",style:typeof s=="function"?s(f):s},"".concat(f,`
|
|
121
|
+
`))})}function r3(e){var r=e.codeString,i=e.codeStyle,s=e.containerStyle,l=s===void 0?{float:"left",paddingRight:"10px"}:s,u=e.numberStyle,f=u===void 0?{}:u,c=e.startingLineNumber;return dn.createElement("code",{style:Object.assign({},i,l)},n3({lines:r.replace(/\n$/,"").split(`
|
|
122
|
+
`),style:f,startingLineNumber:c}))}function i3(e){return"".concat(e.toString().length,".25em")}function Xy(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 Zy(e,r,i){var s={display:"inline-block",minWidth:i3(i),paddingRight:"1em",textAlign:"right",userSelect:"none"},l=typeof e=="function"?e(r):e,u=oi(oi({},s),l);return u}function Ml(e){var r=e.children,i=e.lineNumber,s=e.lineNumberStyle,l=e.largestLineNumber,u=e.showInlineLineNumbers,f=e.lineProps,c=f===void 0?{}:f,d=e.className,p=d===void 0?[]:d,g=e.showLineNumbers,m=e.wrapLongLines,x=e.wrapLines,_=x===void 0?!1:x,k=_?oi({},typeof c=="function"?c(i):c):{};if(k.className=k.className?[].concat(xh(k.className.trim().split(/\s+/)),xh(p)):p,i&&u){var C=Zy(s,i,l);r.unshift(Xy(i,C))}return m&g&&(k.style=oi({display:"flex"},k.style)),{type:"element",tagName:"span",properties:k,children:r}}function Qy(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 l=e[s];if(l.type==="text")i.push(Ml({children:[l],className:xh(new Set(r))}));else if(l.children){var u,f=r.concat(((u=l.properties)===null||u===void 0?void 0:u.className)||[]);Qy(l.children,f).forEach(function(c){return i.push(c)})}}return i}function s3(e,r,i,s,l,u,f,c,d){var p,g=Qy(e.value),m=[],x=-1,_=0;function k(A,N){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return Ml({children:A,lineNumber:N,lineNumberStyle:c,largestLineNumber:f,showInlineLineNumbers:l,lineProps:i,className:D,showLineNumbers:s,wrapLongLines:d,wrapLines:r})}function C(A,N){if(s&&N&&l){var D=Zy(c,N,f);A.unshift(Xy(N,D))}return A}function b(A,N){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return r||D.length>0?k(A,N,D):C(A,N)}for(var v=function(){var N=g[_],D=N.children[0].value,T=t3(D);if(T){var B=D.split(`
|
|
123
|
+
`);B.forEach(function(H,W){var K=s&&m.length+u,q={type:"text",value:"".concat(H,`
|
|
124
|
+
`)};if(W===0){var R=g.slice(x+1,_).concat(Ml({children:[q],className:N.properties.className})),U=b(R,K);m.push(U)}else if(W===B.length-1){var M=g[_+1]&&g[_+1].children&&g[_+1].children[0],Y={type:"text",value:"".concat(H)};if(M){var Z=Ml({children:[Y],className:N.properties.className});g.splice(_+1,0,Z)}else{var z=[Y],L=b(z,K,N.properties.className);m.push(L)}}else{var I=[q],V=b(I,K,N.properties.className);m.push(V)}}),x=_}_++};_<g.length;)v();if(x!==g.length-1){var y=g.slice(x+1,g.length);if(y&&y.length){var S=s&&m.length+u,j=b(y,S);m.push(j)}}return r?m:(p=[]).concat.apply(p,m)}function a3(e){var r=e.rows,i=e.stylesheet,s=e.useInlineStyles;return r.map(function(l,u){return Yy({node:l,stylesheet:i,useInlineStyles:s,key:"code-segment-".concat(u)})})}function Jy(e){return e&&typeof e.highlightAuto<"u"}function o3(e){var r=e.astGenerator,i=e.language,s=e.code,l=e.defaultCodeValue;if(Jy(r)){var u=QT(r,i);return i==="text"?{value:l,language:"text"}:u?r.highlight(i,s):r.highlightAuto(s)}try{return i&&i!=="text"?{value:r.highlight(s,i)}:{value:l}}catch{return{value:l}}}function l3(e,r){return function(s){var l,u,f=s.language,c=s.children,d=s.style,p=d===void 0?r:d,g=s.customStyle,m=g===void 0?{}:g,x=s.codeTagProps,_=x===void 0?{className:f?"language-".concat(f):void 0,style:oi(oi({},p['code[class*="language-"]']),p['code[class*="language-'.concat(f,'"]')])}:x,k=s.useInlineStyles,C=k===void 0?!0:k,b=s.showLineNumbers,v=b===void 0?!1:b,y=s.showInlineLineNumbers,S=y===void 0?!0:y,j=s.startingLineNumber,A=j===void 0?1:j,N=s.lineNumberContainerStyle,D=s.lineNumberStyle,T=D===void 0?{}:D,B=s.wrapLines,H=s.wrapLongLines,W=H===void 0?!1:H,K=s.lineProps,q=K===void 0?{}:K,R=s.renderer,U=s.PreTag,M=U===void 0?"pre":U,Y=s.CodeTag,Z=Y===void 0?"code":Y,z=s.code,L=z===void 0?(Array.isArray(c)?c[0]:c)||"":z,I=s.astGenerator,V=FT(s,JT);I=I||e;var F=v?dn.createElement(r3,{containerStyle:N,codeStyle:_.style||{},numberStyle:T,startingLineNumber:A,codeString:L}):null,ie=p.hljs||p['pre[class*="language-"]']||{backgroundColor:"#fff"},Q=Jy(I)?"hljs":"prismjs",ee=C?Object.assign({},V,{style:Object.assign({},ie,m)}):Object.assign({},V,{className:V.className?"".concat(Q," ").concat(V.className):Q,style:Object.assign({},m)});if(W?_.style=oi({whiteSpace:"pre-wrap"},_.style):_.style=oi({whiteSpace:"pre"},_.style),!I)return dn.createElement(M,ee,F,dn.createElement(Z,_,L));(B===void 0&&R||W)&&(B=!0),R=R||a3;var X=[{type:"text",value:L}],$=o3({astGenerator:I,language:f,code:L,defaultCodeValue:X});$.language===null&&($.value=X);var oe=(l=(u=L.match(/\n/g))===null||u===void 0?void 0:u.length)!==null&&l!==void 0?l:0,re=A+oe,ve=s3($,B,q,v,S,A,re,T,W);return dn.createElement(M,ee,dn.createElement(Z,_,!S&&F,R({rows:ve,stylesheet:p,useInlineStyles:C})))}}const Vv=/[#.]/g;function c3(e,r){const i=e||"",s={};let l=0,u,f;for(;l<i.length;){Vv.lastIndex=l;const c=Vv.exec(i),d=i.slice(l,c?c.index:i.length);d&&(u?u==="#"?s.id=d:Array.isArray(s.className)?s.className.push(d):s.className=[d]:f=d,l+=d.length),c&&(u=c[0],l++)}return{type:"element",tagName:f||r||"div",properties:s,children:[]}}function e0(e,r,i){const s=i?f3(i):void 0;function l(u,f,...c){let d;if(u==null){d={type:"root",children:[]};const p=f;c.unshift(p)}else{d=c3(u,r);const p=d.tagName.toLowerCase(),g=s?s.get(p):void 0;if(d.tagName=g||p,u3(f))c.unshift(f);else for(const[m,x]of Object.entries(f))d3(e,d.properties,m,x)}for(const p of c)bh(d.children,p);return d.type==="element"&&d.tagName==="template"&&(d.content={type:"root",children:d.children},d.children=[]),d}return l}function u3(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 l=r[s];if(l&&typeof l=="object"){if(!Array.isArray(l))return!0;const u=l;for(const f of u)if(typeof f!="number"&&typeof f!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function d3(e,r,i,s){const l=Yb(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"?l.spaceSeparated?u=iv(s):l.commaSeparated?u=Jx(s):l.commaOrSpaceSeparated?u=iv(Jx(s).join(" ")):u=Kv(l,l.property,s):Array.isArray(s)?u=[...s]:u=l.property==="style"?h3(s):String(s);if(Array.isArray(u)){const f=[];for(const c of u)f.push(Kv(l,l.property,c));u=f}l.property==="className"&&Array.isArray(r.className)&&(u=r.className.concat(u)),r[l.property]=u}}function bh(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)bh(e,i);else if(typeof r=="object"&&"type"in r)r.type==="root"?bh(e,r.children):e.push(r);else throw new Error("Expected node, nodes, or string, got `"+r+"`")}function Kv(e,r,i){if(typeof i=="string"){if(e.number&&i&&!Number.isNaN(Number(i)))return Number(i);if((e.boolean||e.overloadedBoolean)&&(i===""||Qa(i)===Qa(r)))return!0}return i}function h3(e){const r=[];for(const[i,s]of Object.entries(e))r.push([i,s].join(": "));return r.join("; ")}function f3(e){const r=new Map;for(const i of e)r.set(i.toLowerCase(),i);return r}const p3=["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"],m3=e0(Xb,"div");e0(ec,"g",p3);const g3=["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"],Yv={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 t0(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=48&&r<=57}function x3(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=102||r>=65&&r<=70||r>=48&&r<=57}function v3(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=122||r>=65&&r<=90}function Xv(e){return v3(e)||t0(e)}const b3=["","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 y3(e,r){const i={},s=typeof i.additional=="string"?i.additional.charCodeAt(0):i.additional,l=[];let u=0,f=-1,c="",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,x=k(),_;for(u--;++u<=e.length;)if(_===10&&(m=(p?p[f]:0)||1),_=e.charCodeAt(u),_===38){const v=e.charCodeAt(u+1);if(v===9||v===10||v===12||v===32||v===38||v===60||Number.isNaN(v)||s&&v===s){c+=String.fromCharCode(_),m++;continue}const y=u+1;let S=y,j=y,A;if(v===35){j=++S;const q=e.charCodeAt(j);q===88||q===120?(A="hexadecimal",j=++S):A="decimal"}else A="named";let N="",D="",T="";const B=A==="named"?Xv:A==="decimal"?t0:x3;for(j--;++j<=e.length;){const q=e.charCodeAt(j);if(!B(q))break;T+=String.fromCharCode(q),A==="named"&&g3.includes(T)&&(N=T,D=eo(T))}let H=e.charCodeAt(j)===59;if(H){j++;const q=A==="named"?eo(T):!1;q&&(N=T,D=q)}let W=1+j-y,K="";if(!(!H&&i.nonTerminated===!1))if(!T)A!=="named"&&C(4,W);else if(A==="named"){if(H&&!D)C(5,1);else if(N!==T&&(j=S+N.length,W=1+j-S,H=!1),!H){const q=N?1:3;if(i.attribute){const R=e.charCodeAt(j);R===61?(C(q,W),D=""):Xv(R)?D="":C(q,W)}else C(q,W)}K=D}else{H||C(2,W);let q=Number.parseInt(T,A==="hexadecimal"?16:10);if(_3(q))C(7,W),K="�";else if(q in Yv)C(6,W),K=Yv[q];else{let R="";S3(q)&&C(6,W),q>65535&&(q-=65536,R+=String.fromCharCode(q>>>10|55296),q=56320|q&1023),K=R+String.fromCharCode(q)}}if(K){b(),x=k(),u=j-1,m+=j-y+1,l.push(K);const q=k();q.offset++,i.reference&&i.reference.call(i.referenceContext||void 0,K,{start:x,end:q},e.slice(y-1,j)),x=q}else T=e.slice(y-1,j),c+=T,m+=T.length,u=j-1}else _===10&&(g++,f++,m=0),Number.isNaN(_)?b():(c+=String.fromCharCode(_),m++);return l.join("");function k(){return{line:g,column:m,offset:u+((d?d.offset:0)||0)}}function C(v,y){let S;i.warning&&(S=k(),S.column+=y,S.offset+=y,i.warning.call(i.warningContext||void 0,b3[v],S,v))}function b(){c&&(l.push(c),i.text&&i.text.call(i.textContext||void 0,c,{start:x,end:k()}),c="")}}function _3(e){return e>=55296&&e<=57343||e>1114111}function S3(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 w3=0,Al={},Zt={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++w3}),e.__id},clone:function e(r,i){i=i||{};var s,l;switch(Zt.util.type(r)){case"Object":if(l=Zt.util.objId(r),i[l])return i[l];s={},i[l]=s;for(var u in r)r.hasOwnProperty(u)&&(s[u]=e(r[u],i));return s;case"Array":return l=Zt.util.objId(r),i[l]?i[l]:(s=[],i[l]=s,r.forEach(function(f,c){s[c]=e(f,i)}),s);default:return r}}},languages:{plain:Al,plaintext:Al,text:Al,txt:Al,extend:function(e,r){var i=Zt.util.clone(Zt.languages[e]);for(var s in r)i[s]=r[s];return i},insertBefore:function(e,r,i,s){s=s||Zt.languages;var l=s[e],u={};for(var f in l)if(l.hasOwnProperty(f)){if(f==r)for(var c in i)i.hasOwnProperty(c)&&(u[c]=i[c]);i.hasOwnProperty(f)||(u[f]=l[f])}var d=s[e];return s[e]=u,Zt.languages.DFS(Zt.languages,function(p,g){g===d&&p!=e&&(this[p]=u)}),u},DFS:function e(r,i,s,l){l=l||{};var u=Zt.util.objId;for(var f in r)if(r.hasOwnProperty(f)){i.call(r,f,r[f],s||f);var c=r[f],d=Zt.util.type(c);d==="Object"&&!l[u(c)]?(l[u(c)]=!0,e(c,i,null,l)):d==="Array"&&!l[u(c)]&&(l[u(c)]=!0,e(c,i,f,l))}}},plugins:{},highlight:function(e,r,i){var s={code:e,grammar:r,language:i};if(Zt.hooks.run("before-tokenize",s),!s.grammar)throw new Error('The language "'+s.language+'" has no grammar.');return s.tokens=Zt.tokenize(s.code,s.grammar),Zt.hooks.run("after-tokenize",s),Ka.stringify(Zt.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 l=new C3;return Il(l,l.head,e),n0(e,l,r,l.head,0),E3(l)},hooks:{all:{},add:function(e,r){var i=Zt.hooks.all;i[e]=i[e]||[],i[e].push(r)},run:function(e,r){var i=Zt.hooks.all[e];if(!(!i||!i.length))for(var s=0,l;l=i[s++];)l(r)}},Token:Ka};function Ka(e,r,i,s){this.type=e,this.content=r,this.alias=i,this.length=(s||"").length|0}function Zv(e,r,i,s){e.lastIndex=r;var l=e.exec(i);if(l&&s&&l[1]){var u=l[1].length;l.index+=u,l[0]=l[0].slice(u)}return l}function n0(e,r,i,s,l,u){for(var f in i)if(!(!i.hasOwnProperty(f)||!i[f])){var c=i[f];c=Array.isArray(c)?c:[c];for(var d=0;d<c.length;++d){if(u&&u.cause==f+","+d)return;var p=c[d],g=p.inside,m=!!p.lookbehind,x=!!p.greedy,_=p.alias;if(x&&!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,b=s.next,v=l;b!==r.tail&&!(u&&v>=u.reach);v+=b.value.length,b=b.next){var y=b.value;if(r.length>e.length)return;if(!(y instanceof Ka)){var S=1,j;if(x){if(j=Zv(C,v,e,m),!j||j.index>=e.length)break;var T=j.index,A=j.index+j[0].length,N=v;for(N+=b.value.length;T>=N;)b=b.next,N+=b.value.length;if(N-=b.value.length,v=N,b.value instanceof Ka)continue;for(var D=b;D!==r.tail&&(N<A||typeof D.value=="string");D=D.next)S++,N+=D.value.length;S--,y=e.slice(v,N),j.index-=v}else if(j=Zv(C,0,y,m),!j)continue;var T=j.index,B=j[0],H=y.slice(0,T),W=y.slice(T+B.length),K=v+y.length;u&&K>u.reach&&(u.reach=K);var q=b.prev;H&&(q=Il(r,q,H),v+=H.length),k3(r,q,S);var R=new Ka(f,g?Zt.tokenize(B,g):B,_,B);if(b=Il(r,q,R),W&&Il(r,b,W),S>1){var U={cause:f+","+d,reach:K};n0(e,r,i,b.prev,v,U),u&&U.reach>u.reach&&(u.reach=U.reach)}}}}}}function C3(){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 Il(e,r,i){var s=r.next,l={value:i,prev:r,next:s};return r.next=l,s.prev=l,e.length++,l}function k3(e,r,i){for(var s=r.next,l=0;l<i&&s!==e.tail;l++)s=s.next;r.next=s,s.prev=r,e.length-=l}function E3(e){for(var r=[],i=e.head.next;i!==e.tail;)r.push(i.value),i=i.next;return r}const r0=Zt;function i0(){}i0.prototype=r0;const Vt=new i0;Vt.highlight=j3;Vt.register=N3;Vt.alias=T3;Vt.registered=A3;Vt.listLanguages=D3;Vt.util.encode=L3;Vt.Token.stringify=yh;function j3(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(Vt.languages,s))i=Vt.languages[s];else throw new Error("Unknown language: `"+s+"` is not registered")}return{type:"root",children:r0.highlight.call(Vt,e,i,s)}}function N3(e){if(typeof e!="function"||!e.displayName)throw new Error("Expected `function` for `syntax`, got `"+e+"`");Object.hasOwn(Vt.languages,e.displayName)||e(Vt)}function T3(e,r){const i=Vt.languages;let s={};typeof e=="string"?r&&(s[e]=r):s=e;let l;for(l in s)if(Object.hasOwn(s,l)){const u=s[l],f=typeof u=="string"?[u]:u;let c=-1;for(;++c<f.length;)i[f[c]]=i[l]}}function A3(e){if(typeof e!="string")throw new TypeError("Expected `string` for `aliasOrLanguage`, got `"+e+"`");return Object.hasOwn(Vt.languages,e)}function D3(){const e=Vt.languages,r=[];let i;for(i in e)Object.hasOwn(e,i)&&typeof e[i]=="object"&&r.push(i);return r}function yh(e,r){if(typeof e=="string")return{type:"text",value:e};if(Array.isArray(e)){const s=[];let l=-1;for(;++l<e.length;)e[l]!==null&&e[l]!==void 0&&e[l]!==""&&s.push(yh(e[l],r));return s}const i={attributes:{},classes:["token",e.type],content:yh(e.content,r),language:r,tag:"span",type:e.type};return e.alias&&i.classes.push(...typeof e.alias=="string"?[e.alias]:e.alias),Vt.hooks.run("wrap",i),m3(i.tag+"."+i.classes.join("."),R3(i.attributes),i.content)}function L3(e){return e}function R3(e){let r;for(r in e)Object.hasOwn(e,r)&&(e[r]=y3(e[r]));return e}var pt=l3(Vt,{});pt.registerLanguage=function(e,r){return Vt.register(r)};pt.alias=function(e,r){return Vt.alias(e,r)};Bi.displayName="markup";Bi.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function Bi(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 l={};l["language-"+s]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:e.languages[s]},l.cdata=/^<!\[CDATA\[|\]\]>$/i;var u={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:l}};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}ac.displayName="css";ac.aliases=[];function ac(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)}zi.displayName="clike";zi.aliases=[];function zi(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:/[{}[\];(),.:]/}}co.displayName="javascript";co.aliases=["js"];function co(e){e.register(zi),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}Kh.displayName="sql";Kh.aliases=[];function Kh(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:/[;[\]()`,.]/}}oc.displayName="c";oc.aliases=[];function oc(e){e.register(zi),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}Yh.displayName="cpp";Yh.aliases=[];function Yh(e){e.register(oc),(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)}Xh.displayName="bash";Xh.aliases=["sh","shell"];function Xh(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},l={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:l},{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:l},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:l.entity}}],environment:{pattern:RegExp("\\$?"+i),alias:"constant"},variable:l.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=l.variable[1].inside,c=0;c<u.length;c++)f[u[c]]=r.languages.bash[u[c]];r.languages.sh=r.languages.bash,r.languages.shell=r.languages.bash})(e)}Zh.displayName="yaml";Zh.aliases=["yml"];function Zh(e){(function(r){var i=/[*&][^\s[\]{},]+/,s=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,l="(?:"+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 c(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 l}).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 l})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return l}).replace(/<<key>>/g,function(){return"(?:"+u+"|"+f+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:c(/\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:c(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:c(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:c(f),lookbehind:!0,greedy:!0},number:{pattern:c(/[+-]?(?: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)}Qh.displayName="markdown";Qh.aliases=["md"];function Qh(e){e.register(Bi),(function(r){var i=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function s(c){return c=c.replace(/<inner>/g,function(){return i}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+c+")")}var l=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,u=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return l}),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(l),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(l),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(c){["url","bold","italic","strike","code-snippet"].forEach(function(d){c!==d&&(r.languages.markdown[c].inside.content.inside[d]=r.languages.markdown[d])})}),r.hooks.add("after-tokenize",function(c){if(c.language!=="markdown"&&c.language!=="md")return;function d(p){if(!(!p||typeof p=="string"))for(var g=0,m=p.length;g<m;g++){var x=p[g];if(x.type!=="code"){d(x.content);continue}var _=x.content[1],k=x.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 b="language-"+C;k.alias?typeof k.alias=="string"?k.alias=[k.alias,b]:k.alias.push(b):k.alias=[b]}}}d(c.tokens)}),r.hooks.add("wrap",function(c){if(c.type==="code-block"){for(var d="",p=0,g=c.classes.length;p<g;p++){var m=c.classes[p],x=/language-(.+)/.exec(m);if(x){d=x[1];break}}var _=r.languages[d];if(_)c.content=r.highlight(c.content.value,_,d);else if(d&&d!=="none"&&r.plugins.autoloader){var k="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);c.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)}Jh.displayName="ruby";Jh.aliases=["rb"];function Jh(e){e.register(zi),(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("|")+")",l=/(?:"(?:\\.|[^"\\\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+l),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+l+/(?=:(?!:))/.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)}ef.displayName="diff";ef.aliases=[];function ef(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 l=i[s],u=[];/^\w+$/.test(s)||u.push(/\w+/.exec(s)[0]),s==="diff"&&u.push("bold"),r.languages.diff[s]={pattern:RegExp("^(?:["+l+`].*(?:\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)}tf.displayName="docker";tf.aliases=["dockerfile"];function tf(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}),l=/"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"|'(?:[^'\\\r\n]|\\(?:\r\n|[\s\S]))*'/.source,u=/--[\w-]+=(?:<STR>|(?!["'])(?:[^\s\\]|\\.)+)/.source.replace(/<STR>/g,function(){return l}),f={pattern:RegExp(l),greedy:!0},c={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:c,string:f,variable:/\$(?:\w+|\{[^{}"'\\]*\})/,operator:/\\$/m}},comment:c},r.languages.dockerfile=r.languages.docker})(e)}nf.displayName="go";nf.aliases=[];function nf(e){e.register(zi),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"]}rf.displayName="graphql";rf.aliases=[];function rf(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(b){return typeof b!="string"&&b.type!=="comment"&&b.type!=="scalar"}),l=0;function u(b){return s[l+b]}function f(b,v){v=v||0;for(var y=0;y<b.length;y++){var S=u(y+v);if(!S||S.type!==b[y])return!1}return!0}function c(b,v){for(var y=1,S=l;S<s.length;S++){var j=s[S],A=j.content;if(j.type==="punctuation"&&typeof A=="string"){if(b.test(A))y++;else if(v.test(A)&&(y--,y===0))return S}}return-1}function d(b,v){var y=b.alias;y?Array.isArray(y)||(b.alias=y=[y]):b.alias=y=[],y.push(v)}for(;l<s.length;){var p=s[l++];if(p.type==="keyword"&&p.content==="mutation"){var g=[];if(f(["definition-mutation","punctuation"])&&u(1).content==="("){l+=2;var m=c(/^\($/,/^\)$/);if(m===-1)continue;for(;l<m;l++){var x=u(0);x.type==="variable"&&(d(x,"variable-input"),g.push(x.content))}l=m+1}if(f(["punctuation","property-query"])&&u(0).content==="{"&&(l++,d(u(0),"property-mutation"),g.length>0)){var _=c(/^\{$/,/^\}$/);if(_===-1)continue;for(var k=l;k<_;k++){var C=s[k];C.type==="variable"&&g.indexOf(C.content)>=0&&d(C,"variable-input")}}}}})}sf.displayName="scss";sf.aliases=[];function sf(e){e.register(ac),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}af.displayName="json";af.aliases=["webmanifest"];function af(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}of.displayName="java";of.aliases=[];function of(e){e.register(zi),(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,l={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":[l,{pattern:RegExp(/(^|[^\w.])/.source+s+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:l.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+s+/[A-Z]\w*\b/.source),lookbehind:!0,inside:l.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":l,keyword:i,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+s+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:l.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+s+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:l.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)}lc.displayName="typescript";lc.aliases=["ts"];function lc(e){e.register(co),(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)}lf.displayName="python";lf.aliases=["py"];function lf(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}cc.displayName="jsx";cc.aliases=[];function cc(e){e.register(co),e.register(Bi),(function(r){var i=r.util.clone(r.languages.javascript),s=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,l=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,u=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function f(p,g){return p=p.replace(/<S>/g,function(){return s}).replace(/<BRACES>/g,function(){return l}).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 c=function(p){return p?typeof p=="string"?p:typeof p.content=="string"?p.content:p.content.map(c).join(""):""},d=function(p){for(var g=[],m=0;m<p.length;m++){var x=p[m],_=!1;if(typeof x!="string"&&(x.type==="tag"&&x.content[0]&&x.content[0].type==="tag"?x.content[0].content[0].content==="</"?g.length>0&&g[g.length-1].tagName===c(x.content[0].content[1])&&g.pop():x.content[x.content.length-1].content==="/>"||g.push({tagName:c(x.content[0].content[1]),openedBraces:0}):g.length>0&&x.type==="punctuation"&&x.content==="{"?g[g.length-1].openedBraces++:g.length>0&&g[g.length-1].openedBraces>0&&x.type==="punctuation"&&x.content==="}"?g[g.length-1].openedBraces--:_=!0),(_||typeof x=="string")&&g.length>0&&g[g.length-1].openedBraces===0){var k=c(x);m<p.length-1&&(typeof p[m+1]=="string"||p[m+1].type==="plain-text")&&(k+=c(p[m+1]),p.splice(m+1,1)),m>0&&(typeof p[m-1]=="string"||p[m-1].type==="plain-text")&&(k=c(p[m-1])+k,p.splice(m-1,1),m--),p[m]=new r.Token("plain-text",k,null,k)}x.content&&typeof x.content!="string"&&d(x.content)}};r.hooks.add("after-tokenize",function(p){p.language!=="jsx"&&p.language!=="tsx"||d(p.tokens)})})(e)}cf.displayName="tsx";cf.aliases=[];function cf(e){e.register(cc),e.register(lc),(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)}uf.displayName="rust";uf.aliases=[];function uf(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)}df.displayName="toml";df.aliases=[];function df(e){(function(r){var i=/(?:[\w-]+|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*")/.source;function s(l){return l.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 Bl={'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",lc);pt.registerLanguage("javascript",co);pt.registerLanguage("tsx",cf);pt.registerLanguage("jsx",cc);pt.registerLanguage("python",lf);pt.registerLanguage("bash",Xh);pt.registerLanguage("json",af);pt.registerLanguage("css",ac);pt.registerLanguage("html",Bi);pt.registerLanguage("markup",Bi);pt.registerLanguage("xml",Bi);pt.registerLanguage("sql",Kh);pt.registerLanguage("yaml",Zh);pt.registerLanguage("markdown",Qh);pt.registerLanguage("diff",ef);pt.registerLanguage("rust",uf);pt.registerLanguage("go",nf);pt.registerLanguage("java",of);pt.registerLanguage("c",oc);pt.registerLanguage("cpp",Yh);pt.registerLanguage("ruby",Jh);pt.registerLanguage("toml",df);pt.registerLanguage("scss",sf);pt.registerLanguage("graphql",rf);pt.registerLanguage("docker",tf);function s0(e=2e3){const[r,i]=P.useState(!1),s=P.useCallback(async l=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(l);else{const u=document.createElement("textarea");u.value=l,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 O3={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:c,copy:d}=s0();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:c?o.jsx(Xl,{}):o.jsx("svg",{className:"w-4 h-4",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"})})})]}),o.jsx("div",{className:"overflow-x-auto",children:o.jsx(pt,{style:Bl,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})}},Hi=P.memo(function({content:r,className:i=""}){const s=P.useMemo(()=>{let l=M3(r);return l=I3(l),l},[r]);return o.jsx("div",{className:`markdown-content [&_li>p]:inline ${i}`,children:o.jsx(Ej,{remarkPlugins:[HT],components:O3,children:s})})});function M3(e){let r=e.replace(/^(\s*)•\s/gm,"$1- ");return r=r.replace(/^(\d+)\.\s*\n(?=\S)/gm,"$1. "),r}function I3(e){const r=/```/g,i=e.match(r);if(((i==null?void 0:i.length)??0)%2===1){const l=e.lastIndexOf("```");return e.slice(l+3).includes(`
|
|
128
|
+
`),e+"\n```"}return e}const B3=P.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(Hi,{content:r})})]}):o.jsx("div",{className:"text-text-muted text-sm italic bg-bg-tertiary/50 rounded p-1.5 feed-item whitespace-pre-wrap",children:r})});function a0({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 z3={...Bl,'pre[class*="language-"]':{...Bl['pre[class*="language-"]'],background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word",overflowX:"hidden"},'code[class*="language-"]':{...Bl['code[class*="language-"]'],background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"}},H3={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 uc(e){var l;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=(l=r.split(".").pop())==null?void 0:l.toLowerCase();return s?H3[s]??"text":"text"}const o0={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},P3={...o0,display:"inline"},F3={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},ro=P.memo(function({code:r,language:i,variant:s}){const l=s==="inline"?"span":s==="block-nowrap"?"div":"pre",u=s==="inline"?P3:s==="block-nowrap"?o0:F3;return o.jsx(pt,{style:z3,language:i,PreTag:l,customStyle:u,children:r})});function l0({src:e,alt:r,isOpen:i,onClose:s}){return i?o.jsx(jt,{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 U3=P.memo(function({oldString:r,newString:i,filePath:s}){const l=P.useMemo(()=>uc(s),[s]),u=r.split(`
|
|
129
|
+
`),f=i.split(`
|
|
130
|
+
`),c=r.length>0,d=i.length>0;return!c&&!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:[c&&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(ro,{code:r,language:l,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(ro,{code:i,language:l,variant:"block-nowrap"})})]})]})}),$3=P.memo(function({content:r,filePath:i}){const s=P.useMemo(()=>uc(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((l,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(ro,{code:r,language:s,variant:"block"})})]})})}),q3=P.memo(function({regions:r,filePath:i}){const s=P.useMemo(()=>uc(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((l,u)=>o.jsx(W3,{region:l,language:s},u))})}),W3=P.memo(function({region:r,language:i}){const s=G3(r),l=Math.max(...r.beforeContext.map(f=>f.lineNumber),...r.afterContext.map(f=>f.lineNumber),...r.edits.flatMap(f=>[f.startLine,f.endLine])),u=String(l).length;return o.jsx("div",{className:"rounded overflow-hidden border border-border font-mono text-sm",children:s.map((f,c)=>o.jsx(V3,{item:f,language:i,lineNumWidth:u},c))})});function G3(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 l=i.newContent.split(`
|
|
133
|
+
`);for(let u=0;u<l.length;u++)r.push({type:"added",lineNumber:i.startLine+u,content:l[u]})}for(const i of e.afterContext)r.push({type:"context",lineNumber:i.lineNumber,content:i.content});return r}const V3=P.memo(function({item:r,language:i,lineNumWidth:s}){const l=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",c=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:l}),o.jsx("div",{className:`text-center select-none leading-[1.5rem] ${f}`,children:c}),o.jsx("div",{className:`pr-2 overflow-x-auto min-w-0 ${d}`,children:o.jsx(ro,{code:r.content||" ",language:i,variant:"inline"})})]})}),K3=P.memo(function({result:r,metadata:i,filePath:s,heightExpanded:l=!1}){const[u,f]=P.useState(!1),c=P.useMemo(()=>uc(s),[s]),d=i==null?void 0:i.mimeType,p=i==null?void 0:i.base64Data;if(d!=null&&d.startsWith("image/")&&p){const x=`data:${d};base64,${p}`;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`rounded overflow-hidden border border-border ${l?"":"max-h-[45vh]"} flex items-center justify-center cursor-pointer hover:border-accent-primary transition-colors`,onClick:()=>f(!0),children:o.jsx("img",{src:x,alt:s,className:"max-w-full max-h-[45vh] object-contain"})}),o.jsx(l0,{src:x,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(x=>!x.startsWith(`
|
|
135
|
+
[`)&&!x.startsWith("[")).map(x=>x.replace(/^\d+: /,"")).join(`
|
|
136
|
+
`);return o.jsx("div",{className:`rounded overflow-hidden border border-border ${l?"":"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(x=>!x.startsWith(`
|
|
137
|
+
[`)&&!x.startsWith("[")).map((x,_)=>{const k=x.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(ro,{code:m,language:c,variant:"block"})})]})})}),Y3={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"}},Qv=P.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"),l=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":""]}),l.length>0&&o.jsxs("span",{className:"text-xs text-text-muted",children:[l.length," info"]})]}),o.jsx("div",{className:"max-h-48 overflow-y-auto",children:r.map((u,f)=>{const c=Y3[u.severity];return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${c.bg} border-b border-border last:border-b-0`,children:[o.jsx("span",{className:`${c.color} text-xs flex-shrink-0 w-4 text-center`,children:c.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)})})]})}),X3=P.memo(function({command:r,timeout:i,startedAt:s,streamingOutput:l,status:u,result:f,error:c,durationMs:d}){const p=P.useRef(null),[g,m]=P.useState(0);P.useEffect(()=>{p.current&&u==="pending"&&(p.current.scrollTop=p.current.scrollHeight)},[l,u]),P.useEffect(()=>{if(u!=="pending"||!s)return;const C=setInterval(()=>{m(Date.now()-s)},100);return()=>clearInterval(C)},[u,s]);const x=i/1e3,_=u==="pending"?g/1e3:(d??0)/1e3,k=u==="pending"?(l==null?void 0:l.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 / ",x,"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"&&l?l.map((C,b)=>o.jsx("span",{className:C.stream==="stderr"?"text-accent-warning":"",children:Za(C.content)},b)):Za(k)}),u==="error"&&c&&o.jsx("div",{className:"text-xs text-accent-error bg-accent-error/10 p-2 rounded",children:c}),u!=="pending"&&d!==void 0&&o.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",(d/1e3).toFixed(2),"s"]})]})});function Z3(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 Q3({confirmation:e}){const r=Ee(g=>g.confirmPath),i=Ee(g=>g.currentSession),s=Ee(g=>g.switchDangerLevel),{title:l,description:u}=Z3(e.reason),f=e.reason==="sensitive_file"||e.reason==="both",c=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 ${c} ${d} rounded p-3 my-2`,children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("svg",{className:`w-4 h-4 ${f?"text-red-400":"text-amber-400"}`,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"})}),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:l}),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 J3(e,r){if(e==="read_file"){const s=String(r.path??""),l=r.offset,u=r.limit,f=[];return l!==void 0&&l!==1&&f.push(`offset=${l}`),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 Jv(e,r,i){return J3(e,r)}function e5(e){return JSON.stringify(e,null,2)}const t5={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}},n5=P.memo(function({tool:r,args:i,status:s,variant:l="compact",forceCompact:u,result:f,error:c,durationMs:d,diagnostics:p,editContext:g,startedAt:m,streamingOutput:x,metadata:_,callId:k}){const C=r==="edit_file"||r==="write_file",b=r==="run_command"&&s==="pending",v=r==="read_file",S=u?!1:C||b||r==="return_value",[j,A]=P.useState(S),N=t5[s],D=Ee(B=>B.pendingPathConfirmation),T=s==="pending"&&D&&k&&D.callId===k?D:null;return l==="compact"?o.jsxs("div",{className:"flex items-center gap-1.5 text-xs bg-bg-tertiary rounded px-2 py-1.5",children:[o.jsx(a0,{tool:r}),o.jsx("span",{className:"text-accent-primary font-medium",children:r}),o.jsx("span",{className:"text-text-muted truncate flex-1",children:Jv(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-bg-tertiary hover:bg-bg-tertiary/80 text-left",onClick:()=>A(!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:Jv(r,i)}),o.jsx("span",{className:"text-text-muted text-xs",children:j?"▼":"▶"})]}),T&&o.jsx(Q3,{confirmation:T}),(j||v)&&o.jsxs("div",{className:"p-2 bg-bg-secondary border-t border-border space-y-2 min-w-0",children:[r==="run_command"&&o.jsx(X3,{command:String(i.command??""),timeout:i.timeout??12e4,startedAt:m,streamingOutput:x,status:s,result:f,error:c,durationMs:d}),r==="edit_file"&&s==="success"&&o.jsxs(o.Fragment,{children:[g&&g.regions.length>0?o.jsx(q3,{regions:g.regions,filePath:String(i.path??"")}):o.jsx(U3,{oldString:String(i.old_string??""),newString:String(i.new_string??""),filePath:String(i.path??"")}),p&&p.length>0&&o.jsx(Qv,{diagnostics:p})]}),r==="write_file"&&s==="success"&&o.jsxs(o.Fragment,{children:[o.jsx($3,{content:String(i.content??""),filePath:String(i.path??"")}),p&&p.length>0&&o.jsx(Qv,{diagnostics:p})]}),r==="read_file"&&s==="success"&&o.jsx(K3,{result:f,metadata:_,filePath:String(i.path??""),heightExpanded:j}),r==="return_value"&&(()=>{const B=(x==null?void 0:x.map(W=>W.content).join(""))??"",H=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(Hi,{content:H})})]})})(),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:e5(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"&&c&&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:c})]})]})]})}),r5={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 i5(e){return r5[e]??`Preparing ${e}`}const s5=P.memo(function({name:r}){const i=i5(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(a0,{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,"..."]})]})})}),a5={pending:{icon:"○",color:"text-text-muted"},in_progress:{icon:"●",color:"text-accent-warning",animate:!0},completed:{icon:"✓",color:"text-accent-success"}},o5=P.memo(function({todos:r}){return Array.isArray(r)?r.length===0?o.jsx("div",{className:"text-xs text-text-muted italic my-1",children:"No tasks"}):o.jsxs("div",{className:"my-1 rounded border border-border bg-bg-tertiary overflow-hidden",children:[o.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-bg-secondary",children:o.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Tasks"})}),o.jsx("div",{children:r.map((i,s)=>{const l=a5[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:`${(l==null?void 0:l.color)??"text-text-muted"} ${l!=null&&l.animate?"animate-pulse":""} text-sm leading-tight`,children:(l==null?void 0:l.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"})}),eb={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=P.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]))??[]),l=r.find(u=>{var f,c;return u.arguments.action==="get"&&((f=u.result)==null?void 0:f.success)&&((c=u.result)==null?void 0:c.output)});return 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:"Acceptance Criteria"})}),o.jsx("div",{children:l?(()=>{const u=l.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((c,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(Hi,{content:`[${c.id}] ${c.description}`})})]},c.id??d))}catch{return r.map((f,c)=>o.jsx(tb,{tc:f,index:c,criteriaMap:s},f.id??c))}})():r.map((u,f)=>o.jsx(tb,{tc:u,index:f,criteriaMap:s},u.id??f))})]})});function tb({tc:e,index:r,criteriaMap:i}){const s=e.arguments.action,l=s&&eb[s]?eb[s]:{icon:"○",color:"text-text-muted"},u=e.arguments,f=s==="remove",c=u.id,d=u.description,p=c?i.get(c):void 0,g=d??(p==null?void 0:p.description)??(f&&c?`[${c}]`:"Criterion updated"),m=u.reason,x=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:`${l.color} text-sm leading-tight flex-shrink-0`,children:l.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:f?"line-through text-text-muted":"",children:o.jsx(Hi,{content:g})}),m&&o.jsxs("div",{className:`mt-1 text-sm ${x?"text-accent-error":"text-text-muted"}`,children:[o.jsx("span",{className:"text-text-muted",children:"└ "}),'"',m,'"']})]})]})}function l5(e){return e==="criterion"}const c5="#6b7280";function ql(e,r){var i;return((i=e.find(s=>s.id===r))==null?void 0:i.color)??c5}const kt=Kn(e=>{const r=async()=>{await jh("/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 li("POST","/api/agents",i);return s.success&&await r(),s},updateAgent:async(i,s)=>{const l=await li("PUT",`/api/agents/${i}`,s);return l.success&&await r(),l},deleteAgent:async i=>{try{const s=await ke(`/api/agents/${i}`,{method:"DELETE"}),l=await s.json();return s.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==i)})),{success:!0}):{success:!1,error:l.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"}),l=await s.json();return s.ok?(await r(),{success:!0}):{success:!1,error:l.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}});function u5(e){const r=[];let i=[];const s=()=>{i.length>0&&(r.push({type:"criteria_group",toolCalls:i}),i=[])};for(const l of e)l.type==="tool_call"&&l5(l.toolCall.name)?i.push(l.toolCall):(s(),r.push(l));return s(),r}function d5(e,r){if(e.segments&&e.segments.length>0)return h5(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 h5(e,r,i,s,l){const u=[],f=new Map(r.map(c=>[c.id,c]));for(const c of e)switch(c.type){case"text":u.push({type:"text",content:c.content});break;case"thinking":c.content&&c.content.trim().length>0&&u.push({type:"thinking",content:c.content});break;case"tool_call":{const d=f.get(c.toolCallId);d&&u.push({type:"tool_call",toolCall:d});break}}for(const c of i)u.push({type:"preparing_tool_call",preparing:c});return l&&s&&u.push({type:"stats",stats:s}),u}const hf=P.memo(function({message:r,showStats:i=!0,showThinking:s=!0,showVerboseToolOutput:l=!0}){const u=Ee(x=>{var _;return(_=x.currentSession)==null?void 0:_.criteria}),f=kt(x=>x.defaults),c=kt(x=>x.userItems),d=[...f,...c],p=d5(r,i),g=s?p:p.filter(x=>x.type!=="thinking"),m=u5(g);return m.length===0?null:o.jsx("div",{className:"feed-item",children:o.jsxs("div",{className:"min-w-0",children:[m.map((x,_)=>{var k,C;switch(x.type){case"thinking":return o.jsx(B3,{content:x.content},_);case"text":return o.jsx("div",{className:"prose prose-sm prose-invert max-w-none",children:o.jsx(Hi,{content:x.content})},_);case"preparing_tool_call":return o.jsx(s5,{name:x.preparing.name},`preparing-${x.preparing.index}`);case"tool_call":{const b=x.toolCall,v=b.result;if(b.name==="todo_write"){const j=b.arguments.todos,A=Array.isArray(j)?j:[];return o.jsx(o5,{todos:A},_)}const y=(k=v==null?void 0:v.output)==null?void 0:k.includes("[interrupted by user]"),S=v?y?"interrupted":v.success?"success":"error":"pending";return o.jsx(n5,{tool:b.name,args:b.arguments,status:S,variant:"expandable",forceCompact:!l,result:v==null?void 0:v.output,error:v==null?void 0:v.error,durationMs:v==null?void 0:v.durationMs,diagnostics:v==null?void 0:v.diagnostics,editContext:v==null?void 0:v.editContext,startedAt:b.startedAt,streamingOutput:b.streamingOutput,metadata:v==null?void 0:v.metadata,callId:b.id},_)}case"criteria_group":return o.jsx(c0,{toolCalls:x.toolCalls,criteria:u},_);case"stats":{const b=x.stats,v=((C=b.model.split("/").pop())==null?void 0:C.split("-").slice(0,2).join("-"))??b.model,y=ql(d,b.mode),S=A=>A>=1e3?`${(A/1e3).toFixed(1)}k`:A.toString(),j=A=>A>=1e3?`${(A/1e3).toFixed(1)}k`:A.toFixed(1);return o.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[10px] text-text-muted mt-3",children:[o.jsx("span",{className:"flex-1 h-px bg-border"}),o.jsx("span",{className:"text-text-secondary",children:v}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsx("span",{style:{color:y},children:b.mode}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[b.totalTime.toFixed(1),"s"]}),b.toolTime>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[b.toolTime.toFixed(1),"s tools"]})]}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[S(b.prefillTokens)," @ ",j(b.prefillSpeed)," pp"]}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[S(b.generationTokens)," @ ",j(b.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 A=new CustomEvent("open-turn-stats",{detail:{stats:b}});window.dispatchEvent(A)},children:o.jsx("svg",{className:"w-3 h-3",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"})})}),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("svg",{className:"w-2.5 h-2.5",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"})}),o.jsx("span",{children:"Aborted"})]})]})})}),Ct=Kn((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 li("POST","/api/workflows",i);return s.success&&await r().fetchWorkflows(),s},updateWorkflow:async(i,s)=>{const l=await li("PUT",`/api/workflows/${i}`,s);return l.success&&await r().fetchWorkflows(),l},deleteWorkflow:async i=>{try{const s=await ke(`/api/workflows/${i}`,{method:"DELETE"}),l=await s.json();return s.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==i)})),{success:!0}):{success:!1,error:l.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"}),l=await s.json();return s.ok?(await r().fetchWorkflows(),{success:!0}):{success:!1,error:l.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}));function Wl(e,r){const i=parseInt(e.slice(1,3),16),s=parseInt(e.slice(3,5),16),l=parseInt(e.slice(5,7),16);return`rgba(${i},${s},${l},${r})`}function f5(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 p5(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}const m5=P.memo(function({data:r}){var f;const i=Ct(c=>c.defaults),s=Ct(c=>c.userItems),u=((f=[...i,...s].find(c=>c.id===r.workflowId))==null?void 0:f.color)??r.workflowColor??"#8b949e";return o.jsxs("div",{className:"feed-item rounded p-3 border",style:{borderColor:Wl(u,.3),backgroundColor:Wl(u,.08)},children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",stroke:u,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"})}),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(Pa,{label:"Iterations",value:String(r.iterations)}),o.jsx(Pa,{label:"Total time",value:f5(r.totalTimeSeconds)}),o.jsx(Pa,{label:"Tool calls",value:String(r.totalToolCalls)}),o.jsx(Pa,{label:"Tokens",value:p5(r.totalTokensGenerated)}),o.jsx(Pa,{label:"Speed",value:r.avgGenerationSpeed>0?`${r.avgGenerationSpeed} tok/s`:"-"})]})]})});function Pa({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 g5=P.memo(function({data:r}){var f;const i=Ct(c=>c.defaults),s=Ct(c=>c.userItems),u=((f=[...i,...s].find(c=>c.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:Wl(u,.3),backgroundColor:Wl(u,.08)},children:[o.jsx("svg",{className:"w-3 h-3 shrink-0",fill:u,viewBox:"0 0 24 24",children:o.jsx("path",{d:"M8 5v14l11-7z"})}),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 x5({attachments:e,messageId:r}){const[i,s]=P.useState(null),l=Ee(g=>g.visionFallbackByMessage),u=Ee(g=>g.messages),f=P.useMemo(()=>{const g=u.findIndex(m=>m.id===r);if(g===-1)return null;for(let m=g+1;m<u.length;m++){const x=u[m];if(x&&x.role==="assistant")return x.id}return null},[u,r]),c=g=>{s(g)},d=()=>{s(null)},p=g=>{const m=`${r}-${g}`;if(l[m])return l[m];if(f){const x=`${f}-${g}`;return l[x]}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:()=>c(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(l0,{src:i,alt:"Attached image",isOpen:!0,onClose:d})]})}function v5({isOpen:e,onClose:r,promptContext:i}){const[s,l]=P.useState({systemPrompt:!1,messages:!0,tools:!0,requestOptions:!0,injectedFiles:!0,userMessage:!0}),u=f=>{l(c=>({...c,[f]:!c[f]}))};return o.jsx(jt,{isOpen:e,onClose:r,title:"Prompt Inspector",size:"lg",children:o.jsxs("div",{className:"space-y-4",children:[o.jsx(js,{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(js,{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,c)=>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}-${c}`))})}),o.jsx(js,{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,c)=>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}-${c}`))]})}),o.jsx(js,{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(js,{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,c)=>o.jsx(b5,{file:f,expanded:s[`file-${c}`]??!1,onToggle:()=>u(`file-${c}`)},c))})}),o.jsx(js,{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 b5({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("svg",{className:`w-3 h-3 text-text-muted transition-transform ${r?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),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 js({title:e,expanded:r,onToggle:i,badge:s,children:l}){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("svg",{className:`w-4 h-4 text-text-muted transition-transform ${r?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),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:l})]})}function y5({content:e,promptContext:r,align:i="right"}){const[s,l]=P.useState(!1),[u,f]=P.useState(!1),[c,d]=P.useState(!1),p=P.useRef(null);P.useEffect(()=>{const x=_=>{p.current&&!p.current.contains(_.target)&&l(!1)};return s&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[s]);const g=async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(e);else{const x=document.createElement("textarea");x.value=e,x.style.position="fixed",x.style.left="-999999px",document.body.appendChild(x),x.select(),document.execCommand("copy"),document.body.removeChild(x)}d(!0),l(!1),window.setTimeout(()=>d(!1),1500)}catch(x){console.error("Failed to copy:",x)}},m=i==="right";return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`flex items-start gap-1.5 ${m?"":"order-first"}`,children:[c&&o.jsx("svg",{className:"w-4 h-4 text-accent-success",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),o.jsxs("div",{ref:p,className:"relative",children:[o.jsx("button",{onClick:()=>l(!s),className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary",title:"Message options",children:o.jsxs("svg",{className:"w-4 h-4",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"})]})}),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("svg",{className:"w-4 h-4",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"})}),"Copy"]}),r&&o.jsxs("button",{onClick:()=>{f(!0),l(!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.jsxs("svg",{className:"w-4 h-4",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"}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"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"})]}),"Inspect"]})]})]})]}),r&&o.jsx(v5,{isOpen:u,onClose:()=>f(!1),promptContext:r})]})}function _5({message:e}){const[r,i]=P.useState(!1);if(e.messageKind!=="auto-prompt")return null;const s=e.metadata,l=(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:l},onClick:()=>!p&&i(!0)}),o.jsx("span",{className:p?"":"cursor-pointer hover:text-text-secondary transition-colors",style:{color:l},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 ${l}`},children:o.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs",children:e.content})})}),o.jsx(jt,{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:l}}),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 S5({message:e,promptContext:r}){const i=e.messageKind==="auto-prompt",s=e.messageKind==="command",l=e.isSystemGenerated;return o.jsxs("div",{className:"flex justify-end items-start gap-1.5 feed-item",children:[!l&&o.jsx(y5,{content:e.content,promptContext:r,align:"right"}),o.jsxs("div",{className:`max-w-[75%] rounded p-2 ${l?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-white"}`,children:[l&&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 ${l?`${s?"text-teal-200":i?"text-slate-200":"text-amber-200 italic"}`:""}`,children:e.content}),e.attachments&&e.attachments.length>0&&o.jsx(x5,{attachments:e.attachments,messageId:e.id})]})]})}const u0=P.memo(function({message:r,isLastAssistantMessage:i=!1,promptContext:s}){const l=r.role==="user",u=r.role==="assistant",f=r.role==="system",c=r.role==="tool";if(u)return o.jsx(hf,{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(c)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(g5,{data:d})}catch{}if(r.messageKind==="task-completed")try{const d=JSON.parse(r.content);return o.jsx(m5,{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(_5,{message:r}):l?o.jsx(S5,{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(Hi,{content:r.content})})})});function w5({stats:e,onClose:r}){var i;return o.jsx(jt,{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(Dl,{label:"Total Time",value:`${e.totalTime.toFixed(1)}s`}),o.jsx(Dl,{label:"Prefill",value:e.prefillTokens>=1e3?`${(e.prefillTokens/1e3).toFixed(1)}k`:String(e.prefillTokens)}),o.jsx(Dl,{label:"Generated",value:e.generationTokens>=1e3?`${(e.generationTokens/1e3).toFixed(1)}k`:String(e.generationTokens)}),o.jsx(Dl,{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,l)=>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 ",l+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(Ll,{label:"temp",value:s.temperature.toFixed(2)}),s.topP!==void 0&&o.jsx(Ll,{label:"topP",value:s.topP.toFixed(2)}),s.topK!==void 0&&o.jsx(Ll,{label:"topK",value:String(s.topK)}),s.maxTokens!==void 0&&o.jsx(Ll,{label:"maxTok",value:String(s.maxTokens)})]})]})]},l))]})]})})}function Dl({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 Ll({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 d0=(e,r)=>{const i=P.useRef(!0),[s,l]=P.useState(!0),u=()=>{const f=e.current;f&&(f.scrollTop=f.scrollHeight)};return P.useEffect(()=>{const f=e.current;if(!f)return;const c=g=>{if(g.deltaY>0){requestAnimationFrame(()=>requestAnimationFrame(()=>{f.scrollHeight-f.scrollTop-f.offsetHeight<100&&(i.current=!0,l(!0))}));return}i.current=!1,l(!1)},d=new MutationObserver(()=>{i.current&&requestAnimationFrame(u)}),p=setInterval(()=>{i.current&&u()},1e3);return f.addEventListener("wheel",c,{passive:!0}),d.observe(f,{childList:!0,subtree:!0,characterData:!0}),()=>{f.removeEventListener("wheel",c),d.disconnect(),clearInterval(p)}},[r==null?void 0:r.id]),{force_scroll_to_bottom:()=>{i.current=!0,l(!0),u()},isAutoScrollActive:s,setAutoScroll:f=>{i.current=f,l(f),f&&u()}}},C5={verifier:"Verification",code_reviewer:"Code Review",test_generator:"Test Generation",debugger:"Debug"};function k5(e){return{backgroundColor:`${e}20`,color:e,borderColor:`${e}4d`}}function nb(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function E5({contextState:e}){const{currentTokens:r,maxTokens:i,compactionCount:s,dangerZone:l}=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:nb(u,l),children:[zl(r),"/",zl(i)]}),o.jsxs("span",{className:nb(u,l),children:["(",u,"%)"]}),o.jsx(Fb,{percent:u,dangerZone:l,size:"sm"}),l&&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 j5=P.memo(function({messages:r,subAgentType:i,subAgentId:s,isStreaming:l}){const u=P.useRef(null),f=P.useRef(null),[c,d]=P.useState(!1),p=kt(D=>D.defaults),g=kt(D=>D.userItems),m=[...p,...g],x=Ee(D=>D.subAgentContextStates[s]),{showThinking:_,showVerboseToolOutput:k}=Sb(),{isAutoScrollActive:C,setAutoScroll:b}=d0(f,null);P.useEffect(()=>{l||b(!0)},[l]);const v=P.useCallback(()=>{const D=!c;d(D),D&&setTimeout(()=>{var T;(T=u.current)==null||T.scrollIntoView({block:"start",behavior:"smooth"})},220)},[c]),y=m.find(D=>D.id===i),S=(y==null?void 0:y.name)??C5[i]??i,j=ql(m,i),A=k5(j),N=r.filter(D=>D.role!=="tool");return o.jsxs("div",{ref:u,className:"feed-item border border-border rounded overflow-hidden bg-bg-secondary",children:[o.jsxs("div",{className:"w-full flex items-center justify-between px-2 py-1 border-b relative",style:A,children:[o.jsx("span",{className:"text-xs font-medium",children:S}),o.jsx("div",{className:"absolute left-1/2 -translate-x-1/2",children:x&&o.jsx(E5,{contextState:x})}),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:()=>b(!C),children:[o.jsx("span",{className:`w-1 h-1 rounded-full ${C?"bg-accent-success":"border border-text-muted"}`}),"live"]}),o.jsxs("button",{type:"button",className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-tertiary",onClick:v,children:[c?"▼":"▶"," Expand"]})]})]}),o.jsx("div",{ref:f,className:`${c?"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(hf,{message:D,showStats:!0,showThinking:_,showVerboseToolOutput:k},D.id):o.jsx(u0,{message:D,isLastAssistantMessage:!1},D.id))})]})});function N5(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")}function T5({agent:e,isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:l,onDuplicate:u,onDelete:f}){return o.jsxs(Tb,{isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:l,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(c=>o.jsx("span",{className:"text-[10px] font-mono text-text-muted bg-bg-primary px-1 py-0.5 rounded",children:c},c)),e.allowedTools.length>5&&o.jsxs("span",{className:"text-[10px] text-text-muted",children:["+",e.allowedTools.length-5," more"]})]})]})}function rb({title:e,agents:r,subagents:i,isBuiltIn:s,onView:l,onDuplicate:u,onEdit:f,onDelete:c}){if(r.length===0&&i.length===0)return null;const d=p=>o.jsx(T5,{agent:p,isBuiltIn:s,isConfirmingDelete:!1,onView:()=>l(p.id),onEdit:s?void 0:()=>f==null?void 0:f(p.id),onDuplicate:()=>u(p.id),onDelete:s?void 0:()=>c==null?void 0:c(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 A5({isOpen:e,onClose:r,initialEditId:i}){const s=kt(fe=>fe.defaults),l=kt(fe=>fe.userItems),u=kt(fe=>fe.loading),f=kt(fe=>fe.fetchAgents),c=kt(fe=>fe.fetchAgent),d=kt(fe=>fe.fetchDefaultContent),p=kt(fe=>fe.createAgent),g=kt(fe=>fe.updateAgent),m=kt(fe=>fe.deleteAgent),[x,_]=P.useState("list"),[k,C]=P.useState(null),[b,v]=P.useState(!1),[y,S]=P.useState(""),[j,A]=P.useState(""),[N,D]=P.useState(""),[T,B]=P.useState(!0),[H,W]=P.useState([]),[K,q]=P.useState("#6b7280"),[R,U]=P.useState(""),[M,Y]=P.useState(""),[Z,z]=P.useState(!1),[L,I]=P.useState([]);function V(fe){const Ae=new Map;for(const Be of fe){const ot=Be.indexOf(":");if(ot===-1)Ae.set(Be,new Set);else{const ue=Be.slice(0,ot),je=Be.slice(ot+1).split(",").filter(Boolean);Ae.set(ue,new Set(je))}}return Ae}function F(fe){const Ae=[];for(const[Be,ot]of fe)ot.size===0?Ae.push(Be):Ae.push(`${Be}:${[...ot].join(",")}`);return Ae}const ie=V(H),Q=(fe,Ae)=>{const Be=new Map(ie),ot=Be.get(fe)||new Set,ue=new Set(ot);ue.has(Ae)?ue.delete(Ae):ue.add(Ae),ue.size===0?Be.set(fe,new Set):Be.set(fe,ue),W(F(Be))},ee=fe=>{const Ae=new Map(ie);Ae.has(fe)?Ae.delete(fe):Ae.set(fe,new Set),W(F(Ae))},X=fe=>{S(fe.metadata.name),A(fe.metadata.id),D(fe.metadata.description),B(fe.metadata.subagent),W(fe.metadata.allowedTools),q(fe.metadata.color??"#6b7280"),U(fe.prompt),Y("")},$=(fe,Ae,Be)=>{S(fe.metadata.name+" (copy)"),A(`${Ae}-copy-${Date.now()}`),D(fe.metadata.description),B(fe.metadata.subagent),W(fe.metadata.allowedTools),q(fe.metadata.color??"#6b7280"),U(fe.prompt),Y(""),C(null),v(!1),_("edit")},oe=(fe,Ae)=>{X(fe),C(Ae),v(!0),_("edit")};P.useEffect(()=>{e&&(f(),ke("/api/tools").then(fe=>fe.json()).then(fe=>I(fe.tools||[])).catch(()=>I([])),i?s.some(Ae=>Ae.id===i)?d(i).then(Ae=>{Ae&&$(Ae,i)}):c(i).then(Ae=>{Ae&&(X(Ae),C(i),v(!1),_("edit"))}):(_("list"),C(null),v(!1)))},[e,f,c,d,i]);const re=async fe=>{if(s.some(Be=>Be.id===fe)){const Be=await d(fe);if(!Be)return;oe(Be,fe)}else{const Be=await c(fe);if(!Be)return;oe(Be,fe)}},ve=async fe=>{const Ae=await d(fe);Ae&&$(Ae,fe)},be=()=>{C(null),S(""),A(""),D(""),B(!0),W(["read_file"]),q("#6b7280"),U(""),Y(""),v(!1),_("edit")},Le=async fe=>{const Ae=await c(fe);Ae&&(X(Ae),C(fe),v(!1),_("edit"))},Oe=async fe=>{await m(fe)},He=async()=>{const fe=k??j;if(!fe||!y||!R){Y("Name and prompt are required.");return}z(!0),Y("");const Ae={metadata:{id:fe,name:y,description:N,subagent:T,allowedTools:H,color:K},prompt:R},Be=k?await g(k,Ae):await p(Ae);if(z(!1),!Be.success){Y(Be.error??"Failed to save agent.");return}i?r():_("list")},Ue=()=>{i?r():(_("list"),v(!1))},Ne=fe=>{S(fe),k||A(N5(fe))},me=s.filter(fe=>fe.subagent),Te=s.filter(fe=>!fe.subagent),$e=l.filter(fe=>fe.subagent),Rt=l.filter(fe=>!fe.subagent);return x==="edit"?o.jsx(jt,{isOpen:e,onClose:Ue,title:b?`${y}`: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:[M&&o.jsx(Dh,{message:M}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Li,{label:"Name",value:y,onChange:Ne,placeholder:"My Agent",readOnly:b}),o.jsx(Li,{label:"ID",value:j,onChange:A,readOnly:!0,placeholder:"my_agent",hint:"(read-only)",mono:!0})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Li,{label:"Description",value:N,onChange:D,placeholder:"What this agent does",readOnly:b}),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:()=>!b&&B(!0),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${T?"bg-accent-primary/25 text-accent-primary":"bg-bg-tertiary text-text-muted hover:text-text-secondary"} ${b?"pointer-events-none opacity-60":""}`,children:"Sub-agent"}),o.jsx("button",{onClick:()=>!b&&B(!1),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${T?"bg-bg-tertiary text-text-muted hover:text-text-secondary":"bg-accent-primary/25 text-accent-primary"} ${b?"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:K,onChange:fe=>!b&&q(fe.target.value),disabled:b,className:"w-6 h-6 rounded cursor-pointer border border-border bg-transparent"})]})]})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Tools"}),o.jsx("div",{className:"flex flex-wrap gap-1.5 p-2 bg-bg-tertiary border border-border rounded max-h-32 overflow-y-auto",children:L.map(fe=>{const Ae=ie.has(fe.name),Be=fe.actions.length>0,ot=ie.get(fe.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 ${Ae?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted"}`,children:[o.jsx("span",{children:fe.name}),Be&&o.jsx("span",{className:`text-[10px] ${Ae&&ot.size>0?"text-accent-primary":"text-text-muted"}`,children:"*"})]},fe.name);return Be?b?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:fe.name}),o.jsx("span",{className:"text-[10px]",children:"*"})]},fe.name):o.jsx(so,{trigger:ue,minWidth:"160px",items:[...fe.actions.map(Se=>({label:o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",htmlFor:`${fe.name}-${Se}`,children:[o.jsx("input",{type:"checkbox",id:`${fe.name}-${Se}`,checked:ot.has(Se),onChange:()=>Q(fe.name,Se),disabled:b,className:"w-3 h-3 rounded accent-accent-primary"}),o.jsx("span",{children:Se})]}),closeOnClick:!1})),{label:Ae?"Deselect all":"Select all",closeOnClick:!1,onClick:()=>{if(Ae)ee(fe.name);else{const Se=new Map(ie);Se.set(fe.name,new Set(fe.actions)),W(F(Se))}}}]},fe.name):o.jsx("button",{onClick:()=>!b&&ee(fe.name),className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${Ae?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted hover:text-text-secondary"} ${b?"pointer-events-none":"cursor-pointer"}`,children:o.jsx("span",{children:fe.name})},fe.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:R,onChange:fe=>!b&&U(fe.target.value),readOnly:b,placeholder:"Instructions for this agent...",className:`flex-1 w-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 ${b?"opacity-60":""}`})]}),o.jsx(QS,{onCancel:Ue,onSave:He,saving:Z,saveDisabled:!y||!R||b}),b&&o.jsx("div",{className:"flex justify-end mt-2",children:o.jsx(tt,{variant:"primary",onClick:()=>{S(y+" (copy)"),A(`${k}-copy-${Date.now()}`),C(null),v(!1)},children:"Duplicate & Customize"})})]})}):o.jsxs(jt,{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(tt,{variant:"primary",size:"sm",onClick:be,children:"+ New"})})]}),u&&s.length===0&&l.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"Loading agents..."}):s.length===0&&l.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(rb,{title:"Built-in",agents:Te,subagents:me,isBuiltIn:!0,onView:re,onDuplicate:ve}),l.length>0&&o.jsx(rb,{title:"Custom",agents:Rt,subagents:$e,isBuiltIn:!1,onView:re,onDuplicate:ve,onEdit:Le,onDelete:Oe})]})]})}function D5(){const e=Ee(v=>{var y;return(y=v.currentSession)==null?void 0:y.mode}),r=Ee(v=>v.switchMode),i=kt(v=>v.defaults),s=kt(v=>v.userItems),l=kt(v=>v.fetchAgents),u=[...i,...s],[f,c]=P.useState(!1),[d,p]=P.useState(!1),[g,m]=P.useState(null),x=P.useRef(null);if(P.useEffect(()=>{l()},[l]),P.useEffect(()=>{function v(y){x.current&&!x.current.contains(y.target)&&c(!1)}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[]),!e)return null;const _=u.filter(v=>!v.subagent),k=_.find(v=>v.id===e),C=(k==null?void 0:k.name)??e,b=ql(u,e);return o.jsxs("div",{className:"relative",ref:x,children:[o.jsxs("button",{type:"button",onClick:()=>c(!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:b},children:C}),o.jsx("svg",{className:`w-3 h-3 text-text-muted transition-transform ${f?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),f&&_.length>0&&o.jsxs("div",{className:"absolute bottom-full left-0 mb-1 w-56 bg-bg-secondary border border-border rounded-lg shadow-lg overflow-hidden z-50",children:[_.map((v,y)=>{const S=v.id===e,j=ql(u,v.id),A=y<4?`Ctrl+${y+1}`:null;return o.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 text-sm transition-colors group ${S?"bg-bg-tertiary":"hover:bg-bg-tertiary cursor-pointer"}`,children:[o.jsxs("button",{type:"button",onClick:()=>{S||r(v.id),c(!1)},className:"flex-1 text-left flex items-center gap-2 min-w-0",children:[o.jsx("span",{className:"font-medium truncate",style:{color:j},children:v.name}),S&&o.jsx("svg",{className:"w-3.5 h-3.5 text-text-muted shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]}),A&&o.jsxs("span",{className:"shrink-0 px-1.5 py-0.5 text-[10px] bg-bg-tertiary text-text-muted rounded",children:["Ctrl+",y+1]})]},v.id)}),o.jsx("div",{className:"border-t border-border p-1",children:o.jsx("button",{type:"button",onClick:()=>{c(!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(A5,{isOpen:d,onClose:()=>{p(!1),m(null)},initialEditId:g})]})}function L5(){const e=Ee(s=>s.currentSession),r=Ee(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 R5({question:e}){const r=Ee(f=>f.answerQuestion),[i,s]=P.useState(""),l=()=>{r(e.callId,i)},u=f=>{f.key==="Enter"&&!f.shiftKey&&(f.preventDefault(),l())};return o.jsx(jt,{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(tt,{variant:"secondary",size:"sm",onClick:()=>r(e.callId,""),children:"Skip"}),o.jsx(tt,{variant:"primary",size:"sm",onClick:l,children:"Send Answer"})]})]})})}function O5(){const e=Ee(s=>s.connectionStatus),r=Ee(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("svg",{className:"w-4 h-4",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"})}),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=WS(),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 I5({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(Xa,{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 B5({history:e,selectedIndex:r,onSelect:i,onEscape:s,onNavigate:l}){const u=P.useRef(null),f=P.useRef(null);P.useEffect(()=>{f.current&&u.current&&f.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[r]);const c=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(),l("up");break;case"ArrowDown":p.preventDefault(),l("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:c,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 on=Kn((e,r)=>({defaults:[],userItems:[],loading:!1,fetchCommands:async()=>{await jh("/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 li("POST","/api/commands",i);return s.success&&await r().fetchCommands(),s},updateCommand:async(i,s)=>{const l=await li("PUT",`/api/commands/${i}`,s);return l.success&&await r().fetchCommands(),l},deleteCommand:async i=>{try{const s=await ke(`/api/commands/${i}`,{method:"DELETE"}),l=await s.json();return s.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==i)})),{success:!0}):{success:!1,error:l.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"}),l=await s.json();return s.ok?(await r().fetchCommands(),{success:!0}):{success:!1,error:l.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}})),z5={maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576};async function H5(e,r={}){const i={...z5,...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 l=await e.arrayBuffer(),u=G5(l),f=`data:${e.type};base64,${u}`,c=await h0(f);return{dataUrl:f,mimeType:e.type,size:e.size,width:c.width,height:c.height}}return await P5(e,i)}async function P5(e,r){const i=await U5(e),s=await h0(i),{width:l,height:u}=F5(s.width,s.height,r.maxWidth,r.maxHeight),f=$5();f.width=l,f.height=u;const c=f.getContext("2d");if(!c)throw new Error("Failed to get canvas context");c.imageSmoothingEnabled=!0,c.imageSmoothingQuality="high",c.drawImage(s,0,0,l,u);let d=r.quality,p;do{if(p=f.toDataURL(e.type.startsWith("image/gif")?"image/png":e.type,d),ib(p)<=r.maxSizeBytes||d<=.3)break;d-=.1}while(!0);const g=ib(p);return{dataUrl:p,mimeType:e.type.startsWith("image/gif")?"image/png":e.type,size:g,width:l,height:u}}function F5(e,r,i,s){const l=e/r;return e>r&&e>i?{width:i,height:Math.round(i/l)}:r>e&&r>s?{width:Math.round(s*l),height:s}:{width:e,height:r}}function U5(e){return new Promise((r,i)=>{const s=W5(),l=new s;l.onload=()=>r(l.result),l.onerror=()=>i(new Error("Failed to read file")),l.readAsDataURL(e)})}function h0(e){return new Promise((r,i)=>{const s=q5(),l=new s;l.onload=()=>r(l),l.onerror=()=>i(new Error("Failed to load image")),l.src=e})}function $5(){var r;const e=ff();if(!((r=e.document)!=null&&r.createElement))throw new Error("Image compression requires browser canvas APIs");return e.document.createElement("canvas")}function q5(){const e=ff();if(!e.Image)throw new Error("Image compression requires browser image APIs");return e.Image}function W5(){const e=ff();if(!e.FileReader)throw new Error("Image compression requires browser file APIs");return e.FileReader}function ff(){return globalThis}function G5(e){const r=new Uint8Array(e);let i="";for(let s=0;s<r.byteLength;s++){const l=r[s];l!==void 0&&(i+=String.fromCharCode(l))}return btoa(i)}function ib(e){const i=e.split(",")[1];return i?Math.round(i.length*3/4):0}function V5(e){return["image/png","image/jpeg","image/gif"].includes(e.type)}function K5(e,r=50*1024*1024){return e.size>r?{valid:!1,error:`Image file is too large (${sb(e.size)}). Maximum size is ${sb(r)}.`}:{valid:!0}}function sb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function eh(e,r,i,s={}){const{maxSizeBytes:l=50*1024*1024,filename:u}=s;if(!V5(e)){i(`Unsupported file type: ${e.type}. Only PNG, JPG, and GIF are supported.`);return}const f=K5(e,l);if(!f.valid){i(f.error??"Image file is too large");return}try{const c=await H5(e,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),d={id:yb(),filename:u??e.name,mimeType:c.mimeType,size:c.size,data:c.dataUrl};r(d)}catch(c){const d=c instanceof Error?c.message??"Failed to process image":"Failed to process image";i(d)}}function Y5(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 th(e){return{contextWindow:e.contextWindow,temperature:e.temperature??null,topP:e.topP??null,topK:e.topK??null,maxTokens:e.maxTokens??null}}function X5({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 Fa({label:e,value:r,onChange:i,min:s,max:l,step:u=1,helpText:f,defaultValue:c}){const[d,p]=P.useState((r==null?void 0:r.toString())??""),[g,m]=P.useState(r===null);P.useEffect(()=>{p((r==null?void 0:r.toString())??""),m(r===null)},[r]);const x=k=>{if(p(k),k==="")i(null);else{const C=parseFloat(k);isNaN(C)||i(C)}},_=()=>{g?(m(!1),c!==void 0&&(p(c.toString()),i(c))):(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:l,step:u,value:d,readOnly:g,onChange:k=>x(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 Z5({isOpen:e,onClose:r,providerId:i,model:s}){const[l,u]=P.useState(()=>th(s)),[f,c]=P.useState(!1),d=At(m=>m.updateModelSettings);P.useEffect(()=>{u(th(s))},[s]);const p=async()=>{if(l.contextWindow<1024||l.contextWindow>1e7)return;c(!0);const m=l.temperature!==(s.temperature??null)||l.topP!==(s.topP??null)||l.topK!==(s.topK??null)||l.maxTokens!==(s.maxTokens??null);await d(i,s.id,{contextWindow:l.contextWindow,...m&&{temperature:l.temperature,topP:l.topP,topK:l.topK,maxTokens:l.maxTokens}}),c(!1),r()},g=()=>{u(th(s)),r()};return e?o.jsx(jt,{isOpen:e,onClose:r,title:"Model Properties",size:"sm",footer:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(tt,{variant:"secondary",onClick:g,disabled:f,children:"Cancel"}),o.jsx(tt,{variant:"primary",onClick:p,disabled:f||l.contextWindow<1024||l.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(Fa,{label:"Context Window",value:l.contextWindow,onChange:m=>m!==null&&u(x=>({...x,contextWindow:m})),min:1024,max:1e7,helpText:"Range: 1,024 - 10,000,000 tokens"}),o.jsxs(X5,{label:"Sampling Parameters",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Fa,{label:"Temperature",value:l.temperature,onChange:m=>u(x=>({...x,temperature:m})),min:0,max:2,step:.1,helpText:"0.0 - 2.0",defaultValue:1}),o.jsx(Fa,{label:"Top P",value:l.topP,onChange:m=>u(x=>({...x,topP:m})),min:0,max:1,step:.05,helpText:"0.0 - 1.0",defaultValue:1})]}),o.jsx(Fa,{label:"Top K",value:l.topK,onChange:m=>u(x=>({...x,topK:m})),min:1,max:200,helpText:"1 - 200 (leave as default if not supported)"})]}),o.jsx(Fa,{label:"Max Tokens",value:l.maxTokens,onChange:m=>u(x=>({...x,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 Q5(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function J5(){var U;const[,e]=ur(),r=Ee(M=>M.currentSession),i=Ee(M=>M.setSessionProvider),[s,l]=P.useState(!1),[u,f]=P.useState([]),[c,d]=P.useState(null),p=P.useRef(null),[g,m]=P.useState(null),x=P.useRef(new Set),_=At(M=>M.providers),k=At(M=>M.activeProviderId),C=At(M=>M.model);At(M=>M.backend);const b=At(M=>M.llmStatus),v=At(M=>M.activating),y=At(M=>M.activateProvider),S=At(M=>M.refreshModel),j=At(M=>M.refreshProviderModels);P.useEffect(()=>{function M(Y){p.current&&!p.current.contains(Y.target)&&(l(!1),f([]),x.current=new Set)}return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[]),P.useEffect(()=>{if(s){const M=_.map(Y=>Y.id);f(M),M.forEach(Y=>{x.current.has(Y)||(x.current.add(Y),D(Y))})}},[s,_]),_.find(M=>M.id===k);const A=b==="disconnected",N=C?((U=C.split("/").pop())==null?void 0:U.replace(/-/g," "))??C:"detecting...",D=async M=>{d(M);try{await j(M)}catch{}finally{d(null)}},T=M=>{u.includes(M.id)?f(u.filter(Y=>Y!==M.id)):(f([...u,M.id]),D(M.id))},B=async M=>{if(M.id===k){T(M);return}r?(i(M.id,void 0),At.getState().syncFromSession(M.id,""),l(!1),f([])):await y(M.id)&&(l(!1),f([]))},H=M=>{T(M)},W=async(M,Y)=>{M.stopPropagation(),x.current.delete(Y),await j(Y),await D(Y)},K=(M,Y)=>{m({providerId:M,model:Y})},q=()=>{m(null)},R=async(M,Y)=>{if(console.log("[ProviderSelector.handleModelClick] providerId:",M,"model:",Y),r){console.log("[ProviderSelector.handleModelClick] Calling setSessionProvider"),i(M,Y),At.getState().syncFromSession(M,Y),f([]),l(!1);return}d("activating");try{(await ke(`/api/providers/${M}/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:Y})})).ok&&(await At.getState().fetchConfig(),f([]),l(!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:A?"LLM server is offline. Click to retry.":C??"Click to refresh model",children:[A?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:()=>l(!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:[A?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("svg",{className:`w-3 h-3 text-text-muted transition-transform ${s?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),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(M=>{var Y;return o.jsxs("div",{children:[o.jsxs("div",{className:`px-3 py-2 flex items-center justify-between ${M.id===k?"bg-bg-tertiary":"hover:bg-bg-tertiary"} ${v?"opacity-50 cursor-wait":"cursor-pointer"}`,children:[o.jsxs("div",{onClick:()=>!v&&B(M),className:"flex flex-col min-w-0 flex-1 cursor-pointer",children:[o.jsx("span",{className:`text-sm font-medium truncate ${M.id===k?"text-accent-primary":"text-text-primary"}`,children:M.name}),o.jsx("span",{className:"text-xs text-text-muted truncate",children:M.backend!=="auto"&&ES(M.backend)})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[M.id===k?o.jsx("span",{className:"text-accent-success",title:"Active",children:o.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})}):o.jsx("span",{className:"w-4"}),o.jsx("button",{type:"button",onClick:Z=>{Z.stopPropagation(),W(Z,M.id)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Refresh models",children:o.jsx("svg",{className:`w-4 h-4 ${c===M.id?"animate-spin":""} ${M.id===k?"text-accent-primary":"text-text-muted"}`,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"})})}),o.jsx("button",{type:"button",onClick:Z=>{Z.stopPropagation(),H(M)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Show models",children:o.jsx("svg",{className:`w-4 h-4 transition-transform ${u.includes(M.id)?"rotate-180":""} ${M.id===k?"text-accent-primary":"text-text-muted"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]})]}),u.includes(M.id)&&o.jsx("div",{className:"bg-bg-primary border-t border-border",children:c===M.id?o.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"Loading models..."}):(Y=M.models)!=null&&Y.length?M.models.map(Z=>{var z;return o.jsxs("button",{type:"button",onClick:()=>R(M.id,Z.id),disabled:c==="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 ${c==="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:Q5(Z.contextWindow)}),o.jsx("button",{type:"button",onClick:L=>{L.stopPropagation(),K(M.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("svg",{className:"w-3 h-3 text-text-muted",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"})})})]}),C===Z.id&&o.jsx("span",{className:"text-accent-success flex-shrink-0 ml-1",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})})]},Z.id)}):o.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"No models available"})})]},M.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(Z5,{isOpen:!0,onClose:q,providerId:g.providerId,model:g.model})]})}function eA(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}const tA="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 nA({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("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:tA})})})}function f0({isOpen:e,onClose:r,initialEditId:i}){const s=on(me=>me.defaults),l=on(me=>me.userItems),u=on(me=>me.loading),f=on(me=>me.fetchCommands),c=on(me=>me.fetchCommand),d=on(me=>me.fetchDefaultContent),p=on(me=>me.createCommand),g=on(me=>me.updateCommand),m=on(me=>me.deleteCommand),[x,_]=P.useState(null),[k,C]=P.useState(null),{view:b,editingId:v,formError:y,saving:S,formData:j,setView:A,setEditingId:N,setFormError:D,setFormData:T,setSaving:B}=Lb(),{requestDelete:H,clearConfirm:W,isConfirming:K}=Nh(),q=P.useRef(!1),R=kt(me=>me.defaults),U=kt(me=>me.userItems),M=kt(me=>me.fetchAgents),Z=[...R,...U].filter(me=>!me.subagent),z=P.useRef(f),L=P.useRef(M),I=P.useRef(c),V=P.useRef(d),F=P.useRef(i),ie=P.useRef(A),Q=P.useRef(N),ee=P.useRef(D),X=P.useRef(W);P.useEffect(()=>{z.current=f,L.current=M,I.current=c,V.current=d,F.current=i,ie.current=A,Q.current=N,ee.current=D,X.current=W}),P.useEffect(()=>{if(e)if(z.current(),L.current(),q.current||(X.current(),q.current=!0),F.current){const me=s.some(Te=>Te.id===F.current);ie.current("edit"),Q.current(F.current),ee.current(""),me?V.current(F.current).then(Te=>{Te&&T({name:Te.metadata.name+" (copy)",id:`${F.current}-copy-${Date.now()}`,prompt:Te.prompt,agentMode:Te.metadata.agentMode??"",isDefault:!0})}):I.current(F.current).then(Te=>{Te&&T({name:Te.metadata.name,id:Te.metadata.id,prompt:Te.prompt,agentMode:Te.metadata.agentMode??"",isDefault:!1})})}else ie.current("list"),Q.current(null);else q.current=!1},[e]);const $=async me=>{_(me);const Te=await d(me);C((Te==null?void 0:Te.prompt)??null)},oe=async me=>{if(s.some($e=>$e.id===me)){const $e=await d(me);$e&&(N(null),T({name:`${$e.metadata.name} (copy)`,id:`${me}-copy-${Date.now()}`,prompt:$e.prompt,agentMode:$e.metadata.agentMode??"",isDefault:!0}),D(""),A("edit"))}else{const $e=await c(me);$e&&(N(null),T({name:`${$e.metadata.name} (copy)`,id:`${me}-copy-${Date.now()}`,prompt:$e.prompt,agentMode:$e.metadata.agentMode??"",isDefault:!1}),D(""),A("edit"))}},re=()=>{T({name:"",id:"",prompt:"",agentMode:"",isDefault:!1}),N(null),A("edit")},ve=async me=>{const Te=await c(me);Te&&(N(me),T({name:Te.metadata.name,id:Te.metadata.id,prompt:Te.prompt,agentMode:Te.metadata.agentMode??"",isDefault:!1}),D(""),A("edit"))},be=async me=>{await m(me),W()},Le=async()=>{const me=v??j.id;if(!me||!j.name||!j.prompt){D("Name and message are required.");return}B(!0),D("");const Te={metadata:{id:me,name:j.name,...j.agentMode?{agentMode:j.agentMode}:{}},prompt:j.prompt},$e=v?await g(v,Te):await p(Te);if(B(!1),!$e.success){D($e.error??"Failed to save command.");return}i?r():A("list")},Oe=()=>{i?r():(A("list"),_(null),C(null))},He=me=>{T(Te=>({...Te,name:me})),(!v||j.isDefault)&&T(Te=>({...Te,id:eA(me)}))},Ue=()=>{_(null),C(null),A("list")},Ne=()=>{x&&(_(null),A("edit"),N(x),d(x).then(me=>{me&&T({name:`${me.metadata.name} (copy)`,id:`${x}-copy-${Date.now()}`,prompt:me.prompt,agentMode:me.metadata.agentMode??"",isDefault:!0})}))};if(x){const me=s.find(Te=>Te.id===x);return o.jsx(jt,{isOpen:e,onClose:Ue,title:`Default: ${(me==null?void 0:me.name)??x}`,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:x})]}),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:me==null?void 0:me.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:(me==null?void 0:me.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(tt,{variant:"secondary",onClick:Ue,children:"Close"}),o.jsx(tt,{variant:"primary",onClick:Ne,children:"Duplicate & Customize"})]})]})})}return b==="edit"?o.jsx(jt,{isOpen:e,onClose:Oe,title:v?"Edit Command":"New Command",size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[y&&o.jsx(Dh,{message:y}),o.jsxs("div",{className:"space-y-3 mb-3",children:[o.jsx(Db,{name:j.name,id:j.id,nameLabel:"Name",idLabel:"ID",namePlaceholder:"My Command",idPlaceholder:"my-command",readOnlyId:!!v&&!j.isDefault,onNameChange:He,onIdChange:me=>T(Te=>({...Te,id:me}))}),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:me=>T(Te=>({...Te,agentMode:me.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(me=>o.jsx("option",{value:me.id,children:me.name},me.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:me=>T(Te=>({...Te,prompt:me.target.value})),placeholder:"The message that will be sent when this command is triggered...",className:"flex-1 w-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"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border flex-shrink-0",children:[o.jsx(tt,{variant:"secondary",onClick:Oe,children:"Cancel"}),o.jsx(tt,{variant:"primary",onClick:Le,disabled:S||!j.name||!j.prompt,children:S?"Saving...":"Save"})]})]})}):o.jsxs(jt,{isOpen:e,onClose:r,title:"Commands",size:"lg",children:[o.jsx(Nb,{description:"Commands are pre-defined messages you can send with a single click.",onNew:re}),o.jsxs(Ab,{loading:u,hasItems:s.length>0||l.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(me=>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:me.name})}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx(nA,{onClick:()=>$(me.id)}),o.jsx(Ya,{onClick:()=>oe(me.id)})]})]},me.id))})]}),l.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:l.map(me=>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:me.name})})}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx(Is,{onClick:()=>ve(me.id)}),o.jsx(Ya,{onClick:()=>oe(me.id)}),K(me.id,"delete")?o.jsx(Th,{onConfirm:()=>be(me.id),onCancel:W}):o.jsx(Ah,{onClick:()=>H(me.id)})]})]},me.id))})]})]})]})}function p0({items:e,isOpen:r,onOpen:i,onClose:s,filterFn:l}){const[u,f]=P.useState(""),[c,d]=P.useState(0),p=P.useRef(null),g=P.useRef(null);P.useEffect(()=>{r&&(f(""),d(0),requestAnimationFrame(()=>{var b;return(b=g.current)==null?void 0:b.focus()}))},[r]),P.useEffect(()=>{if(!r)return;const b=v=>{p.current&&!p.current.contains(v.target)&&s()};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[r,s]);const m=P.useCallback(()=>{r?s():i()},[r,i,s]),x=P.useCallback(b=>{f(b),d(0)},[]),_=P.useCallback(b=>{const v=e.filter(y=>l(y,u));switch(b.key){case"ArrowDown":b.preventDefault(),d(y=>Math.min(y+1,v.length-1));break;case"ArrowUp":b.preventDefault(),d(y=>Math.max(y-1,0));break;case"Enter":b.preventDefault();break;case"Escape":b.preventDefault(),s();break}},[e,u,l,s]),k=P.useCallback(()=>{d(0)},[]),C=e.filter(b=>l(b,u));return{isOpen:r,search:u,selectedIndex:c,filtered:C,containerRef:p,searchRef:g,handleToggle:m,handleSearchChange:x,handleKeyDown:_,setSelectedIndex:d,resetSelection:k}}function m0({label:e,isOpen:r,onClick:i,className:s=""}){return o.jsxs("button",{type:"button",onClick:i,className:`flex items-center gap-1 text-sm text-text-muted hover:text-text-primary transition-colors ${s}`,children:[e,o.jsx("svg",{className:`w-3 h-3 transition-transform ${r?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]})}function g0({value:e,onChange:r,onKeyDown:i,ref:s,placeholder:l}){return o.jsx("div",{className:"p-2 border-b border-border",children:o.jsx("input",{ref:s,value:e,onChange:u=>r(u.target.value),onKeyDown:i,placeholder:l,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"})})}function x0({children:e,maxHeight:r="max-h-64"}){return o.jsx("div",{className:`overflow-y-auto ${r} p-1`,children:e})}function v0({hasItems:e,message:r}){return o.jsx("div",{className:"px-3 py-2 text-text-muted text-sm",children:e?"No matches":r})}function b0({label:e,onClick:r}){return o.jsx("div",{className:"border-t border-border p-1",children:o.jsx("button",{type:"button",onClick:r,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:e})})}function rA({onSendCommand:e,onOpenManager:r,textareaContent:i,attachments:s}){const[l,u]=P.useState(!1),[f,c]=P.useState(null),d=on(D=>D.defaults),p=on(D=>D.userItems),g=on(D=>D.fetchCommands),m=[...d,...p],{isOpen:x,search:_,selectedIndex:k,filtered:C,containerRef:b,searchRef:v,handleToggle:y,handleSearchChange:S,handleKeyDown:j}=p0({items:m,isOpen:l,onOpen:()=>u(!0),onClose:()=>u(!1),filterFn:(D,T)=>!T||D.name.toLowerCase().includes(T.toLowerCase())});P.useEffect(()=>{l&&g()},[l,g]);const A=async D=>{const T=await on.getState().fetchCommand(D);T&&e(T.prompt,T.metadata.agentMode,i,s),u(!1)},N=()=>{u(!1),r()};return o.jsxs("div",{ref:b,className:"relative",children:[o.jsx(m0,{label:"Commands",isOpen:x,onClick:y}),x&&o.jsxs("div",{className:"absolute bottom-full right-0 mb-1 w-72 bg-bg-secondary border border-border rounded-lg shadow-xl z-50",onKeyDown:j,children:[o.jsx(g0,{value:_,onChange:S,onKeyDown:j,ref:v,placeholder:"Search commands..."}),o.jsx(x0,{children:C.length===0?o.jsx(v0,{hasItems:m.length>0,message:"No commands yet"}):C.map((D,T)=>o.jsxs("div",{className:`flex items-center gap-1 px-3 py-2 rounded transition-colors group ${T===k?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[o.jsx("button",{type:"button",onClick:()=>A(D.id),className:"flex-1 text-left",children:o.jsx("div",{className:"text-sm text-text-primary font-medium",children:D.name})}),o.jsx(Is,{className:"opacity-0 group-hover:opacity-100",onClick:B=>{B.stopPropagation(),u(!1),c(D.id)}})]},D.id))}),o.jsx(b0,{label:"Manage Commands...",onClick:N})]}),o.jsx(f0,{isOpen:!!f,onClose:()=>c(null),initialEditId:f})]})}function iA(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function sA(e){let r=1;for(;e.some(i=>i.id===`s${r}`);)r++;return`s${r}`}const aA=[{value:"agent",label:"Agent"},{value:"sub_agent",label:"Sub-Agent"},{value:"shell",label:"Shell"}],y0={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"},_0=[{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)"}],Ti=150,Lr=54,Ns=80,Rn=30,Ts=70,ab=100,Ai=50,Rl=50,ob=4;function pf(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 oA(e,r,i,s){const l=Rl+Ai+Ti+ab+Ti+Ai+Rl,u=l/2,f=Rl+Ai+Ti/2,c=Rl+Ai+Ti+ab+Ti/2,d=[],p=[],g=new Map,m=e.filter(R=>R.type==="agent"||R.type==="shell"),x=e.filter(R=>R.type==="sub_agent"),_=x.length>0,k=_?f:u,C=m.length>0?c:u,b=Ai+Rn/2;if(d.push({id:"$start",type:"terminal",label:"Start",cx:k,cy:b,w:Ns,h:Rn}),g.set("$start",{cx:k,cy:b,w:Ns,h:Rn}),e.length===0){const R=b+Rn/2+Ts*2+Rn/2;return d.push({id:"$done",type:"terminal",label:"Done",cx:k,cy:R,w:Ns,h:Rn}),g.set("$done",{cx:k,cy:R,w:Ns,h:Rn}),{nodes:d,edges:p,width:l,height:R+Rn/2+Ai,posMap:g}}const v=b+Rn/2+Ts,y=(R,U)=>{R.forEach((M,Y)=>{const Z=v+Y*(Lr+Ts)+Lr/2,{name:z,color:L}=pf(M,s);d.push({id:M.id,type:"step",label:z,color:L,cx:U,cy:Z,w:Ti,h:Lr}),g.set(M.id,{cx:U,cy:Z,w:Ti,h:Lr})})};y(m,k),y(x,C);const S=m.length>0?v+(m.length-1)*(Lr+Ts)+Lr/2:b,j=_?v+(x.length-1)*(Lr+Ts)+Lr/2:b,A=Math.max(S,j)+Lr/2+Ts+Rn/2;d.push({id:"$done",type:"terminal",label:"Done",cx:k,cy:A,w:Ns,h:Rn}),g.set("$done",{cx:k,cy:A,w:Ns,h:Rn});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 R of e)R.transitions.forEach((U,M)=>{if(!U.goto||!g.has(U.goto))return;const Y=g.get(R.id),Z=g.get(U.goto),z=U.when.type==="step_result"?`${U.when.result}`:y0[U.when.type]??U.when.type,L=R.id===U.goto;let I;L?I="back":Z.cy>Y.cy+1?I="down":Z.cy<Y.cy-1?I="back":I="same",N.push({from:R.id,to:U.goto,label:z,edgeKey:`${R.id}:${M}`,direction:I,backEdgeIndex:I==="back"?D++:0})});const T=new Map,B=new Map,H=new Map,W=new Map;for(const R of N)R.direction==="down"&&(T.set(R.from,(T.get(R.from)??0)+1),B.set(R.to,(B.get(R.to)??0)+1));const K=new Map,q=new Map;for(const R of N){if(R.direction!=="same")continue;const U=[R.from,R.to].sort().join("|");K.set(U,(K.get(U)??0)+1)}for(const R of N){if(R.direction==="back"||R.direction==="same"){let I=0;if(R.direction==="same"){const V=[R.from,R.to].sort().join("|");I=q.get(V)??0,q.set(V,I+1)}p.push({...R,fromPort:0,toPort:0,sameEdgeIndex:I});continue}const U=T.get(R.from)??1,M=B.get(R.to)??1,Y=H.get(R.from)??0,Z=W.get(R.to)??0;H.set(R.from,Y+1),W.set(R.to,Z+1);const z=U===1?0:-.6+1.2*Y/(U-1),L=M===1?0:-.6+1.2*Z/(M-1);p.push({...R,fromPort:z,toPort:L,sameEdgeIndex:0})}return{nodes:d,edges:p,width:l,height:A+Rn/2+Ai,posMap:g}}function lA({steps:e,entryStep:r,selectedNodeId:i,selectedEdgeKey:s,startConditionLabel:l,agentTypes:u,isReadOnly:f,onSelectNode:c,onSelectEdge:d,onRemoveStep:p,onCreateTransition:g,onReconnectTo:m,onReconnectFrom:x,onDeleteTransition:_}){const k=P.useRef(null),C=P.useRef(!1),[b,v]=P.useState(null),[y,S]=P.useState(null),[j,A]=P.useState(null),{nodes:N,edges:D,width:T,height:B,posMap:H}=P.useMemo(()=>oA(e,r,l,u),[e,r,l,u]),W=P.useCallback(Q=>{var re;const ee=k.current;if(!ee)return{x:0,y:0};const X=ee.createSVGPoint();X.x=Q.clientX,X.y=Q.clientY;const $=(re=ee.getScreenCTM())==null?void 0:re.inverse();if(!$)return{x:0,y:0};const oe=X.matrixTransform($);return{x:oe.x,y:oe.y}},[]),K=P.useCallback(Q=>!Q||!y||Q==="$start"?!1:y.type==="reconnect-from"?Q!=="$done":!0,[y]),q=P.useCallback((Q,ee)=>{if(f)return;Q.stopPropagation(),Q.preventDefault();const X=W(Q);S({type:"new",fromNodeId:ee,mouseX:X.x,mouseY:X.y})},[W,f]),R=P.useCallback((Q,ee)=>{if(f)return;Q.stopPropagation(),Q.preventDefault();const X=W(Q);S({type:"reconnect-to",fromNodeId:ee.from,edgeKey:ee.edgeKey,mouseX:X.x,mouseY:X.y})},[W,f]),U=P.useCallback((Q,ee)=>{if(f)return;Q.stopPropagation(),Q.preventDefault();const X=W(Q);S({type:"reconnect-from",fromNodeId:ee.from,fixedTargetId:ee.to,edgeKey:ee.edgeKey,mouseX:X.x,mouseY:X.y})},[W,f]),M=P.useCallback(Q=>{if(!y)return;const ee=W(Q);S(X=>X?{...X,mouseX:ee.x,mouseY:ee.y}:null)},[y,W]),Y=P.useCallback(()=>{y&&(C.current=!0,j&&K(j)&&(y.type==="new"?g(y.fromNodeId,j):y.type==="reconnect-to"?m(y.edgeKey,j):y.type==="reconnect-from"&&x(y.edgeKey,j)),S(null),A(null))},[y,j,K,g,m,x]),Z=P.useCallback(()=>{if(C.current){C.current=!1;return}c(null),d(null)},[c,d]);P.useEffect(()=>{if(f)return;const Q=ee=>{ee.target instanceof HTMLInputElement||ee.target instanceof HTMLTextAreaElement||ee.target instanceof HTMLSelectElement||(ee.key==="Delete"||ee.key==="Backspace")&&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=H.get(Q.from),X=H.get(Q.to);if(!ee||!X)return null;let $,oe,re,ve="middle",be,Le;if(Q.direction==="down"){const Oe=ee.cx+Q.fromPort*(ee.w/2-10),He=ee.cy+ee.h/2,Ue=X.cx+Q.toPort*(X.w/2-10),Ne=X.cy-X.h/2,me=Ne-He,Te=Ue-Oe;$=`M ${Oe} ${He} C ${Oe} ${He+me*.4}, ${Ue-Te*.2} ${Ne-me*.1}, ${Ue} ${Ne}`,oe=Oe+(Ue-Oe)*.5,re=He+me*.6,be={x:Oe,y:He},Le={x:Ue,y:Ne}}else if(Q.direction==="back"){const Oe=Q.from===Q.to,He=ee.cx>=T/2,Ue=Q.backEdgeIndex*16,Ne=He?T-20-Ue:20+Ue;if(Oe){const me=ee.cx>=T/2,Te=30+Q.backEdgeIndex*14,$e=ee.cy-ee.h/2,Rt=me?ee.cx+ee.w/2:ee.cx-ee.w/2,fe=me?Rt+Te:Rt-Te,Ae=ee.cx+(me?ee.w/4:-ee.w/4),Be=$e-20-Q.backEdgeIndex*10;$=`M ${Rt} ${ee.cy} C ${fe} ${ee.cy}, ${fe} ${Be}, ${Ae} ${$e}`,oe=fe+10,re=Be+4,ve="middle",be={x:Rt,y:ee.cy},Le={x:Ae,y:$e}}else{const me=He?ee.cx+ee.w/2:ee.cx-ee.w/2,Te=X.cx+(He?X.w/4:-X.w/4),$e=Math.min(ee.cy,X.cy)-X.h/2-18-Q.backEdgeIndex*14;$=`M ${me} ${ee.cy} L ${Ne} ${ee.cy} L ${Ne} ${$e} L ${Te} ${$e} L ${Te} ${X.cy-X.h/2}`,oe=Ne,re=(ee.cy+$e)/2,ve=He?"start":"end",be={x:me,y:ee.cy},Le={x:Te,y:X.cy-X.h/2}}}else{const Oe=X.cx>ee.cx,He=Q.sameEdgeIndex===0?-12:12,Ue=Oe?ee.cx+ee.w/2:ee.cx-ee.w/2,Ne=Oe?X.cx-X.w/2:X.cx+X.w/2,me=ee.cy+He,Te=X.cy+He,$e=(Ue+Ne)/2;$=`M ${Ue} ${me} C ${$e} ${me}, ${$e} ${Te}, ${Ne} ${Te}`,oe=$e,re=(me+Te)/2-6,be={x:Ue,y:me},Le={x:Ne,y:Te}}return{path:$,labelX:oe,labelY:re,labelAnchor:ve,fromPt:be,toPt:Le}},L=(Q,ee)=>{const X=z(Q);if(!X)return null;const{path:$,labelX:oe,labelY:re,labelAnchor:ve}=X,be=s===Q.edgeKey,Le=Q.label&&!(Q.from==="$start"&&Q.label==="Always");return o.jsxs("g",{children:[o.jsx("path",{d:$,fill:"none",stroke:"transparent",strokeWidth:14,className:"cursor-pointer",onClick:Oe=>{Oe.stopPropagation(),d(be?null:Q.edgeKey)}}),o.jsx("path",{d:$,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)},I=()=>{if(!s||y)return null;const Q=D.find(re=>re.edgeKey===s);if(!Q)return null;const ee=z(Q);if(!ee)return null;const{fromPt:X,toPt:$}=ee,oe=6;return o.jsxs(o.Fragment,{children:[Q.edgeKey!=="start"&&o.jsx("circle",{cx:X.x,cy:X.y,r:oe,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:re=>U(re,Q)}),o.jsx("circle",{cx:$.x,cy:$.y,r:oe,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:re=>R(re,Q)})]})},V=()=>{if(!y)return null;let Q,ee,X,$;if(y.type==="reconnect-from"){const ve=H.get(y.fixedTargetId);if(!ve)return null;Q=y.mouseX,ee=y.mouseY,X=ve.cx,$=ve.cy-ve.h/2}else{const ve=H.get(y.fromNodeId);if(!ve)return null;Q=ve.cx,ee=ve.cy+ve.h/2,X=y.mouseX,$=y.mouseY}const oe=$-ee,re=Math.abs(oe)>10?`M ${Q} ${ee} C ${Q} ${ee+oe*.4}, ${X} ${$-oe*.4}, ${X} ${$}`:`M ${Q} ${ee} L ${X} ${$}`;return o.jsx("path",{d:re,fill:"none",stroke:"#58a6ff",strokeWidth:2,strokeDasharray:"6 3",strokeOpacity:.7,pointerEvents:"none"})},F=Q=>{const ee=Q.cy+Q.h/2,X=(y==null?void 0:y.fromNodeId)===Q.id;return o.jsx("circle",{cx:Q.cx,cy:ee,r:ob,fill:X?"#58a6ff":"#1c2128",stroke:X?"#58a6ff":"#484f58",strokeWidth:1.5,strokeOpacity:X?1:.5,className:"cursor-crosshair",onMouseDown:$=>q($,Q.id)})},ie=Q=>{const ee=Q.cy-Q.h/2,X=y&&j===Q.id&&K(Q.id);return o.jsx("circle",{cx:Q.cx,cy:ee,r:ob,fill:X?"#3fb950":"#1c2128",stroke:X?"#3fb950":"#484f58",strokeWidth:1.5,strokeOpacity:X?1:.5})};return o.jsxs("svg",{ref:k,viewBox:`0 0 ${T} ${B}`,className:"block w-full",preserveAspectRatio:"xMidYMin meet",onMouseMove:M,onMouseUp:Y,onClick:Z,children:[o.jsxs("defs",{children:[o.jsx("marker",{id:"arrow",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"7",markerHeight:"5",orient:"auto",children:o.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#484f58"})}),o.jsx("marker",{id:"arrow-selected",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"7",markerHeight:"5",orient:"auto",children:o.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#58a6ff"})})]}),D.map((Q,ee)=>L(Q,ee)),N.map(Q=>{const ee=i===Q.id,X=Q.cx-Q.w/2,$=Q.cy-Q.h/2,oe=b===Q.id,re=y&&j===Q.id&&K(Q.id);if(Q.type==="terminal"){const be=Q.id==="$start",Le=be?"#58a6ff":"#3fb950",Oe=be,He=!be;return o.jsxs("g",{onClick:Ue=>{Ue.stopPropagation(),be&&!f&&d("start")},className:be&&!f?"cursor-pointer":void 0,children:[re&&o.jsx("rect",{x:X-3,y:$-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:X-3,y:$-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:X,y:$,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&&F(Q),He&&ie(Q)]},Q.id)}const ve=Q.color??"#6b7280";return o.jsxs("g",{onClick:be=>{be.stopPropagation(),f||c(ee?null:Q.id)},onMouseEnter:()=>v(Q.id),onMouseLeave:()=>v(null),className:f?void 0:"cursor-pointer",children:[re&&o.jsx("rect",{x:X-3,y:$-3,width:Q.w+6,height:Q.h+6,rx:12,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),ee&&o.jsx("rect",{x:X-3,y:$-3,width:Q.w+6,height:Q.h+6,rx:12,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),o.jsx("rect",{x:X,y:$,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&&F(Q),!f&&ie(Q),oe&&!y&&!f&&o.jsxs("g",{onClick:be=>{be.stopPropagation(),p(Q.id)},className:"cursor-pointer",children:[o.jsx("circle",{cx:X+Q.w-2,cy:$+2,r:8,fill:"#0d1117",fillOpacity:.9,stroke:"#f85149",strokeOpacity:.5,strokeWidth:1}),o.jsx("line",{x1:X+Q.w-5,y1:$-1,x2:X+Q.w+1,y2:$+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"}),o.jsx("line",{x1:X+Q.w+1,y1:$-1,x2:X+Q.w-5,y2:$+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"})]})]},Q.id)}),y&&N.map(Q=>K(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:()=>A(Q.id),onMouseLeave:()=>A(null),onMouseUp:ee=>{ee.stopPropagation(),Y()}},`drop-${Q.id}`):null),V(),I()]})}const Qn="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",Oi="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",ln="block text-[11px] text-text-secondary mb-0.5";function cA({fromLabel:e,toLabel:r,condition:i,fromStep:s,agentTypes:l,onUpdateCondition:u,onDelete:f}){const c=s&&(s.type==="sub_agent"||s.type==="agent")?l.find(p=>p.id===(s.type==="sub_agent"?s.subAgentType:s.toolMode)):void 0,d=(c==null?void 0:c.results)&&c.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("svg",{className:"w-3.5 h-3.5 shrink-0 text-text-muted",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"})}),o.jsx("span",{className:"font-medium text-text-primary",children:r})]}),o.jsxs("div",{children:[o.jsx("label",{className:ln,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:Oi,children:_0.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:ln,children:"Result"}),d?o.jsx("select",{value:i.result??c.results[0],onChange:p=>{u({type:"step_result",result:p.target.value})},className:Oi,children:c.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:Qn})]}),o.jsx("p",{className:"text-text-muted text-[10px]",children:"Drag handles to reconnect. Press Delete to remove."})]})}function nh({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 uA({step:e,isEntry:r,agentTypes:i,transitionCount:s,templateVariables:l,onUpdate:u,onRemove:f,onSetEntry:c}){const{color:d,name:p}=pf(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:c,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:ln,children:"Type"}),o.jsx("select",{value:e.type,onChange:g=>{const m=g.target.value,x=m==="sub_agent"?"verification":"build";if(m==="agent"){const _=i.find(k=>!k.subagent);u({...e,type:m,phase:x,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:x,subAgentType:(_==null?void 0:_.id)??"",name:(_==null?void 0:_.name)??"Sub-Agent"})}else u({...e,type:m,phase:x,name:"Shell"})},className:Oi,children:aA.map(g=>o.jsx("option",{value:g.value,children:g.label},g.value))})]}),e.type==="agent"&&o.jsxs("div",{children:[o.jsx("label",{className:ln,children:"Agent Type"}),o.jsx("select",{value:e.toolMode??"builder",onChange:g=>{const m=i.find(x=>x.id===g.target.value);u({...e,toolMode:g.target.value,name:(m==null?void 0:m.name)??g.target.value})},className:Oi,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:ln,children:"Sub-Agent Type"}),o.jsxs("select",{value:e.subAgentType??"",onChange:g=>{const m=i.find(x=>x.id===g.target.value);u({...e,subAgentType:g.target.value,name:(m==null?void 0:m.name)??g.target.value})},className:Oi,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:ln,children:"Prompt"}),o.jsx("textarea",{value:e.prompt??"",onChange:g=>u({...e,prompt:g.target.value||void 0}),rows:6,className:`${Qn} resize-y text-xs`,placeholder:"Injected on first entry..."}),o.jsx(nh,{variables:l,onInsert:g=>u({...e,prompt:(e.prompt??"")+`{{${g}}}`})})]}),o.jsxs("div",{children:[o.jsx("label",{className:ln,children:"Nudge Prompt"}),o.jsx("textarea",{value:e.nudgePrompt??"",onChange:g=>u({...e,nudgePrompt:g.target.value||void 0}),rows:6,className:`${Qn} resize-y text-xs`,placeholder:"Injected on re-entry..."}),o.jsx(nh,{variables:l,onInsert:g=>u({...e,nudgePrompt:(e.nudgePrompt??"")+`{{${g}}}`})})]})]}),e.type==="shell"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:ln,children:"Command"}),o.jsx("textarea",{value:e.command??"",onChange:g=>u({...e,command:g.target.value}),rows:3,className:`${Qn} font-mono text-xs resize-y`,placeholder:"cd {{workdir}} && npm run lint"}),o.jsx(nh,{variables:l,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:ln,children:"Timeout (ms)"}),o.jsx("input",{type:"number",value:e.timeout??6e4,onChange:g=>u({...e,timeout:Number(g.target.value)}),className:`${Qn} font-mono text-xs`})]}),o.jsxs("div",{children:[o.jsx("label",{className:ln,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:`${Qn} 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 lb=[];function S0({isOpen:e,onClose:r,initialEditId:i}){const s=Ct(pe=>pe.defaults),l=Ct(pe=>pe.userItems),u=Ct(pe=>pe.loading),f=Ct(pe=>pe.templateVariables),c=Ct(pe=>pe.fetchWorkflows),d=Ct(pe=>pe.fetchWorkflow),p=Ct(pe=>pe.fetchDefaultContent),g=Ct(pe=>pe.fetchTemplateVariables),m=Ct(pe=>pe.createWorkflow),x=Ct(pe=>pe.updateWorkflow),_=Ct(pe=>pe.deleteWorkflow),{requestDelete:k,clearConfirm:C,isConfirming:b}=Nh(),[v,y]=P.useState("list"),[S,j]=P.useState(null),[A,N]=P.useState(!1),[D,T]=P.useState(null),[B,H]=P.useState(null),[W,K]=P.useState(""),[q,R]=P.useState(""),[U,M]=P.useState(""),[Y,Z]=P.useState("1.0.0"),[z,L]=P.useState("#3b82f6"),[I,V]=P.useState(""),[F,ie]=P.useState(50),[Q,ee]=P.useState(lb),[X,$]=P.useState({type:"always"}),[oe,re]=P.useState(""),[ve,be]=P.useState(!1),[Le,Oe]=P.useState([]),[He]=P.useState(null);P.useEffect(()=>{e&&(c(),g(),ke("/api/agents").then(pe=>pe.json()).then(pe=>Oe(pe.agents??[])).catch(()=>{}),T(null),H(null),i?s.some(_e=>_e.id===i)?p(i).then(_e=>{_e&&(K(_e.metadata.name+" (copy)"),R(`${i}-copy-${Date.now()}`),M(_e.metadata.description),Z(_e.metadata.version),L(_e.metadata.color??"#3b82f6"),V(_e.entryStep),ie(_e.settings.maxIterations),ee(_e.steps),$(_e.startCondition??{type:"always"}),re(""),j(null),N(!1),y("edit"))}):d(i).then(_e=>{_e&&(K(_e.metadata.name),R(_e.metadata.id),M(_e.metadata.description),Z(_e.metadata.version),L(_e.metadata.color??"#3b82f6"),V(_e.entryStep),ie(_e.settings.maxIterations),ee(_e.steps),$(_e.startCondition??{type:"always"}),re(""),j(i),N(!1),y("edit"))}):(y("list"),j(null),N(!1)))},[e,c,d,p,g,i]);const Ue=async pe=>{const _e=await d(pe);_e&&(j(pe),K(_e.metadata.name),R(_e.metadata.id),M(_e.metadata.description),Z(_e.metadata.version),L(_e.metadata.color??"#3b82f6"),V(_e.entryStep),ie(_e.settings.maxIterations),ee(_e.steps),$(_e.startCondition??{type:"always"}),re(""),T(null),H(null),y("edit"))},Ne=async()=>{var ne;const pe=S??q;if(!pe||!W)return re("Name is required."),!1;if(Q.length===0)return re("Add at least one step."),!1;let _e=I;if(!_e||!Q.some(ye=>ye.id===_e)){if(_e=((ne=Q.find(ye=>ye.id))==null?void 0:ne.id)??"",!_e)return re("All steps need an ID."),!1;V(_e)}be(!0),re("");const Ce={metadata:{id:pe,name:W,description:U,version:Y||"1.0.0",color:z},entryStep:_e,settings:{maxIterations:F},steps:Q,startCondition:X},qe=S?await x(S,Ce):await m(Ce);return be(!1),qe.success?(S||j(pe),!0):(re(qe.error??"Failed to save."),!1)},me=async()=>{await Ne()},Te=async()=>{await Ne()&&(i?r():y("list"))},$e=()=>{i?r():y("list")},Rt=pe=>{K(pe),S||R(iA(pe))},fe=async pe=>{if(s.some(Ce=>Ce.id===pe)){const Ce=await p(pe);if(!Ce)return;K(Ce.metadata.name),R(Ce.metadata.id),M(Ce.metadata.description),Z(Ce.metadata.version),L(Ce.metadata.color??"#3b82f6"),V(Ce.entryStep),ie(Ce.settings.maxIterations),ee(Ce.steps),$(Ce.startCondition??{type:"always"}),re(""),j(pe),N(!0)}else{const Ce=await d(pe);if(!Ce)return;K(Ce.metadata.name),R(Ce.metadata.id),M(Ce.metadata.description),Z(Ce.metadata.version),L(Ce.metadata.color??"#3b82f6"),V(Ce.entryStep),ie(Ce.settings.maxIterations),ee(Ce.steps),$(Ce.startCondition??{type:"always"}),re(""),j(pe),N(!0)}y("edit")},Ae=async pe=>{const Ce=s.some(qe=>qe.id===pe)?await p(pe):await d(pe);Ce&&(K(Ce.metadata.name+" (copy)"),R(`${pe}-copy-${Date.now()}`),M(Ce.metadata.description),Z(Ce.metadata.version),L(Ce.metadata.color??"#3b82f6"),V(Ce.entryStep),ie(Ce.settings.maxIterations),ee(Ce.steps),$(Ce.startCondition??{type:"always"}),re(""),j(null),N(!1),y("edit"))},Be=()=>{j(null),K(""),R(""),M(""),Z("1.0.0"),L("#3b82f6"),V(""),ie(50),ee(structuredClone(lb)),$({type:"always"}),re(""),T(null),H(null),N(!1),y("edit")},ot=async pe=>{await _(pe),C()},ue=P.useCallback(pe=>{T(pe),H(null)},[]),Se=P.useCallback(pe=>{H(pe),T(null)},[]),je=D!==null?Number(D):-1,Ie=je>=0?Q[je]??null:null,Ge=P.useCallback(pe=>{ee(_e=>_e.map((Ce,qe)=>qe===je?pe:Ce))},[je]),Nt=X.type==="step_result"?`${X.result}`:y0[X.type]??X.type,Ze=()=>{const pe=Q.length,_e=sA(Q),Ce=Le.find(qe=>!qe.subagent);ee([...Q,{id:_e,name:(Ce==null?void 0:Ce.name)??"Agent",type:"agent",phase:"build",toolMode:(Ce==null?void 0:Ce.id)??"builder",transitions:[]}]),I||V(_e),ue(String(pe))},Ot=P.useCallback((pe,_e)=>{pe==="$start"?(V(_e),Se("start")):ee(Ce=>{const qe=Ce.find(ye=>ye.id===pe),ne=qe?qe.transitions.length:0;return Se(`${pe}:${ne}`),Ce.map(ye=>ye.id===pe?{...ye,transitions:[...ye.transitions,{when:{type:"always"},goto:_e}]}:ye)})},[Se]),Tt=P.useCallback((pe,_e)=>{if(pe==="start")V(_e);else{const Ce=pe.lastIndexOf(":"),qe=pe.slice(0,Ce),ne=parseInt(pe.slice(Ce+1));ee(ye=>ye.map(Me=>Me.id===qe?{...Me,transitions:Me.transitions.map((Ve,st)=>st===ne?{...Ve,goto:_e}:Ve)}:Me))}},[]),Kt=P.useCallback((pe,_e)=>{const Ce=pe.lastIndexOf(":"),qe=pe.slice(0,Ce),ne=parseInt(pe.slice(Ce+1));ee(ye=>{const Me=ye.find(st=>st.id===qe);if(!Me)return ye;const Ve=Me.transitions[ne];return Ve?ye.map(st=>st.id===qe?{...st,transitions:st.transitions.filter((en,er)=>er!==ne)}:st.id===_e?{...st,transitions:[...st.transitions,Ve]}:st):ye}),H(null)},[]),lt=P.useCallback(pe=>{if(pe==="start")V("");else{const _e=pe.lastIndexOf(":"),Ce=pe.slice(0,_e),qe=parseInt(pe.slice(_e+1));ee(ne=>ne.map(ye=>ye.id===Ce?{...ye,transitions:ye.transitions.filter((Me,Ve)=>Ve!==qe)}:ye))}H(null)},[]),kn=P.useCallback((pe,_e)=>{if(pe==="start")$(_e);else{const Ce=pe.lastIndexOf(":"),qe=pe.slice(0,Ce),ne=parseInt(pe.slice(Ce+1));ee(ye=>ye.map(Me=>Me.id===qe?{...Me,transitions:Me.transitions.map((Ve,st)=>st===ne?{...Ve,when:_e}:Ve)}:Me))}},[]),Jt=pe=>pf(pe,Le).name,Hs=()=>{if(!B)return null;if(B==="start"){const Ve=Q.find(st=>st.id===I);return{type:"start",fromLabel:"Start",toLabel:Ve?Jt(Ve):"(none)",condition:X}}const pe=B.lastIndexOf(":"),_e=B.slice(0,pe),Ce=parseInt(B.slice(pe+1)),qe=Q.find(Ve=>Ve.id===_e);if(!qe)return null;const ne=qe.transitions[Ce];if(!ne)return null;const ye=Q.find(Ve=>Ve.id===ne.goto),Me=ne.goto==="$done"?"Done":ye?Jt(ye):ne.goto;return{type:"step",fromLabel:Jt(qe),toLabel:Me,condition:ne.when}};if(v==="edit"){const pe=Hs();return o.jsxs(jt,{isOpen:e,onClose:$e,title:A?W: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:ln,children:"Name"}),o.jsx("input",{value:W,onChange:_e=>Rt(_e.target.value),placeholder:"Workflow name",className:`${Qn} ${A?"opacity-50":""}`,readOnly:A})]}),o.jsxs("div",{className:"min-w-[100px]",children:[o.jsx("label",{className:ln,children:"ID"}),o.jsx("input",{value:q,readOnly:!0,className:`${Qn} font-mono opacity-50`})]}),o.jsxs("div",{className:"flex-1 min-w-[140px]",children:[o.jsx("label",{className:ln,children:"Description"}),o.jsx("input",{value:U,onChange:_e=>!A&&M(_e.target.value),readOnly:A,placeholder:"What does this workflow do?",className:`${Qn} ${A?"opacity-50":""}`})]}),o.jsxs("div",{className:"w-20",children:[o.jsx("label",{className:ln,children:"Max Iter."}),o.jsx("input",{type:"number",value:F,onChange:_e=>!A&&ie(Number(_e.target.value)),readOnly:A,className:`${Qn} font-mono ${A?"opacity-50":""}`})]}),o.jsxs("div",{children:[o.jsx("label",{className:ln,children:"Color"}),o.jsx("input",{type:"color",value:z,onChange:_e=>!A&&L(_e.target.value),disabled:A,className:`w-8 h-8 rounded border border-border bg-transparent ${A?"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"}),!A&&o.jsx("button",{onClick:Ze,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(lA,{steps:Q,entryStep:I,selectedNodeId:(Ie==null?void 0:Ie.id)??null,selectedEdgeKey:B,startConditionLabel:Nt,agentTypes:Le,isReadOnly:A,onSelectNode:_e=>{if(_e===null){ue(null);return}const Ce=Q.findIndex(qe=>qe.id===_e);ue(Ce>=0?String(Ce):null)},onSelectEdge:Se,onRemoveStep:_e=>{var qe;const Ce=Q.findIndex(ne=>ne.id===_e);if(ee(ne=>ne.filter(ye=>ye.id!==_e)),je===Ce&&ue(null),I===_e){const ne=Q.filter(ye=>ye.id!==_e);V(((qe=ne[0])==null?void 0:qe.id)??"")}},onCreateTransition:Ot,onReconnectTo:Tt,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:Ze,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:A&&(pe||Ie)?o.jsx("p",{className:"text-text-muted text-xs text-center py-8",children:'View only — click "Duplicate & Customize" to edit.'}):pe?pe.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"})}),I&&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("svg",{className:"w-3.5 h-3.5 shrink-0 text-text-muted",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"})}),o.jsx("span",{className:"text-text-primary font-medium",children:pe.toLabel})]}),o.jsxs("div",{children:[o.jsx("label",{className:ln,children:"Activation Condition"}),o.jsx("select",{value:X.type,onChange:_e=>$(_e.target.value==="step_result"?{type:"step_result",result:"success"}:{type:_e.target.value}),className:Oi,children:_0.map(_e=>o.jsx("option",{value:_e.value,children:_e.label},_e.value))})]}),X.type==="step_result"&&o.jsxs("div",{children:[o.jsx("label",{className:ln,children:"Result"}),I&&(()=>{const _e=Q.find(ye=>ye.id===I),Ce=_e&&(_e.type==="sub_agent"||_e.type==="agent")?Le.find(ye=>ye.id===(_e.type==="sub_agent"?_e.subAgentType:_e.toolMode)):void 0,qe=(Ce==null?void 0:Ce.results)&&Ce.results.length>0,ne=(Ce==null?void 0:Ce.results)??[];return qe?o.jsx("select",{value:X.result??ne[0],onChange:ye=>$({type:"step_result",result:ye.target.value}),className:Oi,children:ne.map(ye=>o.jsx("option",{value:ye,children:ye},ye))}):o.jsx("input",{type:"text",value:X.result??"success",onChange:ye=>$({type:"step_result",result:ye.target.value}),placeholder:"e.g. success, passed, failed",className:Qn})})()]}),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(cA,{fromLabel:pe.fromLabel,toLabel:pe.toLabel,condition:pe.condition,fromStep:pe.type==="step"?Q.find(_e=>_e.id===pe.fromLabel):void 0,agentTypes:Le,onUpdateCondition:_e=>kn(B,_e),onDelete:()=>lt(B)}):Ie?o.jsx(uA,{step:Ie,isEntry:Ie.id===I,agentTypes:Le,transitionCount:Ie.transitions.length,templateVariables:f,onUpdate:Ge,onRemove:()=>{var _e;if(Ie&&(ee(Q.filter((Ce,qe)=>qe!==je)),ue(null),I===Ie.id)){const Ce=Q.filter((qe,ne)=>ne!==je);V(((_e=Ce[0])==null?void 0:_e.id)??"")}},onSetEntry:()=>V(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(tt,{variant:"secondary",onClick:$e,children:"Close"}),A?o.jsx(tt,{variant:"primary",onClick:()=>{K(W+" (copy)"),R(`${S}-copy-${Date.now()}`),j(null),N(!1)},children:"Duplicate & Customize"}):o.jsxs(o.Fragment,{children:[o.jsx(tt,{variant:"secondary",onClick:me,disabled:ve||!W,children:ve?"Saving...":"Save"}),o.jsx(tt,{variant:"primary",onClick:Te,disabled:ve||!W,children:"Save & Close"})]})]})]})}return o.jsxs(jt,{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(tt,{variant:"primary",size:"sm",onClick:Be,children:"+ New"})})]}),u&&s.length===0&&l.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"Loading workflows..."}):s.length===0&&l.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(pe=>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:pe.name}),o.jsxs("span",{className:"text-text-muted text-xs",children:["v",pe.version]})]}),o.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:pe.description})]}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx("button",{onClick:()=>fe(pe.id),className:"p-1.5 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors",title:"View",children: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:"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"})})}),o.jsx(Ya,{onClick:()=>Ae(pe.id)})]})]},pe.id))})]}),l.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:l.map(pe=>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:pe.name}),o.jsxs("span",{className:"text-text-muted text-xs",children:["v",pe.version]})]}),o.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:pe.description})]}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx(Ya,{onClick:()=>Ae(pe.id)}),o.jsx(Is,{onClick:()=>Ue(pe.id)}),b(pe.id,"delete")?o.jsx(Th,{onConfirm:()=>ot(pe.id),onCancel:()=>{}}):o.jsx(Ah,{onClick:()=>k(pe.id)})]})]},pe.id))})]})]})]})}function dA(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(l=>l.status==="failed").length>=4);case"step_result":return null;default:return null}}function hA({onSelectWorkflow:e,onOpenManager:r,criteria:i}){const[s,l]=P.useState(!1),[u,f]=P.useState(null),c=Ct(N=>N.defaults),d=Ct(N=>N.userItems),p=Ct(N=>N.fetchWorkflows),g=[...c,...d],{isOpen:m,search:x,selectedIndex:_,filtered:k,containerRef:C,searchRef:b,handleToggle:v,handleSearchChange:y,handleKeyDown:S}=p0({items:g,isOpen:s,onOpen:()=>l(!0),onClose:()=>l(!1),filterFn:(N,D)=>!D||N.name.toLowerCase().includes(D.toLowerCase())});P.useEffect(()=>{s&&p()},[s,p]);const j=N=>{e(N),l(!1)},A=()=>{l(!1),r()};return o.jsxs("div",{ref:C,className:"relative",children:[o.jsx(m0,{label:"Workflows",isOpen:m,onClick:v}),m&&o.jsxs("div",{className:"absolute bottom-full right-0 mb-1 w-72 bg-bg-secondary border border-border rounded-lg shadow-xl z-50",onKeyDown:S,children:[o.jsx(g0,{value:x,onChange:y,onKeyDown:S,ref:b,placeholder:"Search workflows..."}),o.jsx(x0,{children:k.length===0?o.jsx(v0,{hasItems:g.length>0,message:"No workflows yet"}):k.map((N,D)=>{const T=dA(N,i),B=N.color??"#3b82f6";return o.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 rounded transition-colors group ${D===_?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[o.jsxs("button",{type:"button",onClick:()=>j(N.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:B}}),o.jsx("span",{className:"text-sm text-text-primary font-medium flex-1",children:N.name}),T!==null&&o.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{backgroundColor:T?"#22c55e":"#6b7280"},title:T?"Entry condition met":"Entry condition not met"})]}),o.jsx(Is,{className:"opacity-0 group-hover:opacity-100",onClick:H=>{H.stopPropagation(),l(!1),f(N.id)}})]},N.id)})}),o.jsx(b0,{label:"Manage Workflows...",onClick:A})]}),o.jsx(S0,{isOpen:!!u,onClose:()=>f(null),initialEditId:u})]})}function fA({isOpen:e,onClose:r,onCloseComplete:i,onSelectCommand:s,onSelectWorkflow:l,textareaContent:u}){const f=on(M=>M.defaults),c=on(M=>M.userItems),d=on(M=>M.fetchCommands),p=Ct(M=>M.defaults),g=Ct(M=>M.userItems),m=Ct(M=>M.fetchWorkflows),x=kt(M=>M.defaults),_=kt(M=>M.userItems),k=kt(M=>M.fetchAgents),C=Ee(M=>{var Y;return(Y=M.currentSession)==null?void 0:Y.mode}),b=Ee(M=>M.switchMode),[v,y]=P.useState(""),[S,j]=P.useState(0),A=P.useRef(null);P.useEffect(()=>{e&&(d(),m(),k(),y(""),j(0),setTimeout(()=>{var M;return(M=A.current)==null?void 0:M.focus()},50))},[e,d,m,k]),P.useEffect(()=>{e||i==null||i()},[e,i]);const N=(M,Y)=>{if(!Y)return!0;const Z=Y.toLowerCase().split(/\s+/),z=M.toLowerCase().split(/\s+/);return Z.every(L=>{for(const I of z){let V=0;for(let F=0;F<I.length&&V<L.length;F++)I[F]===L[V]&&V++;if(V===L.length)return!0}return!1})},D=[...x,..._].filter(M=>!M.subagent&&M.id!==C&&N(M.name,v)).map(M=>({kind:"agent",id:M.id,name:M.name})),T=[...f,...c].filter(M=>N(M.name,v)).map(M=>({kind:"command",id:M.id,name:M.name})),B=[...p,...g].filter(M=>N(M.name,v)).map(M=>({kind:"workflow",id:M.id,name:M.name})),H=[...D,...T,...B],W=H.length-1,K=M=>{switch(M.key){case"ArrowDown":M.preventDefault(),j(Y=>Math.min(Y+1,W));break;case"ArrowUp":M.preventDefault(),j(Y=>Math.max(Y-1,0));break;case"Enter":M.preventDefault(),q(H[S]);break;case"Escape":M.preventDefault(),r();break}},q=M=>{M&&(M.kind==="agent"?b(M.id):M.kind==="command"?s(M.id,u):l(M.id),r())},R=M=>{y(M),j(0)},U=M=>M==="agent"?"Agent > Switch to":M==="command"?"Command > Launch":"Workflow > Run";return e?Yl.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:A,type:"text",value:v,onChange:M=>R(M.target.value),onKeyDown:K,placeholder:"Search...",className:"flex-1 bg-transparent text-sm focus:outline-none placeholder:text-text-muted"}),o.jsx(Eh,{onClick:r,className:"shrink-0","aria-label":"Close"})]}),o.jsx("div",{className:"overflow-y-auto max-h-80 p-2",children:H.length===0?o.jsx("div",{className:"px-3 py-4 text-center text-text-muted text-sm",children:f.length+c.length+p.length+g.length>0?"No matches":"No agents, commands, or workflows yet"}):H.map((M,Y)=>o.jsxs("button",{type:"button",onClick:()=>q(M),className:`w-full text-left px-3 py-2 rounded text-sm transition-colors ${Y===S?"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:[U(M.kind)," "]}),o.jsx("span",{children:M.name})]},M.id))})]})]}),document.body):null}function pA(e){return e==="criterion"}function mA(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=>pA(s.name))}function gA(e,r=[]){const i=[];let s=null,l=[],u,f=1;const c=new Map,d=new Map,p=[];for(const _ of r)_.type==="message"?c.set(_.message.id,_):_.type==="subagent"?d.set(_.subAgentId,_):_.type==="criteria-batch"&&p.push(_);let g=0;const m=()=>{if(l.length>0){const _=p[g];_&&_.type==="criteria-batch"&&_.toolCalls.length===l.length&&_.toolCalls.every((C,b)=>{var v;return C.id===((v=l[b])==null?void 0:v.id)})?i.push(_):i.push({type:"criteria-batch",toolCalls:[...l]}),g++,l=[]}},x=()=>{if(!s)return;const _=s,k=d.get(_.subAgentId);k&&k.type==="subagent"&&k.messages.length===_.messages.length&&k.messages.every((b,v)=>b===_.messages[v])?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(),x(),f++,i.push({type:"context-divider",windowSequence:f})),u=_.contextWindowId,mA(_)){x();for(const k of _.toolCalls)l.push(k);continue}if(m(),_.subAgentId&&_.subAgentType)s&&s.subAgentId===_.subAgentId?s.messages.push(_):(x(),s={subAgentId:_.subAgentId,subAgentType:_.subAgentType,messages:[_]});else{x();const k=c.get(_.id);k&&k.type==="message"&&k.message===_?i.push(k):i.push({type:"message",message:_})}}return m(),x(),i}function xA(e){const{year:r,month:i,day:s}=Ib(e);return`${r}/${i}/${s} ${Zl(e)}`}function vA(e,r){return e.length<=r?e:e.substring(0,r)+"..."}const bA=10,yA=150;function _A(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 SA(e){return[...e].sort((s,l)=>new Date(l.timestamp).getTime()-new Date(s.timestamp).getTime()).slice(0,bA).reverse().map(s=>({id:s.id,content:s.content,timestamp:s.timestamp,formattedTimestamp:xA(s.timestamp),trimmedContent:vA(s.content,yA),sessionId:s.sessionId,sessionName:s.sessionName}))}function wA(e,r,i){const s=[],l=e.filter(u=>u.role==="user"&&!u.isSystemGenerated&&u.messageKind!=="auto-prompt");for(const u of l)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(..._A(u));return SA(s)}function CA(e,r=[],i=null){const[s,l]=P.useState(0),[u,f]=P.useState(!1),c=P.useMemo(()=>wA(e,r,i),[e,r,i]),d=P.useCallback(()=>{c.length>0&&(l(c.length-1),f(!0))},[c.length]),p=P.useCallback(()=>{f(!1),l(0)},[]),g=P.useCallback(()=>{l(_=>c.length===0?_:_===0?c.length-1:_-1)},[c.length]),m=P.useCallback(()=>{l(_=>c.length===0?_:_===c.length-1?0:_+1)},[c.length]),x=P.useCallback(()=>{if(c.length===0||!u)return null;const _=c[s];return(_==null?void 0:_.content)??null},[c,s,u]);return{history:c,selectedIndex:s,showHistory:u,openHistory:d,closeHistory:p,navigateUp:g,navigateDown:m,selectCurrent:x}}function kA({criteriaSidebarOpen:e,onCriteriaSidebarToggle:r}={}){const i=e??!0,[s,l]=P.useState(""),[u,f]=P.useState([]),[c,d]=P.useState(!1),[p,g]=P.useState(null),[m,x]=P.useState(!1),[_,k]=P.useState(!1),[C,b]=P.useState(!1),[v,y]=P.useState(null),S=P.useRef(null),j=P.useRef(null),A=P.useRef(null),N=Ee(ne=>ne.currentSession),D=Ee(ne=>ne.messages),T=Ee(ne=>ne.streamingMessage),B=Ee(ne=>ne.sessions),H=Ee(ne=>ne.error),W=Ee(ne=>ne.pendingQuestion),K=jb(),q=Ee(ne=>ne.sendMessage),R=Ee(ne=>ne.clearError),U=Ee(ne=>ne.acceptAndBuild),M=Ee(ne=>ne.stopGeneration),Y=Ee(ne=>ne.launchRunner),Z=Ee(ne=>ne.cancelQueued),z=qS(),{showThinking:L,showVerboseToolOutput:I,showStats:V,showAgentDefinitions:F,showWorkflowBars:ie}=Sb(),Q=Ct(ne=>ne.defaults),ee=Ct(ne=>ne.userItems),X=[...Q,...ee],$=Ct(ne=>ne.fetchWorkflows),oe=kt(ne=>ne.defaults),re=kt(ne=>ne.userItems),ve=[...oe,...re].filter(ne=>!ne.subagent);P.useEffect(()=>{$()},[$]);const{history:be,selectedIndex:Le,showHistory:Oe,openHistory:He,closeHistory:Ue,navigateUp:Ne,navigateDown:me,selectCurrent:Te}=CA(D,B,N==null?void 0:N.id);P.useEffect(()=>{const ne=ye=>{y(ye.detail.stats)};return window.addEventListener("open-turn-stats",ne),()=>window.removeEventListener("open-turn-stats",ne)},[]);const $e=P.useMemo(()=>T?D.map(ne=>ne.id===T.id?T:ne):D,[D,T]),Rt=P.useRef([]),fe=P.useMemo(()=>{const ne=gA($e,Rt.current);return Rt.current=ne,ne},[$e]),Ae=P.useMemo(()=>Y5(D),[D]),{force_scroll_to_bottom:Be,isAutoScrollActive:ot,setAutoScroll:ue}=d0(S,N),Se=P.useCallback(()=>{const ne=j.current;if(!ne)return;ne.style.height="auto";const ye=Math.min(200,ne.scrollHeight);ne.style.height=`${ye}px`},[]);P.useEffect(()=>{if(!(N!=null&&N.id))return;const ne=`openfox:draft:${N.id}`,ye=localStorage.getItem(ne);ye!==null&&l(ye)},[N==null?void 0:N.id]),P.useEffect(()=>{var ne;(ne=j.current)==null||ne.focus(),Se()},[N==null?void 0:N.id,Se]),P.useEffect(()=>{if(!(N!=null&&N.id))return;const ne=`openfox:draft:${N.id}`,ye=setTimeout(()=>{s?localStorage.setItem(ne,s):localStorage.removeItem(ne)},500);return()=>clearTimeout(ye)},[N==null?void 0:N.id,s]),P.useEffect(()=>{Se()},[s,Se]),P.useEffect(()=>{const ne=ye=>{ye.key==="Escape"&&K&&M(),ye.key==="ScrollLock"&&ue(!ot)};return window.addEventListener("keydown",ne),()=>window.removeEventListener("keydown",ne)},[K,M,ot]),P.useEffect(()=>{const ne=ye=>{(ye.ctrlKey||ye.metaKey)&&ye.shiftKey&&!ye.altKey&&(ye.preventDefault(),b(!0))};return window.addEventListener("keydown",ne),()=>window.removeEventListener("keydown",ne)},[]),P.useEffect(()=>{const ne=j.current;if(!ne)return;const ye=async Me=>{var st;if(document.activeElement!==ne)return;const Ve=(st=Me.clipboardData)==null?void 0:st.items;if(Ve){for(const en of Array.from(Ve))if(en.type.startsWith("image/")){Me.preventDefault();const er=en.getAsFile();if(!er)continue;await eh(er,Pi=>f(Or=>[...Or,Pi]),g,{filename:"pasted-image"})}}};return ne.addEventListener("paste",ye),()=>ne.removeEventListener("paste",ye)},[]);const je=()=>{l(""),f([]),N!=null&&N.id&&localStorage.removeItem(`openfox:draft:${N.id}`)},Ie=async ne=>{ne.preventDefault(),!(!s.trim()&&u.length===0)&&(Be(),q(s,u.length>0?u:void 0),je())},Ge=ne=>{if((ne.ctrlKey||ne.metaKey)&&ne.code.startsWith("Digit")){const Me=parseInt(ne.code.slice(-1),10)-1,Ve=ve[Me];Ve&&(ne.preventDefault(),Ee.getState().switchMode(Ve.id));return}if(Oe)switch(ne.key){case"Enter":ne.preventDefault();const ye=Te();ye&&(l(ye),Ue());return;case"Escape":ne.preventDefault(),Ue(),K&&M();return;case"ArrowUp":ne.preventDefault(),Ne();return;case"ArrowDown":ne.preventDefault(),me();return}if(ne.key==="ArrowUp"&&s.trim()===""&&!Oe){ne.preventDefault(),He();return}ne.key==="Enter"&&!ne.shiftKey&&(ne.preventDefault(),Ie(ne))},Nt=P.useCallback(async ne=>{const ye=ne.target.files;if(!(!ye||ye.length===0)){g(null);for(const Me of Array.from(ye))await eh(Me,Ve=>f(st=>[...st,Ve]),g);A.current&&(A.current.value="")}},[]),Ze=P.useCallback(ne=>{ne.preventDefault(),ne.stopPropagation(),d(!0)},[]),Ot=P.useCallback(ne=>{ne.preventDefault(),ne.stopPropagation(),d(!1)},[]),Tt=P.useCallback(async ne=>{ne.preventDefault(),ne.stopPropagation(),d(!1),g(null);const ye=ne.dataTransfer.files;if(!(!ye||ye.length===0))for(const Me of Array.from(ye))await eh(Me,Ve=>f(st=>[...st,Ve]),g)},[]),Kt=P.useCallback(ne=>{f(ye=>ye.filter(Me=>Me.id!==ne))},[]),lt=P.useCallback(()=>{var ne;(ne=A.current)==null||ne.click()},[]),kn=(N==null?void 0:N.mode)==="planner",Jt=(N==null?void 0:N.mode)==="builder",Hs=((N==null?void 0:N.criteria.length)??0)>0,pe=(N==null?void 0:N.phase)==="done",_e=fe.some(ne=>ne.type==="message"&&ne.message.role==="assistant"),Ce=kn&&Hs&&!K&&_e&&!pe,qe=ne=>{const ye=s.trim()?s:void 0,Me=u.length>0?u:void 0;kn?U(ne,ye,Me):Jt&&Y(ye,Me,ne),je()};return o.jsxs(pC,{criteriaSidebarOpen:i,onCriteriaSidebarToggle:r,messages:$e,children:[W&&o.jsx(R5,{question:W}),o.jsx(xC,{}),v&&o.jsx(w5,{stats:v,onClose:()=>y(null)}),o.jsx(O5,{}),o.jsxs("div",{ref:S,"data-testid":"chat-scroll-container",className:"flex-1 min-w-0 overflow-y-auto relative",children:[o.jsx("div",{className:"pt-4",children:fe.map((ne,ye)=>{if(ne.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"})]},ye);if(ne.type==="subagent"){const en=ne.messages.some(er=>er.isStreaming);return o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(j5,{messages:ne.messages,subAgentType:ne.subAgentType,subAgentId:ne.subAgentId,isStreaming:en})},ye)}if(ne.type==="criteria-batch")return o.jsx("div",{className:"feed-item px-2 md:px-4",children:o.jsx(c0,{toolCalls:ne.toolCalls,criteria:N==null?void 0:N.criteria})},ye);const Me=ne.message;if(Me.role==="assistant")return o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(hf,{message:Me,showStats:V,showThinking:L,showVerboseToolOutput:I})},ye);const Ve=!F&&Me.messageKind==="auto-prompt",st=!ie&&(Me.messageKind==="workflow-started"||Me.messageKind==="task-completed");return Ve||st?null:o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(u0,{message:Me,isLastAssistantMessage:!1,promptContext:Me.role==="user"?Ae[Me.id]:void 0})},ye)})}),o.jsxs("div",{className:"px-2 md:px-4 pb-4",children:[H&&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:H.code}),o.jsx("div",{className:"text-red-300 text-xs mt-0.5",children:H.message})]}),o.jsx(Xa,{onClick:R,className:"text-red-400 hover:text-red-300 p-0.5",size:"sm"})]})}),Ce&&o.jsx("div",{className:"flex justify-center gap-2 feed-item flex-wrap",children:X.map(ne=>{const ye=ne.color??"#3b82f6",Me=parseInt(ye.slice(1,3),16),Ve=parseInt(ye.slice(3,5),16),st=parseInt(ye.slice(5,7),16),en=`rgba(${Me},${Ve},${st},0.12)`,er=`rgba(${Me},${Ve},${st},0.22)`,Pi=`rgba(${Me},${Ve},${st},0.25)`;return o.jsxs("button",{onClick:()=>U(ne.id),className:"px-4 py-1.5 rounded text-sm font-medium transition-colors",style:{backgroundColor:en,color:ye,border:`1px solid ${Pi}`},onMouseEnter:Or=>{Or.currentTarget.style.backgroundColor=er},onMouseLeave:Or=>{Or.currentTarget.style.backgroundColor=en},children:["▶ ",ne.name]},ne.id)})}),K&&o.jsx(M5,{})]})]}),o.jsxs("form",{onSubmit:Ie,className:"relative p-2 md:p-4 border-t border-border bg-gradient-to-t from-bg-secondary/50 to-transparent",children:[o.jsxs("button",{type:"button",className:"absolute -top-8 right-2 md:right-4 text-sm text-text-muted hover:text-text-primary z-10 flex items-center gap-1.5",onClick:()=>ue(!ot),children:[o.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${ot?"bg-accent-success":"border border-text-muted"}`}),"live"]}),o.jsx("input",{ref:A,type:"file",accept:".png,.jpg,.jpeg,.gif",onChange:Nt,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(ne=>o.jsx(I5,{attachment:ne,onRemove:Kt},ne.id))}),Oe&&o.jsx(B5,{history:be,selectedIndex:Le,onSelect:ne=>{l(ne),Ue()},onEscape:Ue,onNavigate:ne=>{ne==="up"?Ne():me()}}),z.length>0&&o.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:z.map(ne=>o.jsxs("div",{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded text-xs ${ne.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:[ne.mode==="asap"?"ASAP":"Queue",":"]}),o.jsx("span",{className:"truncate max-w-[200px]",children:ne.content}),o.jsx(Xa,{onClick:()=>Z(ne.queueId),size:"sm"})]},ne.queueId))}),o.jsxs("div",{className:`flex items-end gap-3 p-3 rounded border transition-colors ${c?"border-accent-primary/50 bg-accent-primary/10":"border-border bg-bg-tertiary/50"}`,onDragOver:Ze,onDragLeave:Ot,onDrop:Tt,children:[o.jsx("button",{type:"button",onClick:lt,className:"p-3 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Attach image file",children:o.jsx("svg",{className:"w-5 h-5",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"})})}),o.jsx("textarea",{ref:j,value:s,onChange:ne=>{l(ne.target.value),Oe&&Ue()},onKeyDown:Ge,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 flex-col items-end gap-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(rA,{onSendCommand:(ne,ye,Me,Ve)=>{var en;ye&&(N==null?void 0:N.mode)!==ye&&Ee.getState().switchMode(ye);const st=Me&&Me.trim()?`${Me.trim()}
|
|
150
|
+
|
|
151
|
+
${ne}`:ne;(en=S.current)==null||en.scrollTo({top:S.current.scrollHeight,behavior:"smooth"}),q(st,Ve!=null&&Ve.length?Ve:void 0,{messageKind:"command",isSystemGenerated:!0}),je()},onOpenManager:()=>x(!0),textareaContent:s,attachments:u.length>0?u:void 0}),o.jsx(hA,{onSelectWorkflow:qe,onOpenManager:()=>k(!0),criteria:(N==null?void 0:N.criteria)??[]})]}),o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("button",{type:"button",onClick:()=>{var ne;!s.trim()&&u.length===0||((ne=S.current)==null||ne.scrollTo({top:S.current.scrollHeight,behavior:"smooth"}),q(s,u),je())},disabled:!s.trim()&&u.length===0,className:"px-4 py-1.5 rounded 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.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(L5,{})]}),o.jsx(J5,{})]})]}),o.jsx(f0,{isOpen:m,onClose:()=>x(!1)}),o.jsx(S0,{isOpen:_,onClose:()=>k(!1)}),o.jsx(fA,{isOpen:C,onClose:()=>b(!1),textareaContent:s,onCloseComplete:()=>{var ne;return(ne=j.current)==null?void 0:ne.focus()},onSelectCommand:async(ne,ye)=>{const Me=await on.getState().fetchCommand(ne);if(Me){const Ve=ye!=null&&ye.trim()?`${ye.trim()}
|
|
152
|
+
|
|
153
|
+
${Me.prompt}`:Me.prompt;Me.metadata.agentMode&&Ee.getState().switchMode(Me.metadata.agentMode),q(Ve,u!=null&&u.length?u:void 0,{messageKind:"command",isSystemGenerated:!0}),je()}},onSelectWorkflow:ne=>{const ye=s.trim()||void 0,Me=u.length>0?u:void 0;(N==null?void 0:N.mode)==="planner"?Ee.getState().acceptAndBuild(ne,ye,Me):Ee.getState().launchRunner(ye,Me,ne),je()}})]})}P.memo(function({item:r}){const[i,s]=P.useState(!1);return r.type==="start"?o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-amber-500/10 border border-amber-500/30 rounded text-amber-300 text-sm",children:[o.jsx("span",{className:"animate-pulse",children:"●"}),o.jsx("span",{children:"Delegating image to fallback vision model..."}),r.filename&&o.jsxs("span",{className:"text-amber-400/70",children:["(",r.filename,")"]})]}):o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 bg-accent-success/10 border border-accent-success/30 rounded",children:[o.jsx("span",{className:"text-accent-success",children:"✓"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"text-accent-success text-sm",children:"Image description done"}),o.jsx("button",{type:"button",onClick:()=>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(Hi,{content:r.description})})]})]})});function cb({isOpen:e,isRetry:r,onSubmit:i,onCancel:s}){const[l,u]=P.useState(""),f=P.useRef(null);P.useEffect(()=>{e&&(u(""),setTimeout(()=>{var d;return(d=f.current)==null?void 0:d.focus()},100))},[e]);const c=d=>{d.preventDefault(),l.trim()&&i(l)};return o.jsx(jt,{isOpen:e,onClose:s,title:r?"Invalid Password":"Password Required",size:"sm",children:o.jsxs("form",{onSubmit:c,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(Ql,{ref:f,type:"password",value:l,onChange:d=>u(d.target.value),placeholder:"Enter password",autoFocus:!0}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(tt,{type:"button",variant:"secondary",onClick:s,children:"Cancel"}),o.jsx(tt,{type:"submit",disabled:!l.trim(),children:r?"Try Again":"Connect"})]})]})})}const EA=[8e3,11434,8080],jA=[{name:"OpenCode Go",url:"https://opencode.ai/zen/go/v1",backend:"opencode-go"}];function ub(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 w0({size:e="md"}){const r=e==="sm"?"w-4 h-4":"w-6 h-6";return o.jsxs("svg",{className:`animate-spin ${r} text-text-muted`,fill:"none",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"})]})}function NA(){return o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}function TA(){return o.jsx("svg",{className:"w-4 h-4",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 AA({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},(l,u)=>{const f=u+1,c=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 ${c?"bg-accent-primary text-white hover:opacity-80":d?"bg-accent-primary text-white":"bg-bg-tertiary text-text-muted"}`,children:c?"✓":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 ${c?"bg-accent-primary":"bg-border"}`})]},u)})})})}function DA({onNext:e}){const[r,i]=P.useState([]),[s,l]=P.useState([]),[u,f]=P.useState(!1),[c,d]=P.useState(""),[p,g]=P.useState(""),[m,x]=P.useState(""),[_,k]=P.useState("auto"),[C,b]=P.useState(!1),[v,y]=P.useState(null),[S,j]=P.useState(null),[A,N]=P.useState(null),[D,T]=P.useState("");P.useEffect(()=>{B()},[]);async function B(){try{const U=await ke("/api/providers");if(U.ok){const Y=(await U.json()).providers.map(Z=>({id:Z.id,name:Z.name,url:Z.url,backend:Z.backend,model:null,apiKey:Z.apiKey}));i(Y),l(Y)}}catch{}}async function H(U){b(!0),y(null);const M=_!=="auto";try{const Z=await(await ke("/api/providers/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:U,skipBackendDetection:M})})).json();Z.success?(M||k(Z.backend??"auto"),y({success:!0,model:Z.model??void 0})):y({success:!1,error:Z.error??"Connection failed"})}catch(Y){y({success:!1,error:Y instanceof Error?Y.message:"Connection failed"})}b(!1)}function W(){if(!p)return;const U=c||`Provider ${s.length+1}`,M={id:`temp-${Date.now()}`,name:U,url:p,backend:v!=null&&v.success?_:"auto",model:v!=null&&v.success?v.model??null:null,apiKey:m||void 0};l([...s,M]),d(""),g(""),x(""),y(null)}function K(U){j(U),r.some(Y=>Y.id===U)?ke(`/api/providers/${U}`,{method:"DELETE"}).then(()=>{l(s.filter(Y=>Y.id!==U)),i(r.filter(Y=>Y.id!==U)),j(null)}).catch(()=>{j(null)}):(l(s.filter(Y=>Y.id!==U)),j(null))}async function q(){for(const M of s)(M.id.startsWith("temp-")||!r.some(Y=>Y.id===M.id))&&((await ke("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:M.name,url:M.url,backend:M.backend,model:M.model,apiKey:M.apiKey})})).ok||console.error("Failed to add provider",M));const U=s.filter(M=>!M.id.startsWith("temp-"));e({providers:U})}const R=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(U=>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:ub(U.backend)}),A===U.id?o.jsx("input",{type:"text",value:D,onChange:M=>T(M.target.value),onKeyDown:M=>{M.key==="Enter"&&(l(s.map(Y=>Y.id===U.id?{...Y,name:D}:Y)),N(null)),M.key==="Escape"&&N(null)},onBlur:()=>{l(s.map(M=>M.id===U.id?{...M,name:D}:M)),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(U.id),T(U.name)},title:"Click to edit",children:U.name})]}),o.jsx("p",{className:"text-text-muted text-sm mt-1",children:U.url}),U.model&&o.jsxs("p",{className:"text-text-secondary text-xs mt-0.5",children:["Model: ",U.model]})]}),o.jsx("button",{onClick:()=>K(U.id),disabled:S===U.id,className:"p-2 text-text-muted hover:text-red-500 transition-colors disabled:opacity-50",title:"Remove provider",children:o.jsx(TA,{})})]},U.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:U=>{U.preventDefault(),p&&W()},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:jA.map(U=>o.jsx("button",{type:"button",onClick:()=>{d(U.name),g(U.url),k(U.backend),y(null)},className:`p-2 rounded border text-center text-sm transition-colors ${p===U.url?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:U.name},U.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:EA.map(U=>o.jsxs("button",{type:"button",onClick:()=>{d(""),g(`http://localhost:${U}`),k("auto"),y(null)},className:`p-2 rounded border text-center text-sm transition-colors ${p===`http://localhost:${U}`?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:["localhost:",U]},U))})]}),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:U=>{g(U.target.value),y(null)},onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),H(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:c,onChange:U=>d(U.target.value),onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),W())},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:U=>x(U.target.value),placeholder:"sk-...",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),v&&o.jsx("div",{className:`p-3 rounded-lg ${v.success?"bg-accent-primary/10":"bg-red-500/10"}`,children:v.success?o.jsxs("p",{className:"text-accent-primary font-medium",children:["✓ Connected to ",ub(_),v.model&&` (${v.model})`]}):o.jsx("p",{className:"text-red-500",children:v.error})}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{type:"button",onClick:()=>H(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(w0,{size:"sm"}):"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:v!=null&&v.success?"Add Provider ✓":"Add Provider"})]}),o.jsx("button",{type:"button",onClick:()=>{f(!1),d(""),g(""),y(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(NA,{}),"Add Provider"]}),o.jsx("button",{onClick:q,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 LA({onNext:e}){const[r,i]=P.useState(""),[s,l]=P.useState(!1);return P.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:()=>l(!0),className:"px-4 py-2 bg-bg-secondary border border-border rounded-lg hover:border-text-muted",children:"Browse"})]})]}),s&&o.jsx(Hb,{initialPath:r||void 0,onSelect:u=>{i(u),l(!1)},onClose:()=>l(!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 RA({onNext:e}){const[r,i]=P.useState(!1),[s,l]=P.useState("http://localhost:11434"),[u,f]=P.useState("qwen3-vl:2b"),{copied:c,copy:d}=s0();P.useEffect(()=>{ke("/api/config").then(g=>g.json()).then(g=>{g.visionFallback&&(i(g.visionFallback.enabled),l(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:c?o.jsx(Xl,{className:"w-4 h-4 text-accent-primary"}):o.jsxs("svg",{className:"w-4 h-4",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"})]})})]})]}),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=>l(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 OA({onComplete:e}){const[r,i]=P.useState(1),[s,l]=P.useState(!1),[u,f]=P.useState({});async function c(m){f(x=>({...x,providers:m.providers})),i(2)}async function d(m){f(x=>({...x,...m})),i(3)}async function p(m){l(!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(x){console.error("Failed to save onboarding data:",x),l(!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(Xa,{onClick:e,className:"absolute top-4 right-4 p-2",variant:"modal",size:"xl"}),o.jsx(AA,{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(w0,{size:"md"}),o.jsx("p",{className:"mt-4 text-text-secondary",children:"Saving your settings..."})]}):o.jsxs(o.Fragment,{children:[r===1&&o.jsx(DA,{onNext:c}),r===2&&o.jsx(LA,{onNext:d}),r===3&&o.jsx(RA,{onNext:p})]})})]})}function mf(){return typeof window>"u"?!1:localStorage.getItem("openfox_token")!==null}function C0(){return o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Jl,{})})}function MA({sidebarOpen:e,onSidebarToggle:r}){const[,i]=Ch("/p/:projectId"),s=i==null?void 0:i.projectId,l=Ee(m=>m.connectionStatus),u=Ee(m=>m.listSessions),f=Ee(m=>m.clearSession),c=Gt(m=>m.currentProject),d=Gt(m=>m.loadProject),p=mf(),g=l==="connected"||p;return P.useEffect(()=>{g&&s&&((c==null?void 0:c.id)!==s&&d(s),u(s),f())},[g,s,c==null?void 0:c.id,d,u,f]),!c||c.id!==s?o.jsx(C0,{}):o.jsxs(o.Fragment,{children:[o.jsx(zb,{projectId:s,isOpen:e,onClose:r}),o.jsx("div",{className:"flex-1 min-w-0 bg-bg-primary",children:o.jsx(Rw,{})})]})}function IA({sidebarOpen:e,onSidebarToggle:r,rightSidebarOpen:i,onRightSidebarToggle:s}){const[,l]=Ch("/p/:projectId/s/:sessionId"),u=l==null?void 0:l.projectId,f=l==null?void 0:l.sessionId,[,c]=ur(),d=Ee(S=>S.connectionStatus),p=Ee(S=>S.currentSession),g=Ee(S=>S.loadSession),m=Ee(S=>S.listSessions),x=Ee(S=>S.pendingSessionCreate),_=Ee(S=>S.error),k=Ee(S=>S.clearError),C=Gt(S=>S.currentProject),b=Gt(S=>S.loadProject),v=mf(),y=d==="connected"||v;return P.useEffect(()=>{y&&u&&(C==null?void 0:C.id)!==u&&b(u)},[y,u,C==null?void 0:C.id,b]),P.useEffect(()=>{y&&f&&(p==null?void 0:p.id)!==f&&!x&&g(f),y&&u&&m(u)},[y,f,p==null?void 0:p.id,g,m,x,u]),P.useEffect(()=>{(_==null?void 0:_.code)==="NOT_FOUND"&&u&&(k(),c(`/p/${u}`))},[_,u,k,c]),!C||C.id!==u?o.jsx(C0,{}):o.jsxs(o.Fragment,{children:[o.jsx(zb,{projectId:u,isOpen:e,onClose:r}),o.jsx("div",{className:"flex-1 min-w-0 bg-bg-primary",children:o.jsx(kA,{criteriaSidebarOpen:i,onCriteriaSidebarToggle:s})})]})}function BA(){const e=At(i=>i.fetchConfig);function r(){e(),window.history.back()}return o.jsx("div",{className:"flex-1 overflow-y-auto",children:o.jsx(OA,{onComplete:r})})}function zA(){const{connectionStatus:e}=GS(),r=At(R=>R.fetchConfig),i=At(R=>R.refreshProviderModels),s=Qt(R=>R.getSetting),l=At(R=>R.providers),u=At(R=>R.activeProviderId),[,f]=ur(),c=mf(),[d,p]=P.useState(!1);P.useEffect(()=>{(e==="connected"||c)&&r().then(()=>{p(!0);for(const R of jS)s(R)})},[e,c,r,s]),P.useEffect(()=>{d&&u&&i(u).then(()=>{r()})},[d,u,i,r]),P.useEffect(()=>{d&&l.length===0&&f("/onboarding")},[d,l.length]);const g=()=>{const R=localStorage.getItem("openfox:leftSidebar");return R!==null?R==="true":!1},m=()=>{const R=localStorage.getItem("openfox:rightSidebar");return R!==null?R==="true":!0},[x,_]=P.useState(g),[k,C]=P.useState(m),[b,v]=P.useState(!1),[y,S]=P.useState(!1),[j,A]=P.useState(!1);P.useEffect(()=>{const R=()=>{A(window.innerWidth<768)};return R(),window.addEventListener("resize",R),()=>window.removeEventListener("resize",R)},[]);const N=j?b:x,D=j?y:k,T=()=>{j?v(!b):_(!x)},B=()=>{j?S(!y):C(!k)};P.useEffect(()=>{j||localStorage.setItem("openfox:leftSidebar",String(x))},[x,j]),P.useEffect(()=>{j||localStorage.setItem("openfox:rightSidebar",String(k))},[k,j]),P.useEffect(()=>{(e==="connected"||c)&&r()},[e,r,c]);const H=Ee(R=>R.showPasswordModal),W=Ee(R=>R.passwordModalRetry),K=Ee(R=>R.submitPassword),q=Ee(R=>R.cancelPassword);return e!=="connected"&&!H&&!c?o.jsxs(o.Fragment,{children:[o.jsx(cb,{isOpen:!0,isRetry:W,onSubmit:K,onCancel:q}),o.jsx("div",{className:"h-screen flex items-center justify-center",children:o.jsx(Tw,{text:"Connecting to server..."})})]}):o.jsxs(o.Fragment,{children:[o.jsx(cb,{isOpen:H,isRetry:W,onSubmit:K,onCancel:q}),o.jsxs("div",{className:"h-screen flex flex-col",children:[o.jsx(Cw,{}),o.jsx(bw,{onMenuClick:T,onCriteriaToggle:B}),o.jsx("div",{className:"flex-1 flex overflow-hidden",children:o.jsxs(xS,{children:[o.jsx(Da,{path:"/onboarding",children:o.jsx(BA,{})}),o.jsx(Da,{path:"/p/:projectId/s/:sessionId",children:o.jsx(IA,{sidebarOpen:N,onSidebarToggle:T,rightSidebarOpen:D,onRightSidebarToggle:B})}),o.jsx(Da,{path:"/p/:projectId/new",children:o.jsx(Lw,{})}),o.jsx(Da,{path:"/p/:projectId",children:o.jsx(MA,{sidebarOpen:N,onSidebarToggle:T})}),o.jsx(Da,{path:"/",children:o.jsx(Dw,{})})]})})]})]})}Y1.createRoot(document.getElementById("root")).render(o.jsx(dn.StrictMode,{children:o.jsx(zA,{})}));
|